fuliqi
2024-12-09 40ab33e2f20233d1d30571247c33465ad9afc534
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
<?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.ycl.platform.mapper.ImageResourceSecurityMapper">
 
    <resultMap type="com.ycl.platform.domain.entity.ImageResourceSecurity" id="ImageResourceSecurityResult">
        <result property="id" column="id"/>
        <result property="deptId" column="dept_id"/>
        <result property="platformOnline" column="platform_online"/>
        <result property="propertyAccuracy" column="property_accuracy"/>
        <result property="weakPassword" column="weak_password"/>
        <result property="riskProperty" column="risk_property"/>
        <result property="boundaryIntegrity" column="boundary_integrity"/>
        <result property="createTime" column="create_time"/>
    </resultMap>
 
    <sql id="selectImageResourceSecurityVo">
        SELECT id,
               dept_id,
               platform_online,
               property_accuracy,
               weak_password,
               risk_property,
               boundary_integrity,
               create_time
        FROM t_image_resource_security
    </sql>
 
    <select id="selectImageResourceSecurityList" resultType="com.ycl.platform.domain.entity.ImageResourceSecurity">
        select id, a.dept_id, area AS deptName, platform_online, property_accuracy, weak_password, risk_property, boundary_integrity from t_image_resource_security a
        LEFT JOIN sys_dept b ON a.dept_id = b.dept_id AND b.del_flag = 0
        <where>
            <if test="platformOnline != null ">and platform_online = #{platformOnline}</if>
            <if test="propertyAccuracy != null ">and property_accuracy = #{propertyAccuracy}</if>
            <if test="weakPassword != null ">and weak_password = #{weakPassword}</if>
            <if test="riskProperty != null ">and risk_property = #{riskProperty}</if>
            <if test="boundaryIntegrity != null ">and boundary_integrity = #{boundaryIntegrity}</if>
        </where>
        ORDER BY a.create_time DESC
        limit 7
    </select>
 
    <select id="selectImageResourceSecurityById" resultMap="ImageResourceSecurityResult">
        <include refid="selectImageResourceSecurityVo"/>
        where id = #{id}
    </select>
 
    <insert id="insertImageResourceSecurity" useGeneratedKeys="true" keyProperty="id">
        insert into t_image_resource_security
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="deptId != null">dept_id,</if>
            <if test="platformOnline != null">platform_online,</if>
            <if test="propertyAccuracy != null">property_accuracy,</if>
            <if test="weakPassword != null">weak_password,</if>
            <if test="riskProperty != null">risk_property,</if>
            <if test="boundaryIntegrity != null">boundary_integrity,</if>
            <if test="createTime != null">create_time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="deptId != null">#{deptId},</if>
            <if test="platformOnline != null">#{platformOnline},</if>
            <if test="propertyAccuracy != null">#{propertyAccuracy},</if>
            <if test="weakPassword != null">#{weakPassword},</if>
            <if test="riskProperty != null">#{riskProperty},</if>
            <if test="boundaryIntegrity != null">#{boundaryIntegrity},</if>
            <if test="createTime != null">#{createTime},</if>
        </trim>
    </insert>
 
    <insert id="saveBatch">
        insert into t_image_resource_security (dept_id, platform_online, property_accuracy, weak_password, risk_property, boundary_integrity, create_time) VALUES
        <foreach collection="list" item="item" separator=",">
            (#{item.deptId}, #{item.platformOnline}, #{item.propertyAccuracy}, #{item.weakPassword}, #{item.riskProperty}, #{item.boundaryIntegrity}, #{item.createTime})
        </foreach>
    </insert>
 
    <update id="updateImageResourceSecurity">
        update t_image_resource_security
        <trim prefix="SET" suffixOverrides=",">
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="platformOnline != null">platform_online = #{platformOnline},</if>
            <if test="propertyAccuracy != null">property_accuracy = #{propertyAccuracy},</if>
            <if test="weakPassword != null">weak_password = #{weakPassword},</if>
            <if test="riskProperty != null">risk_property = #{riskProperty},</if>
            <if test="boundaryIntegrity != null">boundary_integrity = #{boundaryIntegrity},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteImageResourceSecurityById">
        DELETE
        FROM t_image_resource_security
        WHERE id = #{id}
    </delete>
 
    <delete id="deleteImageResourceSecurityByIds">
        delete from t_image_resource_security where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <select id="getLatest" resultType="com.ycl.platform.domain.entity.ImageResourceSecurity">
        select * from t_image_resource_security
        where dept_id = #{deptId}
        and date_format(create_time,'%Y-%m')  = date_format(#{date}, '%Y-%m')
        order by create_time desc
        limit 1
    </select>
</mapper>