123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <?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.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" />
- <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 * FROM employee WHERE user_id_ = #{userId}
- </select>
- <!-- 全查询 -->
- <select id="findAll" resultMap="Employee">
- SELECT * FROM employee ORDER BY user_id_
- </select>
-
- <!-- 向数据库增加一条记录 -->
- <insert id="insert" parameterType="com.ym.mec.web.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_,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},#{organId},#{jobNature},#{isProbationPeriod},#{educationBackground},#{graduateSchool},#{technicalTitles},#{entryDate},#{certificateType},#{certificateNum},#{updateTime},#{createTime},#{introduction},#{demissionDate})
- </insert>
-
- <!-- 根据主键查询一条记录 -->
- <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}
- </update>
- <update id="updatePassword">
- UPDATE sys_user SET password_ = #{password} WHERE id_ = #{userID}
- </update>
- <update id="updateUserLockStatus">
- UPDATE sys_user SET lock_flag_ = IF(lock_flag_=0,9,0) WHERE id_=#{userID}
- </update>
- <!-- 根据主键删除一条记录 -->
- <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">
- 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.role_id_=sr.id_
- </select>
- </mapper>
|