【优化】客户增加简称与全称合并查询、及查询优化

pull/4/head
zengchenxi 8 months ago
parent df4d5ab5a7
commit b1725702a1

@ -119,4 +119,7 @@ public class CustomerPageReqVO extends PageParam {
@Schema(description = "公司税号") @Schema(description = "公司税号")
private String taxNo; private String taxNo;
} @Schema(description = "简称或全称")
private String briefOrName;
}

@ -1,13 +1,12 @@
package com.chanko.yunxi.mes.module.heli.dal.mysql.customer; package com.chanko.yunxi.mes.module.heli.dal.mysql.customer;
import java.util.*;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult; import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX; import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX;
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.chanko.yunxi.mes.module.heli.controller.admin.customer.vo.CustomerPageReqVO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.customer.CustomerDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.customer.CustomerDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import com.chanko.yunxi.mes.module.heli.controller.admin.customer.vo.*; import org.springframework.util.StringUtils;
/** /**
* Mapper * Mapper
@ -18,11 +17,16 @@ import com.chanko.yunxi.mes.module.heli.controller.admin.customer.vo.*;
public interface CustomerMapper extends BaseMapperX<CustomerDO> { public interface CustomerMapper extends BaseMapperX<CustomerDO> {
default PageResult<CustomerDO> selectPage(CustomerPageReqVO reqVO) { default PageResult<CustomerDO> selectPage(CustomerPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<CustomerDO>() LambdaQueryWrapperX<CustomerDO> query = new LambdaQueryWrapperX<CustomerDO>()
.likeIfPresent(CustomerDO::getCode, reqVO.getCode()) .likeIfPresent(CustomerDO::getCode, reqVO.getCode())
.likeIfPresent(CustomerDO::getBrief, reqVO.getBrief()) .likeIfPresent(CustomerDO::getBrief, reqVO.getBrief())
.eqIfPresent(CustomerDO::getStatus, reqVO.getStatus()) .eqIfPresent(CustomerDO::getStatus, reqVO.getStatus())
.orderByDesc(CustomerDO::getId)); .orderByDesc(CustomerDO::getId);
if(!StringUtils.isEmpty(reqVO.getBriefOrName())){
query.and(QueryWrapper -> QueryWrapper.like(CustomerDO::getBrief, reqVO.getBriefOrName()).or().like(CustomerDO::getName, reqVO.getName()));
}
return selectPage(reqVO, query);
} }
} }

@ -62,11 +62,12 @@ public interface ProcessDesignMapper extends BaseMapperX<ProcessDesignDO> {
.eq(reqVO.getProjectSubId() != null, ProcessDesignDO::getProjectSubId, reqVO.getProjectSubId()) .eq(reqVO.getProjectSubId() != null, ProcessDesignDO::getProjectSubId, reqVO.getProjectSubId())
.in(reqVO.getProjectSubIdList() != null && !reqVO.getProjectSubIdList().isEmpty(), ProcessDesignDO::getProjectSubId, reqVO.getProjectSubIdList()) .in(reqVO.getProjectSubIdList() != null && !reqVO.getProjectSubIdList().isEmpty(), ProcessDesignDO::getProjectSubId, reqVO.getProjectSubIdList())
; ;
if(!StringUtils.isEmpty(reqVO.getOwner())){ if(!StringUtils.isEmpty(reqVO.getOwner())){
query.eq("u2.id", reqVO.getOwner()).or().eq("u3.id", reqVO.getOwner()).or().eq("u4.id", reqVO.getOwner()).or().eq("u5.id", reqVO.getOwner()); query.and(QueryWrapper -> QueryWrapper.eq("u2.id", reqVO.getOwner()).or().eq("u3.id", reqVO.getOwner()).or().eq("u4.id", reqVO.getOwner()).or().eq("u5.id", reqVO.getOwner()));
} }
if(reqVO.getUncompletedDesign() != null && reqVO.getUncompletedDesign()){ if(reqVO.getUncompletedDesign() != null && reqVO.getUncompletedDesign()){
query.lt("z.progress", "100").ne(PlanDO::getStatus, ProjectPlanStatusEnum.TERMINATE.getCode()); query.and(QueryWrapper -> QueryWrapper.lt("z.progress", "100").ne(PlanDO::getStatus, ProjectPlanStatusEnum.TERMINATE.getCode()));
} }
return selectPage(reqVO, query); return selectPage(reqVO, query);

@ -1,26 +1,20 @@
package com.chanko.yunxi.mes.module.heli.service.customer; package com.chanko.yunxi.mes.module.heli.service.customer;
import cn.hutool.core.lang.UUID;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.customer.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.customer.CustomerDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult; import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
import com.chanko.yunxi.mes.module.heli.controller.admin.customer.vo.CustomerPageReqVO;
import com.chanko.yunxi.mes.module.heli.controller.admin.customer.vo.CustomerSaveReqVO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.customer.CustomerDO;
import com.chanko.yunxi.mes.module.heli.dal.mysql.customer.CustomerMapper; import com.chanko.yunxi.mes.module.heli.dal.mysql.customer.CustomerMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.chanko.yunxi.mes.module.heli.enums.CodeEnum.CUSTOMER; import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.CODE_REPEAT;
import static com.chanko.yunxi.mes.module.heli.enums.CodeEnum.WORKSHOP; import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.CUSTOMER_NOT_EXISTS;
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*;
/** /**
* Service * Service

@ -36,7 +36,7 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
.inIfPresent(AdminUserDO::getDeptId, deptIds) .inIfPresent(AdminUserDO::getDeptId, deptIds)
.orderByDesc(AdminUserDO::getId); .orderByDesc(AdminUserDO::getId);
if(!StringUtils.isEmpty(reqVO.getUserNickName())){ if(!StringUtils.isEmpty(reqVO.getUserNickName())){
query.like(AdminUserDO::getUsername, reqVO.getUserNickName()).or().like(AdminUserDO::getNickname, reqVO.getUserNickName()); query.and(QueryWrapper -> QueryWrapper.like(AdminUserDO::getUsername, reqVO.getUserNickName()).or().like(AdminUserDO::getNickname, reqVO.getUserNickName()));
} }
return selectPage(reqVO, query); return selectPage(reqVO, query);
} }

@ -31,6 +31,7 @@ export interface CustomerVO {
updateTime?: Date updateTime?: Date
creator?: string creator?: string
creatorName?: string creatorName?: string
briefOrName: string
} }
// 查询客户列表 // 查询客户列表

Loading…
Cancel
Save