|
|
@@ -301,10 +301,14 @@
|
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
|
</update>
|
|
|
<select id="selectVoucherDetailList" resultType="com.goafanti.voucher.bo.JtVoucherDetailListBo">
|
|
|
- select b.id,a.name,a.money,b.receive_time as receiveTime, a.duration_day as durationDay,
|
|
|
- a.source,b.status,b.use_time as useTime,c.mobile as userMobile
|
|
|
- from jt_voucher a
|
|
|
- left join jt_voucher_detail b on a.id=b.voucher_id
|
|
|
+ select
|
|
|
+ b.id, a.name, a.money, b.receive_time as receiveTime, a.duration_day as durationDay,
|
|
|
+ IF(date_add(b.receive_time, interval a.duration_day day) < now(),2,b.status) as status,
|
|
|
+ a.source, b.use_time as useTime, c.mobile as userMobile,
|
|
|
+ date_format(b.receive_time,'%Y-%m-%d %H:%I:%S')as starTime,
|
|
|
+ date_format(date_add(b.receive_time, interval a.duration_day day),'%Y-%m-%d %H:%I:%S')as endTime
|
|
|
+ from jt_voucher_detail b
|
|
|
+ left join jt_voucher a on a.id=b.voucher_id
|
|
|
left join user c on b.use_uid=c.id
|
|
|
where 1=1
|
|
|
<if test="uid != null">
|
|
|
@@ -314,7 +318,7 @@
|
|
|
and a.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
|
|
|
</if>
|
|
|
<if test="status != null">
|
|
|
- and b.status = #{status,jdbcType=INTEGER}
|
|
|
+ and IF(date_add(b.receive_time, interval a.duration_day day) < now(),2,b.status) = #{status,jdbcType=INTEGER}
|
|
|
</if>
|
|
|
<if test="userMobile != null">
|
|
|
and c.mobile = #{userMobile,jdbcType=VARCHAR}
|
|
|
@@ -329,6 +333,9 @@
|
|
|
<if test="sort == 1">
|
|
|
order by b.receive_time
|
|
|
</if>
|
|
|
+ <if test="sort == 2">
|
|
|
+ order by endTime
|
|
|
+ </if>
|
|
|
<if test="sortType != null">
|
|
|
desc
|
|
|
</if>
|
|
|
@@ -338,9 +345,9 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="selectVoucherDetailCount" resultType="java.lang.Integer">
|
|
|
- select count(*) from jt_voucher a
|
|
|
- left join jt_voucher_detail b on a.id=b.voucher_id
|
|
|
- left join user c on b.use_uid=c.id
|
|
|
+ select count(*) from jt_voucher_detail b
|
|
|
+ left join jt_voucher a on a.id=b.voucher_id
|
|
|
+ left join user c on b.use_uid=c.id
|
|
|
where 1=1
|
|
|
<if test="uid != null">
|
|
|
and b.use_uid = #{uid,jdbcType=VARCHAR}
|
|
|
@@ -349,7 +356,7 @@
|
|
|
and a.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
|
|
|
</if>
|
|
|
<if test="status != null">
|
|
|
- and b.status = #{status,jdbcType=INTEGER}
|
|
|
+ and IF(date_add(b.receive_time, interval a.duration_day day) < now(),2,b.status) = #{status,jdbcType=INTEGER}
|
|
|
</if>
|
|
|
<if test="userMobile != null">
|
|
|
and c.mobile = #{userMobile,jdbcType=VARCHAR}
|