无关风月
2025-05-08 9486766c806fe1d9e082b2fd02ea1cc558f1b443
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?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.dsh.activity.mapper.IntroduceRewardsMapper">
 
 
    <update id="changeState">
        update t_introduce_rewards set
        state = #{state}
        <where>
            <if test="ids != null and ids.size()>0">
                AND t_introduce_rewards.id IN
                <foreach collection="ids" separator="," item="id" open="(" close=")">
                    #{id}
                </foreach>
            </if>
        </where>
    </update>
    <select id="listAll" resultType="com.dsh.activity.model.IntroduceVO">
        select t1.id,CONCAT(t1.province,t1.city) as provinceAndCity,t1.startTime,t1.endTime,
        t1.giveClass,t1.state,t1.insertTime from t_introduce_rewards t1
        <where>
            <if test="query.city!=null and query.city!= ''">
                and t1.cityCode = #{query.city}
            </if>
            <if test="query.province!=null and query.province!= ''">
                and t1.provinceCode = #{query.province}
            </if>
            <if test="query.activityState!=null and query.activityState!= ''">
                AND t1.state = #{query.activityState}
            </if>
            <if test="sTime !=null and sTime!= '' and eTime !=null and eTime!= ''">
                and t1.startTime between #{sTime} and #{eTime}
            </if>
            <if test="sTime !=null and sTime!= '' and eTime !=null and eTime!= ''">
                and t1.endTime between #{sTime} and #{eTime}
            </if>
            <choose>
                <when test="query.state == 1">
                    and NOW() between t1.startTime and t1.endTime
                </when>
                <when test="query.state == 2">
                    and t1.endTime &lt;= NOW()
                </when>
                <when test="query.state == 3">
                    and t1.startTime &gt;= NOW()
                </when>
            </choose>
        </where>
    </select>
</mapper>