|
@@ -0,0 +1,217 @@
|
|
|
+<?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.yonge.cooleshow.biz.dal.dao.EmployeeDao">
|
|
|
+
|
|
|
+ <resultMap type="com.yonge.cooleshow.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"/>
|
|
|
+ <result column="contact_address_" property="contactAddress"/>
|
|
|
+ <result column="postal_code_" property="postalCode"/>
|
|
|
+ <result column="dept_id_" property="deptId"/>
|
|
|
+ <result column="dept_ids_" property="deptIds"/>
|
|
|
+ <result column="post_ids_" property="postIds"/>
|
|
|
+ <result column="post_dept_ids_" property="postDeptIds"/>
|
|
|
+ <result column="bank_card_" property="bankCard"/>
|
|
|
+ <result column="open_bank_address_" property="openBankAddress"/>
|
|
|
+ <result column="tenant_id_" property="tenantId" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap type="com.yonge.cooleshow.auth.api.entity.SysUser" id="SysUser">
|
|
|
+ <result column="id_" property="id"/>
|
|
|
+ <result column="username_" property="username"/>
|
|
|
+ <result column="password_" property="password"/>
|
|
|
+ <result column="salt_" property="salt"/>
|
|
|
+ <result column="phone_" property="phone"/>
|
|
|
+ <result column="avatar_" property="avatar"/>
|
|
|
+ <result column="organ_id_" property="organId"/>
|
|
|
+ <result column="create_time_" property="createTime"/>
|
|
|
+ <result column="update_time_" property="updateTime"/>
|
|
|
+ <result column="lock_flag_" property="lockFlag"/>
|
|
|
+ <result column="del_flag_" property="delFlag" typeHandler="com.yonge.cooleshow.common.dal.CustomEnumTypeHandler"/>
|
|
|
+ <result column="wx_openid_" property="wxOpenid"/>
|
|
|
+ <result column="qq_openid_" property="qqOpenid"/>
|
|
|
+ <result column="user_type_" property="userType"/>
|
|
|
+ <result column="gender_" property="gender"/>
|
|
|
+ <result column="nation_" property="nation"/>
|
|
|
+ <result column="birthdate_" property="birthdate"/>
|
|
|
+ <result column="email_" property="email"/>
|
|
|
+ <result column="im_token_" property="imToken"/>
|
|
|
+ <result column="real_name_" property="realName"/>
|
|
|
+ <result column="id_card_no_" property="idCardNo"/>
|
|
|
+ <result column="wechat_id_" property="wechatId"/>
|
|
|
+ </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.yonge.cooleshow.biz.dal.entity.Employee" useGeneratedKeys="true" keyColumn="id"
|
|
|
+ keyProperty="id">
|
|
|
+ INSERT INTO employee
|
|
|
+ (user_id_,job_nature_,is_probation_period_,education_background_,graduate_school_,technical_titles_,
|
|
|
+ entry_date_,update_time_,create_time_,introduction_,demission_date_,contact_address_)
|
|
|
+ VALUES(#{userId},#{jobNature},#{isProbationPeriod},#{educationBackground},#{graduateSchool},
|
|
|
+ #{technicalTitles},#{entryDate},now(),now(),#{introduction},#{demissionDate},#{contactAddress})
|
|
|
+ </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>
|
|
|
+
|
|
|
+ <insert id="batchInsertRoleMenu">
|
|
|
+ INSERT INTO sys_role_menu (role_id_,menu_id_) VALUES
|
|
|
+ <foreach collection="menuIds" item="item" index="index" separator=",">
|
|
|
+ (#{roleId}, #{item})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <delete id="delRoleMenu">
|
|
|
+ DELETE FROM `sys_role_menu`
|
|
|
+ WHERE menu_id_ in
|
|
|
+ <foreach collection="menuIds" open="(" close=")" item="item" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <insert id="insertSysRole" keyColumn="id_" keyProperty="id" parameterType="com.yonge.cooleshow.auth.api.entity.SysRole"
|
|
|
+ useGeneratedKeys="true">
|
|
|
+ INSERT INTO `sys_role` (`role_name_`, `role_code_`, `role_desc_`, `create_time_`,
|
|
|
+ `update_time_`, `del_flag_`, `organ_id_`, `tenant_id_`)
|
|
|
+ VALUES (#{roleName}, #{roleCode}, #{roleDesc}, #{createTime},
|
|
|
+ #{updateTime}, #{delFlag}, #{organId}, #{tenantId});
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <select id="queryByPhone" resultMap="SysUser">
|
|
|
+ select * from sys_user where phone_ = #{phone} OR username_ = #{phone}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据主键查询一条记录 -->
|
|
|
+ <update id="update" parameterType="com.yonge.cooleshow.biz.dal.entity.Employee">
|
|
|
+ UPDATE employee
|
|
|
+ <set>
|
|
|
+ <if test="contactAddress != null">
|
|
|
+ contact_address_ = #{contactAddress},
|
|
|
+ </if>
|
|
|
+ <if test="postalCode != null">
|
|
|
+ postal_code_ = #{postalCode},
|
|
|
+ </if>
|
|
|
+ <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_ = NOW(),
|
|
|
+ </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>
|
|
|
+ dept_id_ = #{deptId},
|
|
|
+ <if test="deptIds != null">
|
|
|
+ dept_ids_ = #{deptIds},
|
|
|
+ </if>
|
|
|
+ <if test="postIds != null">
|
|
|
+ post_ids_ = #{postIds},
|
|
|
+ </if>
|
|
|
+ <if test="postDeptIds != null">
|
|
|
+ post_dept_ids_ = #{postDeptIds},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ WHERE user_id_ = #{userId} and tenant_id_ = #{tenantId}
|
|
|
+ </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,1,0) WHERE id_=#{userID}
|
|
|
+ </update>
|
|
|
+ <update id="updateUserDemissionDate">
|
|
|
+ UPDATE employee SET demission_date_ = IF(demission_date_ IS NULL,now(),NULL) WHERE user_id_=#{userID}
|
|
|
+ </update>
|
|
|
+ <update id="updateUserLock">
|
|
|
+ UPDATE sys_user SET lock_flag_ = #{status} WHERE id_=#{userID}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!-- 根据主键删除一条记录 -->
|
|
|
+ <delete id="delete">
|
|
|
+ DELETE FROM employee WHERE user_id_ = #{userId}
|
|
|
+ </delete>
|
|
|
+ <delete id="delEmployeeRole">
|
|
|
+ DELETE FROM sys_user_role WHERE user_id_ = #{userId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <!-- 分页查询 -->
|
|
|
+ <select id="queryPage" resultMap="Employee" parameterType="map">
|
|
|
+ SELECT * FROM employee where tenant_id_ = #{tenantId} ORDER BY user_id_
|
|
|
+ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询当前表的总记录数 -->
|
|
|
+ <select id="queryCount" resultType="int">
|
|
|
+ SELECT COUNT(*) FROM employee where tenant_id_ = #{tenantId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryUserRole" resultType="java.lang.Integer">
|
|
|
+ SELECT sur.role_id_ FROM sys_user_role sur WHERE sur.user_id_ = #{userId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getUsers" resultMap="SysUser">
|
|
|
+ select * from sys_user where id_ IN
|
|
|
+ <foreach collection="userIds" open="(" close=")" separator="," item="userId">
|
|
|
+ #{userId}
|
|
|
+ </foreach>
|
|
|
+ </select>
|
|
|
+</mapper>
|