bug
jiangping
2023-11-07 64b432916af9c9218ab3f3eca614e26c542142ae
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
<?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="doumeemes.dao.ext.CompanyExtMapper">
 
  <!-- 管理页面查询 -->
  <resultMap id="CompanyExtListVO" type="doumeemes.dao.ext.vo.CompanyExtListVO" autoMapping="true">
    <id column="ID" jdbcType="INTEGER" property="id"/>
    <association property="lpmodel" javaType="doumeemes.dao.system.model.SystemUser">
      <id column="LPMODEL_ID" jdbcType="INTEGER" property="id"/>
      <result column="LPMODEL_DELETED" jdbcType="TINYINT" property="deleted"/>
      <result column="LPMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/>
      <result column="LPMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
      <result column="LPMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/>
      <result column="LPMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
      <result column="LPMODEL_FIXED" jdbcType="TINYINT" property="fixed"/>
      <result column="LPMODEL_PASSWORD" jdbcType="VARCHAR" property="password"/>
      <result column="LPMODEL_SALT" jdbcType="VARCHAR" property="salt"/>
      <result column="LPMODEL_AVATAR" jdbcType="VARCHAR" property="avatar"/>
      <result column="LPMODEL_MOBILE" jdbcType="VARCHAR" property="mobile"/>
      <result column="LPMODEL_EMAIL" jdbcType="VARCHAR" property="email"/>
      <result column="LPMODEL_SEX" jdbcType="VARCHAR" property="sex"/>
      <result column="LPMODEL_BIRTHDAY" jdbcType="DATE" property="birthday"/>
      <result column="LPMODEL_EMP_NO" jdbcType="VARCHAR" property="empNo"/>
      <result column="LPMODEL_REALNAME" jdbcType="VARCHAR" property="realname"/>
      <result column="LPMODEL_USERNAME" jdbcType="VARCHAR" property="username"/>
      <result column="LPMODEL_SYSTEMID" jdbcType="VARCHAR" property="systemid"/>
      <result column="LPMODEL_INVALID_TIME" jdbcType="TIMESTAMP" property="invalidTime"/>
      <result column="LPMODEL_TYPE" jdbcType="INTEGER" property="type"/>
    </association>
  </resultMap>
  <select id="selectList" parameterType="doumeemes.dao.ext.dto.QueryCompanyExtDTO" resultMap="CompanyExtListVO">
    SELECT
      `a`.*,
      `lpmodel`.`ID` AS LPMODEL_ID,
      `lpmodel`.`DELETED` AS LPMODEL_DELETED,
      `lpmodel`.`CREATE_USER` AS LPMODEL_CREATE_USER,
      `lpmodel`.`CREATE_TIME` AS LPMODEL_CREATE_TIME,
      `lpmodel`.`UPDATE_USER` AS LPMODEL_UPDATE_USER,
      `lpmodel`.`UPDATE_TIME` AS LPMODEL_UPDATE_TIME,
      `lpmodel`.`FIXED` AS LPMODEL_FIXED,
      `lpmodel`.`PASSWORD` AS LPMODEL_PASSWORD,
      `lpmodel`.`SALT` AS LPMODEL_SALT,
      `lpmodel`.`AVATAR` AS LPMODEL_AVATAR,
      `lpmodel`.`MOBILE` AS LPMODEL_MOBILE,
      `lpmodel`.`EMAIL` AS LPMODEL_EMAIL,
      `lpmodel`.`SEX` AS LPMODEL_SEX,
      `lpmodel`.`BIRTHDAY` AS LPMODEL_BIRTHDAY,
      `lpmodel`.`EMP_NO` AS LPMODEL_EMP_NO,
      `lpmodel`.`REALNAME` AS LPMODEL_REALNAME,
      `lpmodel`.`USERNAME` AS LPMODEL_USERNAME,
      `lpmodel`.`SYSTEMID` AS LPMODEL_SYSTEMID,
      `lpmodel`.`INVALID_TIME` AS LPMODEL_INVALID_TIME,
      `lpmodel`.`TYPE` AS LPMODEL_TYPE
    FROM `company` `a`
    LEFT JOIN `system_user` `lpmodel` ON a.LEGAL_PERSON_ID=lpmodel.ID
    <where>
      <if test="id != null">
        AND `a`.`ID` = #{id}
      </if>
      <if test="deleted != null">
        AND `a`.`DELETED` = #{deleted}
      </if>
      <if test="createUser != null">
        AND `a`.`CREATE_USER` = #{createUser}
      </if>
      <if test="createTime != null">
        AND `a`.`CREATE_TIME` = #{createTime}
      </if>
      <if test="updateUser != null">
        AND `a`.`UPDATE_USER` = #{updateUser}
      </if>
      <if test="updateTime != null">
        AND `a`.`UPDATE_TIME` = #{updateTime}
      </if>
      <if test="origin != null">
        AND `a`.`ORIGIN` = #{origin}
      </if>
      <if test="name != null and name != ''">
        AND `a`.`NAME` = #{name}
      </if>
      <if test="remark != null and remark != ''">
        AND `a`.`REMARK` = #{remark}
      </if>
      <if test="type != null and type != ''">
        AND `a`.`TYPE` = #{type}
      </if>
      <if test="legalPersonId != null">
        AND `a`.`LEGAL_PERSON_ID` = #{legalPersonId}
      </if>
      <if test="legalPersonPhone != null and legalPersonPhone != ''">
        AND `a`.`LEGAL_PERSON_PHONE` = #{legalPersonPhone}
      </if>
      <if test="registerDate != null">
        AND `a`.`REGISTER_DATE` = #{registerDate}
      </if>
      <if test="addr != null and addr != ''">
        AND `a`.`ADDR` = #{addr}
      </if>
      <if test="businessScope != null and businessScope != ''">
        AND `a`.`BUSINESS_SCOPE` = #{businessScope}
      </if>
      <if test="businessTerm != null and businessTerm != ''">
        AND `a`.`BUSINESS_TERM` = #{businessTerm}
      </if>
      <if test="issueDate != null">
        AND `a`.`ISSUE_DATE` = #{issueDate}
      </if>
      <if test="creditCode != null and creditCode != ''">
        AND `a`.`CREDIT_CODE` = #{creditCode}
      </if>
      <if test="registerCapital != null and registerCapital != ''">
        AND `a`.`REGISTER_CAPITAL` = #{registerCapital}
      </if>
      <if test="fileFormat != null and fileFormat != ''">
        AND `a`.`FILE_FORMAT` = #{fileFormat}
      </if>
      <if test="fileName != null and fileName != ''">
        AND `a`.`FILE_NAME` = #{fileName}
      </if>
      <if test="fileStoreAddr != null and fileStoreAddr != ''">
        AND `a`.`FILE_STORE_ADDR` = #{fileStoreAddr}
      </if>
      <if test="authStatus != null">
        AND `a`.`AUTH_STATUS` = #{authStatus}
      </if>
      <if test="authId != null">
        AND `a`.`AUTH_ID` = #{authId}
      </if>
      <if test="dingdingId != null and dingdingId != ''">
        AND `a`.`DINGDING_ID` = #{dingdingId}
      </if>
      <if test="openUserNum != null">
        AND `a`.`OPEN_USER_NUM` = #{openUserNum}
      </if>
      <if test="openModules != null and openModules != ''">
        AND `a`.`OPEN_MODULES` = #{openModules}
      </if>
      <if test="oepnValidDate != null">
        AND `a`.`OEPN_VALID_DATE` = #{oepnValidDate}
      </if>
      <if test="oepnType != null">
        AND `a`.`OEPN_TYPE` = #{oepnType}
      </if>
      <if test="channelId != null">
        AND `a`.`CHANNEL_ID` = #{channelId}
      </if>
      <if test="lpmodelId != null">
        AND `lpmodel`.`ID` = #{lpmodelId}
      </if>
      <if test="lpmodelDeleted != null">
        AND `lpmodel`.`DELETED` = #{lpmodelDeleted}
      </if>
      <if test="lpmodelCreateUser != null">
        AND `lpmodel`.`CREATE_USER` = #{lpmodelCreateUser}
      </if>
      <if test="lpmodelCreateTime != null">
        AND `lpmodel`.`CREATE_TIME` = #{lpmodelCreateTime}
      </if>
      <if test="lpmodelUpdateUser != null">
        AND `lpmodel`.`UPDATE_USER` = #{lpmodelUpdateUser}
      </if>
      <if test="lpmodelUpdateTime != null">
        AND `lpmodel`.`UPDATE_TIME` = #{lpmodelUpdateTime}
      </if>
      <if test="lpmodelFixed != null">
        AND `lpmodel`.`FIXED` = #{lpmodelFixed}
      </if>
      <if test="lpmodelPassword != null and lpmodelPassword != ''">
        AND `lpmodel`.`PASSWORD` = #{lpmodelPassword}
      </if>
      <if test="lpmodelSalt != null and lpmodelSalt != ''">
        AND `lpmodel`.`SALT` = #{lpmodelSalt}
      </if>
      <if test="lpmodelAvatar != null and lpmodelAvatar != ''">
        AND `lpmodel`.`AVATAR` = #{lpmodelAvatar}
      </if>
      <if test="lpmodelMobile != null and lpmodelMobile != ''">
        AND `lpmodel`.`MOBILE` = #{lpmodelMobile}
      </if>
      <if test="lpmodelEmail != null and lpmodelEmail != ''">
        AND `lpmodel`.`EMAIL` = #{lpmodelEmail}
      </if>
      <if test="lpmodelSex != null and lpmodelSex != ''">
        AND `lpmodel`.`SEX` = #{lpmodelSex}
      </if>
      <if test="lpmodelBirthday != null">
        AND `lpmodel`.`BIRTHDAY` = #{lpmodelBirthday}
      </if>
      <if test="lpmodelEmpNo != null and lpmodelEmpNo != ''">
        AND `lpmodel`.`EMP_NO` = #{lpmodelEmpNo}
      </if>
      <if test="lpmodelRealname != null and lpmodelRealname != ''">
        AND `lpmodel`.`REALNAME` = #{lpmodelRealname}
      </if>
      <if test="lpmodelUsername != null and lpmodelUsername != ''">
        AND `lpmodel`.`USERNAME` = #{lpmodelUsername}
      </if>
      <if test="lpmodelSystemid != null and lpmodelSystemid != ''">
        AND `lpmodel`.`SYSTEMID` = #{lpmodelSystemid}
      </if>
      <if test="lpmodelInvalidTime != null">
        AND `lpmodel`.`INVALID_TIME` = #{lpmodelInvalidTime}
      </if>
      <if test="lpmodelType != null">
        AND `lpmodel`.`TYPE` = #{lpmodelType}
      </if>
    </where>
  </select>
  <select id="selectCompanyInfoList" parameterType="doumeemes.dao.ext.dto.QueryCompanyExtDTO" resultType="doumeemes.dao.ext.vo.CompanyInfoListVO" >
    SELECT
      comp.ID,
      comp.OPEN_USER_NUM as openUserNum,
      comp.NAME as companyName,
      dept.name AS remark,
      comp.ADDR,
      comp.DINGDING_INFO,
      comp.OEPN_TYPE,
      comu.PHONE as PHONE
      ,comu.id as companyUserId
      ,comp.OEPN_VALID_DATE AS oepnValidDate
      ,comp.LINKER as linkName
      ,comp.status
      ,comp.LINK_PHONE
      ,comp.SALESPERSON
      ,t2.REALNAME as SALESPERSON_NAME
      ,comp.CREATE_USER
      ,comp.CREATE_TIME
      ,t3.REALNAME  as CREATE_USER_NAME
    FROM
    company comp
    LEFT JOIN SYSTEM_USER t2 ON comp.SALESPERSON = t2.ID
    LEFT JOIN SYSTEM_USER t3 ON comp.CREATE_USER = t3.ID
    left join department dept on dept.COMPANY_ID = comp.ID and  dept.PARENT_ID IS NULL AND dept.TYPE != 4
    LEFT JOIN company_user comu ON dept.id = comu.ROOT_DEPART_ID AND comu.IS_MASTER = 1
    <where>
      <if test="dto.name != null and dto.name != ''">
        comp.NAME LIKE concat('%',#{dto.name},'%')
      </if>
      <if test="dto.deleted != null">
       and comp.DELETED = #{dto.deleted}
      </if>
      <if test="dto.oepnType != null">
        and  comp.OEPN_TYPE = #{dto.oepnType}
      </if>
      <if test="dto.status != null">
        and comp.status = #{dto.status}
      </if>
    </where>
    order by comp.CREATE_TIME desc
  </select>
  <select id="selectCompanyInfo" resultType="doumeemes.dao.ext.vo.CompanyInfoListVO">
    SELECT
      comp.ID,
      comp.NAME as orgName,
      dept.name AS remark,
      comp.ADDR,
      comp.OEPN_TYPE,
      comp.REMARK,
      comp.credit_code,
      comu.PHONE,
      comp.FILE_STORE_ADDR as fileStoreAddr
      ,comu.name as mastAccountName
      ,comp.OEPN_VALID_DATE AS oepnValidDate
      ,comp.LINKER as linkName
      ,comp.status
      ,comp.LINK_PHONE
      ,comp.LEGAL_PERSON_PHONE
      ,comp.SALESPERSON
      ,t2.REALNAME as SALESPERSONNAME
      ,t2.MOBILE as SALESPERSONMOBILE
      ,comp.CREATE_USER
      ,t3.REALNAME  as CREATE_USER_NAME
      ,comp.CREATE_TIME
    FROM
      company comp
 
      LEFT JOIN SYSTEM_USER t2 ON comp.SALESPERSON = t2.ID
      LEFT JOIN SYSTEM_USER t3 ON comp.CREATE_USER = t3.ID
      left join department dept on dept.COMPANY_ID = comp.ID and  dept.PARENT_ID IS NULL AND dept.TYPE != 4
      LEFT JOIN company_user comu ON dept.id = comu.ROOT_DEPART_ID AND comu.IS_MASTER = 1
    where comp.id = #{companyId}
  </select>
</mapper>