GoodsDonMapper.java 1.6 KB

123456789101112131415161718192021222324252627282930313233
  1. package com.cyksj.mapper;
  2. import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  3. import com.cyksj.model.entity.GoodsDon;
  4. import com.cyksj.model.views.GoodsDonSkuView;
  5. import org.apache.ibatis.annotations.Select;
  6. import java.math.BigDecimal;
  7. import java.util.List;
  8. /**
  9. * @author chan
  10. * @date 2022/9/27 5:31 PM
  11. */
  12. public interface GoodsDonMapper extends BaseMapper<GoodsDon> {
  13. @Select("select gdk.price from goods_don gd left join goods_don_sku gdk on gdk.goods_id = gd.id" +
  14. " where gd.id = #{goodsId} and gd.deleted is true" +
  15. " and gd.status is true and gd.type = 2" +
  16. " order by gdk.price limit 1")
  17. BigDecimal selectMinPriceSkuByGoodsId(Long goodsId);
  18. @Select("select distinct g.id,g.title from order_don o inner join (select user_id from user_distribute_shared where shared_id = #{cpsUserId}) us on us.user_id = o.user_id and o.is_fixed_distribute is true and o.relation_id != 0 and o.status not in ('close','noPayment')" +
  19. " inner join goods_don g on o.goods_id = g.id order by g.id")
  20. List<GoodsDon> getDistributeGoodsDetail(Long cpsUserId);
  21. @Select("select sku.id as skuId,sku.goods_id,sku.spec_val,g.title as goodsTitle from goods_don_sku sku inner join goods_don g on g.id = sku.goods_id" +
  22. " where g.deleted is true and type = #{type}")
  23. List<GoodsDonSkuView> selectGoodsDonSkuByGoodsType(Integer type);
  24. @Select("select g.id, g.title from (select distinct goods_id from order_don where status not in ('close','noPayment') and yhs_id = #{yhsId}) o inner join goods_don g on g.id = o.goods_id and g.type = 1")
  25. List<GoodsDon> getYhShopDistributeGoodsDetail(Long yhsId);
  26. }