This commit is contained in:
Vinjor 2024-08-03 17:59:23 +08:00
commit caa9e5308d
4 changed files with 31 additions and 0 deletions

View File

@ -29,6 +29,14 @@ public interface CarMainMapper extends BaseMapper<CarMain> {
*/ */
IPage<CarMainRespVO> findPage(Page<CarMain> page, @Param("dto") CarMainReqVO pageReqVO); IPage<CarMainRespVO> findPage(Page<CarMain> 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<CarMain> selectListByCusId( @Param("cusId") String cusId);
List<CarMain> isDataKeyValueRepeat(@Param("dto") CarMain carMain); List<CarMain> isDataKeyValueRepeat(@Param("dto") CarMain carMain);
} }

View File

@ -4,9 +4,13 @@ import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.exception.ServiceException; import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.entity.CustomerItem; import cn.iocoder.yudao.module.custom.entity.CustomerItem;
import cn.iocoder.yudao.module.custom.entity.CustomerMain; import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.mapper.CarMainMapper;
import cn.iocoder.yudao.module.custom.mapper.CustomerMainMapper; import cn.iocoder.yudao.module.custom.mapper.CustomerMainMapper;
import cn.iocoder.yudao.module.custom.service.CarMainService;
import cn.iocoder.yudao.module.custom.service.CustomerCarService;
import cn.iocoder.yudao.module.custom.service.CustomerItemService; import cn.iocoder.yudao.module.custom.service.CustomerItemService;
import cn.iocoder.yudao.module.custom.service.CustomerMainService; import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO; import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO;
@ -39,6 +43,10 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
private CustomerMainMapper customerMainMapper; private CustomerMainMapper customerMainMapper;
@Resource @Resource
private CustomerItemService customerItemService; private CustomerItemService customerItemService;
@Resource
private CustomerCarService customerCarService;
@Resource
private CarMainMapper carMainMapper;
/** /**
* 客户管理分页列表查询 * 客户管理分页列表查询
@ -102,8 +110,11 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
LambdaQueryWrapper<CustomerItem> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CustomerItem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(BaseDO::getDeleted, 0).eq(CustomerItem::getCusId, id); lambdaQueryWrapper.eq(BaseDO::getDeleted, 0).eq(CustomerItem::getCusId, id);
List<CustomerItem> itemList = customerItemService.list(lambdaQueryWrapper); List<CustomerItem> itemList = customerItemService.list(lambdaQueryWrapper);
/*3、车辆信息*/
List<CarMain> carList = carMainMapper.selectListByCusId(id);
CustomerMainRespVO result = JSONUtil.toBean(JSONUtil.parseObj(main).toJSONString(0), CustomerMainRespVO.class); CustomerMainRespVO result = JSONUtil.toBean(JSONUtil.parseObj(main).toJSONString(0), CustomerMainRespVO.class);
result.setItemList(itemList); result.setItemList(itemList);
result.setCarList(carList);
return result; return result;
} }

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.custom.vo; package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.entity.CustomerItem; import cn.iocoder.yudao.module.custom.entity.CustomerItem;
import cn.iocoder.yudao.module.custom.entity.CustomerMain; import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
@ -20,5 +21,7 @@ public class CustomerMainRespVO extends CustomerMain {
private Integer carCount; private Integer carCount;
/**扩展信息*/ /**扩展信息*/
List<CustomerItem> itemList; List<CustomerItem> itemList;
/**客户绑定车辆信息*/
List<CarMain> carList;
} }

View File

@ -90,4 +90,13 @@
</if> </if>
</select> </select>
<select id="selectListByCusId" resultType="cn.iocoder.yudao.module.custom.entity.CarMain">
SELECT
<include refid="column"></include>
FROM
`base_car_main`
WHERE
id IN ( SELECT car_id FROM base_customer_car WHERE cus_id = #{cusId} AND deleted = 0 )
AND deleted = 0
</select>
</mapper> </mapper>