| @@ -131,12 +131,16 @@ public class WxMerchantController extends BaseController { | |||||
| @ApiOperation("子商户列表查询") | @ApiOperation("子商户列表查询") | ||||
| @GetMapping("/subMerchantList") | @GetMapping("/subMerchantList") | ||||
| @ApiImplicitParam(name = "subName", value = "subName", dataType = "Long", paramType = "query", required = true) | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| @SystemControllerLog(description = "子商户列表查询") | @SystemControllerLog(description = "子商户列表查询") | ||||
| public ResultData subMerchantList(String subName) { | |||||
| public ResultData subMerchantList(@ModelAttribute WxMerchant wxMerchant, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::subMerchantList"); | logger.debug("[" + getIpAddr() + "] WxMerchantController::subMerchantList"); | ||||
| List<WxMerchant> merchants = wxMerchantService.subMerchantList(subName); | |||||
| return new ResultData(merchants); | |||||
| if (null == wxMerchant) wxMerchant = new WxMerchant(); | |||||
| wxMerchant.setSortColumns(BaseEntity.SortField.TopTime_DESC); | |||||
| PageInfo<WxMerchant> pageInfo = wxMerchantService.subMerchantList(wxMerchant, pageNum, pageSize); | |||||
| return new ResultData(pageInfo); | |||||
| } | } | ||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @@ -428,5 +428,7 @@ public class WxMerchant extends TenantEntity { | |||||
| private Integer hasCarVendor; | private Integer hasCarVendor; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Integer noCarVendor; | private Integer noCarVendor; | ||||
| @TableField(exist = false) | |||||
| private List<Long> merchantIds; | |||||
| } | } | ||||
| @@ -58,5 +58,4 @@ public interface WxMerchantMapper extends CommonMapper<WxMerchant, Long> { | |||||
| List<WxMerchant> getMerchantListByIds(@Param("relationIds") List<Long> relationIds); | List<WxMerchant> getMerchantListByIds(@Param("relationIds") List<Long> relationIds); | ||||
| List<WxMerchant> getSubMerchantListByIds(@Param("merchantIds") List<Long> merchantIds,@Param("subName") String subName); | |||||
| } | } | ||||
| @@ -218,6 +218,6 @@ public interface WxMerchantService { | |||||
| List<WxMerchant> relationList(Long regionId); | List<WxMerchant> relationList(Long regionId); | ||||
| List<WxMerchant> subMerchantList(String subName); | |||||
| PageInfo<WxMerchant> subMerchantList(WxMerchant wxMerchant, Integer pageNum, Integer pageSize); | |||||
| } | } | ||||
| @@ -2076,9 +2076,11 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| * 查询剩余子商户 | * 查询剩余子商户 | ||||
| */ | */ | ||||
| @Override | @Override | ||||
| public List<WxMerchant> subMerchantList(String subName) { | |||||
| public PageInfo<WxMerchant> subMerchantList(WxMerchant wxMerchant, Integer pageNum, Integer pageSize) { | |||||
| //查询已经被选择了的子商户 | //查询已经被选择了的子商户 | ||||
| List<Long> merchantIds = wxMerchantRelationService.getRelationByRegionId(null); | List<Long> merchantIds = wxMerchantRelationService.getRelationByRegionId(null); | ||||
| return wxMerchantMapper.getSubMerchantListByIds(merchantIds,subName); | |||||
| wxMerchant.setMerchantIds(merchantIds); | |||||
| PageInfo<WxMerchant> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxMerchantMapper.findList(wxMerchant)); | |||||
| return pageInfo; | |||||
| } | } | ||||
| } | } | ||||
| @@ -180,6 +180,12 @@ | |||||
| #{notInIdItem} | #{notInIdItem} | ||||
| </foreach> | </foreach> | ||||
| </if> | </if> | ||||
| <if test="merchantIds != null and merchantIds.size > 0"> | |||||
| and m.id NOT IN | |||||
| <foreach collection="merchantIds" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | <if test=" null != sortColumns">order by ${sortColumns}</if> | ||||
| </sql> | </sql> | ||||
| @@ -462,19 +468,4 @@ | |||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="getSubMerchantListByIds" resultType="com.iformall.domain.po.WxMerchant"> | |||||
| select <include refid="allColumns"/> | |||||
| from wx_merchant m | |||||
| where m.is_del=0 and m.is_admin=4 | |||||
| <if test="merchantIds != null and merchantIds.size > 0"> | |||||
| and m.id NOT IN | |||||
| <foreach collection="merchantIds" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test="subName != null and subName != ''"> | |||||
| and name like concat('%',#{subName},'%') | |||||
| </if> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||