Просмотр исходного кода

[需求][新增]:C端商户列表接口

release_toaliyun_real
hupeng 7 лет назад
committed by Stormeye Wu
Родитель
Сommit
e46f00ba07
5 измененных файлов: 67 добавлений и 8 удалений
  1. +15
    -0
      mallinkCApi/src/main/java/com/iformall/controller/WxMerchantController.java
  2. +1
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxMerchantMapper.java
  3. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxMerchantService.java
  4. +6
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java
  5. +44
    -6
      mallinkService/src/main/resources/mapper/WxMerchantMapper.xml

+ 15
- 0
mallinkCApi/src/main/java/com/iformall/controller/WxMerchantController.java Просмотреть файл

@@ -1,11 +1,15 @@
package com.iformall.controller;

import com.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.vo.WxMerchantVo;
import com.iformall.enums.EnumMerchantStatus;
import com.iformall.service.WxMerchantService;
import com.iformall.utils.HashUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@@ -26,6 +30,17 @@ public class WxMerchantController extends BaseController {
@Autowired
private WxMerchantService wxMerchantService;

@ApiOperation("分页列表接口")
@GetMapping("list")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
public ResultData list(@ModelAttribute WxMerchantVo wxMerchant, Integer pageNum, Integer pageSize) {
logger.debug("[" + getIpAddr() + "] WxMerchantController::list");
if (null == wxMerchant) wxMerchant = new WxMerchantVo();
wxMerchant.setMerchantStatus(EnumMerchantStatus.VALID.getCode());
return new ResultData(wxMerchantService.listAsPageCVo(wxMerchant, pageNum, pageSize));
}

@ApiOperation("根据code查询接口")
@GetMapping("/findByCode")


+ 1
- 1
mallinkService/src/main/java/com/iformall/mapper/WxMerchantMapper.java Просмотреть файл

@@ -8,7 +8,7 @@ import com.iformall.domain.vo.WxMerchantVo;
public interface WxMerchantMapper extends CommonMapper<WxMerchant, Long> {

List<WxMerchant> findList(WxMerchant wxMerchant);
List<WxMerchantVo> findListCVo(WxMerchantVo wxMerchantVo);
WxMerchantVo getMerchantByCode(HashMap<String, String> params);
}

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxMerchantService.java Просмотреть файл

@@ -23,7 +23,7 @@ public interface WxMerchantService {
* @return
*/
PageInfo<WxMerchant> listAsPage(WxMerchant record, Integer pageIndex, Integer pageSize);
PageInfo<WxMerchantVo> listAsPageCVo(WxMerchantVo record, Integer pageIndex, Integer pageSize);
/**
* 根据code查询
*


+ 6
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java Просмотреть файл

@@ -104,6 +104,12 @@ public class WxMerchantServiceImpl implements WxMerchantService {
return pageInfo;
}


@Override
public PageInfo<WxMerchantVo> listAsPageCVo(WxMerchantVo record, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.findListCVo(record));
}

@Override
public WxMerchantVo getMerchantInfo(HashMap<String, String> params) {
return wxMerchantMapper.getMerchantByCode(params);


+ 44
- 6
mallinkService/src/main/resources/mapper/WxMerchantMapper.xml Просмотреть файл

@@ -92,20 +92,20 @@
<include refid="dynamicWhereConditions"/>
</select>

<sql id="allMerchantDiscountVoColumns">
<sql id="allMerchantVoColumns">
m.id,
m.img_url,m.name,m.link_phone,m.status,
m.img_url,m.name,m.link_phone,m.status,m.business_id,
s.addr,s.shop_number,s.baidu_poi,
mb.building_name,mf.floor_name
</sql>

<resultMap id="MerchantDiscountVoResultMap" type="com.iformall.domain.vo.WxMerchantVo">
<resultMap id="MerchantVoResultMap" type="com.iformall.domain.vo.WxMerchantVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl"/>
<result column="name" jdbcType="VARCHAR" property="merchantName"/>
<result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone"/>
<result column="status" jdbcType="VARCHAR" property="merchantStatus"/>
<result column="business_id" jdbcType="INTEGER" property="businessId"/>
<result column="addr" jdbcType="VARCHAR" property="addr"/>
<result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
<result column="building_name" jdbcType="VARCHAR" property="buildingName"/>
@@ -115,9 +115,9 @@
</resultMap>


<select id="getMerchantByCode" parameterType="java.util.Map" resultMap="MerchantDiscountVoResultMap">
<select id="getMerchantByCode" parameterType="java.util.Map" resultMap="MerchantVoResultMap">
select
<include refid="allMerchantDiscountVoColumns"/>
<include refid="allMerchantVoColumns"/>
FROM wx_merchant m
left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0
left join wx_shop s on ms.shop_id = s.id
@@ -136,5 +136,43 @@
</where>
</select>

<select id="findListCVo" parameterType="com.iformall.domain.vo.WxMerchantVo" resultMap="MerchantVoResultMap">
select
<include refid="allMerchantVoColumns"/>
FROM wx_merchant m
left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0
left join wx_shop s on ms.shop_id = s.id
left join wx_mall_building mb on s.building = mb.id
left join wx_mall_floor mf on s.floor = mf.id
where 1 = 1
<if test=" null != merchantName and ''!=merchantName ">
and m.`name` like concat('%', #{merchantName},'%')
</if>

<if test=" null != merchantLinkPhone and ''!=merchantLinkPhone ">
and m.`link_phone` like concat('%', #{merchantLinkPhone},'%')
</if>

<if test=" null != businessId ">
and m.`business_id` = #{businessId}
</if>

<if test=" null != merchantStatus ">
and m.`status` = #{merchantStatus}
</if>

<if test=" null != shopNumber and ''!=shopNumber ">
and s.`shop_number` like concat('%', #{shopNumber},'%')
</if>

<if test=" null != buildingName and ''!=buildingName ">
and mb.`building_name` like concat('%', #{buildingName},'%')
</if>

<if test=" null != floorName and ''!=floorName ">
and mf.`floor_name` like concat('%', #{floorName},'%')
</if>

</select>

</mapper>

Загрузка…
Отмена
Сохранить