This commit is contained in:
xiao-fajia 2024-08-07 10:00:08 +08:00
commit 21505d1dee
18 changed files with 265 additions and 96 deletions

View File

@ -11,4 +11,6 @@ public class BaseConstants {
public static final String CUS_SIGN_CUSTOMER = "customer";
/**车辆标识*/
public static final String CUS_SIGN_CAR = "car";
/**客户信息表名称*/
public static final String TABLE_BASE_CUSTOMER_MAIN = "base_customer_main";
}

View File

@ -4,6 +4,7 @@ import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.service.CarMainService;
import cn.iocoder.yudao.module.custom.vo.CarMainReqVO;
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*;
@ -121,7 +122,7 @@ public class CarMainController {
*/
@GetMapping("/export-excel")
@Operation(summary = "导出车辆信息 Excel")
@PreAuthorize("@ss.hasPermission('base:car-main:export')")
@PreAuthorize("@ss.hasPermission('base:car-main:customer')")
@ApiAccessLog(operateType = EXPORT)
public void exportCarMainExcel(CarMainReqVO pageReqVO, HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
@ -131,4 +132,18 @@ public class CarMainController {
BeanUtils.toBean(list, CarMainRespVO.class));
}
/**
* 绑定用户
*
* @param saveReqVO CustomerMainSaveReqVO
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
**/
@PostMapping("/bindCustomerCar")
@Operation(summary = "绑定用户")
@PreAuthorize("@ss.hasPermission('base:car-main:bindCustomer')")
public CommonResult<Boolean> bindCustomerCar(@RequestBody CustomerMainSaveReqVO saveReqVO) {
carMainService.bindCustomAndCar(saveReqVO);
return success(true);
}
}

View File

@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
import cn.iocoder.yudao.module.label.service.BusiLabelService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
@ -20,6 +21,7 @@ import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.yudao.common.BaseConstants.TABLE_BASE_CUSTOMER_MAIN;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
@ -35,6 +37,8 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
public class CustomerMainController {
@Resource
private CustomerMainService customerMainService;
@Resource
private BusiLabelService busiLabelService;
/**
* 客户管理分页列表查询
@ -153,4 +157,19 @@ public class CustomerMainController {
return success(true);
}
/**
* 设置标签
*
* @param saveReqVO CustomerMainSaveReqVO
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
* @author PQZ
* @date 16:35 2024/8/6
**/
@PostMapping("/setLabel")
@Operation(summary = "设置标签")
public CommonResult<Boolean> setLabel(@Valid @RequestBody CustomerMainSaveReqVO saveReqVO) {
busiLabelService.saveBusiLable(saveReqVO.getId(), TABLE_BASE_CUSTOMER_MAIN, saveReqVO.getLabelList());
return success(true);
}
}

View File

@ -29,14 +29,7 @@ public interface CarMainMapper extends BaseMapper<CarMain> {
*/
IPage<CarMainRespVO> findPage(Page<CarMainReqVO> page, @Param("dto") CarMainReqVO pageReqVO);
/**
* 通过客户id查询车辆信息
* @author PQZ
* @date 15:19 2024/8/3
* @param cusId 客户id
* @return java.util.List<cn.iocoder.yudao.module.custom.entity.CarMain>
**/
List<CarMainRespVO> selectListByCusId( @Param("cusId") String cusId);
/**
* 车牌号车架号发动机号码 查重

View File

@ -1,8 +1,13 @@
package cn.iocoder.yudao.module.custom.mapper;
import cn.iocoder.yudao.module.custom.entity.CustomerCar;
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 客户车辆管理关联Mapper
@ -12,5 +17,21 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CustomerCarMapper extends BaseMapper<CustomerCar> {
/**
* 通过客户id查询车辆信息
* @author PQZ
* @date 15:19 2024/8/3
* @param cusId 客户id
* @return java.util.List<cn.iocoder.yudao.module.custom.entity.CarMain>
**/
List<CarMainRespVO> selectCarListByCusId(@Param("cusId") String cusId);
/**
* 通过车辆id查询客户信息
*
* @param carId 车辆id
* @return java.util.List<cn.iocoder.yudao.module.custom.entity.CarMain>
**/
List<CustomerMainRespVO> selectCusListByCarId(@Param("carId") String carId);
}

View File

