EmployeeInfoMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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. <mapper namespace="com.ym.mec.biz.dal.dao.EmployeeInfoDao">
  5. <resultMap type="com.ym.mec.biz.dal.entity.EmployeeInfo" id="EmployeeInfo">
  6. <result column="id_" property="id" />
  7. <result column="real_name_" property="realName" />
  8. <result column="mobile_no_" property="mobileNo" />
  9. <result column="wechat_no_" property="wechatNo" />
  10. <result column="id_card_" property="idCard" />
  11. <result column="age_" property="age" />
  12. <result column="gender_" property="gender" />
  13. <result column="birthdate_" property="birthdate" />
  14. <result column="emergency_contact_name_" property="emergencyContactName" />
  15. <result column="emergency_contact_relation_" property="emergencyContactRelation" />
  16. <result column="emergency_contact_phone_" property="emergencyContactPhone" />
  17. <result column="live_city_" property="liveCity" />
  18. <result column="intention_city_" property="intentionCity" />
  19. <result column="educational_background_" property="educationalBackground" />
  20. <result column="subject_id_list_" property="subjectIdList" />
  21. <result column="job_subject_id_list_" property="jobSubjectIdList" />
  22. <result column="assessment_result_" property="assessmentResult" />
  23. <result column="other_comment_" property="otherComment" />
  24. <result column="entry_date_" property="entryDate" />
  25. <result column="entry_date_" property="entryDateStr" />
  26. <result column="position_" property="position" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
  27. <result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
  28. <result column="is_probation_period_" property="isProbationPeriod" />
  29. <result column="bank_card_no_" property="bankCardNo" />
  30. <result column="bank_address_" property="bankAddress" />
  31. <result column="resignation_date_" property="resignationDate" />
  32. <result column="resignation_date_" property="resignationDateStr" />
  33. <result column="resignation_reason_" property="resignationReason" />
  34. <result column="organ_id_" property="organId" />
  35. <result column="operator_id_" property="operatorId" />
  36. <result column="source_from_" property="sourceFrom" />
  37. <result column="job_type_" property="jobType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
  38. <result column="job_nature_" property="jobNature" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
  39. <result column="hrbp_" property="hrbp" />
  40. <result column="hrbp_name_" property="hrbpName" />
  41. <result column="create_time_" property="createTime" />
  42. <result column="update_time_" property="updateTime" />
  43. <result column="organName" property="organName" />
  44. <result column="subjectName" property="subjectName" />
  45. <result column="operatorName" property="operatorName" />
  46. <result column="next_visit_date_" property="nextVisitDate" />
  47. <result column="next_visit_date_" property="nextVisitDateStr" />
  48. <result column="tenant_id_" property="tenantId" />
  49. </resultMap>
  50. <resultMap type="com.ym.mec.biz.dal.dto.EmployeeInfoDto" id="EmployeeInfoDto" extends="EmployeeInfo">
  51. <collection property="employeeVisitList"
  52. select="com.ym.mec.biz.dal.dao.EmployeeVisitDao.queryByEmployeeInfoId"
  53. column="id_" />
  54. </resultMap>
  55. <!-- 根据主键查询一条记录 -->
  56. <select id="get" resultMap="EmployeeInfo">
  57. SELECT * FROM employee_info WHERE id_ = #{id}
  58. </select>
  59. <select id="queryDetail" resultMap="EmployeeInfoDto">
  60. SELECT * FROM employee_info WHERE id_ = #{id}
  61. </select>
  62. <!-- 全查询 -->
  63. <select id="findAll" resultMap="EmployeeInfo">
  64. SELECT * FROM employee_info where tenant_id_ = #{tenantId} ORDER
  65. BY id_
  66. </select>
  67. <!-- 向数据库增加一条记录 -->
  68. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.EmployeeInfo"
  69. useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  70. <!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval
  71. AS ID FROM DUAL </selectKey> -->
  72. INSERT INTO employee_info
  73. (id_,real_name_,mobile_no_,wechat_no_,id_card_,age_,gender_,birthdate_,emergency_contact_name_,emergency_contact_relation_,emergency_contact_phone_,live_city_,intention_city_,educational_background_,subject_id_list_,assessment_result_,other_comment_,entry_date_,organ_id_,position_,status_,is_probation_period_,bank_card_no_,bank_address_,resignation_date_,operator_id_,source_from_,create_time_,update_time_,job_subject_id_list_,resignation_reason_,job_type_,job_nature_,hrbp_,tenant_id_)
  74. VALUES(#{id},#{realName},#{mobileNo},#{wechatNo},#{idCard},#{age},#{gender},#{birthdate},#{emergencyContactName},#{emergencyContactRelation},#{emergencyContactPhone},#{liveCity},#{intentionCity},#{educationalBackground},#{subjectIdList},#{assessmentResult},#{otherComment},#{entryDate},#{organId},#{position,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{isProbationPeriod},#{bankCardNo},#{bankAddress},#{resignationDate},#{operatorId},#{sourceFrom},#{createTime},#{updateTime},#{jobSubjectIdList},#{resignationReason},#{jobType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{jobNature,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{hrbp},#{tenantId})
  75. </insert>
  76. <!-- 根据主键查询一条记录 -->
  77. <update id="update" parameterType="com.ym.mec.biz.dal.entity.EmployeeInfo">
  78. UPDATE employee_info
  79. <set>
  80. <if test="isProbationPeriod != null">
  81. is_probation_period_ = #{isProbationPeriod},
  82. </if>
  83. <if test="subjectIdList != null">
  84. subject_id_list_ = #{subjectIdList},
  85. </if>
  86. gender_ = #{gender},
  87. entry_date_ = #{entryDate},
  88. other_comment_ = #{otherComment},
  89. <if test="status != null">
  90. status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  91. </if>
  92. educational_background_ = #{educationalBackground},
  93. emergency_contact_phone_ = #{emergencyContactPhone},
  94. resignation_date_ = #{resignationDate},
  95. position_ = #{position,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  96. <if test="updateTime != null">
  97. update_time_ = #{updateTime},
  98. </if>
  99. emergency_contact_relation_ = #{emergencyContactRelation},
  100. <if test="id != null">
  101. id_ = #{id},
  102. </if>
  103. bank_card_no_ = #{bankCardNo},
  104. real_name_ = #{realName},
  105. id_card_ = #{idCard},
  106. age_ = #{age},
  107. live_city_ = #{liveCity},
  108. intention_city_ = #{intentionCity},
  109. <if test="createTime != null">
  110. create_time_ = #{createTime},
  111. </if>
  112. wechat_no_ = #{wechatNo},
  113. assessment_result_ = #{assessmentResult},
  114. mobile_no_ = #{mobileNo},
  115. emergency_contact_name_ = #{emergencyContactName},
  116. birthdate_ = #{birthdate},
  117. bank_address_ = #{bankAddress},
  118. <if test="organId != null">
  119. organ_id_ = #{organId},
  120. </if>
  121. <if test="operatorId != null">
  122. operator_id_ = #{operatorId},
  123. </if>
  124. <if test="jobSubjectIdList != null">
  125. job_subject_id_list_ = #{jobSubjectIdList},
  126. </if>
  127. <if test="resignationReason != null">
  128. resignation_reason_ = #{resignationReason},
  129. </if>
  130. <if test="jobType != null">
  131. job_type_ = #{jobType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  132. </if>
  133. <if test="jobNature != null">
  134. job_nature_ = #{jobNature,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  135. </if>
  136. <if test="hrbp != null">
  137. hrbp_ = #{hrbp},
  138. </if>
  139. <if test="nextVisitDate != null">
  140. next_visit_date_ = #{nextVisitDate},
  141. </if>
  142. source_from_ = #{sourceFrom}
  143. </set>
  144. WHERE id_ = #{id} and tenant_id_ = #{tenantId}
  145. </update>
  146. <!-- 根据主键删除一条记录 -->
  147. <delete id="delete">
  148. DELETE FROM employee_info WHERE id_ = #{id}
  149. </delete>
  150. <sql id="queryPageMap">
  151. <where>
  152. tenant_id_ = #{tenantId}
  153. <if test="notMobileAndWechat == 1">
  154. AND ei.mobile_no_ IS NULL AND ei.wechat_no_ IS NULL
  155. </if>
  156. <if test="notMobileAndWechat == 0">
  157. AND (ei.mobile_no_ IS NOT NULL OR ei.wechat_no_ IS NOT NULL)
  158. </if>
  159. <if test="organId != null">
  160. AND ei.organ_id_ = #{organId}
  161. </if>
  162. <if test="userNameOrIdOrMobile != null">
  163. AND (ei.real_name_ LIKE CONCAT('%',#{userNameOrIdOrMobile},'%') OR ei.mobile_no_ LIKE CONCAT('%',#{userNameOrIdOrMobile},'%') OR ei.id_ = #{userNameOrIdOrMobile})
  164. </if>
  165. <if test="subjectId != null">
  166. AND find_in_set(#{subjectId},ei.subject_id_list_)
  167. </if>
  168. <if test="sourceFrom != null">
  169. AND ei.source_from_ = #{sourceFrom}
  170. </if>
  171. <if test="hrbp != null">
  172. AND ei.hrbp_ = #{hrbp}
  173. </if>
  174. <if test="intentionCity != null">
  175. AND ei.intention_city_ LIKE CONCAT('%',#{intentionCity},'%')
  176. </if>
  177. <if test="position != null">
  178. AND ei.position_ = #{position,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  179. </if>
  180. <if test="status != null">
  181. AND ei.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  182. </if>
  183. <if test="startDate != null">
  184. AND date(ei.update_time_) &gt;= #{startDate}
  185. </if>
  186. <if test="endDate != null">
  187. AND date(ei.update_time_) &lt;= #{endDate}
  188. </if>
  189. <if test="visitStartDate != null">
  190. AND date(ei.next_visit_date_) &gt;= #{visitStartDate}
  191. </if>
  192. <if test="visitEndDate != null">
  193. AND date(ei.next_visit_date_) &lt;= #{visitEndDate}
  194. </if>
  195. <if test="operator != null">
  196. AND (ei.operator_id_ like concat('%',#{operator},'%') or u.real_name_ like concat('%',#{operator},'%'))
  197. </if>
  198. </where>
  199. </sql>
  200. <!-- 分页查询 -->
  201. <select id="queryPage" resultMap="EmployeeInfo" parameterType="map">
  202. SELECT o.name_ organName,group_concat(s.name_) subjectName,u.real_name_ operatorName,ei.*,u1.real_name_ hrbp_name_ FROM employee_info ei
  203. left join subject s on find_in_set(s.id_,ei.subject_id_list_)
  204. left join organization o on o.id_ = ei.organ_id_
  205. left join sys_user u on u.id_ = ei.operator_id_
  206. left join sys_user u1 on u1.id_ = ei.hrbp_
  207. <include refid="queryPageMap"/>
  208. GROUP BY ei.id_
  209. ORDER BY ei.update_time_ desc
  210. <include refid="global.limit" />
  211. </select>
  212. <!-- 查询当前表的总记录数 -->
  213. <select id="queryCount" resultType="int">
  214. SELECT COUNT(ei.id_) FROM employee_info ei
  215. left join sys_user u on u.id_ = ei.operator_id_
  216. <include refid="queryPageMap"/>
  217. </select>
  218. <select id="findByPhone" resultMap="EmployeeInfo">
  219. SELECT * FROM employee_info WHERE mobile_no_ = #{mobileNo}
  220. </select>
  221. </mapper>