Authored by 匡佳华

优惠券发放记录分页查询sql优化

... ... @@ -58,6 +58,7 @@ public class BatchService {
static {
// 基础商品导出限制两万
EXPORT_NUM_LIMIT_MAP.put("baseProduce", 20000);
EXPORT_NUM_LIMIT_MAP.put("couponServiceImpl", 100000);
}
@Value("${file.saveDir}")
... ...
... ... @@ -21,23 +21,28 @@
</sql>
<select id="selectByCondition" resultType="com.yoho.ufo.model.coupon.UserCoupon">
select <include refid="Base_Column_List"/> from user_coupon
where 1=1
<if test="param.couponId != null">
and coupon_Id=#{param.couponId}
</if>
<if test="param.couponCode != null">
and coupon_code=#{param.couponCode}
</if>
<if test="param.uid != null">
and uid=#{param.uid}
</if>
<if test="param.status != null">
and status=#{param.status}
</if>
order by id desc
<if test="param.size > 0">
limit #{param.start},#{param.size}
</if>
inner join (
select id from user_coupon
<where>
<if test="param.couponId != null">
and coupon_Id=#{param.couponId}
</if>
<if test="param.couponCode != null">
and coupon_code=#{param.couponCode}
</if>
<if test="param.uid != null">
and uid=#{param.uid}
</if>
<if test="param.status != null">
and status=#{param.status}
</if>
</where>
order by id desc
<if test="param.size > 0">
limit #{param.start},#{param.size}
</if>
)
a using(id)
</select>
<select id="selectTotalByCondition" resultType="java.lang.Integer">
select count(1) from user_coupon
... ...