EmployeeInfoMapper.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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="assessment_result_" property="assessmentResult" />
  22. <result column="other_comment_" property="otherComment" />
  23. <result column="entry_date_" property="entryDate" />
  24. <result column="position_" property="position" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
  25. <result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
  26. <result column="is_probation_period_" property="isProbationPeriod" />
  27. <result column="bank_card_no_" property="bankCardNo" />
  28. <result column="bank_address_" property="bankAddress" />
  29. <result column="resignation_date_" property="resignationDate" />
  30. <result column="organ_id_" property="organId" />
  31. <result column="operator_id_" property="operatorId" />
  32. <result column="source_from_" property="sourceFrom" />
  33. <result column="create_time_" property="createTime" />
  34. <result column="update_time_" property="updateTime" />
  35. <result column="organName" property="organName" />
  36. <result column="subjectName" property="subjectName" />
  37. <result column="operatorName" property="operatorName" />
  38. </resultMap>
  39. <!-- 根据主键查询一条记录 -->
  40. <select id="get" resultMap="EmployeeInfo">
  41. SELECT * FROM
  42. employee_info WHERE id_ = #{id}
  43. </select>
  44. <!-- 全查询 -->
  45. <select id="findAll" resultMap="EmployeeInfo">
  46. SELECT * FROM employee_info ORDER
  47. BY id_
  48. </select>
  49. <!-- 向数据库增加一条记录 -->
  50. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.EmployeeInfo"
  51. useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  52. <!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval
  53. AS ID FROM DUAL </selectKey> -->
  54. INSERT INTO employee_info
  55. (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_)
  56. 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})
  57. </insert>
  58. <!-- 根据主键查询一条记录 -->
  59. <update id="update" parameterType="com.ym.mec.biz.dal.entity.EmployeeInfo">
  60. UPDATE employee_info
  61. <set>
  62. <if test="isProbationPeriod != null">
  63. is_probation_period_ = #{isProbationPeriod},
  64. </if>
  65. <if test="subjectIdList != null">
  66. subject_id_list_ = #{subjectIdList},
  67. </if>
  68. gender_ = #{gender},
  69. entry_date_ = #{entryDate},
  70. other_comment_ = #{otherComment},
  71. <if test="status != null">
  72. status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  73. </if>
  74. educational_background_ = #{educationalBackground},
  75. emergency_contact_phone_ = #{emergencyContactPhone},
  76. resignation_date_ = #{resignationDate},
  77. position_ = #{position,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  78. <if test="updateTime != null">
  79. update_time_ = #{updateTime},
  80. </if>
  81. emergency_contact_relation_ = #{emergencyContactRelation},
  82. <if test="id != null">
  83. id_ = #{id},
  84. </if>
  85. bank_card_no_ = #{bankCardNo},
  86. real_name_ = #{realName},
  87. id_card_ = #{idCard},
  88. age_ = #{age},
  89. live_city_ = #{liveCity},
  90. intention_city_ = #{intentionCity},
  91. <if test="createTime != null">
  92. create_time_ = #{createTime},
  93. </if>
  94. wechat_no_ = #{wechatNo},
  95. assessment_result_ = #{assessmentResult},
  96. mobile_no_ = #{mobileNo},
  97. emergency_contact_name_ = #{emergencyContactName},
  98. birthdate_ = #{birthdate},
  99. bank_address_ = #{bankAddress},
  100. <if test="organId != null">
  101. organ_id_ = #{organId},
  102. </if>
  103. <if test="operatorId != null">
  104. operator_id_ = #{operatorId},
  105. </if>
  106. source_from_ = #{sourceFrom}
  107. </set>
  108. WHERE id_ = #{id}
  109. </update>
  110. <!-- 根据主键删除一条记录 -->
  111. <delete id="delete">
  112. DELETE FROM employee_info WHERE id_ = #{id}
  113. </delete>
  114. <sql id="queryPageMap">
  115. <where>
  116. <if test="organId != null">
  117. AND ei.organ_id_ = #{organId}
  118. </if>
  119. <if test="userNameOrIdOrMobile != null">
  120. AND (ei.real_name_ LIKE CONCAT('%',#{userNameOrIdOrMobile},'%') OR ei.mobile_no_ LIKE CONCAT('%',#{userNameOrIdOrMobile},'%') OR ei.id_ = #{userNameOrIdOrMobile})
  121. </if>
  122. <if test="subjectId != null">
  123. AND find_in_set(#{subjectId},ei.subject_id_list_)
  124. </if>
  125. <if test="sourceFrom != null">
  126. AND ei.source_from_ = #{sourceFrom}
  127. </if>
  128. <if test="position != null">
  129. AND ei.position_ = #{position,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  130. </if>
  131. <if test="status != null">
  132. AND ei.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  133. </if>
  134. <if test="startDate != null">
  135. AND ei.update_time_ &gt;= #{startDate}
  136. </if>
  137. <if test="endDate != null">
  138. AND ei.update_time_ &lt;= #{endDate}
  139. </if>
  140. </where>
  141. </sql>
  142. <!-- 分页查询 -->
  143. <select id="queryPage" resultMap="EmployeeInfo" parameterType="map">
  144. SELECT o.name_ organName,group_concat(s.name_) subjectName,u.real_name_ operatorName,ei.* FROM employee_info ei
  145. left join subject s on find_in_set(s.id_,ei.subject_id_list_)
  146. left join organization o on o.id_ = ei.organ_id_
  147. left join sys_user u on u.id_ = ei.operator_id_
  148. <include refid="queryPageMap"/>
  149. GROUP BY ei.id_
  150. ORDER BY ei.update_time_ desc
  151. <include refid="global.limit" />
  152. </select>
  153. <!-- 查询当前表的总记录数 -->
  154. <select id="queryCount" resultType="int">
  155. SELECT COUNT(ei.id_) FROM employee_info ei
  156. <include refid="queryPageMap"/>
  157. </select>
  158. </mapper>