地质所 沉降监测网建设项目
zmk
2024-05-15 9e3afc6d0fa514f986d3fea40fa23124e6fb5070
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?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.javaweb.geo.mapper.CompanyMapper">
    
    <resultMap type="Company" id="CompanyResult">
        <result property="ids"    column="ids"    />
        <result property="addTime"    column="add_time"    />
        <result property="cardAnnex"    column="card_annex"    />
        <result property="cardBackAnnex"    column="card_back_annex"    />
        <result property="city"    column="city"    />
        <result property="code"    column="code"    />
        <result property="creditAnnex"    column="credit_annex"    />
        <result property="creditCode"    column="credit_code"    />
        <result property="district"    column="district"    />
        <result property="fullName"    column="full_name"    />
        <result property="idCard"    column="id_card"    />
        <result property="legalPerson"    column="legal_person"    />
        <result property="legalPersonPhone"    column="legal_person_phone"    />
        <result property="powerOfAttorneyAnnex"    column="power_of_attorney_annex"    />
        <result property="province"    column="province"    />
        <result property="regAddress"    column="reg_address"    />
        <result property="secretKey"    column="secret_key"    />
        <result property="nature"    column="nature"    />
        <result property="position"    column="position"    />
        <result property="certificationsCode"    column="certifications_code"    />
        <result property="certificationsAnnex"    column="certifications_annex"    />
        <result property="description"    column="description"    />
        <result property="certificationsCode2"    column="certifications_code2"    />
        <result property="certificationsAnnex2"    column="certifications_annex2"    />
        <result property="userName"    column="user_name"    />
        <result property="userPhone"    column="user_phone"    />
        <result property="category"    column="category"    />
        <result property="status"    column="status"    />
        <result property="projectNums"    column="project_nums"    />
    </resultMap>
 
    <sql id="selectCompanyVo">
        select ids, add_time, card_annex, card_back_annex, city, code, credit_annex, credit_code, district, full_name, id_card, legal_person, legal_person_phone, power_of_attorney_annex, province, reg_address, secret_key, nature, position, certifications_code, certifications_annex, description, certifications_code2, certifications_annex2, user_name, user_phone, category, status from js_company
    </sql>
 
    <select id="selectCompanyList" parameterType="Company" resultMap="CompanyResult">
        <include refid="selectCompanyVo"/>
        <where>
            <if test="ids != null  and ids != ''"> and ids = #{ids}</if>
            <if test="addTime != null "> and add_time = #{addTime}</if>
            <if test="cardAnnex != null  and cardAnnex != ''"> and card_annex = #{cardAnnex}</if>
            <if test="cardBackAnnex != null  and cardBackAnnex != ''"> and card_back_annex = #{cardBackAnnex}</if>
            <if test="city != null  and city != ''"> and city = #{city}</if>
            <if test="code != null  and code != ''"> and code = #{code}</if>
            <if test="creditAnnex != null  and creditAnnex != ''"> and credit_annex = #{creditAnnex}</if>
            <if test="creditCode != null  and creditCode != ''"> and credit_code = #{creditCode}</if>
            <if test="district != null  and district != ''"> and district = #{district}</if>
            <if test="fullName != null  and fullName != ''"> and full_name like concat('%', #{fullName}, '%')</if>
            <if test="idCard != null  and idCard != ''"> and id_card = #{idCard}</if>
            <if test="legalPerson != null  and legalPerson != ''"> and legal_person = #{legalPerson}</if>
            <if test="legalPersonPhone != null  and legalPersonPhone != ''"> and legal_person_phone = #{legalPersonPhone}</if>
            <if test="powerOfAttorneyAnnex != null  and powerOfAttorneyAnnex != ''"> and power_of_attorney_annex = #{powerOfAttorneyAnnex}</if>
            <if test="province != null  and province != ''"> and province = #{province}</if>
            <if test="regAddress != null  and regAddress != ''"> and reg_address = #{regAddress}</if>
            <if test="secretKey != null  and secretKey != ''"> and secret_key = #{secretKey}</if>
            <if test="nature != null  and nature != ''"> and nature = #{nature}</if>
            <if test="position != null  and position != ''"> and position = #{position}</if>
            <if test="certificationsCode != null  and certificationsCode != ''"> and certifications_code = #{certificationsCode}</if>
            <if test="certificationsAnnex != null  and certificationsAnnex != ''"> and certifications_annex = #{certificationsAnnex}</if>
            <if test="description != null  and description != ''"> and description = #{description}</if>
            <if test="certificationsCode2 != null  and certificationsCode2 != ''"> and certifications_code2 = #{certificationsCode2}</if>
            <if test="certificationsAnnex2 != null  and certificationsAnnex2 != ''"> and certifications_annex2 = #{certificationsAnnex2}</if>
            <if test="userName != null  and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
            <if test="userPhone != null  and userPhone != ''"> and user_phone = #{userPhone}</if>
            <if test="category != null  and category != ''"> and category = #{category}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
        </where>
    </select>
    
    <select id="selectCompanyById" parameterType="String" resultMap="CompanyResult">
        <include refid="selectCompanyVo"/>
        where ids = #{ids}
    </select>
 
    <select id="selectAllCompanyNum" resultType="java.lang.Long">
        SELECT count(ids) FROM js_company
    </select>
 
    <select id="selectCompanyNum" resultType="java.lang.Long">
        select count(a.ids) from (SELECT * FROM js_project WHERE `status` = '0' AND is_deleted = '0' GROUP BY company_id) a
    </select>
 
    <select id="selectCompanProjectNums" resultMap="CompanyResult">
        SELECT
        a.full_name,
        count(b.full_name) AS project_nums
        FROM
        js_company a
        LEFT JOIN js_project b ON a.ids = b.company_id
        <where>
            <if test="startTime != null and startTime != ''">
                and b.create_time >= #{startTime,jdbcType=TIMESTAMP}
            </if>
            <if test="endTime != null and endTime != ''">
                and b.create_time &lt;= #{endTime,jdbcType=TIMESTAMP}
            </if>
        </where>
        GROUP BY
        a.full_name
        ORDER BY project_nums DESC
        LIMIT 0,10
    </select>
 
    <insert id="insertCompany" parameterType="Company">
        insert into js_company
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="ids != null  and ids != ''">ids,</if>
            <if test="addTime != null ">add_time,</if>
            <if test="cardAnnex != null  and cardAnnex != ''">card_annex,</if>
            <if test="cardBackAnnex != null  and cardBackAnnex != ''">card_back_annex,</if>
            <if test="city != null  and city != ''">city,</if>
            <if test="code != null  and code != ''">code,</if>
            <if test="creditAnnex != null  and creditAnnex != ''">credit_annex,</if>
            <if test="creditCode != null  and creditCode != ''">credit_code,</if>
            <if test="district != null  and district != ''">district,</if>
            <if test="fullName != null  and fullName != ''">full_name,</if>
            <if test="idCard != null  and idCard != ''">id_card,</if>
            <if test="legalPerson != null  and legalPerson != ''">legal_person,</if>
            <if test="legalPersonPhone != null  and legalPersonPhone != ''">legal_person_phone,</if>
            <if test="powerOfAttorneyAnnex != null  and powerOfAttorneyAnnex != ''">power_of_attorney_annex,</if>
            <if test="province != null  and province != ''">province,</if>
            <if test="regAddress != null  and regAddress != ''">reg_address,</if>
            <if test="secretKey != null  and secretKey != ''">secret_key,</if>
            <if test="nature != null  and nature != ''">nature,</if>
            <if test="position != null  and position != ''">position,</if>
            <if test="certificationsCode != null  and certificationsCode != ''">certifications_code,</if>
            <if test="certificationsAnnex != null  and certificationsAnnex != ''">certifications_annex,</if>
            <if test="description != null  and description != ''">description,</if>
            <if test="certificationsCode2 != null  and certificationsCode2 != ''">certifications_code2,</if>
            <if test="certificationsAnnex2 != null  and certificationsAnnex2 != ''">certifications_annex2,</if>
            <if test="userName != null  and userName != ''">user_name,</if>
            <if test="userPhone != null  and userPhone != ''">user_phone,</if>
            <if test="category != null  and category != ''">category,</if>
            <if test="status != null  and status != ''">status,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="ids != null  and ids != ''">#{ids},</if>
            <if test="addTime != null ">#{addTime},</if>
            <if test="cardAnnex != null  and cardAnnex != ''">#{cardAnnex},</if>
            <if test="cardBackAnnex != null  and cardBackAnnex != ''">#{cardBackAnnex},</if>
            <if test="city != null  and city != ''">#{city},</if>
            <if test="code != null  and code != ''">#{code},</if>
            <if test="creditAnnex != null  and creditAnnex != ''">#{creditAnnex},</if>
            <if test="creditCode != null  and creditCode != ''">#{creditCode},</if>
            <if test="district != null  and district != ''">#{district},</if>
            <if test="fullName != null  and fullName != ''">#{fullName},</if>
            <if test="idCard != null  and idCard != ''">#{idCard},</if>
            <if test="legalPerson != null  and legalPerson != ''">#{legalPerson},</if>
            <if test="legalPersonPhone != null  and legalPersonPhone != ''">#{legalPersonPhone},</if>
            <if test="powerOfAttorneyAnnex != null  and powerOfAttorneyAnnex != ''">#{powerOfAttorneyAnnex},</if>
            <if test="province != null  and province != ''">#{province},</if>
            <if test="regAddress != null  and regAddress != ''">#{regAddress},</if>
            <if test="secretKey != null  and secretKey != ''">#{secretKey},</if>
            <if test="nature != null  and nature != ''">#{nature},</if>
            <if test="position != null  and position != ''">#{position},</if>
            <if test="certificationsCode != null  and certificationsCode != ''">#{certificationsCode},</if>
            <if test="certificationsAnnex != null  and certificationsAnnex != ''">#{certificationsAnnex},</if>
            <if test="description != null  and description != ''">#{description},</if>
            <if test="certificationsCode2 != null  and certificationsCode2 != ''">#{certificationsCode2},</if>
            <if test="certificationsAnnex2 != null  and certificationsAnnex2 != ''">#{certificationsAnnex2},</if>
            <if test="userName != null  and userName != ''">#{userName},</if>
            <if test="userPhone != null  and userPhone != ''">#{userPhone},</if>
            <if test="category != null  and category != ''">#{category},</if>
            <if test="status != null  and status != ''">#{status},</if>
         </trim>
    </insert>
 
    <update id="updateCompany" parameterType="Company">
        update js_company
        <trim prefix="SET" suffixOverrides=",">
            <if test="addTime != null ">add_time = #{addTime},</if>
            <if test="cardAnnex != null  and cardAnnex != ''">card_annex = #{cardAnnex},</if>
            <if test="cardBackAnnex != null  and cardBackAnnex != ''">card_back_annex = #{cardBackAnnex},</if>
            <if test="city != null  and city != ''">city = #{city},</if>
            <if test="code != null  and code != ''">code = #{code},</if>
            <if test="creditAnnex != null  and creditAnnex != ''">credit_annex = #{creditAnnex},</if>
            <if test="creditCode != null  and creditCode != ''">credit_code = #{creditCode},</if>
            <if test="district != null  and district != ''">district = #{district},</if>
            <if test="fullName != null  and fullName != ''">full_name = #{fullName},</if>
            <if test="idCard != null  and idCard != ''">id_card = #{idCard},</if>
            <if test="legalPerson != null  and legalPerson != ''">legal_person = #{legalPerson},</if>
            <if test="legalPersonPhone != null  and legalPersonPhone != ''">legal_person_phone = #{legalPersonPhone},</if>
            <if test="powerOfAttorneyAnnex != null  and powerOfAttorneyAnnex != ''">power_of_attorney_annex = #{powerOfAttorneyAnnex},</if>
            <if test="province != null  and province != ''">province = #{province},</if>
            <if test="regAddress != null  and regAddress != ''">reg_address = #{regAddress},</if>
            <if test="secretKey != null  and secretKey != ''">secret_key = #{secretKey},</if>
            <if test="nature != null  and nature != ''">nature = #{nature},</if>
            <if test="position != null  and position != ''">position = #{position},</if>
            <if test="certificationsCode != null  and certificationsCode != ''">certifications_code = #{certificationsCode},</if>
            <if test="certificationsAnnex != null  and certificationsAnnex != ''">certifications_annex = #{certificationsAnnex},</if>
            <if test="description != null  and description != ''">description = #{description},</if>
            <if test="certificationsCode2 != null  and certificationsCode2 != ''">certifications_code2 = #{certificationsCode2},</if>
            <if test="certificationsAnnex2 != null  and certificationsAnnex2 != ''">certifications_annex2 = #{certificationsAnnex2},</if>
            <if test="userName != null  and userName != ''">user_name = #{userName},</if>
            <if test="userPhone != null  and userPhone != ''">user_phone = #{userPhone},</if>
            <if test="category != null  and category != ''">category = #{category},</if>
            <if test="status != null  and status != ''">status = #{status},</if>
        </trim>
        where ids = #{ids}
    </update>
 
    <delete id="deleteCompanyById" parameterType="String">
        delete from js_company where ids = #{ids}
    </delete>
 
    <delete id="deleteCompanyByIds" parameterType="String">
        delete from js_company where ids in 
        <foreach item="ids" collection="array" open="(" separator="," close=")">
            #{ids}
        </foreach>
    </delete>
    
</mapper>