baizonghao
2023-02-24 bcc6047ef19e2bd7a83c7f6e6abcb2cd1d8107cc
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
<?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.mapper.caseHandler.WritMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ycl.entity.caseHandler.Writ">
        <id column="base_case_id" property="baseCaseId"/>
        <result column="illegal_building_id" property="illegalBuildingId"/>
        <result column="writ_type" property="writType"/>
        <result column="writ_code" property="writCode"/>
        <result column="illegal_type" property="illegalType"/>
        <result column="send_time" property="sendTime"/>
        <result column="limit_time" property="limitTime"/>
        <result column="send_content" property="sendContent"/>
        <result column="rectify_time" property="rectifyTime"/>
        <result column="rectify_situation" property="rectifySituation"/>
        <result column="remark" property="remark"/>
        <result column="writ_pic" property="writPic"/>
        <result column="original_pic" property="originalPic"/>
        <result column="rectified_pic" property="rectifiedPic"/>
        <result column="other_pic" property="otherPic"/>
        <result column="create_user" property="createUser"/>
        <result column="create_time" property="createTime"/>
    </resultMap>
 
    <resultMap id="VoMap" type="com.ycl.vo.writ.WritVO" extends="BaseResultMap">
        <result column="writ_type_name" property="writTypeName" jdbcType="VARCHAR"/>
        <result column="category_name" property="categoryName" jdbcType="VARCHAR"/>
        <result column="event_code" property="eventCode" jdbcType="VARCHAR"/>
        <result column="template_code" property="templateCode" jdbcType="VARCHAR"/>
 
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        base_case_id
        , illegal_building_id, writ_type, writ_code, illegal_type, send_time, limit_time, send_content, rectify_time, rectify_situation, remark, writ_pic, original_pic, rectified_pic, othen_pic, create_user, create_time
    </sql>
    <update id="deleteValueByCaseId">
        update ums_writ set value = null where base_case_id = #{baseCaseId}
    </update>
<!--    <delete id="deleteValueByCaseId">-->
<!--        delete from ums_writ where base_case_id = #{baseCaseId}-->
<!--    </delete>-->
    <select id="selectWritPage" resultMap="VoMap">
        SELECT w.*, wt.`name` as writ_type_name,bc.`code` event_code,dd.`name` category_name,wt.code template_code
        FROM ums_writ w
        LEFT JOIN ums_writ_template wt on w.writ_type = wt.id
        LEFT JOIN ums_illegal_building ib on w.illegal_building_id = ib.base_case_id
        LEFT JOIN ums_data_dictionary dd on ib.category_id = dd.id
        LEFT JOIN ums_base_case bc on ib.base_case_id = bc.id
        <where>
            w.value is not null
            <if test="keyword != null">
                w.writ_code like CONCAT('%',#{keyword},'%')
                or bc.`code` like CONCAT('%',#{keyword},'%')
                or wt.name like CONCAT('%',#{keyword},'%')
            </if>
        </where>
        order by w.create_time desc
    </select>
 
</mapper>