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

[A端][更改]:卡和券的列表接口分开

release_toaliyun_real
hupeng 7 лет назад
Родитель
Сommit
f718bec621
6 измененных файлов: 288 добавлений и 42 удалений
  1. +34
    -26
      mallinkAdmin/src/main/java/com/iformall/controller/WxCouponController.java
  2. +3
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/WxUserCouponController.java
  3. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java
  4. +1
    -9
      mallinkService/src/main/java/com/iformall/service/WxCouponService.java
  5. +10
    -7
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  6. +238
    -0
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml

+ 34
- 26
mallinkAdmin/src/main/java/com/iformall/controller/WxCouponController.java Просмотреть файл

@@ -9,6 +9,7 @@ import com.iformall.domain.po.WxCoupon;
import com.iformall.domain.po.WxCouponChannel; import com.iformall.domain.po.WxCouponChannel;
import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxMerchant;
import com.iformall.enums.EnumCouponStatus; import com.iformall.enums.EnumCouponStatus;
import com.iformall.enums.EnumCouponType;
import com.iformall.enums.EnumCouponValidType; import com.iformall.enums.EnumCouponValidType;
import com.iformall.enums.EnumMerchantStatus; import com.iformall.enums.EnumMerchantStatus;
import com.iformall.service.WxCouponChannelService; import com.iformall.service.WxCouponChannelService;
@@ -41,20 +42,14 @@ public class WxCouponController extends BaseController {
@Autowired @Autowired
private WxCouponChannelService wxCouponChannelService; private WxCouponChannelService wxCouponChannelService;


@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 WxCoupon wxCoupon, Integer pageNum, Integer pageSize) {
logger.debug("[" + getIpAddr() + "] WxCouponController::list");
private ResultData listType(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize, Integer type) {
if (null == wxCoupon) wxCoupon = new WxCoupon(); if (null == wxCoupon) wxCoupon = new WxCoupon();
wxCoupon.setTenantId(getTenantId()); wxCoupon.setTenantId(getTenantId());
wxCoupon.setSortColumns(WxCoupon.Field.Id_DESC); wxCoupon.setSortColumns(WxCoupon.Field.Id_DESC);
PageInfo<WxCoupon> page = null; PageInfo<WxCoupon> page = null;
if (wxCoupon.getStatus() != null && wxCoupon.getStatus() == -1) if (wxCoupon.getStatus() != null && wxCoupon.getStatus() == -1)
wxCoupon.setStatus(null); wxCoupon.setStatus(null);
page = wxCouponService.listAsPage(wxCoupon, pageNum, pageSize);
page = wxCouponService.listAsPage(wxCoupon, pageNum, pageSize, type);


List<WxCoupon> wxCouponList = page.getList(); List<WxCoupon> wxCouponList = page.getList();


@@ -93,10 +88,40 @@ public class WxCouponController extends BaseController {
} }


} }

return new ResultData(page); return new ResultData(page);
} }



@ApiOperation("分页列表接口")
@GetMapping("listCoupon")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
public ResultData listCoupon(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) {
logger.debug("[" + getIpAddr() + "] WxCouponController::listCoupon");
return listType(wxCoupon, pageNum, pageSize, 0); //券列表
}

@ApiOperation("分页列表接口")
@GetMapping("listCard")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
public ResultData listCard(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) {
logger.debug("[" + getIpAddr() + "] WxCouponController::listCard");
return listType(wxCoupon, pageNum, pageSize, EnumCouponType.CARD_MULTIMCH.getCode()); //卡列表
}

@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 WxCoupon wxCoupon, Integer pageNum, Integer pageSize) {
logger.debug("[" + getIpAddr() + "] WxCouponController::list");
return listType(wxCoupon, pageNum, pageSize, null); //全列表
}

@ApiOperation("新增接口") @ApiOperation("新增接口")
@PostMapping("add") @PostMapping("add")
public ResultData add(@RequestBody WxCoupon wxCoupon) { public ResultData add(@RequestBody WxCoupon wxCoupon) {
@@ -131,21 +156,4 @@ public class WxCouponController extends BaseController {
logger.debug("[" + getIpAddr() + "] WxCouponController::findById");; logger.debug("[" + getIpAddr() + "] WxCouponController::findById");;
return new ResultData(wxCouponService.getVoById(id)); return new ResultData(wxCouponService.getVoById(id));
} }


@ApiOperation("分页列表接口")
@GetMapping("send/list")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
public ResultData sendList(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) {
logger.debug("[" + getIpAddr() + "] WxCouponController::sendList");
if (null == wxCoupon) wxCoupon = new WxCoupon();
wxCoupon.setTenantId(getTenantId());
wxCoupon.setStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode());

return new ResultData(wxCouponService.listAsPage(wxCoupon, pageNum, pageSize));
}


} }

+ 3
- 0
mallinkAdmin/src/main/java/com/iformall/controller/WxUserCouponController.java Просмотреть файл

@@ -37,4 +37,7 @@ public class WxUserCouponController extends BaseController {
return new ResultData(Result.SUCCESS,"查询成功",wxUserCouponService.findList(wxUserCoupon.getcUserId(),wxUserCoupon.getCouponStatus())); return new ResultData(Result.SUCCESS,"查询成功",wxUserCouponService.findList(wxUserCoupon.getcUserId(),wxUserCoupon.getCouponStatus()));
} }





} }

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

