双重预防项目-国泰新华二开定制版
SZH
2022-08-20 f9f0687195e0fe349185437d22c495d74c8d4a20
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
<?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.ruoyi.project.system.company.mapper.CompanyMapper">
    
    <resultMap type="com.ruoyi.project.system.company.domain.Company" id="CompanyResult">
        <result property="companyId"    column="company_id"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
        <result property="companyName"    column="company_name"    />
        <result property="companyPrincipal"    column="company_principal"    />
        <result property="companyAddress"    column="company_address"    />
        <result property="companyPhone"    column="company_phone"    />
        <result property="companyFourColorMapUrl"    column="company_four_color_map_url"    />
        <result property="postSafetyRiskBarChartUrl"    column="post_safety_risk_bar_chart_url"    />
        <result property="companyRegion"    column="company_region"    />
 
        <result property="companyUnifiedSocialCreditCode"    column="company_unified_social_credit_code"    />
        <result property="companyBusinessLicense"    column="company_business_license"    />
        <result property="companyRegisteredAddressOfBusinessLicense"    column="company_registered_address_of_business_license"    />
        <result property="companyScale"    column="company_scale"    />
        <result property="companyNumberOfEmployees"    column="company_number_of_employees"    />
        <result property="companyEstablished"    column="company_established"    />
        <result property="companyArea"    column="company_area"    />
        <result property="companyRegisteredCapital"    column="company_registered_capital"    />
        <result property="companyTotalAssets"    column="company_total_assets"    />
        <result property="companyActualIncomeOfThePreviousYear"    column="company_actual_income_of_the_previous_year"    />
        <result property="companyAnnualProfit"    column="company_annual_profit"    />
        <result property="companyEconomicType"    column="company_economic_type"    />
        <result property="companyIndustry"    column="company_industry"    />
        <result property="companySubIndustry"    column="company_sub_industry"    />
 
        <result property="companyLegalRepresentative"    column="company_legal_representative"    />
        <result property="companyCorporatePosition"    column="company_corporate_position"    />
        <result property="companyLegalPersonPhone"    column="company_legal_person_phone"    />
        <result property="companyCorporateOfficePhone"    column="company_corporate_office_phone"    />
        <result property="companyPersonInChargeOfRectification"    column="company_person_in_charge_of_rectification"    />
        <result property="companyRectifierPhone"    column="company_rectifier_phone"    />
        <result property="companyOrganizer"    column="company_organizer"    />
        <result property="companyGroupCompanyName"    column="company_group_company_name"    />
        <result property="companySecurityFunction"    column="company_security_function"    />
        <result property="companyPostalCode"    column="company_postal_code"    />
        <result property="companyIntroduction"    column="company_introduction"    />
        <result property="companyOther"    column="company_other"    />
 
        <result property="parentId"    column="parent_id"    />
        <result property="ancestors"    column="ancestors"    />
        <result property="parentName" column="parent_name" />
    </resultMap>
 
    <sql id="selectCompanyVo">
        select company_id, create_by, create_time, update_by, update_time, remark,
        company_name, company_principal, company_address, company_phone,
        company_four_color_map_url,post_safety_risk_bar_chart_url,
        company_region, company_unified_social_credit_code, company_business_license,
        company_registered_address_of_business_license, company_scale, company_number_of_employees,
         company_established, company_area, company_registered_capital, company_total_assets,
         company_actual_income_of_the_previous_year, company_annual_profit, company_economic_type,
         company_industry, company_legal_representative, company_corporate_position, company_legal_person_phone,
         company_corporate_office_phone, company_person_in_charge_of_rectification, company_rectifier_phone,
         company_organizer, company_group_company_name, company_security_function, company_postal_code,
         company_introduction, company_other,
         parent_id, ancestors,company_sub_industry
        from sys_company
    </sql>
 
    <select id="selectCompanyList" parameterType="Company" resultMap="CompanyResult">
        <include refid="selectCompanyVo"/>
        <where>  
            <if test="companyId != null "> and company_id = #{companyId}</if>
            <if test="createBy != null  and createBy != ''"> and create_by = #{createBy}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="companyName != null  and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
            <if test="companyPrincipal != null  and companyPrincipal != ''"> and company_principal = #{companyPrincipal}</if>
            <if test="companyAddress != null  and companyAddress != ''"> and company_address = #{companyAddress}</if>
            <if test="companyPhone != null  and companyPhone != ''"> and company_phone = #{companyPhone}</if>
            <if test="companyFourColorMapUrl != null  and companyFourColorMapUrl != ''"> and company_four_color_map_url = #{companyFourColorMapUrl}</if>
            <if test="postSafetyRiskBarChartUrl != null  and postSafetyRiskBarChartUrl != ''"> and post_safety_risk_bar_chart_url = #{postSafetyRiskBarChartUrl}</if>
            <if test="companyRegion != null  and companyRegion != ''"> and company_region = #{companyRegion}</if>
 
            <if test="companyUnifiedSocialCreditCode != null  and companyUnifiedSocialCreditCode != ''"> and company_unified_social_credit_code = #{companyUnifiedSocialCreditCode}</if>
            <if test="companyBusinessLicense != null  and companyBusinessLicense != ''"> and company_business_license = #{companyBusinessLicense}</if>
            <if test="companyRegisteredAddressOfBusinessLicense != null  and companyRegisteredAddressOfBusinessLicense != ''"> and company_registered_address_of_business_license like concat('%', #{companyRegisteredAddressOfBusinessLicense}, '%')</if>
            <if test="companyScale != null  and companyScale != ''"> and company_scale = #{companyScale}</if>
            <if test="companyNumberOfEmployees != null "> and company_number_of_employees &gt; #{companyNumberOfEmployees}</if>
            <if test="params.beginCompanyEstablished != null and params.beginCompanyEstablished != '' and params.endCompanyEstablished != null and params.endCompanyEstablished != ''"> and company_established between #{params.beginCompanyEstablished} and #{params.endCompanyEstablished}</if>
            <if test="companyArea != null "> and company_area &gt; #{companyArea}</if>
            <if test="companyRegisteredCapital != null "> and company_registered_capital &gt; #{companyRegisteredCapital}</if>
            <if test="companyTotalAssets != null "> and company_total_assets &gt; #{companyTotalAssets}</if>
            <if test="companyActualIncomeOfThePreviousYear != null "> and company_actual_income_of_the_previous_year &gt; #{companyActualIncomeOfThePreviousYear}</if>
            <if test="companyAnnualProfit != null "> and company_annual_profit &gt; #{companyAnnualProfit}</if>
            <if test="companyEconomicType != null  and companyEconomicType != ''"> and company_economic_type = #{companyEconomicType}</if>
            <if test="companyIndustry != null  and companyIndustry != ''"> and company_industry = #{companyIndustry}</if>
            <if test="companySubIndustry != null  and companySubIndustry != ''"> and company_sub_industry = #{companySubIndustry}</if>
 
            <if test="companyLegalRepresentative != null  and companyLegalRepresentative != ''"> and company_legal_representative like concat('%', #{companyLegalRepresentative}, '%')</if>
            <if test="companyCorporatePosition != null  and companyCorporatePosition != ''"> and company_corporate_position like concat('%', #{companyCorporatePosition}, '%')</if>
            <if test="companyLegalPersonPhone != null  and companyLegalPersonPhone != ''"> and company_legal_person_phone like concat('%', #{companyLegalPersonPhone}, '%')</if>
            <if test="companyCorporateOfficePhone != null  and companyCorporateOfficePhone != ''"> and company_corporate_office_phone like concat('%', #{companyCorporateOfficePhone}, '%')</if>
            <if test="companyPersonInChargeOfRectification != null  and companyPersonInChargeOfRectification != ''"> and company_person_in_charge_of_rectification like concat('%', #{companyPersonInChargeOfRectification}, '%')</if>
            <if test="companyRectifierPhone != null  and companyRectifierPhone != ''"> and company_rectifier_phone like concat('%', #{companyRectifierPhone}, '%')</if>
            <if test="companyOrganizer != null  and companyOrganizer != ''"> and company_organizer like concat('%', #{companyOrganizer}, '%')</if>
            <if test="companyGroupCompanyName != null  and companyGroupCompanyName != ''"> and company_group_company_name like concat('%', #{companyGroupCompanyName}, '%')</if>
            <if test="companySecurityFunction != null  and companySecurityFunction != ''"> and company_security_function like concat('%', #{companySecurityFunction}, '%')</if>
            <if test="companyPostalCode != null  and companyPostalCode != ''"> and company_postal_code like concat('%', #{companyPostalCode}, '%')</if>
            <if test="companyIntroduction != null  and companyIntroduction != ''"> and company_introduction like concat('%', #{companyIntroduction}, '%')</if>
            <if test="companyOther != null  and companyOther != ''"> and company_other like concat('%', #{companyOther}, '%')</if>
 
            <if test="parentId != null "> and parent_id = #{parentId}</if>
            <if test="ancestors != null  and ancestors != ''"> and ancestors = #{ancestors}</if>
        </where>
        order by parent_id DESC , create_time DESC
    </select>
    
    <select id="selectCompanyById" parameterType="Long" resultMap="CompanyResult">
        select t.company_id, t.create_by, t.create_time, t.update_by, t.update_time,
        t.remark, t.company_name, t.company_principal, t.company_address, t.company_phone,
        t.company_four_color_map_url, t.post_safety_risk_bar_chart_url, t.company_region,
        t.company_unified_social_credit_code, t.company_business_license,
        t.company_registered_address_of_business_license, t.company_scale,
        t.company_number_of_employees, t.company_established, t.company_area,
        t.company_registered_capital, t.company_total_assets, t.company_actual_income_of_the_previous_year,
        t.company_annual_profit, t.company_economic_type, t.company_industry, t.company_legal_representative,
        t.company_corporate_position, t.company_legal_person_phone, t.company_corporate_office_phone,
        t.company_person_in_charge_of_rectification, t.company_rectifier_phone, t.company_organizer,
        t.company_group_company_name, t.company_security_function, t.company_postal_code,
        t.company_introduction, t.company_other, t.parent_id, t.ancestors, t.company_sub_industry,
        p.company_name as parent_name
        from sys_company t
        left join sys_company p on p.company_id = t.parent_id
        where t.company_id = #{companyId}
    </select>
        
    <insert id="insertCompany" parameterType="Company" useGeneratedKeys="true" keyProperty="companyId">
        insert into sys_company
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="companyId != null ">company_id,</if>
            <if test="createBy != null  and createBy != ''">create_by,</if>
            <if test="createTime != null ">create_time,</if>
            <if test="updateBy != null  and updateBy != ''">update_by,</if>
            <if test="updateTime != null ">update_time,</if>
            <if test="remark != null  and remark != ''">remark,</if>
            <if test="companyName != null  and companyName != ''">company_name,</if>
            <if test="companyPrincipal != null  and companyPrincipal != ''">company_principal,</if>
            <if test="companyAddress != null  and companyAddress != ''">company_address,</if>
            <if test="companyPhone != null  and companyPhone != ''">company_phone,</if>
            <if test="companyFourColorMapUrl != null  and companyFourColorMapUrl != ''">company_four_color_map_url,</if>
            <if test="postSafetyRiskBarChartUrl != null  and postSafetyRiskBarChartUrl != ''">post_safety_risk_bar_chart_url,</if>
            <if test="companyRegion != null  and companyRegion != ''">company_region,</if>
 
            <if test="companyUnifiedSocialCreditCode != null  and companyUnifiedSocialCreditCode != ''">company_unified_social_credit_code,</if>
            <if test="companyBusinessLicense != null  and companyBusinessLicense != ''">company_business_license,</if>
            <if test="companyRegisteredAddressOfBusinessLicense != null  and companyRegisteredAddressOfBusinessLicense != ''">company_registered_address_of_business_license,</if>
            <if test="companyScale != null  and companyScale != ''">company_scale,</if>
            <if test="companyNumberOfEmployees != null ">company_number_of_employees,</if>
            <if test="companyEstablished != null ">company_established,</if>
            <if test="companyArea != null ">company_area,</if>
            <if test="companyRegisteredCapital != null ">company_registered_capital,</if>
            <if test="companyTotalAssets != null ">company_total_assets,</if>
            <if test="companyActualIncomeOfThePreviousYear != null ">company_actual_income_of_the_previous_year,</if>
            <if test="companyAnnualProfit != null ">company_annual_profit,</if>
            <if test="companyEconomicType != null  and companyEconomicType != ''">company_economic_type,</if>
            <if test="companyIndustry != null  and companyIndustry != ''">company_industry,</if>
            <if test="companySubIndustry != null  and companySubIndustry != ''">company_sub_industry,</if>
 
            <if test="companyLegalRepresentative != null  and companyLegalRepresentative != ''">company_legal_representative,</if>
            <if test="companyCorporatePosition != null  and companyCorporatePosition != ''">company_corporate_position,</if>
            <if test="companyLegalPersonPhone != null  and companyLegalPersonPhone != ''">company_legal_person_phone,</if>
            <if test="companyCorporateOfficePhone != null  and companyCorporateOfficePhone != ''">company_corporate_office_phone,</if>
            <if test="companyPersonInChargeOfRectification != null  and companyPersonInChargeOfRectification != ''">company_person_in_charge_of_rectification,</if>
            <if test="companyRectifierPhone != null  and companyRectifierPhone != ''">company_rectifier_phone,</if>
            <if test="companyOrganizer != null  and companyOrganizer != ''">company_organizer,</if>
            <if test="companyGroupCompanyName != null  and companyGroupCompanyName != ''">company_group_company_name,</if>
            <if test="companySecurityFunction != null  and companySecurityFunction != ''">company_security_function,</if>
            <if test="companyPostalCode != null  and companyPostalCode != ''">company_postal_code,</if>
            <if test="companyIntroduction != null  and companyIntroduction != ''">company_introduction,</if>
            <if test="companyOther != null  and companyOther != ''">company_other,</if>
 
            <if test="parentId != null ">parent_id,</if>
            <if test="ancestors != null  and ancestors != ''">ancestors,</if>
 
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="companyId != null ">#{companyId},</if>
            <if test="createBy != null  and createBy != ''">#{createBy},</if>
            <if test="createTime != null ">#{createTime},</if>
            <if test="updateBy != null  and updateBy != ''">#{updateBy},</if>
            <if test="updateTime != null ">#{updateTime},</if>
            <if test="remark != null  and remark != ''">#{remark},</if>
            <if test="companyName != null  and companyName != ''">#{companyName},</if>
            <if test="companyPrincipal != null  and companyPrincipal != ''">#{companyPrincipal},</if>
            <if test="companyAddress != null  and companyAddress != ''">#{companyAddress},</if>
            <if test="companyPhone != null  and companyPhone != ''">#{companyPhone},</if>
            <if test="companyFourColorMapUrl != null  and companyFourColorMapUrl != ''">#{companyFourColorMapUrl},</if>
            <if test="postSafetyRiskBarChartUrl != null  and postSafetyRiskBarChartUrl != ''">#{postSafetyRiskBarChartUrl},</if>
            <if test="companyRegion != null  and companyRegion != ''">#{companyRegion},</if>
 
            <if test="companyUnifiedSocialCreditCode != null  and companyUnifiedSocialCreditCode != ''">#{companyUnifiedSocialCreditCode},</if>
            <if test="companyBusinessLicense != null  and companyBusinessLicense != ''">#{companyBusinessLicense},</if>
            <if test="companyRegisteredAddressOfBusinessLicense != null  and companyRegisteredAddressOfBusinessLicense != ''">#{companyRegisteredAddressOfBusinessLicense},</if>
            <if test="companyScale != null  and companyScale != ''">#{companyScale},</if>
            <if test="companyNumberOfEmployees != null ">#{companyNumberOfEmployees},</if>
            <if test="companyEstablished != null ">#{companyEstablished},</if>
            <if test="companyArea != null ">#{companyArea},</if>
            <if test="companyRegisteredCapital != null ">#{companyRegisteredCapital},</if>
            <if test="companyTotalAssets != null ">#{companyTotalAssets},</if>
            <if test="companyActualIncomeOfThePreviousYear != null ">#{companyActualIncomeOfThePreviousYear},</if>
            <if test="companyAnnualProfit != null ">#{companyAnnualProfit},</if>
            <if test="companyEconomicType != null  and companyEconomicType != ''">#{companyEconomicType},</if>
            <if test="companyIndustry != null  and companyIndustry != ''">#{companyIndustry},</if>
            <if test="companySubIndustry != null  and companySubIndustry != ''">#{companySubIndustry},</if>
 
 
 
            <if test="companyLegalRepresentative != null  and companyLegalRepresentative != ''">#{companyLegalRepresentative},</if>
            <if test="companyCorporatePosition != null  and companyCorporatePosition != ''">#{companyCorporatePosition},</if>
            <if test="companyLegalPersonPhone != null  and companyLegalPersonPhone != ''">#{companyLegalPersonPhone},</if>
            <if test="companyCorporateOfficePhone != null  and companyCorporateOfficePhone != ''">#{companyCorporateOfficePhone},</if>
            <if test="companyPersonInChargeOfRectification != null  and companyPersonInChargeOfRectification != ''">#{companyPersonInChargeOfRectification},</if>
            <if test="companyRectifierPhone != null  and companyRectifierPhone != ''">#{companyRectifierPhone},</if>
            <if test="companyOrganizer != null  and companyOrganizer != ''">#{companyOrganizer},</if>
            <if test="companyGroupCompanyName != null  and companyGroupCompanyName != ''">#{companyGroupCompanyName},</if>
            <if test="companySecurityFunction != null  and companySecurityFunction != ''">#{companySecurityFunction},</if>
            <if test="companyPostalCode != null  and companyPostalCode != ''">#{companyPostalCode},</if>
            <if test="companyIntroduction != null  and companyIntroduction != ''">#{companyIntroduction},</if>
            <if test="companyOther != null  and companyOther != ''">#{companyOther},</if>
 
            <if test="parentId != null ">#{parentId},</if>
            <if test="ancestors != null  and ancestors != ''">#{ancestors},</if>
        </trim>
    </insert>
 
    <update id="updateCompany" parameterType="Company">
        update sys_company
        <trim prefix="SET" suffixOverrides=",">
            <if test="createBy != null  and createBy != ''">create_by = #{createBy},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
            <if test="updateBy != null  and updateBy != ''">update_by = #{updateBy},</if>
            <if test="updateTime != null ">update_time = #{updateTime},</if>
            <if test="remark != null  and remark != ''">remark = #{remark},</if>
            <if test="companyName != null  and companyName != ''">company_name = #{companyName},</if>
            <if test="companyPrincipal != null  and companyPrincipal != ''">company_principal = #{companyPrincipal},</if>
            <if test="companyAddress != null  and companyAddress != ''">company_address = #{companyAddress},</if>
            <if test="companyPhone != null  and companyPhone != ''">company_phone = #{companyPhone},</if>
            <if test="companyFourColorMapUrl != null  and companyFourColorMapUrl != ''">company_four_color_map_url = #{companyFourColorMapUrl},</if>
            <if test="postSafetyRiskBarChartUrl != null  and postSafetyRiskBarChartUrl != ''">post_safety_risk_bar_chart_url = #{postSafetyRiskBarChartUrl},</if>
            <if test="companyRegion != null  and companyRegion != ''">company_region = #{companyRegion},</if>
 
            <if test="companyUnifiedSocialCreditCode != null  and companyUnifiedSocialCreditCode != ''">company_unified_social_credit_code = #{companyUnifiedSocialCreditCode},</if>
            <if test="companyBusinessLicense != null  and companyBusinessLicense != ''">company_business_license = #{companyBusinessLicense},</if>
            <if test="companyRegisteredAddressOfBusinessLicense != null  and companyRegisteredAddressOfBusinessLicense != ''">company_registered_address_of_business_license = #{companyRegisteredAddressOfBusinessLicense},</if>
            <if test="companyScale != null  and companyScale != ''">company_scale = #{companyScale},</if>
            <if test="companyNumberOfEmployees != null ">company_number_of_employees = #{companyNumberOfEmployees},</if>
            <if test="companyEstablished != null ">company_established = #{companyEstablished},</if>
            <if test="companyArea != null ">company_area = #{companyArea},</if>
            <if test="companyRegisteredCapital != null ">company_registered_capital = #{companyRegisteredCapital},</if>
            <if test="companyTotalAssets != null ">company_total_assets = #{companyTotalAssets},</if>
            <if test="companyActualIncomeOfThePreviousYear != null ">company_actual_income_of_the_previous_year = #{companyActualIncomeOfThePreviousYear},</if>
            <if test="companyAnnualProfit != null ">company_annual_profit = #{companyAnnualProfit},</if>
            <if test="companyEconomicType != null  and companyEconomicType != ''">company_economic_type = #{companyEconomicType},</if>
            <if test="companyIndustry != null  and companyIndustry != ''">company_industry = #{companyIndustry},</if>
            <if test="companySubIndustry != null  and companySubIndustry != ''">company_sub_industry = #{companySubIndustry},</if>
 
 
 
            <if test="companyLegalRepresentative != null  and companyLegalRepresentative != ''">company_legal_representative = #{companyLegalRepresentative},</if>
            <if test="companyCorporatePosition != null  and companyCorporatePosition != ''">company_corporate_position = #{companyCorporatePosition},</if>
            <if test="companyLegalPersonPhone != null  and companyLegalPersonPhone != ''">company_legal_person_phone = #{companyLegalPersonPhone},</if>
            <if test="companyCorporateOfficePhone != null  and companyCorporateOfficePhone != ''">company_corporate_office_phone = #{companyCorporateOfficePhone},</if>
            <if test="companyPersonInChargeOfRectification != null  and companyPersonInChargeOfRectification != ''">company_person_in_charge_of_rectification = #{companyPersonInChargeOfRectification},</if>
            <if test="companyRectifierPhone != null  and companyRectifierPhone != ''">company_rectifier_phone = #{companyRectifierPhone},</if>
            <if test="companyOrganizer != null  and companyOrganizer != ''">company_organizer = #{companyOrganizer},</if>
            <if test="companyGroupCompanyName != null  and companyGroupCompanyName != ''">company_group_company_name = #{companyGroupCompanyName},</if>
            <if test="companySecurityFunction != null  and companySecurityFunction != ''">company_security_function = #{companySecurityFunction},</if>
            <if test="companyPostalCode != null  and companyPostalCode != ''">company_postal_code = #{companyPostalCode},</if>
            <if test="companyIntroduction != null  and companyIntroduction != ''">company_introduction = #{companyIntroduction},</if>
            <if test="companyOther != null  and companyOther != ''">company_other = #{companyOther},</if>
 
            <if test="parentId != null ">parent_id = #{parentId},</if>
            <if test="ancestors != null  and ancestors != ''">ancestors = #{ancestors},</if>
        </trim>
        where company_id = #{companyId}
    </update>
 
    <delete id="deleteCompanyById" parameterType="Long">
        delete from sys_company where company_id = #{companyId}
    </delete>
 
    <delete id="deleteCompanyByIds" parameterType="String">
        delete from sys_company where company_id in 
        <foreach item="companyId" collection="array" open="(" separator="," close=")">
            #{companyId}
        </foreach>
    </delete>
 
 
    <select id="selectCompanyCount" parameterType="Company" resultType="int">
        select count(1) from sys_company
        <where>
            <if test="companyId != null and companyId != 0"> and company_id = #{companyId} </if>
            <if test="parentId != null and parentId != 0"> and parent_id = #{parentId} </if>
        </where>
    </select>
 
</mapper>