1
This commit is contained in:
parent
bd0e7afcf3
commit
3b7d69a768
@ -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<PartnerCustomerInfo> page = new Page<>(pageNum,pageSize);
|
||||
startPage();
|
||||
List<PartnerCustomerInfo> list = partnerCustomerInfoService.selectPartnerCustomerInfoList(partnerCustomerInfo);
|
||||
return getDataTable(list);
|
||||
public CommonResult<IPage<?>> list(PartnerCustomerInfo partnerCustomerInfo,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) throws Exception {
|
||||
Page<PartnerCustomerInfo> page = new Page<>(pageNo, pageSize);
|
||||
return success(partnerCustomerInfoService.queryListPage(partnerCustomerInfo, page));
|
||||
// ShopMallPartners partners = partnerService.shopInfo();
|
||||
// partnerCustomerInfo.setPartnerId(partners.getPartnerId());
|
||||
// startPage();
|
||||
// List<PartnerCustomerInfo> list = partnerCustomerInfoService.selectPartnerCustomerInfoList(partnerCustomerInfo);
|
||||
// return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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<PartnerCustomerInf
|
||||
* @param partnerCustomerInfo 客户信息
|
||||
* @return 客户信息集合
|
||||
*/
|
||||
public List<PartnerCustomerInfo> selectPartnerCustomerInfoList(@Param("vo") PartnerCustomerInfo partnerCustomerInfo);
|
||||
public List<PartnerCustomerInfo> selectPartnerCustomerInfoList(@Param("vo") PartnerCustomerInfo vo);
|
||||
|
||||
IPage<PartnerCustomerInfo> pagePartnerCustomerInfoList(@Param("vo") PartnerCustomerInfo vo, Page<PartnerCustomerInfo> page);
|
||||
|
||||
/**
|
||||
* 查询客户信息
|
||||
|
@ -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<PartnerCustomerInf
|
||||
*/
|
||||
public List<PartnerCustomerInfo> selectPartnerCustomerInfoList(PartnerCustomerInfo partnerCustomerInfo);
|
||||
|
||||
IPage<PartnerCustomerInfo> queryListPage(PartnerCustomerInfo entity, Page<PartnerCustomerInfo> page);
|
||||
|
||||
|
||||
/**
|
||||
* 查询客户信息
|
||||
*
|
||||
|
@ -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<PartnerCustomerI
|
||||
private RoleService roleService;
|
||||
@Autowired
|
||||
private PermissionService permissionService;
|
||||
@Resource
|
||||
private PartnerCustomerInfoMapper customerInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询客户信息列表
|
||||
@ -59,7 +63,7 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl<PartnerCustomerI
|
||||
@Override
|
||||
public List<PartnerCustomerInfo> selectPartnerCustomerInfoList(PartnerCustomerInfo partnerCustomerInfo)
|
||||
{
|
||||
List<PartnerCustomerInfo> partnerCustomerInfos = baseMapper.selectPartnerCustomerInfoList(partnerCustomerInfo);
|
||||
List<PartnerCustomerInfo> partnerCustomerInfos = customerInfoMapper.selectPartnerCustomerInfoList(partnerCustomerInfo);
|
||||
for (PartnerCustomerInfo customerInfo : partnerCustomerInfos) {
|
||||
List<ShopUserCar> list = userCarService.selectUserCarsByUserId(customerInfo.getUserId());
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
@ -71,6 +75,20 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl<PartnerCustomerI
|
||||
return partnerCustomerInfos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<PartnerCustomerInfo> queryListPage(PartnerCustomerInfo entity, Page<PartnerCustomerInfo> page) {
|
||||
IPage<PartnerCustomerInfo> partnerCustomerInfos = customerInfoMapper.pagePartnerCustomerInfoList(entity,page);
|
||||
partnerCustomerInfos.getRecords().forEach(item ->{
|
||||
List<ShopUserCar> list = userCarService.selectUserCarsByUserId(item.getUserId());
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
item.setUserCarList(list);
|
||||
}else {
|
||||
item.setUserCarList(new ArrayList<>());
|
||||
}
|
||||
});
|
||||
return partnerCustomerInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询客户信息
|
||||
*
|
||||
|
@ -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
|
||||
</sql>
|
||||
|
||||
<select id="selectPartnerCustomerInfoList" parameterType="cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo" resultType="cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo">
|
||||
<select id="selectPartnerCustomerInfoList" resultType="cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo">
|
||||
select pci.*,
|
||||
sr.name as roleName,
|
||||
sr.code as roleCode
|
||||
@ -46,6 +46,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectPartnerCustomerInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="pagePartnerCustomerInfoList"
|
||||
resultType="cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo">
|
||||
select pci.*,
|
||||
sr.name as roleName,
|
||||
sr.code as roleCode
|
||||
from partner_customer_info pci
|
||||
left join shop_user_car suc on suc.user_id = pci.user_id
|
||||
left join system_users su on su.id = pci.user_id
|
||||
left join system_user_role sur on sur.user_id = su.id
|
||||
left join system_role sr on sr.id = sur.role_id
|
||||
<where>
|
||||
<if test="vo.carNum != null and vo.carNum != ''"> and suc.car_no like concat('%', #{vo.carNum}, '%')</if>
|
||||
<if test="vo.customerName != null and vo.customerName != ''"> and pci.customer_name like concat('%', #{vo.customerName}, '%')</if>
|
||||
<if test="vo.customerPhone != null and vo.customerPhone != ''"> and pci.customer_phone like concat('%', #{vo.customerPhone}, '%')</if>
|
||||
<if test="vo.roleCode != null and vo.roleCode != ''"> and sr.code = #{vo.roleCode}</if>
|
||||
</where>
|
||||
group by pci.id
|
||||
order by suc.next_inspection_date
|
||||
</select>
|
||||
|
||||
<insert id="insertPartnerCustomerInfo" parameterType="cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo">
|
||||
insert into partner_customer_info
|
||||
|
Loading…
Reference in New Issue
Block a user