|
@@ -8,28 +8,17 @@
|
|
|
|
|
|
<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">
|
|
@@ -39,7 +28,6 @@
|
|
|
<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"/>
|
|
@@ -57,17 +45,145 @@
|
|
|
<result column="wechat_id_" property="wechatId"/>
|
|
|
</resultMap>
|
|
|
|
|
|
- <!-- 根据主键查询一条记录 -->
|
|
|
- <select id="get" resultMap="Employee">
|
|
|
- SELECT * FROM employee WHERE user_id_ = #{userId}
|
|
|
- </select>
|
|
|
+ <sql id="baseColumns">
|
|
|
+ t.user_id_ as "userId"
|
|
|
+ , t.job_nature_ as "jobNature"
|
|
|
+ , t.is_probation_period_ as "isProbationPeriod"
|
|
|
+ , t.education_background_ as "educationBackground"
|
|
|
+ , t.graduate_school_ as "graduateSchool"
|
|
|
+ , t.technical_titles_ as "technicalTitles"
|
|
|
+ , t.entry_date_ as "entryDate"
|
|
|
+ , t.update_time_ as "updateTime"
|
|
|
+ , t.create_time_ as "createTime"
|
|
|
+ , t.introduction_ as "introduction"
|
|
|
+ , t.demission_date_ as "demissionDate"
|
|
|
+ , t.contact_address_ as "contactAddress"
|
|
|
+ </sql>
|
|
|
|
|
|
- <!-- 全查询 -->
|
|
|
- <select id="findAll" resultMap="Employee">
|
|
|
- SELECT * FROM employee ORDER BY user_id_
|
|
|
- </select>
|
|
|
+ <select id="detail" resultType="com.yonge.cooleshow.biz.dal.entity.Employee">
|
|
|
+ SELECT
|
|
|
+ <include refid="baseColumns" />,
|
|
|
+ username_ as username,
|
|
|
+ phone_ as phone,
|
|
|
+ gender_ as gender
|
|
|
+ FROM employee t
|
|
|
+ left join sys_user u on t.user_id_ = u.id_
|
|
|
+ where t.user_id_ = #{userId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryPage" resultType="com.yonge.cooleshow.biz.dal.entity.Employee">
|
|
|
+ SELECT
|
|
|
+ <include refid="baseColumns" />,
|
|
|
+ username_ as username,
|
|
|
+ phone_ as phone,
|
|
|
+ gender_ as gender,
|
|
|
+ lock_flag_ as lockFlag
|
|
|
+ FROM employee
|
|
|
+ left join sys_user u on t.user_id_ = u.id
|
|
|
+ <where>
|
|
|
+ <if test="null != param.search and '' != param.search">
|
|
|
+ AND (
|
|
|
+ t.user_id_ LIKE CONCAT('%', #{param.search}, '%') or
|
|
|
+ u.username_ LIKE CONCAT('%', #{param.search}, '%') or
|
|
|
+ u.phone_ LIKE CONCAT('%', #{param.search}, '%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="null != param.gender">
|
|
|
+ and u.gender_ = #{param.gender}
|
|
|
+ </if>
|
|
|
+ <if test="null != param.lockFlag">
|
|
|
+ and u.lock_flag_ = #{param.lockFlag}
|
|
|
+ </if>
|
|
|
+ <if test="param.startTime !=null">
|
|
|
+ <![CDATA[AND t.create_time_ >= #{param.startTime} ]]>
|
|
|
+ </if>
|
|
|
+ <if test="param.endTime !=null">
|
|
|
+ <![CDATA[AND t.create_time_ <= #{param.endTime} ]]>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ORDER BY user_id_
|
|
|
+ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertSysUser" parameterType="com.yonge.cooleshow.auth.api.entity.SysUser" useGeneratedKeys="true" keyColumn="id"
|
|
|
+ keyProperty="id">
|
|
|
+ INSERT INTO sys_user
|
|
|
+ (is_super_admin_,im_token_,id_,username_,salt_,phone_,avatar_,create_time_,update_time_,wx_openid_,qq_openid_,user_type_,
|
|
|
+ gender_,nation_,birthdate_,email_,id_card_no_,wechat_id_,real_name_,certificate_type_)
|
|
|
+ VALUES(#{isSuperAdmin},#{imToken},#{id},#{username},#{salt},#{phone},#{avatar},now(),now(),#{wxOpenid},#{qqOpenid},#{userType},
|
|
|
+ #{gender},#{nation},#{birthdate},#{email},#{idCardNo},#{wechatId},#{realName},#{certificateType})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateSysUser" parameterType="com.yonge.cooleshow.auth.api.entity.SysUser">
|
|
|
+ UPDATE sys_user
|
|
|
+ <set>
|
|
|
+ <if test="delFlag != null">
|
|
|
+ del_flag_ = #{delFlag, typeHandler=com.yonge.cooleshow.common.dal.CustomEnumTypeHandler},
|
|
|
+ </if>
|
|
|
+ <if test="wxOpenid != null and wxOpenid != ''">
|
|
|
+ wx_openid_ = #{wxOpenid},
|
|
|
+ </if>
|
|
|
+ <if test="avatar != null and avatar != ''">
|
|
|
+ avatar_ = #{avatar},
|
|
|
+ </if>
|
|
|
+ <if test="email != null and email != ''">
|
|
|
+ email_ = #{email},
|
|
|
+ </if>
|
|
|
+ <if test="gender != null">
|
|
|
+ gender_ = #{gender},
|
|
|
+ </if>
|
|
|
+ <if test="salt != null and salt != ''">
|
|
|
+ salt_ = #{salt},
|
|
|
+ </if>
|
|
|
+ <if test="username != null and username != ''">
|
|
|
+ username_ = #{username},
|
|
|
+ </if>
|
|
|
+ <if test="userType != null and userType != ''">
|
|
|
+ user_type_ = #{userType},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">
|
|
|
+ update_time_ = NOW(),
|
|
|
+ </if>
|
|
|
+ <if test="lockFlag != null">
|
|
|
+ lock_flag_ = #{lockFlag},
|
|
|
+ </if>
|
|
|
+ <if test="birthdate != null">
|
|
|
+ birthdate_ = #{birthdate},
|
|
|
+ </if>
|
|
|
+ <if test="phone != null and phone != ''">
|
|
|
+ phone_ = #{phone},
|
|
|
+ </if>
|
|
|
+ <if test="qqOpenid != null and qqOpenid != ''">
|
|
|
+ qq_openid_ = #{qqOpenid},
|
|
|
+ </if>
|
|
|
+ <if test="nation != null and nation != ''">
|
|
|
+ nation_ = #{nation},
|
|
|
+ </if>
|
|
|
+ <if test="imToken != null and imToken != ''">
|
|
|
+ im_token_ = #{imToken},
|
|
|
+ </if>
|
|
|
+ <if test="idCardNo != null and idCardNo != ''">
|
|
|
+ id_card_no_ = #{idCardNo},
|
|
|
+ </if>
|
|
|
+ <if test="password != null and password != ''">
|
|
|
+ password_ = #{password},
|
|
|
+ </if>
|
|
|
+ <if test="wechatId != null and wechatId != ''">
|
|
|
+ wechat_id_ = #{wechatId},
|
|
|
+ </if>
|
|
|
+ <if test="realName != null and realName != ''">
|
|
|
+ real_name_ = #{realName},
|
|
|
+ </if>
|
|
|
+ <if test="isSuperAdmin != null">
|
|
|
+ is_super_admin_ = #{isSuperAdmin},
|
|
|
+ </if>
|
|
|
+ <if test="certificateType != null">
|
|
|
+ certificate_type_ = #{certificateType},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ WHERE id_ = #{id}
|
|
|
+ </update>
|
|
|
|
|
|
- <!-- 向数据库增加一条记录 -->
|
|
|
<insert id="insert" parameterType="com.yonge.cooleshow.biz.dal.entity.Employee" useGeneratedKeys="true" keyColumn="id"
|
|
|
keyProperty="id">
|
|
|
INSERT INTO employee
|
|
@@ -77,6 +193,43 @@
|
|
|
#{technicalTitles},#{entryDate},now(),now(),#{introduction},#{demissionDate},#{contactAddress})
|
|
|
</insert>
|
|
|
|
|
|
+ <update id="update" parameterType="com.yonge.cooleshow.biz.dal.entity.Employee">
|
|
|
+ UPDATE employee
|
|
|
+ <set>
|
|
|
+ <if test="jobNature != null">
|
|
|
+ job_nature_ = #{jobNature},
|
|
|
+ </if>
|
|
|
+ <if test="isProbationPeriod != null">
|
|
|
+ is_probation_period_ = #{isProbationPeriod},
|
|
|
+ </if>
|
|
|
+ <if test="educationBackground != null">
|
|
|
+ education_background_ = #{educationBackground},
|
|
|
+ </if>
|
|
|
+ <if test="graduateSchool != null">
|
|
|
+ graduate_school_ = #{graduateSchool},
|
|
|
+ </if>
|
|
|
+ <if test="technicalTitles != null">
|
|
|
+ technical_titles_ = #{technicalTitles},
|
|
|
+ </if>
|
|
|
+ <if test="entryDate != null">
|
|
|
+ entry_date_ = #{entryDate},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">
|
|
|
+ update_time_ = NOW(),
|
|
|
+ </if>
|
|
|
+ <if test="introduction != null">
|
|
|
+ introduction_ = #{introduction},
|
|
|
+ </if>
|
|
|
+ <if test="demissionDate != null">
|
|
|
+ demission_date_ = #{demissionDate},
|
|
|
+ </if>
|
|
|
+ <if test="contactAddress != null">
|
|
|
+ contact_address_ = #{contactAddress},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ WHERE user_id_ = #{userId}
|
|
|
+ </update>
|
|
|
+
|
|
|
<insert id="batchAddEmployeeRole">
|
|
|
INSERT INTO sys_user_role(user_id_,role_id_) values
|
|
|
<foreach collection="roleIds" item="item" index="index" separator=",">
|
|
@@ -91,6 +244,25 @@
|
|
|
</foreach>
|
|
|
</insert>
|
|
|
|
|
|
+ <select id="querySysUserByPhone" resultMap="SysUser">
|
|
|
+ select * from sys_user where phone_ = #{phone} OR username_ = #{phone} LIMIT 1 FOR UPDATE
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 根据主键查询一条记录 -->
|
|
|
+ <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>
|
|
|
+
|
|
|
+
|
|
|
<delete id="delRoleMenu">
|
|
|
DELETE FROM `sys_role_menu`
|
|
|
WHERE menu_id_ in
|
|
@@ -111,79 +283,13 @@
|
|
|
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="updatePasswordReq">
|
|
|
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">
|
|
@@ -193,18 +299,12 @@
|
|
|
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 id="queryUserRole" resultType="java.lang.Long">
|
|
|
SELECT sur.role_id_ FROM sys_user_role sur WHERE sur.user_id_ = #{userId}
|
|
|
</select>
|
|
|
|