| @@ -7,6 +7,7 @@ import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| import lombok.ToString; | import lombok.ToString; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | |||||
| @TableName(value = "wx_press_batch") | @TableName(value = "wx_press_batch") | ||||
| @Data | @Data | ||||
| @@ -17,7 +18,8 @@ public class WxPressBatch extends TenantEntity { | |||||
| private static final long serialVersionUID = 6722507735075416305L; | private static final long serialVersionUID = 6722507735075416305L; | ||||
| protected Long id; | protected Long id; | ||||
| @TableField(exist = false) | |||||
| private List<Long> ids; | |||||
| @io.swagger.annotations.ApiModelProperty(value="批次名称",name="name") | @io.swagger.annotations.ApiModelProperty(value="批次名称",name="name") | ||||
| private String name; | private String name; | ||||
| @io.swagger.annotations.ApiModelProperty(value="EnumPressBatchStatus",name="status") | @io.swagger.annotations.ApiModelProperty(value="EnumPressBatchStatus",name="status") | ||||
| @@ -37,6 +39,8 @@ public class WxPressBatch extends TenantEntity { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private String couponIds; | private String couponIds; | ||||
| @TableField(exist = false) | |||||
| private String couponName; | |||||
| @@ -10,6 +10,8 @@ import org.apache.ibatis.annotations.Param; | |||||
| public interface WxPressBatchItemMapper extends CommonMapper<WxPressBatchItem, Long> { | public interface WxPressBatchItemMapper extends CommonMapper<WxPressBatchItem, Long> { | ||||
| List<WxPressBatchItem> findList(WxPressBatchItem record); | List<WxPressBatchItem> findList(WxPressBatchItem record); | ||||
| List<Long> getBatchIdList(@Param("couponIds")List<Long> couponIds,@Param("tenantId")String tenantId,@Param("pressBatchStatus")Integer pressBatchStatus); | |||||
| WxPressBatchItem getById(@Param("id")Long id,@Param("tenantId")String tenantId); | WxPressBatchItem getById(@Param("id")Long id,@Param("tenantId")String tenantId); | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.service.impl; | package com.iformall.service.impl; | ||||
| import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; | |||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| @@ -34,6 +35,8 @@ public class WxPressBatchServiceImpl implements WxPressBatchService { | |||||
| WxOrderPressMapper wxOrderPressMapper; | WxOrderPressMapper wxOrderPressMapper; | ||||
| @Autowired | @Autowired | ||||
| WxOrderMapper wxOrderMapper; | WxOrderMapper wxOrderMapper; | ||||
| @Autowired | |||||
| WxCouponMapper wxCouponMapper; | |||||
| @Override | @Override | ||||
| @@ -43,6 +46,23 @@ public class WxPressBatchServiceImpl implements WxPressBatchService { | |||||
| @Override | @Override | ||||
| public PageInfo<WxPressBatch> listAsPage(WxPressBatch record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxPressBatch> listAsPage(WxPressBatch record, Integer pageIndex, Integer pageSize) { | ||||
| if (!StringUtils.isBlank(record.getCouponName())) { | |||||
| WxCoupon cq = new WxCoupon(); | |||||
| cq.updateTenantInfo(record); | |||||
| cq.setTitle(StringUtils.trimToNull(record.getCouponName())); | |||||
| List<Long> cids = wxCouponMapper.findIdList(cq); | |||||
| if (null == cids || cids.size() <= 0 ) { | |||||
| record.setId(0L); | |||||
| }else { | |||||
| List<Long> ids = wxPressBatchItemMapper.getBatchIdList(cids, record.getTenantId(), record.getStatus()); | |||||
| if (null == ids || ids.size() <= 0) { | |||||
| record.setId(0L); | |||||
| }else { | |||||
| record.setIds(ids); | |||||
| } | |||||
| } | |||||
| } | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxPressBatchMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxPressBatchMapper.findList(record)); | ||||
| } | } | ||||
| @@ -56,6 +56,19 @@ | |||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | <if test=" null != sortColumns">order by ${sortColumns}</if> | ||||
| </select> | </select> | ||||
| <select id="getBatchIdList" parameterType="java.util.HashMap" resultType="Long"> | |||||
| select distinct press_batch_id from wx_press_batch_item where `tenant_id` = #{tenantId} | |||||
| <if test=" null != pressBatchStatus"> | |||||
| and `press_batch_status` = #{pressBatchStatus} | |||||
| </if> | |||||
| <if test=" null != couponIds "> | |||||
| and `coupon_id` in | |||||
| <foreach collection="couponIds" index="index" item="cIdItem" open="(" separator="," close=")"> | |||||
| #{cIdItem} | |||||
| </foreach> | |||||
| </if> | |||||
| </select> | |||||
| <select id="getById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | <select id="getById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | ||||
| select | select | ||||