广州市综治平台后端
xusd
2025-06-07 36306491396230522fa20585c2621a7fc899849a
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?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">
<!--
 * @title: 案件风险检查\重点案件判断表
 * @description: 自定义sql,请自行实现业务逻辑
 * @company: hugeinfo
 * @author: huangh
 * @time:${createTime}
 * @version 1.0.0
-->
<mapper namespace="cn.huge.module.aidata.dao.mapper.AiCaseRiskMapper">
    <resultMap id="dataResult" type="cn.huge.module.aidata.domain.po.AiCaseRisk">
        <result property="aiCaseRiskId" column="ai_case_risk_id"/>
        <result property="caseId" column="case_id"/>
        <result property="source" column="source"/>
        <result property="sourceName" column="source_name"/>
        <result property="caseTextHash" column="case_text_hash"/>
        <result property="isRisk" column="is_risk"/>
        <result property="isRiskAi" column="is_risk_ai"/>
        <result property="deleteStatus" column="delete_status"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="note" column="note"/>
    </resultMap>
 
    <sql id='table-name'>ai.ai_case_risk</sql>
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.huge.module.aidata.domain.po.AiCaseRisk">
        <id column="ai_case_risk_id" property="aiCaseRiskId"/>
        <result column="case_id" property="caseId"/>
        <result column="source" property="source"/>
        <result column="source_name" property="sourceName"/>
        <result column="case_text_hash" property="caseTextHash"/>
        <result column="is_risk" property="isRisk"/>
        <result column="is_risk_ai" property="isRiskAi"/>
        <result column="delete_status" property="deleteStatus"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <result column="note" property="note"/>
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        ai_case_risk_id, case_id, source, source_name, case_text_hash, is_risk, is_risk_ai,
        delete_status, create_time, update_time, note
    </sql>
 
    <!-- 更新对象 -->
    <update id="updateAiCaseRisk">
        update <include refid="table-name"/>
        <set>
            <if test="entity.caseId != null">case_id = #{entity.caseId},</if>
            <if test="entity.source != null">source = #{entity.source},</if>
            <if test="entity.sourceName != null">source_name = #{entity.sourceName},</if>
            <if test="entity.caseTextHash != null">case_text_hash = #{entity.caseTextHash},</if>
            <if test="entity.isRisk != null">is_risk = #{entity.isRisk},</if>
            <if test="entity.isRiskAi != null">is_risk_ai = #{entity.isRiskAi},</if>
            <if test="entity.deleteStatus != null">delete_status = #{entity.deleteStatus},</if>
            <if test="entity.updateTime != null">update_time = #{entity.updateTime},</if>
            <if test="entity.note != null">note = #{entity.note}</if>
        </set>
        where ai_case_risk_id = #{entity.aiCaseRiskId}
    </update>
 
    <!-- 条件更新对象 -->
    <update id="updateAiCaseRiskTerms">
        update <include refid="table-name"/>
        <set>
            <if test="entity.caseId != null">case_id = #{entity.caseId},</if>
            <if test="entity.source != null">source = #{entity.source},</if>
            <if test="entity.sourceName != null">source_name = #{entity.sourceName},</if>
            <if test="entity.caseTextHash != null">case_text_hash = #{entity.caseTextHash},</if>
            <if test="entity.isRisk != null">is_risk = #{entity.isRisk},</if>
            <if test="entity.isRiskAi != null">is_risk_ai = #{entity.isRiskAi},</if>
            <if test="entity.deleteStatus != null">delete_status = #{entity.deleteStatus},</if>
            <if test="entity.updateTime != null">update_time = #{entity.updateTime},</if>
            <if test="entity.note != null">note = #{entity.note}</if>
        </set>
        <where>
            <if test="terms.aiCaseRiskId != null">
                and ai_case_risk_id = #{terms.aiCaseRiskId}
            </if>
            <if test="terms.caseId != null">
                and case_id = #{terms.caseId}
            </if>
            <if test="terms.isRisk != null">
                and is_risk = #{terms.isRisk}
            </if>
            <if test="terms.isRiskAi != null">
                and is_risk_ai = #{terms.isRiskAi}
            </if>
        </where>
    </update>
 
    <!-- 根据编号物理删除 -->
    <delete id="deleteAiCaseRisk">
        delete from <include refid="table-name"/> where ai_case_risk_id = #{id}
    </delete>
 
    <!-- 按条件查询结果集 -->
    <select id="listTerms" resultMap="BaseResultMap">
        select <include refid="Base_Column_List"/>
        from <include refid="table-name"/>
        <where>
            <if test="terms.aiCaseRiskId != null">
                and ai_case_risk_id = #{terms.aiCaseRiskId}
            </if>
            <if test="terms.caseId != null">
                and case_id = #{terms.caseId}
            </if>
            <if test="terms.isRisk != null">
                and is_risk = #{terms.isRisk}
            </if>
            <if test="terms.isRiskAi != null">
                and is_risk_ai = #{terms.isRiskAi}
            </if>
        </where>
        order by create_time desc
    </select>
 
    <!-- 按条件查询实体总数 -->
    <select id="countTerms" resultType="long">
        select count(1)
        from <include refid="table-name"/>
        <where>
            <if test="terms.aiCaseRiskId != null">
                and ai_case_risk_id = #{terms.aiCaseRiskId}
            </if>
            <if test="terms.caseId != null">
                and case_id = #{terms.caseId}
            </if>
            <if test="terms.isRisk != null">
                and is_risk = #{terms.isRisk}
            </if>
            <if test="terms.isRiskAi != null">
                and is_risk_ai = #{terms.isRiskAi}
            </if>
        </where>
    </select>
 
    <!-- 按条件查询实体分页结果集 -->
    <select id="pageTerms" resultMap="BaseResultMap">
        select <include refid="Base_Column_List"/>
        from <include refid="table-name"/>
        <where>
            <if test="terms.aiCaseRiskId != null">
                and ai_case_risk_id = #{terms.aiCaseRiskId}
            </if>
            <if test="terms.caseId != null">
                and case_id = #{terms.caseId}
            </if>
            <if test="terms.isRisk != null">
                and is_risk = #{terms.isRisk}
            </if>
            <if test="terms.isRiskAi != null">
                and is_risk_ai = #{terms.isRiskAi}
            </if>
        </where>
        <if test="page.sort != null">
            <foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
                isnull(${s.property}), ${s.property} ${s.direction}
            </foreach>
        </if>
        <if test="page.sort == null">
            order by create_time desc
        </if>
        limit #{page.offset}, #{page.size}
    </select>
 
    <!-- 根据条件查询案件风险评估 -->
    <select id="findByConditions" resultMap="BaseResultMap">
        select <include refid="Base_Column_List"/>
        from <include refid="table-name"/>
        <where>
            <if test="risk.caseId != null">
                and case_id = #{risk.caseId}
            </if>
            <if test="risk.source != null">
                and source = #{risk.source}
            </if>
            <if test="risk.sourceName != null">
                and source_name = #{risk.sourceName}
            </if>
            <if test="risk.isRisk != null">
                and is_risk = #{risk.isRisk}
            </if>
            <if test="risk.isRiskAi != null">
                and is_risk_ai = #{risk.isRiskAi}
            </if>
            and delete_status = '1'
        </where>
        order by create_time desc
    </select>
</mapper>