|
@@ -6,31 +6,30 @@
|
|
|
-->
|
|
|
<mapper namespace="com.ym.mec.web.dal.dao.EmployeeDao">
|
|
|
|
|
|
- <resultMap type="com.ym.mec.web.dal.entity.Employee" id="Employee">
|
|
|
- <result column="user_id_" property="userId"/>
|
|
|
- <result column="organ_id_" property="organId"/>
|
|
|
- <result column="job_nature_" property="jobNature" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
|
|
|
- <result column="is_probation_period_" property="isProbationPeriod"
|
|
|
- typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
|
|
|
- <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.web.dal.entity.Employee" id="Employee">
|
|
|
+ <result column="user_id_" property="userId" />
|
|
|
+ <result column="organ_id_" property="organId" />
|
|
|
+ <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>
|
|
|
|
|
|
- <!-- 根据主键查询一条记录 -->
|
|
|
- <select id="get" resultMap="Employee">
|
|
|
+ <!-- 根据主键查询一条记录 -->
|
|
|
+ <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>
|
|
|
|
|
@@ -47,56 +46,56 @@
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
|
<update id="update" parameterType="com.ym.mec.web.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_ = #{organId},
|
|
|
-</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}
|
|
|
+ <if test="isProbationPeriod != null">
|
|
|
+ is_probation_period_ = #{isProbationPeriod},
|
|
|
+ </if>
|
|
|
+ <if test="graduateSchool != null">
|
|
|
+ graduate_school_ = #{graduateSchool},
|
|
|
+ </if>
|
|
|
+ <if test="organId != null">
|
|
|
+ organ_id_ = #{organId},
|
|
|
+ </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="updatePassword">
|
|
|
+ <update id="updatePassword">
|
|
|
UPDATE sys_user SET password_ = #{password} WHERE id_ = #{userID}
|
|
|
</update>
|
|
|
- <update id="updateUserLockStatus">
|
|
|
+
|
|
|
+ <update id="updateUserLockStatus">
|
|
|
UPDATE sys_user SET lock_flag_ = IF(lock_flag_=0,9,0) WHERE id_=#{userID}
|
|
|
</update>
|
|
|
|
|
@@ -114,4 +113,60 @@ demission_date_ = #{demissionDate},
|
|
|
<select id="queryCount" resultType="int">
|
|
|
SELECT COUNT(*) FROM employee
|
|
|
</select>
|
|
|
+
|
|
|
+ <resultMap type="com.ym.mec.web.dal.dto.EmployeeDto" id="EmployeeDto">
|
|
|
+ <result property="id" column="id_" />
|
|
|
+ <result property="username" column="username_" />
|
|
|
+ <result property="gender" column="gender_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
|
|
|
+ <result property="phone" column="phone_" />
|
|
|
+ <result property="lockFlag" column="role_name_" />
|
|
|
+ <result property="roleName" column="lock_flag_" />
|
|
|
+ <result property="jobNature" column="job_nature_" />
|
|
|
+ <result property="entryDate" column="entry_date_" />
|
|
|
+ <result property="demissionDate" column="demission_date_" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="queryCondition">
|
|
|
+ <where>
|
|
|
+ <if test="organId != null">
|
|
|
+ and su.organ_id_ = #{organId}
|
|
|
+ </if>
|
|
|
+ <if test="roleId != null">
|
|
|
+ and sr.id_ = #{roleId}
|
|
|
+ </if>
|
|
|
+ <if test="userNameOrPhone != null">
|
|
|
+ and (su.username_ like LIKE CONCAT('%',#{userNameOrPhone},'%')
|
|
|
+ or su.phone_ like LIKE CONCAT('%',#{userNameOrPhone},'%') or )
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="queryEmployByOrganId" resultMap="EmployeeDto">
|
|
|
+ SELECT
|
|
|
+ su.id_,
|
|
|
+ su.username_,
|
|
|
+ su.gender_,
|
|
|
+ su.phone_,
|
|
|
+ sr.role_name_,
|
|
|
+ su.lock_flag_,
|
|
|
+ e.job_nature_,
|
|
|
+ e.entry_date_,
|
|
|
+ e.demission_date_
|
|
|
+ FROM
|
|
|
+ sys_user su
|
|
|
+ LEFT JOIN employee e ON su.id_=e.user_id_
|
|
|
+ LEFT JOIN sys_user_role sur ON su.id_=sur.user_id_
|
|
|
+ LEFT JOIN sys_role sr ON sur.role_id_=sr.id_
|
|
|
+ <include refid="queryCondition"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryEmployByOrganIdCount" resultType="java.lang.Integer">
|
|
|
+ SELECT
|
|
|
+ count(*)
|
|
|
+ FROM
|
|
|
+ sys_user su
|
|
|
+ LEFT JOIN employee e ON su.id_=e.user_id_
|
|
|
+ LEFT JOIN sys_user_role sur ON su.id_=sur.user_id_
|
|
|
+ LEFT JOIN sys_role sr ON sur.rol
|
|
|
+ </select>
|
|
|
</mapper>
|