feat(crm): 修改订单查询功能
- 添加CrmOrderMapper接口方法selectVoPagePlus - 实现对应的XML查询语句,支持联表查询客户名称 - 在CrmOrderServiceImpl中实现新的分页查询逻辑 - 引入QueryWrapper构建动态查询条件 - 增加客户名称字段到CrmOrderVo视图对象 - 优化查询性能,支持复杂条件筛选和排序
This commit is contained in:
@@ -107,5 +107,7 @@ public class CrmOrderVo {
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
//联查客户名称
|
||||
private String customerName;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.klp.crm.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.klp.crm.domain.CrmOrder;
|
||||
import com.klp.crm.domain.vo.CrmOrderVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 正式订单主Mapper接口
|
||||
@@ -12,4 +15,5 @@ import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
*/
|
||||
public interface CrmOrderMapper extends BaseMapperPlus<CrmOrderMapper, CrmOrder, CrmOrderVo> {
|
||||
|
||||
Page<CrmOrderVo> selectVoPagePlus(Page<Object> build,@Param("ew") QueryWrapper<CrmOrder> lqw);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.klp.crm.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -44,11 +45,32 @@ public class CrmOrderServiceImpl implements ICrmOrderService {
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<CrmOrderVo> queryPageList(CrmOrderBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<CrmOrder> lqw = buildQueryWrapper(bo);
|
||||
Page<CrmOrderVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
QueryWrapper<CrmOrder> lqw = buildQueryWrapperPlus(bo);
|
||||
Page<CrmOrderVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
private QueryWrapper<CrmOrder> buildQueryWrapperPlus(CrmOrderBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
QueryWrapper<CrmOrder> qw = Wrappers.query();
|
||||
qw.eq(StringUtils.isNotBlank(bo.getOrderCode()), "co.order_code", bo.getOrderCode());
|
||||
qw.eq(bo.getOrderType() != null, "co.order_type", bo.getOrderType());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getCustomerId()), "co.customer_id", bo.getCustomerId());
|
||||
qw.eq(bo.getOrderAmount() != null, "co.order_amount", bo.getOrderAmount());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getSalesman()), "co.salesman", bo.getSalesman());
|
||||
qw.eq(bo.getDeliveryDate() != null, "co.delivery_date", bo.getDeliveryDate());
|
||||
qw.eq(bo.getPreOrderStatus() != null, "co.pre_order_status", bo.getPreOrderStatus());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getAuditUser()), "co.audit_user", bo.getAuditUser());
|
||||
qw.eq(bo.getAuditTime() != null, "co.audit_time", bo.getAuditTime());
|
||||
qw.eq(bo.getOrderStatus() != null, "co.order_status", bo.getOrderStatus());
|
||||
qw.eq(bo.getFinanceStatus() != null, "co.finance_status", bo.getFinanceStatus());
|
||||
qw.eq(bo.getUnpaidAmount() != null, "co.unpaid_amount", bo.getUnpaidAmount());
|
||||
//逻辑删除
|
||||
qw.eq("co.del_flag", 0);
|
||||
qw.orderByDesc("co.create_time");
|
||||
return qw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询正式订单主列表
|
||||
*/
|
||||
|
||||
@@ -25,6 +25,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
<select id="selectVoPagePlus" resultType="com.klp.crm.domain.vo.CrmOrderVo">
|
||||
SELECT
|
||||
order_id AS orderId,
|
||||
order_code AS orderCode,
|
||||
order_type AS orderType,
|
||||
customer_id AS customerId,
|
||||
order_amount AS orderAmount,
|
||||
salesman,
|
||||
delivery_date AS deliveryDate,
|
||||
pre_order_status AS preOrderStatus,
|
||||
audit_user AS auditUser,
|
||||
audit_time AS auditTime,
|
||||
order_status AS orderStatus,
|
||||
finance_status AS financeStatus,
|
||||
unpaid_amount AS unpaidAmount,
|
||||
remark,
|
||||
create_by AS createBy,
|
||||
create_time AS createTime,
|
||||
update_by AS updateBy,
|
||||
update_time AS updateTime,
|
||||
cu.customer_name AS customerName
|
||||
FROM crm_order co
|
||||
LEFT JOIN crm_customer cu ON co.customer_id = cu.customer_id
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user