郑永安
2023-06-19 7a6abd05683528032687c75e80e0bd2030a3e46c
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
<?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.gkhy.safePlatform.safeCheck.repository.SafeCheckRegionRepository" >
    <resultMap id="BaseResultMap" type="com.gkhy.safePlatform.safeCheck.entity.SafeCheckRegion" >
        <id column="id" property="id" />
        <result column="uuid" property="uuid"/>
        <result column="delete_status" property="deleteStatus" />
        <result column="region" property="region" />
        <result column="region_department_id" property="regionDepartmentId" />
        <result column="region_type" property="regionType" />
        <result column="gmt_create" property="gmtCreate"/>
        <result column="gmt_moditify" property="gmtModitify" />
        <result column="dep_id" property="depId" />
        <result column="dep_uuid" property="depUuid" />
        <result column="enterprise_id" property="enterpriseId" />
        <result column="enterprise_uuid" property="enterpriseUuid" />
        <result column="create_by_user_name" property="createByUserName" />
        <result column="last_edit_user_name" property="lastEditUserName" />
    </resultMap>
 
<!--    所有的字段-->
    <sql id="allRegionFields">
        id,
        uuid,
        delete_status,
        region,
        region_department_id,
        region_type,
        gmt_create,
        gmt_moditify,
        dep_id,
        dep_uuid,
        enterprise_id,
        enterprise_uuid,
        create_by_user_name,
        last_edit_user_name
    </sql>
 
    <select id="getOneRegion" resultType="com.gkhy.safePlatform.safeCheck.entity.SafeCheckRegion">
        select
        <include refid="allRegionFields"></include>
        from safe_check_region
        where id = #{id} and delete_status = #{status}
    </select>
 
    <select id="getRegionByName" resultType="com.gkhy.safePlatform.safeCheck.entity.SafeCheckRegion">
        select
        <include refid="allRegionFields"></include>
        from safe_check_region
        where region = #{regionName} and delete_status = #{status}
    </select>
 
    <update id="deleteRegionById">
        update safe_check_region set
            delete_status = #{region.deleteStatus},
            gmt_moditify = #{region.gmtModitify},
            last_edit_user_name = #{region.lastEditUserName}
        where id = #{region.id} and delete_status = #{status}
    </update>
 
    <update id="updateRegionById">
        update safe_check_region set
        region = #{newRegion.region},
        region_department_id = #{newRegion.regionDepartmentId},
        region_type = #{newRegion.regionType},
        gmt_moditify = #{newRegion.gmtModitify},
        last_edit_user_name = #{newRegion.lastEditUserName}
        where id = #{newRegion.id}  and delete_status = #{status}
    </update>
 
</mapper>