mitao
2025-01-17 afa0dbb4f54e7244835dd67ec33c3e545f122f71
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?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.ruoyi.system.mapper.config.PopMapper">
 
    <resultMap type="Pop" id="PopResult">
        <result property="popId"    column="pop_id"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="popSort"    column="pop_sort"    />
        <result property="popUrl"    column="pop_url"    />
        <result property="showStartTime"    column="show_start_time"    />
        <result property="showEndTime"    column="show_end_time"    />
        <result property="targetType"    column="target_type"    />
        <result property="linkUrl"    column="link_url"    />
        <result property="jumpId"    column="jump_id"    />
        <result property="createTime"    column="create_time"    />
        <result property="createUserId"    column="create_user_id"    />
    </resultMap>
 
    <sql id="selectPopVo">
        select pop_id, del_flag, pop_sort, pop_url, show_start_time, show_end_time, target_type, link_url, jump_id, create_time, create_user_id from t_pop
    </sql>
 
    <select id="selectPopList" parameterType="Pop" resultMap="PopResult">
        <include refid="selectPopVo"/>
        <where>
            <if test="popSort != null "> and pop_sort = #{popSort}</if>
            <if test="popUrl != null  and popUrl != ''"> and pop_url = #{popUrl}</if>
            <if test="showStartTime != null "> and show_start_time = #{showStartTime}</if>
            <if test="showEndTime != null "> and show_end_time = #{showEndTime}</if>
            <if test="targetType != null "> and target_type = #{targetType}</if>
            <if test="linkUrl != null  and linkUrl != ''"> and link_url = #{linkUrl}</if>
            <if test="jumpId != null  and jumpId != ''"> and jump_id = #{jumpId}</if>
            <if test="createUserId != null "> and create_user_id = #{createUserId}</if>
        </where>
    </select>
 
    <select id="selectPopByPopId" parameterType="Long" resultMap="PopResult">
        <include refid="selectPopVo"/>
        where pop_id = #{popId}
    </select>
 
    <insert id="insertPop" parameterType="Pop" useGeneratedKeys="true" keyProperty="popId">
        insert into t_pop
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">del_flag,</if>
            <if test="popSort != null">pop_sort,</if>
            <if test="popUrl != null">pop_url,</if>
            <if test="showStartTime != null">show_start_time,</if>
            <if test="showEndTime != null">show_end_time,</if>
            <if test="targetType != null">target_type,</if>
            <if test="linkUrl != null">link_url,</if>
            <if test="jumpId != null">jump_id,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createUserId != null">create_user_id,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">#{delFlag},</if>
            <if test="popSort != null">#{popSort},</if>
            <if test="popUrl != null">#{popUrl},</if>
            <if test="showStartTime != null">#{showStartTime},</if>
            <if test="showEndTime != null">#{showEndTime},</if>
            <if test="targetType != null">#{targetType},</if>
            <if test="linkUrl != null">#{linkUrl},</if>
            <if test="jumpId != null">#{jumpId},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createUserId != null">#{createUserId},</if>
        </trim>
    </insert>
 
    <update id="updatePop" parameterType="Pop">
        update t_pop
        <trim prefix="SET" suffixOverrides=",">
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="popSort != null">pop_sort = #{popSort},</if>
            <if test="popUrl != null">pop_url = #{popUrl},</if>
            <if test="showStartTime != null">show_start_time = #{showStartTime},</if>
            <if test="showEndTime != null">show_end_time = #{showEndTime},</if>
            <if test="targetType != null">target_type = #{targetType},</if>
            <if test="linkUrl != null">link_url = #{linkUrl},</if>
            <if test="jumpId != null">jump_id = #{jumpId},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createUserId != null">create_user_id = #{createUserId},</if>
        </trim>
        where pop_id = #{popId}
    </update>
 
    <delete id="deletePopByPopId" parameterType="Long">
        delete from t_pop where pop_id = #{popId}
    </delete>
 
    <delete id="deletePopByPopIds" parameterType="String">
        delete from t_pop where pop_id in
        <foreach item="popId" collection="array" open="(" separator="," close=")">
            #{popId}
        </foreach>
    </delete>
 
    <select id="pageMgtPop" resultType="com.ruoyi.system.domain.vo.MgtPopPageVo">
        SELECT
            pop_id popId,
            pop_url popUrl,
            CASE target_type
                WHEN 1 THEN "外链"
                WHEN 2 THEN "内链"
                ELSE "无"
                END targetType,
            show_start_time showStartTime,
            show_end_time showEndTime,
            create_time createTime
        FROM t_pop
        WHERE del_flag = 0
        ORDER BY create_time DESC
    </select>
 
    <select id="getAppPop" resultType="com.ruoyi.system.domain.vo.AppPopVo">
        SELECT
        pop_id popId,
        pop_url popUrl,
        link_type linkType,
        target_type targetType,
        link_url linkUrl,
        jump_type jumpType,
        jump_id jumpId
        FROM t_pop
        WHERE del_flag = 0 AND CURDATE() BETWEEN show_start_time AND show_end_time
        ORDER BY pop_sort,create_time DESC LIMIT 1
    </select>
</mapper>