|
@@ -6,22 +6,22 @@
|
|
|
-->
|
|
|
<mapper namespace="com.ym.mec.biz.dal.dao.EmployeeDao">
|
|
|
|
|
|
- <resultMap type="com.ym.mec.biz.dal.entity.Employee" id="Employee">
|
|
|
- <result column="user_id_" property="userId" />
|
|
|
- <result column="organ_id_list_" property="organIdList" />
|
|
|
- <result column="job_nature_" property="jobNature" />
|
|
|
- <result column="is_probation_period_" property="isProbationPeriod" />
|
|
|
- <result column="education_background_" property="educationBackground" />
|
|
|
- <result column="graduate_school_" property="graduateSchool" />
|
|
|
- <result column="technical_titles_" property="technicalTitles" />
|
|
|
- <result column="entry_date_" property="entryDate" />
|
|
|
- <result column="certificate_type_" property="certificateType" />
|
|
|
- <result column="certificate_num_" property="certificateNum" />
|
|
|
- <result column="update_time_" property="updateTime" />
|
|
|
- <result column="create_time_" property="createTime" />
|
|
|
- <result column="introduction_" property="introduction" />
|
|
|
- <result column="demission_date_" property="demissionDate" />
|
|
|
- </resultMap>
|
|
|
+ <resultMap type="com.ym.mec.biz.dal.entity.Employee" id="Employee">
|
|
|
+ <result column="user_id_" property="userId"/>
|
|
|
+ <result column="organ_id_list_" property="organIdList"/>
|
|
|
+ <result column="job_nature_" property="jobNature"/>
|
|
|
+ <result column="is_probation_period_" property="isProbationPeriod"/>
|
|
|
+ <result column="education_background_" property="educationBackground"/>
|
|
|
+ <result column="graduate_school_" property="graduateSchool"/>
|
|
|
+ <result column="technical_titles_" property="technicalTitles"/>
|
|
|
+ <result column="entry_date_" property="entryDate"/>
|
|
|
+ <result column="certificate_type_" property="certificateType"/>
|
|
|
+ <result column="certificate_num_" property="certificateNum"/>
|
|
|
+ <result column="update_time_" property="updateTime"/>
|
|
|
+ <result column="create_time_" property="createTime"/>
|
|
|
+ <result column="introduction_" property="introduction"/>
|
|
|
+ <result column="demission_date_" property="demissionDate"/>
|
|
|
+ </resultMap>
|
|
|
|
|
|
<resultMap type="com.ym.mec.auth.api.entity.SysUser" id="SysUser">
|
|
|
<result column="id_" property="id"/>
|
|
@@ -44,81 +44,85 @@
|
|
|
<result column="email_" property="email"/>
|
|
|
<result column="im_token_" property="imToken"/>
|
|
|
<result column="id_card_no_" property="idCardNo"/>
|
|
|
- <result column="esign_id_" property="esignId"/>
|
|
|
<result column="wechat_id_" property="wechatId"/>
|
|
|
</resultMap>
|
|
|
|
|
|
- <!-- 根据主键查询一条记录 -->
|
|
|
- <select id="get" resultMap="Employee" >
|
|
|
- SELECT * FROM employee WHERE user_id_ = #{userId}
|
|
|
+ <!-- 根据主键查询一条记录 -->
|
|
|
+ <select id="get" resultMap="Employee">
|
|
|
+ SELECT * FROM employee WHERE user_id_ = #{userId}
|
|
|
</select>
|
|
|
|
|
|
- <!-- 全查询 -->
|
|
|
- <select id="findAll" resultMap="Employee">
|
|
|
+ <!-- 全查询 -->
|
|
|
+ <select id="findAll" resultMap="Employee">
|
|
|
SELECT * FROM employee ORDER BY user_id_
|
|
|
</select>
|
|
|
-
|
|
|
- <!-- 向数据库增加一条记录 -->
|
|
|
- <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.Employee" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
- <!--
|
|
|
- <selectKey resultClass="int" keyProperty="id" >
|
|
|
- SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
|
|
|
- </selectKey>
|
|
|
- -->
|
|
|
- INSERT INTO employee (user_id_,organ_id_list_,job_nature_,is_probation_period_,education_background_,graduate_school_,technical_titles_,entry_date_,certificate_type_,certificate_num_,update_time_,create_time_,introduction_,demission_date_) VALUES(#{userId},#{organIdList},#{jobNature},#{isProbationPeriod},#{educationBackground},#{graduateSchool},#{technicalTitles},#{entryDate},#{certificateType},#{certificateNum},#{updateTime},#{createTime},#{introduction},#{demissionDate})
|
|
|
- </insert>
|
|
|
+
|
|
|
+ <!-- 向数据库增加一条记录 -->
|
|
|
+ <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.Employee" useGeneratedKeys="true" keyColumn="id"
|
|
|
+ keyProperty="id">
|
|
|
+ <!--
|
|
|
+ <selectKey resultClass="int" keyProperty="id" >
|
|
|
+ SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
|
|
|
+ </selectKey>
|
|
|
+ -->
|
|
|
+ INSERT INTO employee
|
|
|
+ (user_id_,organ_id_list_,job_nature_,is_probation_period_,education_background_,graduate_school_,technical_titles_,entry_date_,certificate_type_,certificate_num_,update_time_,create_time_,introduction_,demission_date_)
|
|
|
+ VALUES(#{userId},#{organIdList},#{jobNature},#{isProbationPeriod},#{educationBackground},#{graduateSchool},#{technicalTitles},#{entryDate},#{certificateType},#{certificateNum},now(),now(),#{introduction},#{demissionDate})
|
|
|
+ </insert>
|
|
|
+ <insert id="batchAddEmployeeRole">
|
|
|
+ INSERT INTO sys_user_role(user_id_,role_id_) values
|
|
|
+ <foreach collection="roleIds" item="item" index="index" separator=",">
|
|
|
+ (#{userId},#{item})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
|
|
|
<select id="queryByPhone" resultMap="SysUser">
|
|
|
select * from sys_user where phone_ = #{phone} OR username_ = #{phone}
|
|
|
</select>
|
|
|
-
|
|
|
- <!-- 根据主键查询一条记录 -->
|
|
|
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.Employee">
|
|
|
- UPDATE employee <set>
|
|
|
- <if test="isProbationPeriod != null">
|
|
|
- is_probation_period_ = #{isProbationPeriod},
|
|
|
- </if>
|
|
|
- <if test="graduateSchool != null">
|
|
|
- graduate_school_ = #{graduateSchool},
|
|
|
- </if>
|
|
|
- <if test="organId != null">
|
|
|
- organ_id_list_ = #{organIdList},
|
|
|
- </if>
|
|
|
- <if test="introduction != null">
|
|
|
- introduction_ = #{introduction},
|
|
|
- </if>
|
|
|
- <if test="technicalTitles != null">
|
|
|
- technical_titles_ = #{technicalTitles},
|
|
|
- </if>
|
|
|
- <if test="entryDate != null">
|
|
|
- entry_date_ = #{entryDate},
|
|
|
- </if>
|
|
|
- <if test="jobNature != null">
|
|
|
- job_nature_ = #{jobNature},
|
|
|
- </if>
|
|
|
- <if test="createTime != null">
|
|
|
- create_time_ = #{createTime},
|
|
|
- </if>
|
|
|
- <if test="userId != null">
|
|
|
- user_id_ = #{userId},
|
|
|
- </if>
|
|
|
- <if test="certificateType != null">
|
|
|
- certificate_type_ = #{certificateType},
|
|
|
- </if>
|
|
|
- <if test="updateTime != null">
|
|
|
- update_time_ = #{updateTime},
|
|
|
- </if>
|
|
|
- <if test="educationBackground != null">
|
|
|
- education_background_ = #{educationBackground},
|
|
|
- </if>
|
|
|
- <if test="certificateNum != null">
|
|
|
- certificate_num_ = #{certificateNum},
|
|
|
- </if>
|
|
|
- <if test="demissionDate != null">
|
|
|
- demission_date_ = #{demissionDate},
|
|
|
- </if>
|
|
|
- </set> WHERE user_id_ = #{userId}
|
|
|
- </update>
|
|
|
+
|
|
|
+ <!-- 根据主键查询一条记录 -->
|
|
|
+ <update id="update" parameterType="com.ym.mec.biz.dal.entity.Employee">
|
|
|
+ UPDATE employee
|
|
|
+ <set>
|
|
|
+ <if test="isProbationPeriod != null">
|
|
|
+ is_probation_period_ = #{isProbationPeriod},
|
|
|
+ </if>
|
|
|
+ <if test="graduateSchool != null">
|
|
|
+ graduate_school_ = #{graduateSchool},
|
|
|
+ </if>
|
|
|
+ <if test="organIdList != null">
|
|
|
+ organ_id_list_ = #{organIdList},
|
|
|
+ </if>
|
|
|
+ <if test="introduction != null">
|
|
|
+ introduction_ = #{introduction},
|
|
|
+ </if>
|
|
|
+ <if test="technicalTitles != null">
|
|
|
+ technical_titles_ = #{technicalTitles},
|
|
|
+ </if>
|
|
|
+ <if test="entryDate != null">
|
|
|
+ entry_date_ = #{entryDate},
|
|
|
+ </if>
|
|
|
+ <if test="jobNature != null">
|
|
|
+ job_nature_ = #{jobNature},
|
|
|
+ </if>
|
|
|
+ <if test="certificateType != null">
|
|
|
+ certificate_type_ = #{certificateType},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">
|
|
|
+ update_time_ = #{updateTime},
|
|
|
+ </if>
|
|
|
+ <if test="educationBackground != null">
|
|
|
+ education_background_ = #{educationBackground},
|
|
|
+ </if>
|
|
|
+ <if test="certificateNum != null">
|
|
|
+ certificate_num_ = #{certificateNum},
|
|
|
+ </if>
|
|
|
+ <if test="demissionDate != null">
|
|
|
+ demission_date_ = #{demissionDate},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ WHERE user_id_ = #{userId}
|
|
|
+ </update>
|
|
|
|
|
|
<update id="updatePassword">
|
|
|
UPDATE sys_user SET password_ = #{password} WHERE id_ = #{userID}
|
|
@@ -132,41 +136,45 @@
|
|
|
</update>
|
|
|
|
|
|
<!-- 根据主键删除一条记录 -->
|
|
|
- <delete id="delete" >
|
|
|
+ <delete id="delete">
|
|
|
DELETE FROM employee WHERE user_id_ = #{userId}
|
|
|
</delete>
|
|
|
-
|
|
|
- <!-- 分页查询 -->
|
|
|
- <select id="queryPage" resultMap="Employee" parameterType="map">
|
|
|
- SELECT * FROM employee ORDER BY user_id_ <include refid="global.limit"/>
|
|
|
- </select>
|
|
|
-
|
|
|
- <!-- 查询当前表的总记录数 -->
|
|
|
- <select id="queryCount" resultType="int">
|
|
|
+ <delete id="delEmployeeRole">
|
|
|
+ DELETE FROM sys_user_role WHERE user_id_ = #{userId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <!-- 分页查询 -->
|
|
|
+ <select id="queryPage" resultMap="Employee" parameterType="map">
|
|
|
+ SELECT * FROM employee ORDER BY user_id_
|
|
|
+ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询当前表的总记录数 -->
|
|
|
+ <select id="queryCount" resultType="int">
|
|
|
SELECT COUNT(*) FROM employee
|
|
|
</select>
|
|
|
|
|
|
|
|
|
<resultMap type="com.ym.mec.biz.dal.dto.EmployeeDto" id="EmployeeDto">
|
|
|
- <result property="id" column="id_" />
|
|
|
- <result property="realName" column="real_name_" />
|
|
|
+ <result property="id" column="id_"/>
|
|
|
+ <result property="realName" column="real_name_"/>
|
|
|
<result property="gender" column="gender_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
|
|
|
- <result property="phone" column="phone_" />
|
|
|
- <result property="lockFlag" column="lock_flag_" />
|
|
|
- <result property="jobNature" column="job_nature_" />
|
|
|
- <result property="entryDate" column="entry_date_" />
|
|
|
- <result property="demissionDate" column="demission_date_" />
|
|
|
+ <result property="phone" column="phone_"/>
|
|
|
+ <result property="lockFlag" column="lock_flag_"/>
|
|
|
+ <result property="jobNature" column="job_nature_"/>
|
|
|
+ <result property="entryDate" column="entry_date_"/>
|
|
|
+ <result property="demissionDate" column="demission_date_"/>
|
|
|
<collection property="roleNames" ofType="string" javaType="list">
|
|
|
- <result column="role_name_" />
|
|
|
+ <result column="role_name_"/>
|
|
|
</collection>
|
|
|
<collection property="organNameList" ofType="string" javaType="list">
|
|
|
- <result column="organ_name_list_" />
|
|
|
+ <result column="organ_name_list_"/>
|
|
|
</collection>
|
|
|
<collection property="roleIds" ofType="integer" javaType="list">
|
|
|
- <result column="role_id_" />
|
|
|
+ <result column="role_id_"/>
|
|
|
</collection>
|
|
|
<collection property="organIdList" ofType="Long" javaType="list">
|
|
|
- <result column="organ_id_list_" />
|
|
|
+ <result column="organ_id_list_"/>
|
|
|
</collection>
|
|
|
</resultMap>
|
|
|
<select id="queryEmployByOrganId" resultMap="EmployeeDto">
|
|
@@ -192,5 +200,5 @@
|
|
|
<if test="search != null">
|
|
|
AND (su.real_name_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
|
|
|
</if>
|
|
|
- </select>
|
|
|
+ </select>
|
|
|
</mapper>
|