| @@ -7,6 +7,7 @@ import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | |||||
| @TableName(value = "wx_card_daily_log") | @TableName(value = "wx_card_daily_log") | ||||
| @Data | @Data | ||||
| @@ -47,4 +48,8 @@ public class WxCardDailyLog extends TenantEntity { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private String title; | private String title; | ||||
| private List<Long> couponIds; | |||||
| private Date startTime; | |||||
| private Date endTime; | |||||
| } | } | ||||
| @@ -310,5 +310,5 @@ public interface WxCouponService { | |||||
| void delManyCouponMerchants(TenantEntity tenantInfo, List<Long> couponIds, List<Long> merchantIds); | void delManyCouponMerchants(TenantEntity tenantInfo, List<Long> couponIds, List<Long> merchantIds); | ||||
| List<WxCoupon> getByIdList(List<Long> collect, String tenantId); | |||||
| List<WxCoupon> getByIdListOrTitle(List<Long> couponIds, String tenantId, String title); | |||||
| } | } | ||||
| @@ -7,6 +7,7 @@ import com.iformall.domain.po.*; | |||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import org.apache.commons.collections.CollectionUtils; | import org.apache.commons.collections.CollectionUtils; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -29,12 +30,20 @@ public class WxCardDailyLogServiceImpl implements WxCardDailyLogService { | |||||
| @Override | @Override | ||||
| public PageInfo<WxCardDailyLog> listAsPage(WxCardDailyLog record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxCardDailyLog> listAsPage(WxCardDailyLog record, Integer pageIndex, Integer pageSize) { | ||||
| if (StringUtils.isNotBlank(record.getTitle())){ | |||||
| List<WxCoupon> title = wxCouponService.getByIdListOrTitle(new ArrayList<>(), record.getTenantId(), record.getTitle()); | |||||
| if (!CollectionUtils.isEmpty(title)){ | |||||
| List<Long> couponIds = title.parallelStream().map(WxCoupon::getId).collect(Collectors.toList()); | |||||
| record.setCouponIds(couponIds); | |||||
| } | |||||
| } | |||||
| PageInfo<WxCardDailyLog> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardDailyLogMapper.findList(record)); | PageInfo<WxCardDailyLog> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardDailyLogMapper.findList(record)); | ||||
| if (CollectionUtils.isEmpty(pageInfo.getList())){ | if (CollectionUtils.isEmpty(pageInfo.getList())){ | ||||
| return pageInfo; | return pageInfo; | ||||
| } | } | ||||
| List<Long> couponIds = pageInfo.getList().parallelStream().map(WxCardDailyLog::getCouponId).collect(Collectors.toList()); | List<Long> couponIds = pageInfo.getList().parallelStream().map(WxCardDailyLog::getCouponId).collect(Collectors.toList()); | ||||
| List<WxCoupon> list = wxCouponService.getByIdList(couponIds, record.getTenantId()); | |||||
| List<WxCoupon> list = wxCouponService.getByIdListOrTitle(couponIds, record.getTenantId(), null); | |||||
| if (CollectionUtils.isEmpty(list)){ | if (CollectionUtils.isEmpty(list)){ | ||||
| return pageInfo; | return pageInfo; | ||||
| } | } | ||||
| @@ -2106,10 +2106,11 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public List<WxCoupon> getByIdList(List<Long> couponIds, String tenantId) { | |||||
| public List<WxCoupon> getByIdListOrTitle(List<Long> couponIds, String tenantId, String title) { | |||||
| return wxCouponMapper.selectList(new LambdaQueryWrapper<WxCoupon>() | return wxCouponMapper.selectList(new LambdaQueryWrapper<WxCoupon>() | ||||
| .eq(WxCoupon::getIsDel, 0) | .eq(WxCoupon::getIsDel, 0) | ||||
| .in(WxCoupon::getId, couponIds) | |||||
| .in(CollectionUtils.isNotEmpty(couponIds), WxCoupon::getId, couponIds) | |||||
| .like(StringUtils.isNotBlank(title), WxCoupon::getTitle, title) | |||||
| .eq(TenantEntity::getTenantId, tenantId)); | .eq(TenantEntity::getTenantId, tenantId)); | ||||
| } | } | ||||
| @@ -54,12 +54,24 @@ | |||||
| <if test=" null != operatorUser and '' != operatorUser"> | <if test=" null != operatorUser and '' != operatorUser"> | ||||
| and `operator_user` like concat('%', #{operatorUser},'%') | and `operator_user` like concat('%', #{operatorUser},'%') | ||||
| </if> | </if> | ||||
| <if test=" null != startTime "> | |||||
| and `create_date` >= #{startTime} | |||||
| </if> | |||||
| <if test=" null != endTime "> | |||||
| and `create_date` <= #{endTime} | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| #{idItem} | #{idItem} | ||||
| </foreach> | </foreach> | ||||
| </if> | </if> | ||||
| <if test=" null != couponIds "> | |||||
| and coupon_id in | |||||
| <foreach collection="couponIds" 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> | ||||