Skip to content

Commit

Permalink
!6 修复了“错误代码1055与sql_mode = only_full_group_by不兼容”问题
Browse files Browse the repository at this point in the history
Merge pull request !6 from boywangqin/dev
  • Loading branch information
guchengwuyue authored and gitee-org committed Jul 5, 2022
2 parents 896cdca + 045f4ad commit c7ad6ba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions yshop-admin/src/main/resources/config/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/yshop2?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true
username: root
password: root
password: boywangqin

# 初始化配置
initial-size: 3
Expand Down Expand Up @@ -44,7 +44,7 @@ spring:
# 数据库索引
database: 13
# 密码
password:
password: boywangqin
# 连接超时时间
timeout: 5000

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
*/
package co.yixiang.modules.shop.service.mapper;

import co.yixiang.common.mapper.CoreMapper;
import co.yixiang.modules.shop.domain.YxStoreOrder;
import co.yixiang.modules.shop.service.dto.ChartDataDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

import co.yixiang.common.mapper.CoreMapper;
import co.yixiang.modules.shop.domain.YxStoreOrder;
import co.yixiang.modules.shop.service.dto.ChartDataDto;

/**
* @author hupeng
* @date 2020-05-12
Expand All @@ -34,17 +35,19 @@ public interface StoreOrderMapper extends CoreMapper<YxStoreOrder> {
"where refund_status=0 and is_del=0 and paid=1")
Double sumTotalPrice();

//修复了“错误代码1055与sql_mode = only_full_group_by不兼容”问题
//修复方式create_time外面包裹ANY_VALUE关键字
@Select("SELECT IFNULL(sum(pay_price),0) as num," +
"FROM_UNIXTIME(create_time, '%m-%d') as time " +
"FROM_UNIXTIME(ANY_VALUE(create_time), '%m-%d') as time " +
" FROM yx_store_order where refund_status=0 and is_del=0 and paid=1 and pay_time >= ${time}" +
" GROUP BY FROM_UNIXTIME(create_time,'%Y-%m-%d') " +
" ORDER BY create_time ASC")
" GROUP BY FROM_UNIXTIME(ANY_VALUE(create_time),'%Y-%m-%d') " +
" ORDER BY ANY_VALUE(create_time) ASC")
List<ChartDataDto> chartList(@Param("time") int time);

@Select("SELECT count(id) as num," +
"FROM_UNIXTIME(create_time, '%m-%d') as time " +
"FROM_UNIXTIME(ANY_VALUE(create_time), '%m-%d') as time " +
" FROM yx_store_order where refund_status=0 and is_del=0 and paid=1 and pay_time >= ${time}" +
" GROUP BY FROM_UNIXTIME(create_time,'%Y-%m-%d') " +
" ORDER BY create_time ASC")
" GROUP BY FROM_UNIXTIME(ANY_VALUE(create_time),'%Y-%m-%d') " +
" ORDER BY ANY_VALUE(create_time) ASC")
List<ChartDataDto> chartListT(@Param("time") int time);
}

0 comments on commit c7ad6ba

Please sign in to comment.