ViolationCaseFileMapper.xml
7.72 KB
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
<?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.trash.casefile.mapper.ViolationCaseFileMapper">
<resultMap type="violationCaseFile" id="violationCaseFileResult">
<result property="id" column="id" />
<result property="number" column="number" />
<result property="violationObjectType" column="violation_object_type" />
<result property="owningRegion" column="owning_region" />
<result property="violationType" column="violation_type" />
<result property="violationGrade" column="violation_grade" />
<result property="projectName" column="project_name" />
<result property="companyName" column="company_name" />
<result property="describe" column="describe" />
<result property="sendObject" column="send_object" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="status" column="status" />
<result property="receive" column="receive" />
<result property="receiveStatus" column="receive_status" />
<result property="readBy" column="read_by" />
<result property="readTime" column="read_time" />
</resultMap>
<sql id="selectViolationCaseFileVo">
select id, `number`, violation_object_type, owning_region, violation_type, violation_grade, project_name, company_name, `describe`, send_object, create_time, create_by, update_time, update_by, status, receive, receive_status, read_by, read_time from casefile_violation
</sql>
<select id="selectViolationCaseFileList" parameterType="violationCaseFile" resultMap="violationCaseFileResult">
<include refid="selectViolationCaseFileVo"/>
<where>
<if test="number != null and number != ''"> and number = #{number}</if>
<if test="violationObjectType != null and violationObjectType != ''"> and violation_object_type = #{violationObjectType}</if>
<if test="owningRegion != null and owningRegion != ''"> and owning_region = #{owningRegion}</if>
<if test="violationType != null and violationType != ''"> and violation_type = #{violationType}</if>
<if test="violationGrade != null and violationGrade != ''"> and violation_grade = #{violationGrade}</if>
<if test="projectName != null and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if>
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
<if test="describe != null and describe != ''"> and describe = #{describe}</if>
<if test="sendObject != null and sendObject != ''"> and send_object = #{sendObject}</if>
<if test="status != null "> and status = #{status}</if>
<if test="receive != null and receive != ''"> and receive = #{receive}</if>
<if test="receiveStatus != null "> and receive_status = #{receiveStatus}</if>
<if test="readBy != null and readBy != ''"> and read_by = #{readBy}</if>
<if test="readTime != null "> and read_time = #{readTime}</if>
<if test="createTime != null "> and DATE_FORMAT(create_time,("%y%m%d")) = DATE_FORMAT(#{createTime},("%y%m%d"))</if>
</where>
</select>
<select id="selectViolationCaseFileById" parameterType="Long" resultMap="violationCaseFileResult">
<include refid="selectViolationCaseFileVo"/>
where id = #{id}
</select>
<insert id="insertViolationCaseFile" parameterType="ViolationCaseFile" useGeneratedKeys="true" keyProperty="id">
insert into casefile_violation
<trim prefix="(" suffix=")" suffixOverrides=",">
create_time,
<if test="number != null">`number`,</if>
<if test="violationObjectType != null">violation_object_type,</if>
<if test="owningRegion != null">owning_region,</if>
<if test="violationType != null">violation_type,</if>
<if test="violationGrade != null">violation_grade,</if>
<if test="projectName != null">project_name,</if>
<if test="companyName != null">company_name,</if>
<if test="describe != null">`describe`,</if>
<if test="sendObject != null">send_object,</if>
<if test="createBy != null">create_by,</if>
<if test="status != null">status,</if>
<if test="receive != null">receive,</if>
<if test="receiveStatus != null">receive_status,</if>
<if test="readBy != null">read_by,</if>
<if test="readTime != null">read_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
now(),
<if test="number != null">#{number},</if>
<if test="violationObjectType != null">#{violationObjectType},</if>
<if test="owningRegion != null">#{owningRegion},</if>
<if test="violationType != null">#{violationType},</if>
<if test="violationGrade != null">#{violationGrade},</if>
<if test="projectName != null">#{projectName},</if>
<if test="companyName != null">#{companyName},</if>
<if test="describe != null">#{describe},</if>
<if test="sendObject != null">#{sendObject},</if>
<if test="createBy != null">#{createBy},</if>
<if test="status != null">#{status},</if>
<if test="receive != null">#{receive},</if>
<if test="receiveStatus != null">#{receiveStatus},</if>
<if test="readBy != null">#{readBy},</if>
<if test="readTime != null">#{readTime},</if>
</trim>
</insert>
<update id="updateViolationCaseFile" parameterType="ViolationCaseFile">
update casefile_violation
<trim prefix="SET" suffixOverrides=",">
update_time = now(),
<if test="number != null">`number` = #{number},</if>
<if test="violationObjectType != null">violation_object_type = #{violationObjectType},</if>
<if test="owningRegion != null">owning_region = #{owningRegion},</if>
<if test="violationType != null">violation_type = #{violationType},</if>
<if test="violationGrade != null">violation_grade = #{violationGrade},</if>
<if test="projectName != null">project_name = #{projectName},</if>
<if test="companyName != null">company_name = #{companyName},</if>
<if test="describe != null">`describe` = #{describe},</if>
<if test="sendObject != null">send_object = #{sendObject},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="status != null">status = #{status},</if>
<if test="receive != null">receive = #{receive},</if>
<if test="receiveStatus != null">receive_status = #{receiveStatus},</if>
<if test="readBy != null">read_by = #{readBy},</if>
<if test="readTime != null">read_time = #{readTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteViolationCaseFileById" parameterType="Long">
delete from casefile_violation where id = #{id}
</delete>
<delete id="deleteViolationCaseFileByIds" parameterType="String">
delete from casefile_violation where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>