wanglizhong
2025-05-03 de26c331fc9febdc11b85ff98ad657fb12cc2b73
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
<?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.SysClientAppMapper">
    
    <resultMap type="SysClientApp" id="SysClientAppResult">
        <result property="appId"    column="app_id"    />
        <result property="clientName"    column="client_name"    />
        <result property="appKey"    column="app_key"    />
        <result property="securityKey"    column="security_key"    />
        <result property="validStartTime"    column="valid_start_time"    />
        <result property="validEndTime"    column="valid_end_time"    />
        <result property="status"    column="status"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
        <result property="minAppId"    column="min_app_id"    />
    </resultMap>
 
    <sql id="selectSysClientAppVo">
        select app_id, client_name, app_key, security_key, valid_start_time, valid_end_time, status, del_flag, create_by, create_time, update_by, update_time, remark, min_app_id from sys_client_app
    </sql>
 
    <select id="selectSysClientAppList" parameterType="SysClientApp" resultMap="SysClientAppResult">
        <include refid="selectSysClientAppVo"/>
        <where>  
            <if test="clientName != null  and clientName != ''"> and client_name like concat('%', #{clientName}, '%')</if>
            <if test="appKey != null  and appKey != ''"> and app_key = #{appKey}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="validStartTime != null "> and valid_start_time &gt;= #{validStartTime}</if>
            <if test="validEndTime != null "> and valid_end_time &lt;= #{validEndTime}</if>
        </where>
    </select>
    
    <select id="selectSysClientAppByAppId" parameterType="Long" resultMap="SysClientAppResult">
        <include refid="selectSysClientAppVo"/>
        where app_id = #{appId}
    </select>
        
    <select id="selectSysClientAppByAppKey" parameterType="String" resultMap="SysClientAppResult">
        <include refid="selectSysClientAppVo"/>
        where app_key = #{appKey} and del_flag = '0'
    </select>
        
    <insert id="insertSysClientApp" parameterType="SysClientApp" useGeneratedKeys="true" keyProperty="appId">
        insert into sys_client_app
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="clientName != null">client_name,</if>
            <if test="appKey != null">app_key,</if>
            <if test="securityKey != null">security_key,</if>
            <if test="validStartTime != null">valid_start_time,</if>
            <if test="validEndTime != null">valid_end_time,</if>
            <if test="status != null">status,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
            <if test="minAppId != null">min_app_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="clientName != null">#{clientName},</if>
            <if test="appKey != null">#{appKey},</if>
            <if test="securityKey != null">#{securityKey},</if>
            <if test="validStartTime != null">#{validStartTime},</if>
            <if test="validEndTime != null">#{validEndTime},</if>
            <if test="status != null">#{status},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
            <if test="minAppId != null">#{minAppId},</if>
         </trim>
    </insert>
 
    <update id="updateSysClientApp" parameterType="SysClientApp">
        update sys_client_app
        <set>
            <if test="clientName != null and clientName != ''">client_name = #{clientName},</if>
            <if test="appKey != null and appKey != ''">app_key = #{appKey},</if>
            <if test="securityKey != null and securityKey != ''">security_key = #{securityKey},</if>
            <if test="validStartTime != null">valid_start_time = #{validStartTime},</if>
            <if test="validEndTime != null">valid_end_time = #{validEndTime},</if>
            <if test="status != null and status != ''">status = #{status},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="minAppId != null">min_app_id = #{minAppId},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            update_time = sysdate()
        </set>
        where app_id = #{appId}
    </update>
 
    <delete id="deleteSysClientAppByAppId" parameterType="Long">
        delete from sys_client_app where app_id = #{appId}
    </delete>
 
    <delete id="deleteSysClientAppByAppIds" parameterType="Long">
        delete from sys_client_app where app_id in 
        <foreach item="appId" collection="array" open="(" separator="," close=")">
            #{appId}
        </foreach>
    </delete>
</mapper>