<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.stylefeng.guns.modular.system.dao.TDriverPromotionActivityMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.TDriverPromotionActivity">
|
<id column="id" property="id" />
|
<result column="bizType" property="bizType" />
|
<result column="activityTitle" property="activityTitle" />
|
<result column="province" property="province" />
|
<result column="provinceCode" property="provinceCode" />
|
<result column="city" property="city" />
|
<result column="cityCode" property="cityCode" />
|
<result column="district" property="district" />
|
<result column="districtCode" property="districtCode" />
|
<result column="startTime" property="startTime" />
|
<result column="endTime" property="endTime" />
|
<result column="commissionRatio" property="commissionRatio" />
|
<result column="bindingDays" property="bindingDays" />
|
<result column="activityDesc" property="activityDesc" />
|
<result column="status" property="status" />
|
<result column="creator" property="creator" />
|
<result column="createTime" property="createTime" />
|
<result column="updateTime" property="updateTime" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, bizType, activityTitle, province, provinceCode, city, cityCode, district, districtCode, startTime, endTime, commissionRatio, bindingDays, activityDesc, creator, createTime, updateTime,
|
</sql>
|
|
<select id="list" resultType="java.util.Map">
|
select * from (
|
select <include refid="Base_Column_List"/>
|
case
|
when now()>endTime then 4
|
when startTime>now() then 3
|
when now()>startTime and endTime >now() and state =1 then 1
|
when now()>startTime and endTime >now() and state =2 then 2
|
else 0
|
end as status
|
from t_driver_promotion_activity
|
where remove=0
|
<if test="beginTime != null and endTime != null">
|
and createTime between #{beginTime} and #{endTime}
|
</if>
|
|
<if test="name != null">
|
and activityTitle like concat('%',#{name},'%')
|
</if>
|
) t1 where 1=1
|
<if test="status!= null">
|
and t1.status =#{status}
|
</if>
|
order by t1.createTime desc
|
|
|
</select>
|
|
</mapper>
|