Authored by csgyoho

优惠券查询优化

... ... @@ -227,8 +227,8 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
LOGGER.info("checkUpdateCouponParam failed! coupon is null.id is {}",req.getId());
return false;
}
if(coupon.getStatus() != Coupon.CouponStatusEnum.WAITE_CHECK.getValue()){
LOGGER.info("checkUpdateCouponParam failed! coupon is using! status is {}",coupon.getStatus());
if(coupon.getSendNum()>0){
LOGGER.info("checkUpdateCouponParam failed! coupon is using! sendNum is {}",coupon.getSendNum());
return false;
}
return true;
... ... @@ -243,7 +243,7 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
String useTime = com.yoho.ufo.util.DateUtil.int2DateStr(coupon.getStartTime(),"yyyy-MM-dd HH:mm:ss")+"至"+
com.yoho.ufo.util.DateUtil.int2DateStr(coupon.getEndTime(),"yyyy-MM-dd HH:mm:ss");
CouponQueryResp resp = new CouponQueryResp(coupon.getId(),coupon.getCouponName(),coupon.getCouponNum(),
useTime,coupon.getRemark(), getStatusDesc(coupon),coupon.getStatus());
useTime,coupon.getRemark(), getStatusDesc(coupon),coupon.getStatus(),coupon.getCouponToken());
resps.add(resp);
}
return resps;
... ...
... ... @@ -19,6 +19,10 @@ public class CouponQueryResp {
)
private String name;
@BatchExportField(
name = "TOKEN"
)
private String token;
@BatchExportField(
name = "数量"
)
private Integer couponNum;
... ... @@ -35,7 +39,7 @@ public class CouponQueryResp {
)
private String status;
private Integer statusValue;
public CouponQueryResp(Integer id, String name, Integer couponNum, String useTime, String remark, String status, Integer statusValue) {
public CouponQueryResp(Integer id, String name, Integer couponNum, String useTime, String remark, String status, Integer statusValue,String token) {
this.id = id;
this.name = name;
this.couponNum = couponNum;
... ... @@ -43,6 +47,7 @@ public class CouponQueryResp {
this.remark = remark;
this.status = status;
this.statusValue = statusValue;
this.token = token;
}
public CouponQueryResp() {
... ...
... ... @@ -148,15 +148,35 @@
<if test="param.name != null">
and coupon_name=#{param.name}
</if>
<if test="param.status != null">
and status=#{param.status}
</if>
<if test="param.startTime != null">
and start_time>=#{param.startTime}
</if>
<if test="param.endTime != null">
and end_time <![CDATA[<= ]]> #{param.endTime}
</if>
<if test="param.status != null">
<if test="param.status == 3">
<!--已作废-->
and status=#{param.status}
</if>
<if test="param.status == 2">
<!--已过期-->
and end_time <![CDATA[< ]]> #{param.curTime}
and status != 3
</if>
<if test="param.status == 1">
<!--生效中-->
and start_time <![CDATA[<= ]]> #{param.curTime}
and end_time >= #{param.curTime}
and status != 3
</if>
<if test="param.status == 0">
<!--未生效-->
and start_time > #{param.curTime}
and status != 3
</if>
</if>
</select>
<select id="selectByCondition" resultType="com.yoho.ufo.model.coupon.Coupon">
select <include refid="Base_Column_List" /> from coupon where 1=1
... ... @@ -166,15 +186,34 @@
<if test="param.name != null">
and coupon_name=#{param.name}
</if>
<if test="param.status != null">
and status=#{param.status}
</if>
<if test="param.startTime != null">
and start_time>=#{param.startTime}
</if>
<if test="param.endTime != null">
and end_time <![CDATA[<= ]]> #{param.endTime}
</if>
<if test="param.status != null">
<if test="param.status == 3">
<!--已作废-->
and status=#{param.status}
</if>
<if test="param.status == 2">
<!--已过期-->
and end_time <![CDATA[< ]]> #{param.curTime}
and status != 3
</if>
<if test="param.status == 1">
<!--生效中-->
and start_time <![CDATA[<= ]]> #{param.curTime}
and end_time >= #{param.curTime}
and status != 3
</if>
<if test="param.status == 0">
<!--未生效-->
and start_time > #{param.curTime}
and status != 3
</if>
</if>
order by id desc
<if test="param.size > 0">
limit #{param.start},#{param.size}
... ...