EmployeeMapper.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <!--
  4. 这个文件是自动生成的。
  5. 不要修改此文件。所有改动将在下次重新自动生成时丢失。
  6. -->
  7. <mapper namespace="com.ym.mec.biz.dal.dao.EmployeeDao">
  8. <resultMap type="com.ym.mec.biz.dal.entity.Employee" id="Employee">
  9. <result column="user_id_" property="userId"/>
  10. <result column="organ_id_list_" property="organIdList"/>
  11. <result column="job_nature_" property="jobNature"/>
  12. <result column="is_probation_period_" property="isProbationPeriod"/>
  13. <result column="education_background_" property="educationBackground"/>
  14. <result column="graduate_school_" property="graduateSchool"/>
  15. <result column="technical_titles_" property="technicalTitles"/>
  16. <result column="entry_date_" property="entryDate"/>
  17. <result column="certificate_type_" property="certificateType"/>
  18. <result column="certificate_num_" property="certificateNum"/>
  19. <result column="update_time_" property="updateTime"/>
  20. <result column="create_time_" property="createTime"/>
  21. <result column="introduction_" property="introduction"/>
  22. <result column="demission_date_" property="demissionDate"/>
  23. <result column="contact_address_" property="contactAddress"/>
  24. <result column="postal_code_" property="postalCode"/>
  25. <result column="dept_id_" property="deptId"/>
  26. <result column="dept_ids_" property="deptIds"/>
  27. <result column="post_ids_" property="postIds"/>
  28. <result column="post_dept_ids_" property="postDeptIds"/>
  29. <result column="bank_card_" property="bankCard"/>
  30. <result column="open_bank_address_" property="openBankAddress"/>
  31. <result column="tenant_id_" property="tenantId" />
  32. <result column="avatar_" property="avatar"/>
  33. </resultMap>
  34. <resultMap type="com.ym.mec.auth.api.entity.SysUser" id="SysUser">
  35. <result column="id_" property="id"/>
  36. <result column="username_" property="username"/>
  37. <result column="password_" property="password"/>
  38. <result column="salt_" property="salt"/>
  39. <result column="phone_" property="phone"/>
  40. <result column="avatar_" property="avatar"/>
  41. <result column="organ_id_" property="organId"/>
  42. <result column="create_time_" property="createTime"/>
  43. <result column="update_time_" property="updateTime"/>
  44. <result column="lock_flag_" property="lockFlag"/>
  45. <result column="del_flag_" property="delFlag" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
  46. <result column="wx_openid_" property="wxOpenid"/>
  47. <result column="qq_openid_" property="qqOpenid"/>
  48. <result column="user_type_" property="userType"/>
  49. <result column="gender_" property="gender"/>
  50. <result column="nation_" property="nation"/>
  51. <result column="birthdate_" property="birthdate"/>
  52. <result column="email_" property="email"/>
  53. <result column="im_token_" property="imToken"/>
  54. <result column="real_name_" property="realName"/>
  55. <result column="id_card_no_" property="idCardNo"/>
  56. <result column="wechat_id_" property="wechatId"/>
  57. </resultMap>
  58. <!-- 根据主键查询一条记录 -->
  59. <select id="get" resultMap="Employee">
  60. SELECT * FROM employee WHERE user_id_ = #{userId}
  61. </select>
  62. <!-- 全查询 -->
  63. <select id="findAll" resultMap="Employee">
  64. SELECT * FROM employee where tenant_id_ = #{tenantId} ORDER BY user_id_
  65. </select>
  66. <!-- 向数据库增加一条记录 -->
  67. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.Employee" useGeneratedKeys="true" keyColumn="id"
  68. keyProperty="id">
  69. INSERT INTO employee
  70. (user_id_,organ_id_list_,job_nature_,is_probation_period_,education_background_,graduate_school_,technical_titles_,
  71. entry_date_,certificate_type_,certificate_num_,update_time_,create_time_,introduction_,demission_date_,contact_address_,postal_code_,dept_id_,dept_ids_,post_ids_,post_dept_ids_,tenant_id_)
  72. VALUES(#{userId},#{organIdList},#{jobNature},#{isProbationPeriod},#{educationBackground},#{graduateSchool},
  73. #{technicalTitles},#{entryDate},#{certificateType},#{certificateNum},now(),now(),#{introduction},#{demissionDate},#{contactAddress},#{postalCode},#{deptId},#{deptIds},#{postIds},#{postDeptIds},#{tenantId})
  74. </insert>
  75. <insert id="batchAddEmployeeRole">
  76. INSERT INTO sys_user_role(user_id_,role_id_,tenant_id_) values
  77. <foreach collection="roleIds" item="item" index="index" separator=",">
  78. (#{userId},#{item},#{tenantId})
  79. </foreach>
  80. </insert>
  81. <insert id="batchInsertRoleMenu">
  82. INSERT INTO sys_role_menu (role_id_,menu_id_,tenant_id_) VALUES
  83. <foreach collection="menuIds" item="item" index="index" separator=",">
  84. (#{roleId}, #{item},#{tenantId})
  85. </foreach>
  86. </insert>
  87. <delete id="delRoleMenu">
  88. DELETE FROM `sys_role_menu`
  89. WHERE tenant_id_ = #{tenantId}
  90. and menu_id_ in
  91. <foreach collection="menuIds" open="(" close=")" item="item" separator=",">
  92. #{item}
  93. </foreach>
  94. </delete>
  95. <insert id="insertSysRole" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.auth.api.entity.SysRole"
  96. useGeneratedKeys="true">
  97. INSERT INTO `sys_role` (`role_name_`, `role_code_`, `role_desc_`, `create_time_`,
  98. `update_time_`, `del_flag_`, `organ_id_`, `tenant_id_`)
  99. VALUES (#{roleName}, #{roleCode}, #{roleDesc}, #{createTime},
  100. #{updateTime}, #{delFlag}, #{organId}, #{tenantId});
  101. </insert>
  102. <select id="queryByPhone" resultMap="SysUser">
  103. select * from sys_user where phone_ = #{phone} OR username_ = #{phone}
  104. </select>
  105. <!-- 根据主键查询一条记录 -->
  106. <update id="update" parameterType="com.ym.mec.biz.dal.entity.Employee">
  107. UPDATE employee
  108. <set>
  109. <if test="contactAddress != null">
  110. contact_address_ = #{contactAddress},
  111. </if>
  112. <if test="postalCode != null">
  113. postal_code_ = #{postalCode},
  114. </if>
  115. <if test="isProbationPeriod != null">
  116. is_probation_period_ = #{isProbationPeriod},
  117. </if>
  118. <if test="graduateSchool != null">
  119. graduate_school_ = #{graduateSchool},
  120. </if>
  121. <if test="organIdList != null">
  122. organ_id_list_ = #{organIdList},
  123. </if>
  124. <if test="introduction != null">
  125. introduction_ = #{introduction},
  126. </if>
  127. <if test="technicalTitles != null">
  128. technical_titles_ = #{technicalTitles},
  129. </if>
  130. <if test="entryDate != null">
  131. entry_date_ = #{entryDate},
  132. </if>
  133. <if test="jobNature != null">
  134. job_nature_ = #{jobNature},
  135. </if>
  136. <if test="certificateType != null">
  137. certificate_type_ = #{certificateType},
  138. </if>
  139. <if test="updateTime != null">
  140. update_time_ = NOW(),
  141. </if>
  142. <if test="educationBackground != null">
  143. education_background_ = #{educationBackground},
  144. </if>
  145. <if test="certificateNum != null">
  146. certificate_num_ = #{certificateNum},
  147. </if>
  148. <if test="demissionDate != null">
  149. demission_date_ = #{demissionDate},
  150. </if>
  151. dept_id_ = #{deptId},
  152. <if test="deptIds != null">
  153. dept_ids_ = #{deptIds},
  154. </if>
  155. <if test="postIds != null">
  156. post_ids_ = #{postIds},
  157. </if>
  158. <if test="postDeptIds != null">
  159. post_dept_ids_ = #{postDeptIds},
  160. </if>
  161. </set>
  162. WHERE user_id_ = #{userId} and tenant_id_ = #{tenantId}
  163. </update>
  164. <update id="updatePassword">
  165. UPDATE sys_user SET password_ = #{password} WHERE id_ = #{userID}
  166. </update>
  167. <update id="updateUserLockStatus">
  168. UPDATE sys_user SET lock_flag_ = IF(lock_flag_=0,1,0) WHERE id_=#{userID}
  169. </update>
  170. <update id="updateUserDemissionDate">
  171. UPDATE employee SET demission_date_ = IF(demission_date_ IS NULL,now(),NULL) WHERE user_id_=#{userID}
  172. </update>
  173. <update id="updateUserLock">
  174. UPDATE sys_user SET lock_flag_ = #{status} WHERE id_=#{userID}
  175. </update>
  176. <update id="updateEducationTeacherId">
  177. UPDATE music_group SET educational_teacher_id_ = #{targetUserId} WHERE educational_teacher_id_ = #{currentUserId} AND status_ != 'CANCELED';
  178. UPDATE vip_group SET educational_teacher_id_ = #{targetUserId} WHERE educational_teacher_id_ = #{currentUserId} AND group_status_ IN (0,1,5,2,6,4);
  179. UPDATE practice_group SET educational_teacher_id_ = #{targetUserId} WHERE educational_teacher_id_ = #{currentUserId} AND group_status_ != 'CANCEL';
  180. </update>
  181. <!-- 根据主键删除一条记录 -->
  182. <delete id="delete">
  183. DELETE FROM employee WHERE user_id_ = #{userId}
  184. </delete>
  185. <delete id="delEmployeeRole">
  186. DELETE FROM sys_user_role WHERE user_id_ = #{userId}
  187. </delete>
  188. <!-- 分页查询 -->
  189. <select id="queryPage" resultMap="Employee" parameterType="map">
  190. SELECT * FROM employee where tenant_id_ = #{tenantId} ORDER BY user_id_
  191. <include refid="global.limit"/>
  192. </select>
  193. <!-- 查询当前表的总记录数 -->
  194. <select id="queryCount" resultType="int">
  195. SELECT COUNT(*) FROM employee where tenant_id_ = #{tenantId}
  196. </select>
  197. <resultMap type="com.ym.mec.biz.dal.dto.EmployeeDto" id="EmployeeDto">
  198. <result property="id" column="user_id_"/>
  199. <result property="realName" column="real_name_"/>
  200. <result property="gender" column="gender_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
  201. <result property="phone" column="phone_"/>
  202. <result property="lockFlag" column="lock_flag_"/>
  203. <result property="jobNature" column="job_nature_"/>
  204. <result property="entryDate" column="entry_date_"/>
  205. <result property="demissionDate" column="demission_date_"/>
  206. <result property="contactAddress" column="contact_address_"/>
  207. <result property="postalCode" column="postal_code_"/>
  208. <result property="organIdStr" column="organ_id_str_"/>
  209. <result property="deptId" column="dept_id_"/>
  210. <result property="deptIds" column="dept_ids_"/>
  211. <result property="postIds" column="post_ids_"/>
  212. <result property="postDeptIds" column="post_dept_ids_"/>
  213. <collection property="roleNames" ofType="string" javaType="list">
  214. <result column="role_name_"/>
  215. </collection>
  216. <collection property="roleIds" ofType="integer" javaType="list">
  217. <result column="role_id_"/>
  218. </collection>
  219. </resultMap>
  220. <select id="queryEmployByOrganId" resultMap="EmployeeDto">
  221. SELECT ue.*,ue.organ_id_ organ_id_str_,sr.role_name_,sr.id_ role_id_
  222. FROM (SELECT e.user_id_,su.real_name_,su.gender_,su.phone_,su.user_type_,e.job_nature_,su.lock_flag_,
  223. e.entry_date_,e.demission_date_,e.organ_id_list_ organ_id_,e.create_time_,e.contact_address_,
  224. e.postal_code_,e.dept_id_,e.dept_ids_,e.post_ids_,e.post_dept_ids_
  225. FROM employee e
  226. LEFT JOIN sys_user su ON e.user_id_ = su.id_
  227. <if test="roleId != null">
  228. LEFT JOIN sys_user_role sur ON sur.user_id_ = e.user_id_
  229. </if>
  230. <where>
  231. su.del_flag_ = '0' and su.tenant_id_ = #{tenantId}
  232. <if test="lockFlag != null">
  233. AND su.lock_flag_ = #{lockFlag}
  234. </if>
  235. <if test="demissionflag != null and demissionflag == 1">
  236. AND e.demission_date_ IS NOT NULL
  237. </if>
  238. <if test="demissionflag != null and demissionflag == 0">
  239. AND e.demission_date_ IS NULL
  240. </if>
  241. <if test="organId != null">
  242. AND INTE_ARRAY(e.organ_id_list_,#{organId})
  243. </if>
  244. <if test="roleId != null">
  245. AND sur.role_id_ = #{roleId}
  246. </if>
  247. <if test="jobNature != null">
  248. AND e.job_nature_ = #{jobNature}
  249. </if>
  250. <if test="search != null">
  251. AND (su.real_name_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%') or su.id_ like CONCAT('%',#{search},'%'))
  252. </if>
  253. <if test="userIds != null and userIds.size() > 0">
  254. AND e.user_id_ IN
  255. <foreach collection="userIds" item="userId" separator="," open="(" close=")">
  256. #{userId}
  257. </foreach>
  258. </if>
  259. </where>
  260. ORDER BY e.create_time_ DESC <include refid="global.limit"/>) ue
  261. LEFT JOIN sys_user_role sur ON sur.user_id_ = ue.user_id_
  262. LEFT JOIN sys_role sr ON sr.id_ = sur.role_id_
  263. </select>
  264. <select id="queryEmployByOrganIdCount" resultType="int">
  265. SELECT COUNT(DISTINCT e.user_id_)
  266. FROM employee e
  267. LEFT JOIN sys_user su ON e.user_id_ = su.id_
  268. <if test="roleId != null">
  269. LEFT JOIN sys_user_role sur ON sur.user_id_ = e.user_id_
  270. </if>
  271. <where>
  272. su.del_flag_ = '0' and su.tenant_id_ = #{tenantId}
  273. <if test="organId != null">
  274. AND INTE_ARRAY(e.organ_id_list_,#{organId})
  275. </if>
  276. <if test="demissionflag != null and demissionflag == 1">
  277. AND e.demission_date_ IS NOT NULL
  278. </if>
  279. <if test="demissionflag != null and demissionflag == 0">
  280. AND e.demission_date_ IS NULL
  281. </if>
  282. <if test="jobNature != null">
  283. AND e.job_nature_ = #{jobNature}
  284. </if>
  285. <if test="search != null">
  286. AND (su.real_name_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%') or su.id_ like CONCAT('%',#{search},'%'))
  287. </if>
  288. <if test="roleId != null">
  289. AND sur.role_id_ = #{roleId}
  290. </if>
  291. <if test="userIds != null and userIds.size() > 0">
  292. AND e.user_id_ IN
  293. <foreach collection="userIds" item="userId" separator="," open="(" close=")">
  294. #{userId}
  295. </foreach>
  296. </if>
  297. </where>
  298. </select>
  299. <select id="queryUserRole" resultType="java.lang.Integer">
  300. SELECT sur.role_id_ FROM sys_user_role sur WHERE sur.user_id_ = #{userId}
  301. </select>
  302. <select id="findByRole" resultType="com.ym.mec.biz.dal.dto.SimpleUserDto">
  303. SELECT DISTINCT su.id_ userId,
  304. su.real_name_ userName,
  305. su.avatar_ avatar,
  306. e.organ_id_list_ organIds
  307. FROM
  308. sys_user su
  309. LEFT JOIN sys_user_role sur ON su.id_ = sur.user_id_
  310. LEFT JOIN employee e ON e.user_id_ = su.id_
  311. WHERE
  312. su.lock_flag_ = 0 AND su.del_flag_ = '0' AND FIND_IN_SET(sur.role_id_, #{roleIds})
  313. <if test="organIds!=null and organIds!=''">
  314. AND INTE_ARRAY(e.organ_id_list_,#{organIds})
  315. </if>
  316. </select>
  317. <select id="findByIds" resultType="com.ym.mec.biz.dal.dto.SimpleUserDto">
  318. SELECT su.id_ userId,su.real_name_ userName
  319. FROM sys_user su
  320. WHERE id_ IN
  321. <foreach collection="userIds" item="userId" separator="," open="(" close=")">
  322. #{userId}
  323. </foreach>
  324. </select>
  325. <select id="hasCourseGroupRelation" resultType="java.lang.Integer">
  326. SELECT SUM(a.num) FROM
  327. (SELECT COUNT(vg.id_) num FROM vip_group vg WHERE vg.educational_teacher_id_ = #{employeeId} AND vg.group_status_ IN (0,1,5,2,6,4)
  328. UNION ALL
  329. SELECT COUNT(mg.id_) num FROM music_group mg WHERE mg.educational_teacher_id_ = #{employeeId} AND mg.status_ != 'CANCELED'
  330. UNION ALL
  331. SELECT COUNT(pg.id_) num FROM practice_group pg WHERE pg.educational_teacher_id_ = #{employeeId} AND pg.group_status_ != 'CANCEL')a
  332. </select>
  333. <select id="hasCourseSchedule" resultType="java.lang.Integer">
  334. SELECT COUNT(DISTINCT cs.id_)
  335. FROM course_schedule_teacher_salary csts
  336. LEFT JOIN course_schedule cs ON cs.id_ = csts.course_schedule_id_
  337. AND CONCAT(cs.class_date_,' ',cs.start_class_time_) > NOW() AND cs.del_flag_ = '0' AND cs.pre_course_flag_ != 1
  338. WHERE csts.user_id_ = #{employeeId}
  339. </select>
  340. <select id="queryRepairOrganList" resultType="java.lang.Integer">
  341. SELECT DISTINCT organ_id_ FROM music_group mg
  342. WHERE repair_user_id_ = #{userId}
  343. </select>
  344. <select id="queryEducationOrganList" resultType="java.lang.Integer">
  345. SELECT DISTINCT c.organ_id_ FROM (
  346. SELECT organ_id_ FROM music_group
  347. WHERE educational_teacher_id_ = #{userId}
  348. UNION
  349. SELECT organ_id_ FROM practice_group
  350. WHERE educational_teacher_id_ = #{userId}
  351. UNION
  352. SELECT organ_id_ FROM vip_group
  353. WHERE educational_teacher_id_ = #{userId}) c
  354. </select>
  355. <select id="queryTeamTeacherOrganList" resultType="java.lang.Integer">
  356. SELECT DISTINCT organ_id_ FROM music_group
  357. WHERE team_teacher_id_ = #{userId}
  358. </select>
  359. <select id="queryDirectorOrganList" resultType="java.lang.Integer">
  360. SELECT DISTINCT organ_id_ FROM music_group
  361. WHERE director_user_id_ = #{userId}
  362. </select>
  363. <update id="employeeLevel">
  364. <foreach collection="employeeLevelDtos" item="item">
  365. <if test="item.roleName == 'repair'">
  366. UPDATE music_group SET repair_user_id_ = #{item.transferUserId} WHERE repair_user_id_ = #{item.levelUserId} AND organ_id_ = #{item.organId};
  367. </if>
  368. <if test="item.roleName == 'education'">
  369. UPDATE music_group SET educational_teacher_id_ = #{item.transferUserId} WHERE educational_teacher_id_ = #{item.levelUserId} AND organ_id_ = #{item.organId};
  370. UPDATE practice_group SET educational_teacher_id_ = #{item.transferUserId} WHERE educational_teacher_id_ = #{item.levelUserId} AND organ_id_ = #{item.organId};
  371. UPDATE vip_group SET educational_teacher_id_ = #{item.transferUserId} WHERE educational_teacher_id_ = #{item.levelUserId} AND organ_id_ = #{item.organId};
  372. </if>
  373. <if test="item.roleName == 'teamTeacher'">
  374. UPDATE music_group SET team_teacher_id_ = #{item.transferUserId} WHERE team_teacher_id_ = #{item.levelUserId} AND organ_id_ = #{item.organId};
  375. </if>
  376. <if test="item.roleName == 'director'">
  377. UPDATE music_group SET director_user_id_ = #{item.transferUserId} WHERE director_user_id_ = #{item.levelUserId} AND organ_id_ = #{item.organId};
  378. </if>
  379. </foreach>
  380. </update>
  381. <select id="findAllByRole" resultType="com.ym.mec.biz.dal.dto.SimpleUserDto">
  382. SELECT DISTINCT su.id_ userId,
  383. su.real_name_ userName,
  384. su.avatar_ avatar,
  385. e.organ_id_list_ organIds
  386. FROM
  387. sys_user su
  388. LEFT JOIN sys_user_role sur ON su.id_ = sur.user_id_
  389. LEFT JOIN employee e ON e.user_id_ = su.id_
  390. WHERE FIND_IN_SET(sur.role_id_, #{roleIds})
  391. <if test="organIds!=null and organIds!=''">
  392. AND INTE_ARRAY(e.organ_id_list_,#{organIds})
  393. </if>
  394. </select>
  395. <select id="queryMusicGroupIdByUserId" resultType="java.lang.String">
  396. SELECT DISTINCT id_ FROM music_group
  397. WHERE (director_user_id_ = #{levelUserId} OR educational_teacher_id_ = #{levelUserId} OR team_teacher_id_ = #{levelUserId} OR repair_user_id_ = #{levelUserId})
  398. AND status_ IN ('PROGRESS','PAUSE','PREPARE')
  399. </select>
  400. <select id="queryPracticeGroupIdByUserId" resultType="java.lang.String">
  401. SELECT DISTINCT id_ FROM practice_group
  402. WHERE educational_teacher_id_ = #{levelUserId} AND group_status_ = 'NORMAL'
  403. </select>
  404. <select id="queryVipGroupIdByUserId" resultType="java.lang.String">
  405. SELECT DISTINCT id_ FROM vip_group
  406. WHERE educational_teacher_id_ = #{levelUserId} AND group_status_ IN (2,6)
  407. </select>
  408. <select id="getUsers" resultMap="SysUser">
  409. select * from sys_user where id_ IN
  410. <foreach collection="userIds" open="(" close=")" separator="," item="userId">
  411. #{userId}
  412. </foreach>
  413. </select>
  414. <select id="countEmployeeBasicInfo" resultType="java.lang.Integer">
  415. SELECT COUNT(e.user_id_)
  416. FROM employee e
  417. LEFT JOIN sys_user su ON su.id_ = e.user_id_
  418. <include refid="queryEmployeeBasicInfoSql"/>
  419. </select>
  420. <select id="queryEmployeeBasicInfo" resultMap="com.ym.mec.biz.dal.dao.StudentDao.SysUserDto">
  421. SELECT e.user_id_,su.real_name_ username_,su.phone_
  422. FROM employee e
  423. LEFT JOIN sys_user su ON su.id_ = e.user_id_
  424. <include refid="queryEmployeeBasicInfoSql"/>
  425. <include refid="global.limit"/>
  426. </select>
  427. <sql id="queryEmployeeBasicInfoSql">
  428. <where>
  429. e.demission_date_ IS NULL AND su.lock_flag_ = 0 AND su.del_flag_ = '0'
  430. <if test="search != null and search != ''">
  431. AND (e.user_id_ = #{search} OR su.real_name_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
  432. </if>
  433. <if test="organId != null and organId != ''">
  434. AND INTE_ARRAY(e.organ_id_list_,#{organId})
  435. </if>
  436. <if test="imGroupId != null and imGroupId != ''">
  437. AND e.user_id_ NOT IN (SELECT user_id_ FROM im_group_member WHERE im_group_id_ = #{imGroupId})
  438. </if>
  439. </where>
  440. </sql>
  441. <select id="queryBaseInfoByPage" resultMap="Employee" parameterType="map">
  442. SELECT t.*,su.avatar_ FROM employee t
  443. LEFT JOIN sys_user su on t.user_id_ = su.id_
  444. <include refid="global.limit"/>
  445. </select>
  446. <select id="queryBaseInfoByCount" resultType="int">
  447. SELECT COUNT(*) FROM employee
  448. </select>
  449. </mapper>