123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- <?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="com.ym.mec.biz.dal.dao.EmployeeInfoDao">
- <resultMap type="com.ym.mec.biz.dal.entity.EmployeeInfo" id="EmployeeInfo">
- <result column="id_" property="id" />
- <result column="real_name_" property="realName" />
- <result column="mobile_no_" property="mobileNo" />
- <result column="wechat_no_" property="wechatNo" />
- <result column="id_card_" property="idCard" />
- <result column="age_" property="age" />
- <result column="gender_" property="gender" />
- <result column="birthdate_" property="birthdate" />
- <result column="emergency_contact_name_" property="emergencyContactName" />
- <result column="emergency_contact_relation_" property="emergencyContactRelation" />
- <result column="emergency_contact_phone_" property="emergencyContactPhone" />
- <result column="live_city_" property="liveCity" />
- <result column="intention_city_" property="intentionCity" />
- <result column="educational_background_" property="educationalBackground" />
- <result column="subject_id_list_" property="subjectIdList" />
- <result column="job_subject_id_list_" property="jobSubjectIdList" />
- <result column="assessment_result_" property="assessmentResult" />
- <result column="other_comment_" property="otherComment" />
- <result column="entry_date_" property="entryDate" />
- <result column="entry_date_" property="entryDateStr" />
- <result column="position_" property="position" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
- <result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
- <result column="is_probation_period_" property="isProbationPeriod" />
- <result column="bank_card_no_" property="bankCardNo" />
- <result column="bank_address_" property="bankAddress" />
- <result column="resignation_date_" property="resignationDate" />
- <result column="resignation_date_" property="resignationDateStr" />
- <result column="resignation_reason_" property="resignationReason" />
- <result column="organ_id_" property="organId" />
- <result column="operator_id_" property="operatorId" />
- <result column="source_from_" property="sourceFrom" />
- <result column="job_type_" property="jobType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
- <result column="job_nature_" property="jobNature" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
- <result column="hrbp_" property="hrbp" />
- <result column="hrbp_name_" property="hrbpName" />
- <result column="create_time_" property="createTime" />
- <result column="update_time_" property="updateTime" />
- <result column="organName" property="organName" />
- <result column="subjectName" property="subjectName" />
- <result column="operatorName" property="operatorName" />
- <result column="next_visit_date_" property="nextVisitDate" />
- <result column="next_visit_date_" property="nextVisitDateStr" />
- <result column="tenant_id_" property="tenantId" />
- </resultMap>
-
- <resultMap type="com.ym.mec.biz.dal.dto.EmployeeInfoDto" id="EmployeeInfoDto" extends="EmployeeInfo">
-
- <collection property="employeeVisitList"
- select="com.ym.mec.biz.dal.dao.EmployeeVisitDao.queryByEmployeeInfoId"
- column="id_" />
-
- </resultMap>
- <!-- 根据主键查询一条记录 -->
- <select id="get" resultMap="EmployeeInfo">
- SELECT * FROM employee_info WHERE id_ = #{id}
- </select>
-
- <select id="queryDetail" resultMap="EmployeeInfoDto">
- SELECT * FROM employee_info WHERE id_ = #{id}
- </select>
- <!-- 全查询 -->
- <select id="findAll" resultMap="EmployeeInfo">
- SELECT * FROM employee_info where tenant_id_ = #{tenantId} ORDER
- BY id_
- </select>
- <!-- 向数据库增加一条记录 -->
- <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.EmployeeInfo"
- useGeneratedKeys="true" keyColumn="id" keyProperty="id">
- <!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval
- AS ID FROM DUAL </selectKey> -->
- INSERT INTO employee_info
- (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_)
- 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})
- </insert>
- <!-- 根据主键查询一条记录 -->
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.EmployeeInfo">
- UPDATE employee_info
- <set>
- <if test="isProbationPeriod != null">
- is_probation_period_ = #{isProbationPeriod},
- </if>
- <if test="subjectIdList != null">
- subject_id_list_ = #{subjectIdList},
- </if>
- gender_ = #{gender},
- entry_date_ = #{entryDate},
- other_comment_ = #{otherComment},
- <if test="status != null">
- status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- </if>
- educational_background_ = #{educationalBackground},
- emergency_contact_phone_ = #{emergencyContactPhone},
- resignation_date_ = #{resignationDate},
- position_ = #{position,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- <if test="updateTime != null">
- update_time_ = #{updateTime},
- </if>
- emergency_contact_relation_ = #{emergencyContactRelation},
- <if test="id != null">
- id_ = #{id},
- </if>
- bank_card_no_ = #{bankCardNo},
- real_name_ = #{realName},
- id_card_ = #{idCard},
- age_ = #{age},
- live_city_ = #{liveCity},
- intention_city_ = #{intentionCity},
- <if test="createTime != null">
- create_time_ = #{createTime},
- </if>
- wechat_no_ = #{wechatNo},
- assessment_result_ = #{assessmentResult},
- mobile_no_ = #{mobileNo},
- emergency_contact_name_ = #{emergencyContactName},
- birthdate_ = #{birthdate},
- bank_address_ = #{bankAddress},
- <if test="organId != null">
- organ_id_ = #{organId},
- </if>
- <if test="operatorId != null">
- operator_id_ = #{operatorId},
- </if>
- <if test="jobSubjectIdList != null">
- job_subject_id_list_ = #{jobSubjectIdList},
- </if>
- <if test="resignationReason != null">
- resignation_reason_ = #{resignationReason},
- </if>
- <if test="jobType != null">
- job_type_ = #{jobType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="jobNature != null">
- job_nature_ = #{jobNature,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="hrbp != null">
- hrbp_ = #{hrbp},
- </if>
- <if test="nextVisitDate != null">
- next_visit_date_ = #{nextVisitDate},
- </if>
- source_from_ = #{sourceFrom}
- </set>
- WHERE id_ = #{id} and tenant_id_ = #{tenantId}
- </update>
- <!-- 根据主键删除一条记录 -->
- <delete id="delete">
- DELETE FROM employee_info WHERE id_ = #{id}
- </delete>
-
- <sql id="queryPageMap">
- <where>
- tenant_id_ = #{tenantId}
- <if test="notMobileAndWechat == 1">
- AND ei.mobile_no_ IS NULL AND ei.wechat_no_ IS NULL
- </if>
- <if test="notMobileAndWechat == 0">
- AND (ei.mobile_no_ IS NOT NULL OR ei.wechat_no_ IS NOT NULL)
- </if>
- <if test="organId != null">
- AND ei.organ_id_ = #{organId}
- </if>
- <if test="userNameOrIdOrMobile != null">
- AND (ei.real_name_ LIKE CONCAT('%',#{userNameOrIdOrMobile},'%') OR ei.mobile_no_ LIKE CONCAT('%',#{userNameOrIdOrMobile},'%') OR ei.id_ = #{userNameOrIdOrMobile})
- </if>
- <if test="subjectId != null">
- AND find_in_set(#{subjectId},ei.subject_id_list_)
- </if>
- <if test="sourceFrom != null">
- AND ei.source_from_ = #{sourceFrom}
- </if>
- <if test="hrbp != null">
- AND ei.hrbp_ = #{hrbp}
- </if>
- <if test="intentionCity != null">
- AND ei.intention_city_ LIKE CONCAT('%',#{intentionCity},'%')
- </if>
- <if test="position != null">
- AND ei.position_ = #{position,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- </if>
- <if test="status != null">
- AND ei.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- </if>
- <if test="startDate != null">
- AND date(ei.update_time_) >= #{startDate}
- </if>
- <if test="endDate != null">
- AND date(ei.update_time_) <= #{endDate}
- </if>
- <if test="visitStartDate != null">
- AND date(ei.next_visit_date_) >= #{visitStartDate}
- </if>
- <if test="visitEndDate != null">
- AND date(ei.next_visit_date_) <= #{visitEndDate}
- </if>
- <if test="operator != null">
- AND (ei.operator_id_ like concat('%',#{operator},'%') or u.real_name_ like concat('%',#{operator},'%'))
- </if>
- </where>
- </sql>
- <!-- 分页查询 -->
- <select id="queryPage" resultMap="EmployeeInfo" parameterType="map">
- SELECT o.name_ organName,group_concat(s.name_) subjectName,u.real_name_ operatorName,ei.*,u1.real_name_ hrbp_name_ FROM employee_info ei
- left join subject s on find_in_set(s.id_,ei.subject_id_list_)
- left join organization o on o.id_ = ei.organ_id_
- left join sys_user u on u.id_ = ei.operator_id_
- left join sys_user u1 on u1.id_ = ei.hrbp_
- <include refid="queryPageMap"/>
- GROUP BY ei.id_
- ORDER BY ei.update_time_ desc
- <include refid="global.limit" />
- </select>
- <!-- 查询当前表的总记录数 -->
- <select id="queryCount" resultType="int">
- SELECT COUNT(ei.id_) FROM employee_info ei
- left join sys_user u on u.id_ = ei.operator_id_
- <include refid="queryPageMap"/>
- </select>
- <select id="findByPhone" resultMap="EmployeeInfo">
- SELECT * FROM employee_info WHERE mobile_no_ = #{mobileNo}
- </select>
- </mapper>
|