Browse Source

渠道PAGE添加查询条件

v1.0
15989082884@163.com 2 years ago
parent
commit
0b341ace82
  1. 23
      src/main/java/com/qs/serve/modules/bms/controller/BmsChannelController.java
  2. 27
      src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelMyController.java
  3. 2
      src/main/java/com/qs/serve/modules/bms/entity/BmsChannel.java
  4. 3
      src/main/resources/mapper/bms/BmsChannelMapper.xml

23
src/main/java/com/qs/serve/modules/bms/controller/BmsChannelController.java

@ -113,11 +113,34 @@ public class BmsChannelController {
if(param.getLoadByCurrent()!=null&&param.getLoadByCurrent().equals(1)){ if(param.getLoadByCurrent()!=null&&param.getLoadByCurrent().equals(1)){
return bmsChannelMyController.getPage4UnderAndMine(param); return bmsChannelMyController.getPage4UnderAndMine(param);
} }
LambdaQueryWrapper<BmsChannel> channelWrapper = new LambdaQueryWrapper<>(param); LambdaQueryWrapper<BmsChannel> channelWrapper = new LambdaQueryWrapper<>(param);
channelWrapper.orderByDesc(BmsChannel::getCreateTime); channelWrapper.orderByDesc(BmsChannel::getCreateTime);
if(StringUtils.hasText(param.getSeachSupplierName())){
BmsSupplierChannel searchSupplierChannel = new BmsSupplierChannel();
searchSupplierChannel.setSupplierName(param.getSeachSupplierName());
List<BmsSupplierChannel> bmsSupplierChannelList = bmsSupplierChannelService.selectSupplierChannelList(searchSupplierChannel);
List<Long> channelIds = bmsSupplierChannelList.stream().map(a->a.getChannelId()).collect(Collectors.toList());
if(channelIds.size()>0) {
channelWrapper.in(BmsChannel::getId, channelIds);
}else{
channelWrapper.eq(BmsChannel::getId, 0L);
}
}
PageUtil.startPage(); PageUtil.startPage();
List<BmsChannel> list = bmsChannelService.list(channelWrapper); List<BmsChannel> list = bmsChannelService.list(channelWrapper);
list.forEach(a->{
BmsSupplierChannel searchSupplierChannel = new BmsSupplierChannel();
searchSupplierChannel.setChannelId(a.getId());
List<BmsSupplierChannel> bmsSupplierChannelList = bmsSupplierChannelService.selectSupplierChannelList(searchSupplierChannel);
a.setSupplierNames(bmsSupplierChannelList.stream().map(b->b.getSupplierName()).collect(Collectors.toList()));
});
return R.byPageHelperList(list); return R.byPageHelperList(list);
} }

27
src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelMyController.java

@ -11,15 +11,9 @@ import com.qs.serve.common.util.CollectionUtil;
import com.qs.serve.common.util.PageUtil; import com.qs.serve.common.util.PageUtil;
import com.qs.serve.common.util.StringUtils; import com.qs.serve.common.util.StringUtils;
import com.qs.serve.modules.bms.common.MasterUserType; import com.qs.serve.modules.bms.common.MasterUserType;
import com.qs.serve.modules.bms.entity.BmsChannel; import com.qs.serve.modules.bms.entity.*;
import com.qs.serve.modules.bms.entity.BmsChannelPoint;
import com.qs.serve.modules.bms.entity.BmsMasterUser;
import com.qs.serve.modules.bms.entity.BmsRegionUser;
import com.qs.serve.modules.bms.mapper.BmsMasterUserMapper; import com.qs.serve.modules.bms.mapper.BmsMasterUserMapper;
import com.qs.serve.modules.bms.service.BmsChannelPointService; import com.qs.serve.modules.bms.service.*;
import com.qs.serve.modules.bms.service.BmsChannelService;
import com.qs.serve.modules.bms.service.BmsMasterUserService;
import com.qs.serve.modules.bms.service.BmsRegionUserService;
import com.qs.serve.modules.his.entity.HisUserChannelPoint; import com.qs.serve.modules.his.entity.HisUserChannelPoint;
import com.qs.serve.modules.his.service.HisUserChannelPointService; import com.qs.serve.modules.his.service.HisUserChannelPointService;
import com.qs.serve.modules.sys.service.SysPostUserService; import com.qs.serve.modules.sys.service.SysPostUserService;
@ -50,6 +44,7 @@ public class BmsChannelMyController {
private BmsChannelService bmsChannelService; private BmsChannelService bmsChannelService;
private BmsMasterUserService bmsMasterUserService; private BmsMasterUserService bmsMasterUserService;
private SysPostUserService postUserService; private SysPostUserService postUserService;
private BmsSupplierChannelService bmsSupplierChannelService;
/** /**
* 翻页(我负责的) * 翻页(我负责的)
@ -91,8 +86,24 @@ public class BmsChannelMyController {
String loginUserId = AuthContextUtils.getSysUserId(); String loginUserId = AuthContextUtils.getSysUserId();
List<String> userIds = postUserService.listByChildIds(loginUserId); List<String> userIds = postUserService.listByChildIds(loginUserId);
userIds.add(loginUserId); userIds.add(loginUserId);
// if(StringUtils.hasText(param.getSeachSupplierName())){
// BmsSupplierChannel searchSupplierChannel = new BmsSupplierChannel();
// searchSupplierChannel.setSupplierName(param.getSeachSupplierName());
// List<BmsSupplierChannel> bmsSupplierChannelList = bmsSupplierChannelService.selectSupplierChannelList(searchSupplierChannel);
// List<Long> supplierIds = bmsSupplierChannelList.stream().map(a->a.getSupplierId()).collect(Collectors.toList());
// param.setSupplierIds(supplierIds);
// }
PageUtil.startPage(); PageUtil.startPage();
List<BmsChannel> list = bmsChannelService.selectChannelList(param, userIds,param.getSupplierIdForFindChild()); List<BmsChannel> list = bmsChannelService.selectChannelList(param, userIds,param.getSupplierIdForFindChild());
list.forEach(a->{
BmsSupplierChannel searchSupplierChannel = new BmsSupplierChannel();
searchSupplierChannel.setChannelId(a.getId());
List<BmsSupplierChannel> bmsSupplierChannelList = bmsSupplierChannelService.selectSupplierChannelList(searchSupplierChannel);
a.setSupplierNames(bmsSupplierChannelList.stream().map(b->b.getSupplierName()).collect(Collectors.toList()));
});
return R.byPageHelperList(list); return R.byPageHelperList(list);
} }

2
src/main/java/com/qs/serve/modules/bms/entity/BmsChannel.java

@ -123,5 +123,7 @@ public class BmsChannel implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private List<String> supplierNames; private List<String> supplierNames;
@TableField(exist = false)
private String seachSupplierName;
} }

3
src/main/resources/mapper/bms/BmsChannelMapper.xml

@ -48,6 +48,9 @@
#{selectId} #{selectId}
</foreach> </foreach>
<if test="supplierId != null and supplierId != ''"> and bms_supplier_channel.supplier_id = #{supplierId}</if> <if test="supplierId != null and supplierId != ''"> and bms_supplier_channel.supplier_id = #{supplierId}</if>
<if test="query.seachSupplierName != null and query.seachSupplierName!=''">
and `his_user_supplier`.`supplier_name` like concat('%',#{query.seachSupplierName},'%')
</if>
and `bms_supplier_channel`.`del_flag` = 0 and `bms_supplier_channel`.`del_flag` = 0
GROUP BY channel_id GROUP BY channel_id
) tmp ) tmp

Loading…
Cancel
Save