@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.vo.CarMainReqVO;
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
@ -58,4 +59,11 @@ public interface CarMainService extends IService<CarMain> {
IPage<CarMainRespVO> getCarMainPage(CarMainReqVO pageReqVO);
/**
* 绑定车辆信息
*
* @param saveReqVO CustomerMainSaveReqVO实体
* @return void
**/
void bindCustomAndCar(CustomerMainSaveReqVO saveReqVO);
}

View File

@ -1,21 +1,37 @@
package cn.iocoder.yudao.module.custom.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.entity.CustomerCar;
import cn.iocoder.yudao.module.custom.entity.CustomerItem;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.mapper.CarMainMapper;
import cn.iocoder.yudao.module.custom.mapper.CustomerCarMapper;
import cn.iocoder.yudao.module.custom.service.CarMainService;
import cn.iocoder.yudao.module.custom.service.CustomerCarService;
import cn.iocoder.yudao.module.custom.vo.CarMainReqVO;
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import static cn.iocoder.yudao.common.BaseConstants.CUS_SIGN_CAR;
import static cn.iocoder.yudao.common.BaseConstants.CUS_SIGN_CUSTOMER;
/**
* 车辆信息 Service 实现类
*
@ -24,6 +40,12 @@ import java.util.List;
@Service
public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> implements CarMainService{
@Autowired
private CustomerCarMapper customerCarMapper;
@Autowired
private CustomerCarService customerCarService;
/**
* 创建车辆信息
*
@ -97,9 +119,16 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
* @return
*/
@Override
public CarMain getCarMain(String id) {
public CarMainRespVO getCarMain(String id) {
//数据单查
return baseMapper.selectById(id);
CarMain carMain = baseMapper.selectById(id);
CarMainRespVO result = BeanUtils.toBean(carMain, CarMainRespVO.class);
//联查客户信息
List<CustomerMainRespVO> cusList = customerCarMapper.selectCusListByCarId(id);
result.setCusList(cusList);
return result;
}
/**
@ -116,6 +145,29 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
return baseMapper.findPage(page,pageReqVO);
}
/**
* 绑定客户信息
*
* @param saveReqVO CustomerMainSaveReqVO实体
* @return void
**/
@Override
public void bindCustomAndCar(CustomerMainSaveReqVO saveReqVO) {
List<CustomerCar> customerCars = new ArrayList<>();
List<CustomerMainRespVO> cusList = saveReqVO.getCusList();
if (ObjectUtil.isNotEmpty(cusList)){
//组装数据
cusList.forEach(item -> {
CustomerCar customerCar = new CustomerCar();
customerCar.setCarId(saveReqVO.getId());
customerCar.setCusId(item.getId());
customerCar.setIsOwner(item.getIsOwner());
customerCars.add(customerCar);
});
}
customerCarService.bindCustomerCar(saveReqVO.getId(),CUS_SIGN_CAR,customerCars);
}
/**
* 车牌号车架号发动机号码 查重
* @param reqVO
@ -192,4 +244,5 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
}
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.custom.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.custom.entity.CustomerCar;
import cn.iocoder.yudao.module.custom.mapper.CustomerCarMapper;
@ -11,6 +12,7 @@ import org.springframework.validation.annotation.Validated;
import java.util.List;
import static cn.iocoder.yudao.common.BaseConstants.CUS_SIGN_CAR;
import static cn.iocoder.yudao.common.BaseConstants.CUS_SIGN_CUSTOMER;
/**
@ -41,13 +43,15 @@ public class CustomerCarServiceImpl extends ServiceImpl<CustomerCarMapper, Custo
if (CUS_SIGN_CUSTOMER.equals(mainTable)) {
//如果主表是客户表
lambdaQueryWrapper.eq(CustomerCar::getCusId, mainId);
} else {
this.remove(lambdaQueryWrapper);
} else if(CUS_SIGN_CAR.equals(mainTable)){
//如果主表是车辆表
lambdaQueryWrapper.eq(CustomerCar::getCarId, mainId);
this.remove(lambdaQueryWrapper);
}
this.remove(lambdaQueryWrapper);
/*2、保存新关联关系*/
if (null != customerCars && !customerCars.isEmpty()) {
if (ObjectUtil.isNotEmpty(customerCars) && !customerCars.isEmpty()) {
customerCars.forEach(item -> {
//防止主键重复
item.setId(null);

View File

@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.custom.entity.CustomerCar;
import cn.iocoder.yudao.module.custom.entity.CustomerItem;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.mapper.CarMainMapper;
import cn.iocoder.yudao.module.custom.mapper.CustomerCarMapper;
import cn.iocoder.yudao.module.custom.mapper.CustomerMainMapper;
import cn.iocoder.yudao.module.custom.service.CarMainService;
import cn.iocoder.yudao.module.custom.service.CustomerCarService;
@ -18,6 +19,8 @@ import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
import cn.iocoder.yudao.module.label.entity.BusiLabel;
import cn.iocoder.yudao.module.label.service.BusiLabelService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -50,7 +53,11 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
@Resource
private CustomerCarService customerCarService;
@Resource
private CustomerCarMapper customerCarMapper;
@Resource
private CarMainMapper carMainMapper;
@Resource
private BusiLabelService busiLabelService;
/**
* 客户管理分页列表查询
@ -115,10 +122,13 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
lambdaQueryWrapper.eq(BaseDO::getDeleted, 0).eq(CustomerItem::getCusId, id);
List<CustomerItem> itemList = customerItemService.list(lambdaQueryWrapper);
/*3、车辆信息*/
List<CarMainRespVO> carList = carMainMapper.selectListByCusId(id);
List<CarMainRespVO> carList = customerCarMapper.selectCarListByCusId(id);
CustomerMainRespVO result = JSONUtil.toBean(JSONUtil.parseObj(main).toJSONString(0), CustomerMainRespVO.class);
result.setItemList(itemList);
result.setCarList(carList);
/*4、标签信息*/
List<BusiLabel> labelList = busiLabelService.listByMainId(id);
result.setLabelList(labelList);
return result;
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.custom.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
@ -16,6 +17,9 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@ToString(callSuper = true)
public class CarBrandReqVO extends PageParam {
@Schema(description = "主键标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "8714")
private String id;
@Schema(description = "品牌名称", example = "李四")
private String brandName;

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
@ -15,79 +16,20 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@ExcelIgnoreUnannotated
public class CarMainRespVO extends CarMain {
@Schema(description = "主键标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "8714")
@ExcelProperty("主键标识")
private String id;
@Schema(description = "发动机号码", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("发动机号码")
private String engineNumber;
@Schema(description = "车架号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("车架号")
private String vin;
@Schema(description = "车牌号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("车牌号")
private String licenseNumber;
@Schema(description = "车辆型号")
@ExcelProperty("车辆型号")
private String carModel;
@Schema(description = "保养日期")
@ExcelProperty("保养日期")
private LocalDateTime maintenanceDate;
@Schema(description = "保养里程")
@ExcelProperty("保养里程")
private String maintenanceMileage;
@Schema(description = "年检日期", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("年检日期")
private LocalDateTime inspectionDate;
@Schema(description = "保险日期")
@ExcelProperty("保险日期")
private LocalDateTime insuranceDate;
@Schema(description = "二级维护时间")
@ExcelProperty("二级维护时间")
private LocalDateTime checkDate;
@Schema(description = "车辆品牌", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("车辆品牌")
private String carBrand;
@Schema(description = "车辆性质:营运 非营运等", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("车辆性质")
private String carNature;
@Schema(description = "车辆类别:私家车 货车 教练车 公务车 出租车")
@ExcelProperty("车辆类别")
private String carCategory;
@Schema(description = "车辆注册日期", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("车辆注册日期")
private LocalDateTime carRegisterDate;
@Schema(description = "行驶证图片")
@ExcelProperty("行驶证图片")
private String carLicenseImg;
@Schema(description = "最近办理业务")
@ExcelProperty("最近办理业务")
private String recentlyHandledBusiness;
@Schema(description = "最近办理业务的时间")
@ExcelProperty("最近办理业务的时间")
private LocalDateTime recentlyHandleBusinessTime;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
/**是否车主0否1是*/
@Schema(description = "是否车主0否1是")
private String isOwner;
@Schema(description = "创建时间")
private List<CustomerMainRespVO> cusList;
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.custom.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
@ -16,6 +17,9 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@ToString(callSuper = true)
public class CarModelReqVO extends PageParam {
@Schema(description = "主键标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "8714")
private String id;
@Schema(description = "排序")
private Integer sort;

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.module.custom.entity.CustomerItem;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.label.entity.BusiLabel;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -23,5 +24,10 @@ public class CustomerMainRespVO extends CustomerMain {
List<CarMainRespVO> carList;
/**经办人信息集合*/
List<CustomerMain> attnList;
/**标签信息*/
List<BusiLabel> labelList;
/**是否车主0否1是*/
private String isOwner;
}

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.module.custom.entity.CustomerItem;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.label.entity.BusiLabel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -15,5 +16,9 @@ public class CustomerMainSaveReqVO extends CustomerMain {
private List<CustomerItem> itemList;
/**客户绑定车辆信息*/
private List<CarMainRespVO> carList;
/**客户绑定车辆信息*/
private List<CustomerMainRespVO> cusList;
/**标签信息*/
List<BusiLabel> labelList;
}

View File

@ -49,5 +49,7 @@ public class BusiLabel extends TenantBaseDO {
* 系统标识
*/
private String systemCode;
/**标签库类型*/
private String labelType;
}

View File

@ -89,18 +89,5 @@
</if>
</select>
<select id="selectListByCusId" resultType="cn.iocoder.yudao.module.custom.vo.CarMainRespVO">
SELECT
<include refid="baseCarMainColumn"></include>,
main.is_owner AS isOwner
FROM
base_customer_car main
LEFT JOIN
base_car_main tbcm ON main.car_id = tbcm.id AND tbcm.deleted = 0
WHERE
main.deleted = 0
AND main.cus_id = #{cusId}
ORDER BY
main.create_time DESC
</select>
</mapper>

View File

@ -2,4 +2,92 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.custom.mapper.CustomerCarMapper">
<sql id="baseCarMainColumn">
tbcarm.id,
tbcarm.engine_number,
tbcarm.vin,
tbcarm.license_number,
tbcarm.car_model,
tbcarm.maintenance_date,
tbcarm.maintenance_mileage,
tbcarm.inspection_date,
tbcarm.insurance_date,
tbcarm.check_date,
tbcarm.next_maintenance_date,
tbcarm.next_maintenance_mileage,
tbcarm.next_inspection_date,
tbcarm.insurance_expiry_date,
tbcarm.next_check_date,
tbcarm.car_brand,
tbcarm.car_nature,
tbcarm.car_category,
tbcarm.car_register_date,
tbcarm.car_license_img,
tbcarm.recently_handled_business,
tbcarm.recently_handle_business_time,
tbcarm.deleted,
tbcarm.creator,
tbcarm.create_time,
tbcarm.updater,
tbcarm.update_time
</sql>
<sql id="baseCustomerMainColumn">
tbcusm.id,
tbcusm.user_id,
tbcusm.type_code,
tbcusm.dept_code,
tbcusm.cus_name,
tbcusm.phone_number,
tbcusm.birthday,
tbcusm.address,
tbcusm.sex,
tbcusm.id_card,
tbcusm.id_card_image,
tbcusm.data_from,
tbcusm.near_do_time,
tbcusm.near_do_content,
tbcusm.inviter,
tbcusm.inviter_type,
tbcusm.status,
tbcusm.tenant_id,
tbcusm.deleted,
tbcusm.creator,
tbcusm.create_time,
tbcusm.updater,
tbcusm.update_time
</sql>
<select id="selectCarListByCusId" resultType="cn.iocoder.yudao.module.custom.vo.CarMainRespVO">
SELECT
<include refid="baseCarMainColumn"></include>,
main.is_owner AS isOwner
FROM
base_customer_car main
LEFT JOIN
base_car_main tbcarm ON main.car_id = tbcarm.id AND tbcarm.deleted = 0
WHERE
main.deleted = 0
AND
main.cus_id = #{cusId}
ORDER BY
main.create_time DESC
</select>
<select id="selectCusListByCarId" resultType="cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO">
SELECT
<include refid="baseCustomerMainColumn"></include>,
main.is_owner AS isOwner
FROM
base_customer_car main
LEFT JOIN
base_customer_main tbcusm ON main.cus_id = tbcusm.id AND tbcusm.deleted = 0
WHERE
main.deleted = 0
AND
main.car_id = #{carId}
ORDER BY
main.create_time DESC
</select>
</mapper>

View File

@ -50,6 +50,12 @@
<if test="entity.systemCode != null and entity.systemCode != ''">
AND item.system_code = #{entity.systemCode}
</if>
<if test="entity.phoneNumber != null and entity.phoneNumber != ''">
AND main.phoneNumber LIKE concat('%',#{entity.phoneNumber},'%')
</if>
<if test="entity.idCard != null and entity.idCard != ''">
AND main.idCard LIKE concat('%',#{entity.idCard},'%')
</if>
</where>
GROUP BY main.id
ORDER BY main.create_time DESC