@@ -10,6 +10,8 @@ import com.iformall.domain.po.WxCoupon;
public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> {


List<WxCoupon> findList(WxCoupon wxCoupon); List<WxCoupon> findList(WxCoupon wxCoupon);
List<WxCoupon> findCardList(WxCoupon wxCoupon);
List<WxCoupon> findCouponList(WxCoupon wxCoupon);


WxCouponCVo findVoDetail(@Param("id")Long id); WxCouponCVo findVoDetail(@Param("id")Long id);




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

@@ -17,15 +17,7 @@ public interface WxCouponService {
* @param pageSize * @param pageSize
* @return * @return
*/ */
PageInfo<WxCoupon> listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize);


/**
* 不分页
* @param record
* @return
*/
List<WxCoupon> findList(WxCoupon record);
PageInfo<WxCoupon> listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize, Integer type);
/** /**
* 根据Id获得实体 * 根据Id获得实体


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

@@ -48,13 +48,16 @@ public class WxCouponServiceImpl implements WxCouponService {




@Override @Override
public PageInfo<WxCoupon> listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findList(record));
}

@Override
public List<WxCoupon> findList(WxCoupon record) {
return wxCouponMapper.findList(record);
public PageInfo<WxCoupon> listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize, Integer type) {
if (type == null) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findList(record));
}
else if (type.equals(EnumCouponType.COUPON_MULTIMCH)) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findCardList(record));
}
else {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findCouponList(record));
}
} }


@Override @Override


+ 238
- 0
mallinkService/src/main/resources/mapper/WxCouponMapper.xml Просмотреть файл

@@ -152,6 +152,244 @@
<include refid="dynamicWhereConditions"/> <include refid="dynamicWhereConditions"/>
</select> </select>


<sql id="dynamicWhereConditionsForCard">
where `type` = 7

<if test=" null != id ">
and `id` = #{id}
</if>

<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != type ">
and `type` = #{type}
</if>

<if test=" null != coverImg ">
and `cover_img` like concat('%', #{coverImg},'%')
</if>

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

<if test=" null != subTitle ">
and `sub_title` like concat('%', #{subTitle},'%')
</if>

<if test=" null != salePrice ">
and `sale_price` = #{salePrice}
</if>

<if test=" null != usePrice ">
and `use_price` = #{usePrice}
</if>

<if test=" null != useLimitQuantity ">
and `use_limit_quantity` = #{useLimitQuantity}
</if>

<if test=" null != sendType ">
and `send_type` = #{sendType}
</if>

<if test=" null != validType ">
and `valid_type` = #{validType}
</if>

<if test=" null != validStartDate ">
and `valid_start_date` = #{validStartDate}
</if>

<if test=" null != validEndDate ">
and `valid_end_date` = #{validEndDate}
</if>

<if test=" null != validDays ">
and `valid_days` = #{validDays}
</if>

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

<if test=" null != price ">
and `price` = #{price}
</if>

<if test=" null != unit ">
and `unit` = #{unit}
</if>

<if test=" null != remainInventory ">
and `remain_inventory` = #{remainInventory}
</if>

<if test=" null != inventory ">
and `inventory` = #{inventory}
</if>

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

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

<if test=" null != startdate and null!=enddate">
and `create_date` between #{startdate} and #{enddate}
</if>

<if test=" null != updateDate ">
and `update_date` = #{updateDate}
</if>

<if test=" null != business ">
and `business` = #{business}
</if>

<if test=" null != supportTransfer ">
and `support_transfer` = #{supportTransfer}
</if>

<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
<if test=" null != sortColumns">order by ${sortColumns}</if>
</sql>

<select id="findCardList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_coupon
<include refid="dynamicWhereConditionsForCard"/>
</select>

<sql id="dynamicWhereConditionsForCoupon">
where `type` &lt; 7

<if test=" null != id ">
and `id` = #{id}
</if>

<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != type ">
and `type` = #{type}
</if>

<if test=" null != coverImg ">
and `cover_img` like concat('%', #{coverImg},'%')
</if>

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

<if test=" null != subTitle ">
and `sub_title` like concat('%', #{subTitle},'%')
</if>

<if test=" null != salePrice ">
and `sale_price` = #{salePrice}
</if>

<if test=" null != usePrice ">
and `use_price` = #{usePrice}
</if>

<if test=" null != useLimitQuantity ">
and `use_limit_quantity` = #{useLimitQuantity}
</if>

<if test=" null != sendType ">
and `send_type` = #{sendType}
</if>

<if test=" null != validType ">
and `valid_type` = #{validType}
</if>

<if test=" null != validStartDate ">
and `valid_start_date` = #{validStartDate}
</if>

<if test=" null != validEndDate ">
and `valid_end_date` = #{validEndDate}
</if>

<if test=" null != validDays ">
and `valid_days` = #{validDays}
</if>

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

<if test=" null != price ">
and `price` = #{price}
</if>

<if test=" null != unit ">
and `unit` = #{unit}
</if>

<if test=" null != remainInventory ">
and `remain_inventory` = #{remainInventory}
</if>

<if test=" null != inventory ">
and `inventory` = #{inventory}
</if>

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

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

<if test=" null != startdate and null!=enddate">
and `create_date` between #{startdate} and #{enddate}
</if>

<if test=" null != updateDate ">
and `update_date` = #{updateDate}
</if>

<if test=" null != business ">
and `business` = #{business}
</if>

<if test=" null != supportTransfer ">
and `support_transfer` = #{supportTransfer}
</if>

<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
<if test=" null != sortColumns">order by ${sortColumns}</if>
</sql>

<select id="findCouponList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_coupon
<include refid="dynamicWhereConditionsForCoupon"/>
</select>

<resultMap id="WxCouponCVoMap" type="com.iformall.domain.vo.WxCouponCVo"> <resultMap id="WxCouponCVoMap" type="com.iformall.domain.vo.WxCouponCVo">
<id column="id" jdbcType="BIGINT" property="id"/> <id column="id" jdbcType="BIGINT" property="id"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>


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