master:档口客户销售管理列表调优;
parent
d99912d716
commit
9445e153dc
|
|
@ -3,6 +3,7 @@ package com.ruoyi.xkt.dto.storeCusProdDiscount;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
|
@ -13,7 +14,7 @@ import java.util.Date;
|
|||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@Data
|
||||
|
||||
@Accessors(chain = true)
|
||||
public class StoreCusProdDiscPageResDTO {
|
||||
|
||||
@ApiModelProperty(value = "档口客户商品优惠ID")
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.ruoyi.xkt.domain.StoreCustomerProductDiscount;
|
||||
import com.ruoyi.xkt.dto.storeCusProdDiscount.StoreCusProdDiscPageDTO;
|
||||
import com.ruoyi.xkt.dto.storeCusProdDiscount.StoreCusProdDiscPageResDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -23,4 +24,13 @@ public interface StoreCustomerProductDiscountMapper extends BaseMapper<StoreCust
|
|||
*/
|
||||
List<StoreCusProdDiscPageResDTO> selectDiscPage(StoreCusProdDiscPageDTO pageDTO);
|
||||
|
||||
/**
|
||||
* 档口客户优惠分页关联
|
||||
*
|
||||
* @param storeProdColorIdList 商品颜色ID列表
|
||||
* @return List<StoreCusProdDiscPageResDTO>
|
||||
*/
|
||||
List<StoreCusProdDiscPageResDTO> selectDiscPageRelate(@Param("storeProdColorIdList") List<Long> storeProdColorIdList);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,7 +158,22 @@ public class StoreCustomerProductDiscountServiceImpl implements IStoreCustomerPr
|
|||
throw new ServiceException("当前用户非档口管理者或子账号,无权限操作!", HttpStatus.ERROR);
|
||||
}
|
||||
PageHelper.startPage(pageDTO.getPageNum(), pageDTO.getPageSize());
|
||||
// 查询分页数据
|
||||
List<StoreCusProdDiscPageResDTO> list = this.cusProdDiscMapper.selectDiscPage(pageDTO);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return Page.empty(pageDTO.getPageSize(), pageDTO.getPageNum());
|
||||
}
|
||||
// 处理分页的价格及颜色等
|
||||
List<StoreCusProdDiscPageResDTO> relateList = this.cusProdDiscMapper.selectDiscPageRelate(list.stream()
|
||||
.map(StoreCusProdDiscPageResDTO::getStoreProdColorId).distinct().collect(Collectors.toList()));
|
||||
Map<Long, StoreCusProdDiscPageResDTO> relateMap = relateList.stream().collect(Collectors
|
||||
.toMap(StoreCusProdDiscPageResDTO::getStoreProdColorId, Function.identity()));
|
||||
list.forEach(x -> {
|
||||
StoreCusProdDiscPageResDTO relate = relateMap.get(x.getStoreProdColorId());
|
||||
if (ObjectUtils.isNotEmpty(relate)) {
|
||||
x.setPrice(relate.getPrice()).setColorName(relate.getColorName());
|
||||
}
|
||||
});
|
||||
return Page.convert(new PageInfo<>(list));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,15 +13,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
scpd.store_cus_id AS storeCusId,
|
||||
scpd.store_cus_name AS storeCusName,
|
||||
scpd.store_prod_color_id AS storeProdColorId,
|
||||
spc.color_name,
|
||||
spcs.price,
|
||||
scpd.discount,
|
||||
scpd.update_time
|
||||
FROM
|
||||
store_customer_product_discount scpd
|
||||
JOIN store_product sp ON scpd.store_prod_id = sp.id AND sp.del_flag = 0
|
||||
JOIN store_product_color spc ON scpd.store_prod_color_id = spc.id AND spc.del_flag = 0
|
||||
JOIN store_product_color_size spcs ON spc.store_prod_id = spcs.store_prod_id AND spcs.del_flag = 0 AND spc.store_color_id = spcs.store_color_id
|
||||
JOIN store_product sp ON scpd.store_prod_id = sp.id AND sp.del_flag = 0
|
||||
WHERE
|
||||
scpd.del_flag = 0 AND scpd.store_id = #{storeId}
|
||||
<if test="cusName != null and cusName != ''"> AND scpd.store_cus_name like concat('%', #{cusName}, '%')</if>
|
||||
|
|
@ -34,4 +30,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
|
||||
<select id="selectDiscPageRelate" resultType="com.ruoyi.xkt.dto.storeCusProdDiscount.StoreCusProdDiscPageResDTO">
|
||||
SELECT
|
||||
spc.id AS storeProdColorId,
|
||||
spc.color_name,
|
||||
MIN(spcs.price) AS price
|
||||
FROM
|
||||
store_product_color spc
|
||||
JOIN
|
||||
store_product_color_size spcs ON spc.store_prod_id = spcs.store_prod_id AND spcs.store_color_id = spcs.store_color_id AND spcs.del_flag = 0
|
||||
WHERE
|
||||
spc.del_flag = 0
|
||||
AND spc.id IN
|
||||
<foreach item="item" collection="storeProdColorIdList" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
GROUP BY
|
||||
spc.store_prod_id,
|
||||
spc.store_color_id
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue