From 3b7d69a768ee71b3c380b63ef786610db88881c5 Mon Sep 17 00:00:00 2001 From: PQZ Date: Thu, 19 Sep 2024 23:54:35 +0800 Subject: [PATCH] 1 --- .../PartnerCustomerInfoController.java | 23 +++++++++++-------- .../mapper/PartnerCustomerInfoMapper.java | 8 ++++++- .../service/IPartnerCustomerInfoService.java | 6 +++++ .../impl/PartnerCustomerInfoServiceImpl.java | 20 +++++++++++++++- .../partner/PartnerCustomerInfoMapper.xml | 21 ++++++++++++++++- 5 files changed, 66 insertions(+), 12 deletions(-) diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/controller/PartnerCustomerInfoController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/controller/PartnerCustomerInfoController.java index 766d9758..330004e1 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/controller/PartnerCustomerInfoController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/controller/PartnerCustomerInfoController.java @@ -6,16 +6,20 @@ import cn.iocoder.yudao.module.core.page.TableDataInfo; import cn.iocoder.yudao.module.core.text.Convert; import cn.iocoder.yudao.module.core.text.ServletUtils; import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService; +import cn.iocoder.yudao.module.label.vo.LabelRespVO; import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo; import cn.iocoder.yudao.module.partner.service.IPartnerCustomerInfoService; import cn.iocoder.yudao.module.shop.entity.ShopMallPartners; import cn.iocoder.yudao.util.ExcelUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + /** * 客户信息Controller * @@ -35,15 +39,16 @@ public class PartnerCustomerInfoController extends BaseController * 查询客户信息列表 */ @GetMapping("/list") - public TableDataInfo list(PartnerCustomerInfo partnerCustomerInfo) throws Exception { - ShopMallPartners partners = partnerService.shopInfo(); - partnerCustomerInfo.setPartnerId(partners.getPartnerId()); - int pageNum = Convert.toInt(ServletUtils.getParameter("pageNum"), 1); - int pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10); - Page page = new Page<>(pageNum,pageSize); - startPage(); - List list = partnerCustomerInfoService.selectPartnerCustomerInfoList(partnerCustomerInfo); - return getDataTable(list); + public CommonResult> list(PartnerCustomerInfo partnerCustomerInfo, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) throws Exception { + Page page = new Page<>(pageNo, pageSize); + return success(partnerCustomerInfoService.queryListPage(partnerCustomerInfo, page)); +// ShopMallPartners partners = partnerService.shopInfo(); +// partnerCustomerInfo.setPartnerId(partners.getPartnerId()); +// startPage(); +// List list = partnerCustomerInfoService.selectPartnerCustomerInfoList(partnerCustomerInfo); +// return getDataTable(list); } /** diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/mapper/PartnerCustomerInfoMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/mapper/PartnerCustomerInfoMapper.java index 7053d3dd..f4f94db2 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/mapper/PartnerCustomerInfoMapper.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/mapper/PartnerCustomerInfoMapper.java @@ -1,8 +1,12 @@ package cn.iocoder.yudao.module.partner.mapper; +import cn.iocoder.yudao.module.label.vo.LabelPageReqVO; +import cn.iocoder.yudao.module.label.vo.LabelRespVO; import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -23,7 +27,9 @@ public interface PartnerCustomerInfoMapper extends BaseMapper selectPartnerCustomerInfoList(@Param("vo") PartnerCustomerInfo partnerCustomerInfo); + public List selectPartnerCustomerInfoList(@Param("vo") PartnerCustomerInfo vo); + + IPage pagePartnerCustomerInfoList(@Param("vo") PartnerCustomerInfo vo, Page page); /** * 查询客户信息 diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/IPartnerCustomerInfoService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/IPartnerCustomerInfoService.java index edef9261..ff506e05 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/IPartnerCustomerInfoService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/IPartnerCustomerInfoService.java @@ -1,6 +1,9 @@ package cn.iocoder.yudao.module.partner.service; +import cn.iocoder.yudao.module.label.vo.LabelPageReqVO; +import cn.iocoder.yudao.module.label.vo.LabelRespVO; import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; @@ -22,6 +25,9 @@ public interface IPartnerCustomerInfoService extends IService selectPartnerCustomerInfoList(PartnerCustomerInfo partnerCustomerInfo); + IPage queryListPage(PartnerCustomerInfo entity, Page page); + + /** * 查询客户信息 * diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java index dccc659b..6a1d2fa8 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java @@ -17,6 +17,7 @@ import cn.iocoder.yudao.module.system.service.user.AdminUserService; import cn.iocoder.yudao.util.DateUtils; import cn.iocoder.yudao.util.StringUtils; 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.apache.commons.lang3.ObjectUtils; @@ -25,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; import java.util.ArrayList; import java.util.HashSet; import java.util.List; @@ -49,6 +51,8 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl selectPartnerCustomerInfoList(PartnerCustomerInfo partnerCustomerInfo) { - List partnerCustomerInfos = baseMapper.selectPartnerCustomerInfoList(partnerCustomerInfo); + List partnerCustomerInfos = customerInfoMapper.selectPartnerCustomerInfoList(partnerCustomerInfo); for (PartnerCustomerInfo customerInfo : partnerCustomerInfos) { List list = userCarService.selectUserCarsByUserId(customerInfo.getUserId()); if (CollectionUtil.isNotEmpty(list)){ @@ -71,6 +75,20 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl queryListPage(PartnerCustomerInfo entity, Page page) { + IPage partnerCustomerInfos = customerInfoMapper.pagePartnerCustomerInfoList(entity,page); + partnerCustomerInfos.getRecords().forEach(item ->{ + List list = userCarService.selectUserCarsByUserId(item.getUserId()); + if (CollectionUtil.isNotEmpty(list)){ + item.setUserCarList(list); + }else { + item.setUserCarList(new ArrayList<>()); + } + }); + return partnerCustomerInfos; + } + /** * 查询客户信息 * diff --git a/dl-module-inspection/src/main/resources/mapper/partner/PartnerCustomerInfoMapper.xml b/dl-module-inspection/src/main/resources/mapper/partner/PartnerCustomerInfoMapper.xml index 5947ce4e..ddd865a2 100644 --- a/dl-module-inspection/src/main/resources/mapper/partner/PartnerCustomerInfoMapper.xml +++ b/dl-module-inspection/src/main/resources/mapper/partner/PartnerCustomerInfoMapper.xml @@ -23,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select id, partner_id, customer_name, customer_phone, user_id, sex, user_age, dept_id, create_time, creator, update_time, updater from partner_customer_info - select pci.*, sr.name as roleName, sr.code as roleCode @@ -46,6 +46,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} + insert into partner_customer_info