| @@ -35,6 +35,23 @@ public class WxMerchantController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private QrCodeService qrCodeService; | private QrCodeService qrCodeService; | ||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("listVo") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| @SystemControllerLog(description = "商户-列表") | |||||
| public ResultData listVo(@ModelAttribute WxMerchant wxMerchant, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::list"); | |||||
| if (null == wxMerchant) wxMerchant = new WxMerchant(); | |||||
| wxMerchant.setTenantId(getTenantId()); | |||||
| wxMerchant.setSortColumns(WxMerchant.Field.TopTime_DESC); | |||||
| final PageInfo<WxMerchant> page = wxMerchantService.listVoAsPage(wxMerchant, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -3,7 +3,6 @@ package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.po.WxMerchant; | import com.iformall.domain.po.WxMerchant; | ||||
| import com.iformall.domain.vo.WxMerchantVo; | import com.iformall.domain.vo.WxMerchantVo; | ||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -22,4 +21,7 @@ public interface WxMerchantMapper extends CommonMapper<WxMerchant, Long> { | |||||
| List<Map<String,Object>> findBusByFloorId(Map<String, Object> params); | List<Map<String,Object>> findBusByFloorId(Map<String, Object> params); | ||||
| int hasMerchant(WxMerchant wxMerchant); | int hasMerchant(WxMerchant wxMerchant); | ||||
| List<WxMerchant> findListVo(WxMerchant record); | |||||
| } | } | ||||
| @@ -104,4 +104,7 @@ public interface WxMerchantService { | |||||
| boolean hasMerchant(WxMerchant wxMerchant); | boolean hasMerchant(WxMerchant wxMerchant); | ||||
| Optional<WxMerchant> findByName(String name); | Optional<WxMerchant> findByName(String name); | ||||
| PageInfo<WxMerchant> listVoAsPage(WxMerchant wxMerchant, Integer pageNum, Integer pageSize); | |||||
| } | } | ||||
| @@ -99,36 +99,8 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| @Override | @Override | ||||
| public PageInfo<WxMerchant> listAsPage(WxMerchant record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxMerchant> listAsPage(WxMerchant record, Integer pageIndex, Integer pageSize) { | ||||
| PageHelper.startPage(pageIndex, pageSize); | PageHelper.startPage(pageIndex, pageSize); | ||||
| List<WxMerchant> merchants = wxMerchantMapper.findList(record); | List<WxMerchant> merchants = wxMerchantMapper.findList(record); | ||||
| for (WxMerchant merchant : merchants) { | |||||
| WxRentContract wxRentContract = new WxRentContract(); | |||||
| wxRentContract.setMerchantId(merchant.getId()); | |||||
| List<WxRentContract> lrc = wxRentContractMapper.selectRentContractByMerchantId(wxRentContract); | |||||
| if (!lrc.isEmpty()) { | |||||
| merchant.setRentalStartDate(lrc.get(0).getRentalStartDate()); | |||||
| merchant.setRentalEndDate(lrc.get(0).getRentalEndDate()); | |||||
| } | |||||
| if (record.getRentShopType() != null) { | |||||
| List<Map<String, Object>> shops = new ArrayList<>(); | |||||
| WxMerchantShop wxMerchantShop = new WxMerchantShop(); | |||||
| wxMerchantShop.setMerchantId(merchant.getId()); | |||||
| wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | |||||
| List<WxMerchantShop> wxMerchantShopList = wxMerchantShopMapper.findList(wxMerchantShop); | |||||
| for (WxMerchantShop merchantShop : wxMerchantShopList) { | |||||
| WxShop shop = new WxShop(); | |||||
| shop.setId(merchantShop.getShopId()); | |||||
| List<Map<String, Object>> shoplist = wxShopMapper.findListMap(shop); | |||||
| if (shoplist.size() > 0) { | |||||
| shops.add(shoplist.get(0)); | |||||
| } | |||||
| } | |||||
| merchant.setShoplist(shops); | |||||
| } | |||||
| } | |||||
| PageInfo<WxMerchant> pageInfo = new PageInfo<>(merchants); | PageInfo<WxMerchant> pageInfo = new PageInfo<>(merchants); | ||||
| return pageInfo; | return pageInfo; | ||||
| } | } | ||||
| @@ -729,4 +701,30 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| return Optional.of(merchantList.get(0)); | return Optional.of(merchantList.get(0)); | ||||
| return Optional.empty(); | return Optional.empty(); | ||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxMerchant> listVoAsPage(WxMerchant record, Integer pageIndex, Integer pageSize) { | |||||
| PageHelper.startPage(pageIndex, pageSize); | |||||
| List<WxMerchant> merchants = wxMerchantMapper.findListVo(record); | |||||
| for (WxMerchant merchant : merchants) { | |||||
| if (record.getRentShopType() != null) { | |||||
| List<Map<String, Object>> shops = new ArrayList<>(); | |||||
| WxMerchantShop wxMerchantShop = new WxMerchantShop(); | |||||
| wxMerchantShop.setMerchantId(merchant.getId()); | |||||
| wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | |||||
| List<WxMerchantShop> wxMerchantShopList = wxMerchantShopMapper.findList(wxMerchantShop); | |||||
| for (WxMerchantShop merchantShop : wxMerchantShopList) { | |||||
| WxShop shop = new WxShop(); | |||||
| shop.setId(merchantShop.getShopId()); | |||||
| List<Map<String, Object>> shoplist = wxShopMapper.findListMap(shop); | |||||
| if (shoplist.size() > 0) { | |||||
| shops.add(shoplist.get(0)); | |||||
| } | |||||
| } | |||||
| merchant.setShoplist(shops); | |||||
| } | |||||
| } | |||||
| PageInfo<WxMerchant> pageInfo = new PageInfo<>(merchants); | |||||
| return pageInfo; | |||||
| } | |||||
| } | } | ||||
| @@ -31,16 +31,23 @@ | |||||
| <result column="talk_user_main" jdbcType="VARCHAR" property="talkUserMain"/> | <result column="talk_user_main" jdbcType="VARCHAR" property="talkUserMain"/> | ||||
| <result column="talk_user_aux" jdbcType="VARCHAR" property="talkUserAux"/> | <result column="talk_user_aux" jdbcType="VARCHAR" property="talkUserAux"/> | ||||
| <result column="link_line_phone" property="linkLinePhone"/> | <result column="link_line_phone" property="linkLinePhone"/> | ||||
| <result column="rental_start_date" property="rentalStartDate"/> | |||||
| <result column="rental_end_date" property="rentalEndDate"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`img_url`,`name`,`link_phone`,`create_date`,`update_date`,`car_vendor_type`,`car_params`,`status`,`link_person`, | `id`,`tenant_id`,`img_url`,`name`,`link_phone`,`create_date`,`update_date`,`car_vendor_type`,`car_params`,`status`,`link_person`, | ||||
| `business_id`,`sub_business_id`,`shop_type`,`brand`,`type`,`is_public`,email,`title`,`cover_picture`,`is_admin`,`bill_setting`,`qr_code`, | `business_id`,`sub_business_id`,`shop_type`,`brand`,`type`,`is_public`,email,`title`,`cover_picture`,`is_admin`,`bill_setting`,`qr_code`, | ||||
| `introduction`,`action_desc`,`is_del`, | |||||
| `talk_user_main`,`talk_user_aux`,link_line_phone | |||||
| `introduction`,`action_desc`,`is_del`,`talk_user_main`,`talk_user_aux`,link_line_phone | |||||
| </sql> | </sql> | ||||
| <sql id="allColumnsVo"> | |||||
| m.`id`,m.`tenant_id`,m.`img_url`,m.`name`,m.`link_phone`,m.`create_date`,m.`update_date`,m.`car_vendor_type`,m.`car_params`,m.`status`,m.`link_person`, | |||||
| m.`business_id`,m.`sub_business_id`,m.`shop_type`,m.`brand`,m.`type`,m.`is_public`,m.email,m.`title`,m.`cover_picture`,m.`is_admin`,m.`bill_setting`,m.`qr_code`, | |||||
| m.`introduction`,m.`action_desc`,m.`is_del`,m.`talk_user_main`,m.`talk_user_aux`,m.link_line_phone,r.rental_start_date,r.rental_end_date | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| where is_del = 0 | where is_del = 0 | ||||
| @@ -132,7 +139,103 @@ | |||||
| from wx_merchant | from wx_merchant | ||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| <select id="findListVo" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumnsVo"/> | |||||
| from wx_merchant m left join (select merchant_id,rental_start_date,rental_end_date from wx_rent_contract where | |||||
| tenant_id=#{tenantId} and status in(2,3,4)) r | |||||
| on m.id=r.merchant_id | |||||
| <include refid="dynamicWhereConditionsVo"/> | |||||
| </select> | |||||
| <sql id="dynamicWhereConditionsVo"> | |||||
| where m.is_del = 0 | |||||
| <if test=" null != id "> | |||||
| and m.`id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and m.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != imgUrl "> | |||||
| and m.`img_url` like concat('%', #{imgUrl},'%') | |||||
| </if> | |||||
| <if test=" null != name and ''!=name "> | |||||
| and m.`name` like concat('%', #{name},'%') | |||||
| </if> | |||||
| <if test=" null != linkPhone and ''!=linkPhone "> | |||||
| and m.`link_phone` like concat('%', #{linkPhone},'%') | |||||
| </if> | |||||
| <if test=" null != createDate "> | |||||
| and m.`create_date` = #{createDate} | |||||
| </if> | |||||
| <if test=" null != updateDate "> | |||||
| and m.`update_date` = #{updateDate} | |||||
| </if> | |||||
| <if test=" null != carVendorType "> | |||||
| and m.`car_vendor_type` = #{carVendorType} | |||||
| </if> | |||||
| <if test=" null != businessId "> | |||||
| and m.`business_id` = #{businessId} | |||||
| </if> | |||||
| <if test=" null != subBusinessId "> | |||||
| and m.`sub_business_id` = #{subBusinessId} | |||||
| </if> | |||||
| <if test=" null != carParams "> | |||||
| and m.`car_params` like concat('%', #{carParams},'%') | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and m.`status` = #{status} | |||||
| </if> | |||||
| <if test=" null != linkPerson "> | |||||
| and m.`link_person` = #{linkPerson} | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| and m.`type` = #{type} | |||||
| </if> | |||||
| <if test=" null != isPublic "> | |||||
| and m.`is_public` = #{isPublic} | |||||
| </if> | |||||
| <if test=" null != email "> | |||||
| and m.`email` = #{email} | |||||
| </if> | |||||
| <if test=" null != isAdmin "> | |||||
| and m.`is_admin` = #{isAdmin} | |||||
| </if> | |||||
| <if test=" null != isDel "> | |||||
| and m.`is_del` = #{isDel} | |||||
| </if> | |||||
| <if test=" null != brand "> | |||||
| and m.`brand` = #{brand} | |||||
| </if> | |||||
| <if test=" null != rentShopType "> | |||||
| and m.id not in( | |||||
| select merchant_id from wx_rent_contract where tenant_id=#{tenantId} and rent_shop_type=1 and merchant_id is | |||||
| not null and status in(1,2,3,4) | |||||
| ) | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and m.id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <sql id="allMerchantVoColumns"> | <sql id="allMerchantVoColumns"> | ||||
| m.id,m.img_url,m.name,m.link_phone,m.status,m.business_id, | m.id,m.img_url,m.name,m.link_phone,m.status,m.business_id, | ||||
| m.is_public,m.email,m.title,m.cover_picture,m.sub_business_id, | m.is_public,m.email,m.title,m.cover_picture,m.sub_business_id, | ||||