kongzy
2024-06-03 022b17044ab6bb284fd6313da91d1d1dfb2d5079
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
<?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.assess.system.mapper.SysAgencyMapper">
    <resultMap type="com.gkhy.assess.system.domain.SysAgency" id="SysAgencyResult">
        <id     property="id"        column="id"         />
        <result property="name"     column="name"      />
        <result property="creditCode"     column="credit_code"      />
        <result property="attribute"     column="attribute"      />
        <result property="province"     column="province"      />
        <result property="city"     column="city"      />
        <result property="district"     column="district"      />
        <result property="address"     column="address"      />
        <result property="web"     column="web"      />
        <result property="legalPerson"     column="legal_person"      />
        <result property="legalPhone"     column="legal_phone"      />
        <result property="manager"     column="manager"      />
        <result property="managerPhone"     column="manager_phone"      />
        <result property="certNumber"     column="cert_number"      />
        <result property="certPath"     column="cert_path"      />
        <result property="issueDate"     column="issue_date"      />
        <result property="validDate"     column="valid_date"      />
        <result property="assetValue"     column="asset_value"      />
        <result property="workArea"     column="work_area"      />
        <result property="archiveArea"     column="archive_area"      />
        <result property="regAddress"     column="reg_address"      />
        <result property="business"     column="business"      />
        <result property="reportPath"     column="report_path"      />
        <result property="delFlag"     column="del_flag"      />
        <result property="publication"     column="publication"      />
        <result property="createTime"     column="create_time"      />
        <result property="remark"     column="remark"      />
        <association property="user" javaType="com.gkhy.assess.system.domain.SysUser" resultMap="userResult" />
        <collection property="businessNames" ofType="java.lang.String" select="getBusinessById" column="{business=business}"/>
    </resultMap>
 
    <resultMap id="userResult" type="com.gkhy.assess.system.domain.SysUser">
        <id     property="id"       column="user_id"        />
        <result property="username"     column="username"      />
        <result property="phone"      column="phone"       />
    </resultMap>
 
 
    <sql id="selectAgencyVo">
        select a.id,a.name,a.credit_code,a.attribute,a.province,a.city,a.district,a.address,a.web,a.legal_person,
               a.legal_phone,a.manager,a.manager_phone,a.cert_number,a.cert_path,a.issue_date,a.valid_date,a.asset_value,a.work_area,a.archive_area,
               a.reg_address,a.business,a.report_path,a.del_flag,a.publication,a.create_time,a.remark,
               b.id as user_id,b.username,b.phone
        from sys_agency a
        left join sys_user b on b.agency_id=a.id and b.identity=1 and b.del_flag=0
    </sql>
 
    <select id="checkAgencyNameUnique" resultType="com.gkhy.assess.system.domain.SysAgency">
        select id,name from sys_agency where name=#{name} and del_flag=0 limit 1
    </select>
 
    <select id="agencyList" resultMap="SysAgencyResult">
        select a.id,a.name,a.credit_code,a.attribute,a.cert_number,a.issue_date,a.valid_date,a.create_time,a.business,a.province,a.city,a.district,a.publication from sys_agency a
        <where>
            and a.del_flag = 0
            <if test="name != null and name != ''">
                AND a.name like concat('%', #{name}, '%')
            </if>
            <if test="province != null and province != ''">
                AND a.province=#{province}
            </if>
            <if test="city != null and city != ''">
                AND a.city=#{city}
            </if>
            <if test="district != null and district != ''">
                AND a.district=#{district}
            </if>
            <if test="business != null and business != ''">
                AND a.business like concat("%",#{business},"%")
            </if>
            <if test="publication != null">
                AND a.publication =#{publication}
            </if>
        </where>
        order by a.create_time desc
    </select>
 
    <select id="getAgencyById" resultMap="SysAgencyResult">
        <include refid="selectAgencyVo"/>
        where a.del_flag = 0 and a.id=#{agencyId}
    </select>
 
 
    <select id="getBusinessById" resultType="java.lang.String">
        select label from sys_dict_data where id in
        <foreach item="item" index="index" collection="business.split(',')"  open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>
</mapper>