|
|
@@ -15,6 +15,7 @@ import com.cyksj.mapper.UserDistributePosterRecordMapper;
|
|
|
import com.cyksj.mapper.manage.coupon.CouponDistributePopularizeMapper;
|
|
|
import com.cyksj.mapper.manage.distribute.*;
|
|
|
import com.cyksj.model.entity.*;
|
|
|
+import com.cyksj.model.views.CpsGoodsDonDistributeView;
|
|
|
import com.cyksj.model.views.DistributePosterGoodsCpsView;
|
|
|
import com.cyksj.model.views.UserDistributePopularizeView;
|
|
|
import com.cyksj.model.views.UserDistributePosterOrderDetailView;
|
|
|
@@ -209,32 +210,16 @@ public class CpsPopularizeController {
|
|
|
* 获取所有平台列表
|
|
|
*/
|
|
|
@GetMapping("/get/all/goods")
|
|
|
- public Result<List<GoodsDon>> getAllGoodsList(Boolean isNoBuyout, Boolean isRate) {
|
|
|
+ public Result<List<CpsGoodsDonDistributeView>> getAllGoodsList(Boolean isNoBuyout, Boolean isRate) {
|
|
|
Long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
|
|
|
- MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
|
|
|
- //过滤买断制 平台
|
|
|
- String conditionSql;
|
|
|
- if (isNoBuyout != null && isNoBuyout) {
|
|
|
- mapBuilder.field(GoodsDon::getSpecialType).op(Operator.IsNull);
|
|
|
- conditionSql = "(select count(*) from goods_don_sku sku where sku.goods_id = g.id and sku.months = 300) = 0";
|
|
|
- } else {
|
|
|
- conditionSql = "(special_type is null or special_type != 'giftCard')";
|
|
|
- }
|
|
|
- conditionSql += " and exists (select id from goods_don_sku sku where sku.goods_id = g.id limit 1)";
|
|
|
+ MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
|
|
|
if (isRate != null && isRate) {
|
|
|
- UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class)
|
|
|
- .eq(UserDistribute::getUserId, cpsUserId)
|
|
|
- .eq(UserDistribute::getDeleted, 1)
|
|
|
- .last("limit 1"));
|
|
|
- conditionSql += String.format(" and exists (select 1 from user_plat_distribute_rate upr where upr.distribute_id = %s and upr.goods_id = g.id and upr.rate > 0)", userDistribute.getId());
|
|
|
+ builder.field(CpsGoodsDonDistributeView::getRate, 0).op(Operator.GreaterThan);
|
|
|
}
|
|
|
- List<GoodsDon> goodsDons = beanSearcher.searchAll(GoodsDon.class, mapBuilder
|
|
|
- .put("condition", conditionSql)
|
|
|
- .field(GoodsDon::getType, 1)
|
|
|
- .field(GoodsDon::getStatus, 1)
|
|
|
- .field(GoodsDon::getDeleted, true)
|
|
|
- .onlySelect(GoodsDon::getId, GoodsDon::getCategory, GoodsDon::getType, GoodsDon::getTitle, GoodsDon::getSecondType).build());
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(goodsDons);
|
|
|
+ List<CpsGoodsDonDistributeView> list = beanSearcher.searchAll(CpsGoodsDonDistributeView.class, builder
|
|
|
+ .put("distribute_id", String.format("and distribute_id = (select id from user_distribute where user_id = %s and deleted is true limit 1)", cpsUserId))
|
|
|
+ .build());
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(list);
|
|
|
}
|
|
|
|
|
|
/**
|