Commit 32cfec23 authored by machengbo's avatar machengbo

解决 mybatisplus 和 pagehelper 冲突问题

parent 4c40b5d1
package com.jz.manage.config.mybatisPlusConfig; package com.jz.manage.config.mybatisPlusConfig;
import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize; import com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
...@@ -29,6 +30,14 @@ public class MybatisPlusConfig { ...@@ -29,6 +30,14 @@ public class MybatisPlusConfig {
paginationInterceptor.setCountSqlParser(new JsqlParserCountOptimize(true)); paginationInterceptor.setCountSqlParser(new JsqlParserCountOptimize(true));
return paginationInterceptor; return paginationInterceptor;
} }
@Bean
ConfigurationCustomizer mybatisConfigurationCustomizer() {
return new ConfigurationCustomizer() {
@Override
public void customize(org.apache.ibatis.session.Configuration configuration) {
configuration.addInterceptor(new com.github.pagehelper.PageInterceptor());
}
};
}
} }
...@@ -33,7 +33,7 @@ public class SwaggerConfiguration { ...@@ -33,7 +33,7 @@ public class SwaggerConfiguration {
private ApiInfo apiInfo() { private ApiInfo apiInfo() {
return new ApiInfoBuilder() return new ApiInfoBuilder()
.title("数据商城平台 RESTful APIs") .title("数据平台 RESTful APIs")
.description("swagger-bootstrap-ui") .description("swagger-bootstrap-ui")
.termsOfServiceUrl("http://localhost:5050/") .termsOfServiceUrl("http://localhost:5050/")
.contact("Bellamy") .contact("Bellamy")
......
...@@ -4,8 +4,6 @@ import com.jz.common.bean.BasePageBean; ...@@ -4,8 +4,6 @@ import com.jz.common.bean.BasePageBean;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
/** /**
* 平台利润中心--财务管理交易明细返回对象 * 平台利润中心--财务管理交易明细返回对象
* *
...@@ -19,7 +17,7 @@ public class TradeDetilDto extends BasePageBean { ...@@ -19,7 +17,7 @@ public class TradeDetilDto extends BasePageBean {
* 企业名 * 企业名
*/ */
@ApiModelProperty(value = "企业名") @ApiModelProperty(value = "企业名")
private BigDecimal departmentName; private String departmentName;
/** /**
* 数据名称 * 数据名称
*/ */
...@@ -38,11 +36,11 @@ public class TradeDetilDto extends BasePageBean { ...@@ -38,11 +36,11 @@ public class TradeDetilDto extends BasePageBean {
@ApiModelProperty(value = "订单方式") @ApiModelProperty(value = "订单方式")
private String orderMethod; private String orderMethod;
public BigDecimal getDepartmentName() { public String getDepartmentName() {
return departmentName; return departmentName;
} }
public void setDepartmentName(BigDecimal departmentName) { public void setDepartmentName(String departmentName) {
this.departmentName = departmentName; this.departmentName = departmentName;
} }
......
...@@ -49,8 +49,9 @@ public class PlatformTradeFlowInfoServiceImpl implements PlatformTradeFlowInfoSe ...@@ -49,8 +49,9 @@ public class PlatformTradeFlowInfoServiceImpl implements PlatformTradeFlowInfoSe
Map param = new HashMap(); Map param = new HashMap();
//从session中获取平台用户id //从session中获取平台用户id
//SysUserDto user = (SysUserDto) SessionUtils.getUserCurrent(requset,"sysUser"); //SysUserDto user = (SysUserDto) SessionUtils.getUserCurrent(requset,"sysUser");
//map.put("userId", user.getUserId()); //param.put("userId", user.getUserId());
//param.put("pageNum", pageBean.getPageNum());
//param.put("pageSize", pageBean.getPageSize());
PageHelper.startPage(pageBean.getPageNum(), pageBean.getPageSize()); PageHelper.startPage(pageBean.getPageNum(), pageBean.getPageSize());
List<OrderCountInfoDto> list = platformTradeFlowInfoDao.findListOrderCount(param); List<OrderCountInfoDto> list = platformTradeFlowInfoDao.findListOrderCount(param);
PageInfo<OrderCountInfoDto> pageInfo = new PageInfo<>(list); PageInfo<OrderCountInfoDto> pageInfo = new PageInfo<>(list);
......
...@@ -140,12 +140,20 @@ ...@@ -140,12 +140,20 @@
<!--平台利润中心,我的订单--> <!--平台利润中心,我的订单-->
<select id="findListOrderCount" resultType="com.jz.manage.moduls.controller.finance.platForm.OrderCountInfoDto" parameterType="map"> <select id="findListOrderCount" resultType="com.jz.manage.moduls.controller.finance.platForm.OrderCountInfoDto" parameterType="map">
select select
order_time as orderTime, t1.orderTime,
ifnull(sum(order_money),'0') as orderMoney, ifnull(sum(t1.orderMoney),'0') as orderMoney,
count(order_id) as orderTotal count(t1.orderId) as orderTotal
from t_order t1 from(
group by date_format(order_time,'%Y-%m-%d') select
order by date_format(order_time,'%Y-%m-%d') desc date_format(order_time,'%Y-%m-%d') as orderTime,
order_money as orderMoney,
order_id as orderId
from t_order
where 1=1 and order_status='02' and del_flag='N'
<if test="sellerId != null">seller_id=#{sellerId}</if>
) t1
group by t1.orderTime
order by t1.orderTime desc
</select> </select>
<!--平台利润中心,订单交易明细--> <!--平台利润中心,订单交易明细-->
...@@ -157,7 +165,7 @@ ...@@ -157,7 +165,7 @@
t1.order_money as orderMoney, t1.order_money as orderMoney,
(case when t1.payment_method ='01' then '余额' else '其他' end) as paymentMethod, (case when t1.payment_method ='01' then '余额' else '其他' end) as paymentMethod,
(case when t1.purchase_method ='01' then '年' when t1.purchase_method ='02' then '季' when t1.purchase_method ='03' then '月' (case when t1.purchase_method ='01' then '年' when t1.purchase_method ='02' then '季' when t1.purchase_method ='03' then '月'
when t1.purchase_method ='04' then '次' end) as purchaseMethod when t1.purchase_method ='04' then '次' end) as purchaseMethod,
t3.data_name as dataName, t3.data_name as dataName,
t3.category_id as categoryId, t3.category_id as categoryId,
t5.department_name as departmentName t5.department_name as departmentName
...@@ -165,7 +173,7 @@ ...@@ -165,7 +173,7 @@
inner join t_order_goods_info t2 on t1.order_id=t2.order_id inner join t_order_goods_info t2 on t1.order_id=t2.order_id
inner join t_data_goods t3 on t2.data_goods_id=t3.data_goods_id inner join t_data_goods t3 on t2.data_goods_id=t3.data_goods_id
left join t_mall_customer t4 on t4.customer_id=t1.customer_id and t4.del_flag='N' left join t_mall_customer t4 on t4.customer_id=t1.customer_id and t4.del_flag='N'
left join t_department t5 on t5.department_id=t1.department_id and t5.del_flag='N' left join t_department t5 on t5.department_id=t4.department_id and t5.del_flag='N'
where 1=1 and t1.order_status='02' and t1.del_flag='N' where 1=1 and t1.order_status='02' and t1.del_flag='N'
<if test="creTime != null">and date_format(t1.cre_time,'%Y-%m-%d')= #{creTime}</if> <if test="creTime != null">and date_format(t1.cre_time,'%Y-%m-%d')= #{creTime}</if>
<if test="departmentName != null">and t5.department_name like concat('%',#{departmentName},'%')</if> <if test="departmentName != null">and t5.department_name like concat('%',#{departmentName},'%')</if>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<alibaba.fastjson.version>1.2.47</alibaba.fastjson.version> <alibaba.fastjson.version>1.2.47</alibaba.fastjson.version>
<mybatis-pagehelper.version>4.2.0</mybatis-pagehelper.version> <mybatis-pagehelper.version>5.1.6</mybatis-pagehelper.version>
<mysql-connector.version>5.1.48</mysql-connector.version> <mysql-connector.version>5.1.48</mysql-connector.version>
<druid.version>1.1.12</druid.version> <druid.version>1.1.12</druid.version>
<mybatis-spring.version>1.3.1</mybatis-spring.version> <mybatis-spring.version>1.3.1</mybatis-spring.version>
...@@ -73,11 +73,11 @@ ...@@ -73,11 +73,11 @@
</dependency> </dependency>
<!-- spring boot 和mybatis --> <!-- spring boot 和mybatis -->
<dependency> <!--<dependency>
<groupId>org.mybatis.spring.boot</groupId> <groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId> <artifactId>mybatis-spring-boot-starter</artifactId>
<version>${mybatis-spring.version}</version> <version>${mybatis-spring.version}</version>
</dependency> </dependency>-->
<!-- mybatis plus --> <!-- mybatis plus -->
<dependency> <dependency>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment