This commit is contained in:
PQZ 2024-09-20 20:39:29 +08:00
parent ca3e41a501
commit 8ead3de94c
4 changed files with 56 additions and 5 deletions

View File

@ -27,4 +27,13 @@ public interface CustomerMainMapper extends BaseMapper<CustomerMain> {
* @date 15:01 2024/8/1
**/
IPage<CustomerMainRespVO> selectListPage(@Param("entity") CustomerMainPageReqVO pageReqVO, Page<CustomerMainRespVO> page);
/**
* 通过id查询客户信息
* @author PQZ
* @date 19:34 2024/9/20
* @param id 客户id
* @return cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO
**/
CustomerMainRespVO queryById(@Param("id") String id);
}

View File

@ -90,7 +90,6 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
*
* @param saveReqVO 保存客户信息扩展实体
* @param sign 标识(新增客户created/编辑客户update)
* @return void
* @author PQZ
* @date 15:46 2024/8/1
**/
@ -170,14 +169,13 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
@Override
public CustomerMainRespVO getCustomerById(String id) {
/*1、主表信息*/
CustomerMain main = this.getById(id);
CustomerMainRespVO result = customerMainMapper.queryById(id);
/*2、扩展表信息*/
LambdaQueryWrapper<CustomerItem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(BaseDO::getDeleted, 0).eq(CustomerItem::getCusId, id);
List<CustomerItem> itemList = customerItemService.list(lambdaQueryWrapper);
/*3、车辆信息*/
List<CarMainRespVO> carList = customerCarMapper.selectCarListByCusId(id);
CustomerMainRespVO result = JSONUtil.toBean(JSONUtil.parseObj(main).toJSONString(0), CustomerMainRespVO.class);
result.setItemList(itemList);
result.setCarList(carList);
/*4、标签信息*/

View File

@ -7,6 +7,7 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Schema(description = "管理后台 - 客户管理 Response VO")
@ -30,8 +31,14 @@ public class CustomerMainRespVO extends CustomerMain {
List<String> brandAndModel;
/**会员名称 */
private String levelName;
/**是否车主0否1是*/
private String isOwner;
/**积分余额*/
private BigDecimal balance;
/**冻结积分*/
private BigDecimal forzeBalance;
/**累计充值额度*/
private BigDecimal allBalance;
}

View File

@ -41,7 +41,7 @@
FROM
base_customer_main main
LEFT JOIN base_customer_item item ON main.id = item.cus_id AND item.deleted = 0
LEFT JOIN dl_member_level memberLevel ON main.member_level_id = memberLevel.id
LEFT JOIN dl_member_level memberLevel ON main.member_level_id = memberLevel.id
<where>
main.deleted = 0
<if test="entity.cusName != null and entity.cusName != ''">
@ -84,4 +84,41 @@
and main.type_code = '04'
ORDER BY main.create_time DESC
</select>
<select id="queryById" resultType="cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO">
SELECT
main.id AS id,
main.user_id AS userId,
main.type_code AS typeCode,
main.dept_code AS deptCode,
main.cus_name AS cusName,
main.phone_number AS phoneNumber,
main.birthday AS birthday,
main.address AS address,
main.sex AS sex,
main.id_card AS idCard,
main.id_card_image AS idCardImage,
main.data_from AS dataFrom,
main.near_do_time AS nearDoTime,
main.near_do_content AS nearDoContent,
main.inviter AS inviter,
main.inviter_type AS inviterType,
main.STATUS AS STATUS,
group_concat( item.ser_content ) AS serContents,
memberLevel.NAME AS levelName,
COALESCE(bcb.balance, 0.00) AS balance,
COALESCE(bcb.forze_balance, 0.00) AS forzeBalance,
COALESCE(bcb.all_balance, 0.00) AS allBalance
FROM
base_customer_main main
LEFT JOIN base_customer_item item ON main.id = item.cus_id
AND item.deleted = 0
LEFT JOIN dl_member_level memberLevel ON main.member_level_id = memberLevel.id
AND memberLevel.deleted = 0
LEFT JOIN base_customer_balance bcb ON main.id = bcb.cus_id AND bcb.deleted = 0
where
main.deleted = 0
and main.id = #{id}
GROUP BY
main.id
</select>
</mapper>