UserInfoDao.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  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. <mapper namespace="com.jeeplus.modules.hr.dao.UserInfoDao">
  4. <sql id="userInfoColumns">
  5. a.id AS "id",
  6. a.create_by AS "createBy.id",
  7. a.create_date AS "createDate",
  8. a.update_by AS "updateBy.id",
  9. a.update_date AS "updateDate",
  10. a.remarks AS "remarks",
  11. a.del_flag AS "delFlag",
  12. a.user_id AS "userId",
  13. a.company_id AS "companyId",
  14. a.name AS "name",
  15. a.nick_name AS "nickName",
  16. a.gender AS "gender",
  17. a.job_number AS "jobNumber",
  18. a.highest_degree AS "highestDegree",
  19. a.highest_school AS "highestSchool",
  20. a.highest_profession AS "highestProfession",
  21. a.highest_graduationtime AS "highestGraduationTime",
  22. a.first_degree AS "firstDegree",
  23. a.first_chool AS "firstSchool",
  24. a.first_profession AS "firstProfession",
  25. a.first_graduationtime AS "firstGraduationTime",
  26. a.birthday AS "birthday",
  27. a.id_card AS "idCard",
  28. a.professional_title AS "professionalTitle",
  29. a.professional_getdate AS "professionalGetdate",
  30. a.social_insurance_account AS "socialInsuranceAccount",
  31. a.medical_insurance_account AS "medicalInsuranceAccount",
  32. a.bank_account AS "bankAccount",
  33. a.provident_fund_account AS "providentFundAccount",
  34. a.qq AS "qq",
  35. a.weixin AS "weixin",
  36. a.mobilephone AS "mobilePhone",
  37. a.email AS "email",
  38. a.is_costengineer AS "isCostengineer",
  39. a.costengineer_getdate AS "costengineerGetdate",
  40. a.workstart_date AS "workstartDate",
  41. a.probation_position AS "probationPosition",
  42. a.probation_duration AS "probationDuration",
  43. a.probation_enddate AS "probationEnddate",
  44. a.professional_qualification AS "professionalQualification",
  45. a.engaged_job AS "engagedJob",
  46. a.other_qualification AS "otherQualification",
  47. a.personal_profile AS "personalProfile"
  48. </sql>
  49. <sql id="userInfoJoins">
  50. </sql>
  51. <select id="findUserInfoList" resultType="UserInfo" >
  52. SELECT
  53. ui.id AS "id",
  54. ui.create_by AS "createBy",
  55. ui.create_date AS "reateDate",
  56. ui.update_by AS "updateBy.id",
  57. ui.update_date AS "updateDate",
  58. ui.remarks AS "remarks",
  59. ui.del_flag AS "delFlag",
  60. ui.user_id AS "userId",
  61. ui.company_id AS "companyId",
  62. ui.name AS "name",
  63. ui.nick_name AS "nickName",
  64. ui.gender AS "gender",
  65. ui.job_number AS "jobNumber",
  66. ui.highest_degree AS "highestDegree",
  67. ui.highest_school AS "highestSchool",
  68. ui.highest_profession AS "highestProfession",
  69. ui.highest_graduationtime AS "highestGraduationTime",
  70. ui.first_degree AS "firstDegree",
  71. ui.first_chool AS "firstSchool",
  72. ui.first_profession AS "firstProfession",
  73. ui.first_graduationtime AS "firstGraduationTime",
  74. ui.birthday AS "birthday",
  75. ui.id_card AS "idCard",
  76. ui.professional_title AS "professionalTitle",
  77. ui.professional_getdate AS "professionalGetdate",
  78. ui.social_insurance_account AS "socialInsuranceAccount",
  79. ui.medical_insurance_account AS "medicalInsuranceAccount",
  80. ui.bank_account AS "bankAccount",
  81. ui.provident_fund_account AS "providentFundAccount",
  82. ui.qq AS "qq",
  83. ui.weixin AS "weixin",
  84. ui.mobilephone AS "mobilePhone",
  85. ui.email AS "email",
  86. ui.is_costengineer AS "isCostengineer",
  87. ui.costengineer_getdate AS "costengineerGetdate",
  88. ui.workstart_date AS "workstartDate",
  89. ui.probation_position AS "probationPosition",
  90. ui.probation_duration AS "probationDuration",
  91. ui.probation_enddate AS "probationEnddate",
  92. ui.professional_qualification AS "professionalQualification",
  93. ui.engaged_job AS "engagedJob",
  94. ui.other_qualification AS "otherQualification",
  95. ui.personal_profile AS "personalProfile",
  96. uo.id AS "userOffice.id",
  97. uo.create_by AS "userOffice.createBy.id",
  98. uo.create_date AS "userOffice.createDate",
  99. uo.update_by AS "userOffice.updateBy.id",
  100. uo.update_date AS "userOffice.updateDate",
  101. uo.remarks AS "userOffice.remarks",
  102. uo.del_flag AS "userOffice.delFlag",
  103. uo.user_id AS "userOffice.userId",
  104. uo.company_id AS "userOffice.companyId",
  105. uo.office_id AS "userOffice.officeId",
  106. uo.master AS "userOffice.master",
  107. uo.status AS "userOffice.status",
  108. u.id AS "userOffice.user.id",
  109. u.com_id AS "userOffice.user.comId",
  110. u.company_id AS "userOffice.user.company.id",
  111. u.office_id AS "userOffice.user.office.id",
  112. u.login_name AS "userOffice.user.loginName",
  113. u.password AS "userOffice.user.passwork",
  114. u.password_remake AS "userOffice.user.passwordRemake",
  115. u.no AS "userOffice.user.no",
  116. u.name AS "userOffice.user.name",
  117. u.sex AS "userOffice.user.sex",
  118. u.email AS "userOffice.user.email",
  119. u.phone AS "userOffice.user.phone",
  120. u.mobile AS "userOffice.user.mobile",
  121. u.ishide AS "userOffice.user.ishide",
  122. u.user_type AS "userOffice.user.userType",
  123. u.login_ip AS "userOffice.user.loginIp",
  124. u.login_date AS "userOffice.user.loginDate",
  125. u.remarks AS "userOffice.user.remarks",
  126. u.login_flag AS "userOffice.user.loginFlag",
  127. u.photo AS "userOffice.user.photo",
  128. u.default_photo AS "userOffice.user.defaultPhoto",
  129. u.qrcode AS "userOffice.user.qrcode",
  130. u.sign AS "userOffice.user.sign",
  131. u.create_by AS "userOffice.user.createBy.id",
  132. u.create_date AS "userOffice.user.createDate",
  133. u.update_by AS "userOffice.user.updateBy.id",
  134. u.update_date AS "userOffice.user.updateDate",
  135. u.del_flag AS "userOffice.user.delFlag"
  136. FROM sys_user_office uo
  137. LEFT JOIN sys_user u ON u.id = uo.user_id
  138. LEFT JOIN sys_user_info ui ON ui.sys_user_office_id = uo.id
  139. <where>
  140. uo.del_flag = '0'
  141. AND uo.status = '3'
  142. <if test="companyId !=null and companyId !=''">
  143. AND uo.company_id = #{companyId}
  144. </if>
  145. <if test="name != null and name !=''">
  146. AND (ui.name LIKE concat('%',#{name},'%') or u.name LIKE concat('%',#{name},'%'))
  147. </if>
  148. <if test="gender != null and gender !=''">
  149. AND (ui.gender = #{gender} or u.sex = #{gender})
  150. </if>
  151. <if test="mobilePhone !=null and mobilePhone != ''">
  152. AND (ui.mobilePhone LIKE concat('%',#{mobilePhone},'%') or u.phone LIKE concat ('%',#{mobilePhone},'%'))
  153. </if>
  154. <if test="idCard !=null and idCard !=''">
  155. AND (ui.id_card LIKE concat('%',#{idCard},'%'))
  156. </if>
  157. <if test="officeId != null and officeId !=''">
  158. AND uo.office_id = #{officeId}
  159. </if>
  160. </where>
  161. <choose>
  162. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  163. ORDER BY ${page.orderBy}
  164. </when>
  165. <otherwise>
  166. ORDER BY uo.create_by DESC
  167. </otherwise>
  168. </choose>
  169. </select>
  170. <select id="findUserInfoByUserIdCompanyId" resultType="UserInfo">
  171. SELECT <include refid="userInfoColumns"/>
  172. FROM sys_user_info a
  173. WHERE a.del_flag = '0'
  174. AND user_id = #{userId}
  175. AND company_id = #{companyId}
  176. </select>
  177. <select id="get" resultType="UserInfo" >
  178. SELECT
  179. <include refid="userInfoColumns"/>
  180. FROM sys_user_info a
  181. <include refid="userInfoJoins"/>
  182. WHERE a.id = #{id}
  183. </select>
  184. <select id="findList" resultType="UserInfo">
  185. SELECT
  186. <include refid="userInfoColumns"/>,
  187. FROM sys_user_info a
  188. <include refid="userInfoJoins"/>
  189. <where>
  190. a.del_flag = #{DEL_FLAG_NORMAL}
  191. </where>
  192. <choose>
  193. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  194. ORDER BY ${page.orderBy}
  195. </when>
  196. <otherwise>
  197. ORDER BY a.update_date DESC
  198. </otherwise>
  199. </choose>
  200. </select>
  201. <select id="findAllList" resultType="UserInfo" >
  202. SELECT
  203. <include refid="userInfoColumns"/>
  204. FROM sys_user_info a
  205. <include refid="userInfoJoins"/>
  206. <where>
  207. a.del_flag = #{DEL_FLAG_NORMAL}
  208. </where>
  209. <choose>
  210. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  211. ORDER BY ${page.orderBy}
  212. </when>
  213. <otherwise>
  214. ORDER BY a.update_date DESC
  215. </otherwise>
  216. </choose>
  217. </select>
  218. <insert id="insert">
  219. INSERT INTO sys_user_info(
  220. id,
  221. create_by,
  222. create_date,
  223. update_by,
  224. update_date,
  225. remarks,
  226. del_flag,
  227. user_id,
  228. company_id,
  229. sys_user_office_id,
  230. name,
  231. nick_name,
  232. gender,
  233. job_number,
  234. highest_degree,
  235. highest_school,
  236. highest_profession,
  237. highest_graduationtime,
  238. first_degree,
  239. first_chool,
  240. first_profession,
  241. first_graduationtime,
  242. birthday,
  243. id_card,
  244. professional_title,
  245. professional_getdate,
  246. social_insurance_account,
  247. medical_insurance_account,
  248. bank_account,
  249. provident_fund_account,
  250. qq,
  251. weixin,
  252. mobilephone,
  253. email,
  254. is_costengineer,
  255. costengineer_getdate,
  256. workstart_date,
  257. probation_position,
  258. probation_duration,
  259. probation_enddate,
  260. professional_qualification,
  261. engaged_job,
  262. other_qualification,
  263. personal_profile
  264. ) VALUES (
  265. #{id},
  266. #{createBy.id},
  267. #{createDate},
  268. #{updateBy.id},
  269. #{updateDate},
  270. #{remarks},
  271. #{delFlag},
  272. #{userId},
  273. #{companyId},
  274. #{userOffice.id},
  275. #{name},
  276. #{nickName},
  277. #{gender},
  278. #{jobNumber},
  279. #{highestDegree},
  280. #{highestSchool},
  281. #{highestProfession},
  282. #{highestGraduationTime},
  283. #{firstDegree},
  284. #{firstSchool},
  285. #{firstProfession},
  286. #{firstGraduationTime},
  287. #{birthday},
  288. #{idCard},
  289. #{professionalTitle},
  290. #{professionalGetdate},
  291. #{socialInsuranceAccount},
  292. #{medicalInsuranceAccount},
  293. #{bankAccount},
  294. #{providentFundAccount},
  295. #{qq},
  296. #{weixin},
  297. #{mobilePhone},
  298. #{email},
  299. #{isCostengineer},
  300. #{costengineerGetdate},
  301. #{workstartDate},
  302. #{probationPosition},
  303. #{probationDuration},
  304. #{probationEnddate},
  305. #{professionalQualification},
  306. #{engagedJob},
  307. #{otherQualification},
  308. #{personalProfile}
  309. )
  310. </insert>
  311. <update id="update">
  312. UPDATE sys_user_info SET
  313. update_by = #{updateBy.id},
  314. update_date = #{updateDate},
  315. remarks = #{remarks},
  316. user_id = #{userId},
  317. company_id = #{companyId},
  318. name = #{name},
  319. nick_name = #{nickName},
  320. gender = #{gender},
  321. job_number = #{jobNumber},
  322. highest_degree = #{highestDegree},
  323. highest_school = #{highestSchool},
  324. highest_profession = #{highestProfession},
  325. highest_graduationtime = #{highestGraduationTime},
  326. first_degree = #{firstDegree},
  327. first_chool = #{firstSchool},
  328. first_profession = #{firstProfession},
  329. first_graduationtime = #{firstGraduationTime},
  330. birthday = #{birthday},
  331. id_card = #{idCard},
  332. professional_title = #{professionalTitle},
  333. professional_getdate = #{professionalGetdate},
  334. social_insurance_account = #{socialInsuranceAccount},
  335. medical_insurance_account = #{medicalInsuranceAccount},
  336. bank_account = #{bankAccount},
  337. provident_fund_account = #{providentFundAccount},
  338. qq = #{qq},
  339. weixin = #{weixin},
  340. mobilephone = #{mobilePhone},
  341. email = #{email},
  342. is_costengineer = #{isCostengineer},
  343. costengineer_getdate = #{costengineerGetdate},
  344. workstart_date = #{workstartDate},
  345. probation_position = #{probationPosition},
  346. probation_duration = #{probationDuration},
  347. probation_enddate = #{probationEnddate},
  348. professional_qualification = #{professionalQualification},
  349. engaged_job = #{engagedJob},
  350. other_qualification = #{otherQualification},
  351. personal_profile = #{personalProfile},
  352. sys_user_office_id = #{userOffice.id}
  353. WHERE id = #{id}
  354. </update>
  355. <!--物理删除-->
  356. <update id="delete">
  357. DELETE FROM sys_user_info
  358. WHERE id = #{id}
  359. </update>
  360. <!--逻辑删除-->
  361. <update id="deleteByLogic">
  362. UPDATE sys_user_info SET
  363. del_flag = #{DEL_FLAG_DELETE}
  364. WHERE id = #{id}
  365. </update>
  366. <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
  367. <select id="findUniqueByProperty" resultType="UserInfo" statementType="STATEMENT">
  368. select * FROM sys_user_info where ${propertyName} = '${value}'
  369. </select>
  370. </mapper>