<?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.ruoyi.station.mapper.MjWorkUserMapper">
|
|
<resultMap type="MjWorkUser" id="MjWorkUserResult">
|
<result property="id" column="id" />
|
<result property="userId" column="user_id" />
|
<result property="userName" column="user_name" />
|
<result property="organizationId" column="organization_id" />
|
<result property="organizationName" column="organization_name" />
|
<result property="deptId" column="dept_id" />
|
<result property="deptName" column="dept_name" />
|
<result property="pass" column="pass" />
|
<result property="enable" column="enable" />
|
<result property="iPrivilege" column="iPrivilege" />
|
<result property="createTime" column="create_time" />
|
<result property="updateTime" column="update_time" />
|
<result property="createBy" column="create_by" />
|
<result property="updateBy" column="update_by" />
|
<result property="sort" column="sort" />
|
<result property="delFlag" column="del_flag" />
|
<result property="expandStatus" column="expand_status" />
|
<result property="expandStatus1" column="expand_status1" />
|
</resultMap>
|
|
<sql id="selectMjWorkUserVo">
|
select id, user_id, user_name, organization_id, organization_name, dept_id, dept_name, pass,enable,iPrivilege, create_time, update_time, create_by, update_by, sort, del_flag, expand_status, expand_status1 from mj_work_user
|
</sql>
|
|
<select id="selectMjWorkUserList" parameterType="MjWorkUser" resultMap="MjWorkUserResult">
|
SELECT u.*
|
from mj_work_user u
|
left JOIN mj_dept d on u.dept_id=d.id
|
where u.del_flag='0'
|
<if test="userId != null and userId != ''"> and u.user_id = #{userId}</if>
|
<if test="userName != null and userName != ''"> and u.user_name like concat('%', #{userName}, '%')</if>
|
<if test="organizationId != null and organizationId != ''"> and u.organization_id = #{organizationId}</if>
|
<if test="organizationName != null and organizationName != ''"> and u.organization_name like concat('%', #{organizationName}, '%')</if>
|
<if test="deptId != null and deptId != ''"> and u.dept_id =#{deptId} OR u.`dept_id` IN( SELECT t.id FROM mj_dept t WHERE FIND_IN_SET(#{deptId},t.dept_parent_id)) </if>
|
<if test="deptName != null and deptName != ''"> and u.dept_name like concat('%', #{deptName}, '%')</if>
|
<if test="pass != null and pass != ''"> and u.pass = #{pass}</if>
|
<if test="enable != null and enable != ''"> and u.enable = #{enable}</if>
|
<if test="iPrivilege != null and iPrivilege != ''"> and u.iPrivilege = #{iPrivilege}</if>
|
<if test="sort != null "> and u.sort = #{sort}</if>
|
<if test="expandStatus != null "> and u.expand_status = #{expandStatus}</if>
|
<if test="expandStatus1 != null "> and u.expand_status1 = #{expandStatus1}</if>
|
order by create_time desc
|
</select>
|
|
<select id="selectMjWorkUserById" parameterType="Long" resultMap="MjWorkUserResult">
|
<include refid="selectMjWorkUserVo"/>
|
where id = #{id}
|
</select>
|
<select id="selectMjWorkUserListAll" parameterType="MjWorkUser" resultMap="MjWorkUserResult">
|
SELECT *
|
from mj_work_user
|
<where>
|
del_flag='0'
|
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
|
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
<if test="organizationId != null and organizationId != ''"> and organization_id = #{organizationId}</if>
|
<if test="organizationName != null and organizationName != ''"> and organization_name like concat('%', #{organizationName}, '%')</if>
|
<if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
|
<if test="pass != null and pass != ''"> and pass = #{pass}</if>
|
<if test="enable != null and enable != ''"> and enable = #{enable}</if>
|
<if test="iPrivilege != null and iPrivilege != ''"> and iPrivilege = #{iPrivilege}</if>
|
<if test="sort != null "> and sort = #{sort}</if>
|
<if test="expandStatus != null "> and expand_status = #{expandStatus}</if>
|
<if test="expandStatus1 != null "> and expand_status1 = #{expandStatus1}</if>
|
</where>
|
</select>
|
<select id="selectUserByLoginName" parameterType="String" resultMap="MjWorkUserResult">
|
<include refid="selectMjWorkUserVo"/>
|
where user_name = #{userName}
|
</select>
|
|
<insert id="insertMjWorkUser" parameterType="MjWorkUser" useGeneratedKeys="true" keyProperty="id">
|
insert into mj_work_user
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">id,</if>
|
<if test="userId != null">user_id,</if>
|
<if test="userName != null">user_name,</if>
|
<if test="organizationId != null">organization_id,</if>
|
<if test="organizationName != null">organization_name,</if>
|
<if test="deptId != null">dept_id,</if>
|
<if test="deptName != null">dept_name,</if>
|
<if test="pass != null">pass,</if>
|
<if test="enable != null">enable,</if>
|
<if test="iPrivilege != null">iPrivilege,</if>
|
<if test="createTime != null">create_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
<if test="createBy != null">create_by,</if>
|
<if test="updateBy != null">update_by,</if>
|
<if test="sort != null">sort,</if>
|
<if test="delFlag != null">del_flag,</if>
|
<if test="expandStatus != null">expand_status,</if>
|
<if test="expandStatus1 != null">expand_status1,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id},</if>
|
<if test="userId != null">#{userId},</if>
|
<if test="userName != null">#{userName},</if>
|
<if test="organizationId != null">#{organizationId},</if>
|
<if test="organizationName != null">#{organizationName},</if>
|
<if test="deptId != null">#{deptId},</if>
|
<if test="deptName != null">#{deptName},</if>
|
<if test="pass != null">#{pass},</if>
|
<if test="enable != null">#{enable},</if>
|
<if test="iPrivilege != null">#{iPrivilege},</if>
|
<if test="createTime != null">#{createTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
<if test="createBy != null">#{createBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
<if test="sort != null">#{sort},</if>
|
<if test="delFlag != null">#{delFlag},</if>
|
<if test="expandStatus != null">#{expandStatus},</if>
|
<if test="expandStatus1 != null">#{expandStatus1},</if>
|
</trim>
|
</insert>
|
|
<update id="updateMjWorkUser" parameterType="MjWorkUser">
|
update mj_work_user
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="userId != null">user_id = #{userId},</if>
|
<if test="userName != null">user_name = #{userName},</if>
|
<if test="organizationId != null">organization_id = #{organizationId},</if>
|
<if test="organizationName != null">organization_name = #{organizationName},</if>
|
<if test="deptId != null">dept_id = #{deptId},</if>
|
<if test="deptName != null">dept_name = #{deptName},</if>
|
<if test="pass != null">pass = #{pass},</if>
|
<if test="enable != null">enable = #{enable},</if>
|
<if test="iPrivilege != null">iPrivilege = #{iPrivilege},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="sort != null">sort = #{sort},</if>
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
<if test="expandStatus != null">expand_status = #{expandStatus},</if>
|
<if test="expandStatus1 != null">expand_status1 = #{expandStatus1},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteMjWorkUserById" parameterType="Long">
|
delete from mj_work_user where id = #{id}
|
</delete>
|
|
<delete id="deleteMjWorkUserByIds" parameterType="String">
|
delete from mj_work_user where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
<select id="selectWorkUserCount" resultType="Integer">
|
select count(1) from mj_work_user where del_flag = 0
|
</select>
|
|
<select id="selectUserListByDeptId" parameterType="String" resultType="com.ruoyi.station.model.DeptUsersModel">
|
select id id, user_name title from mj_work_user
|
where
|
del_flag='0'
|
<if test="deptId != null and deptId != ''"> and dept_id =#{deptId}</if>
|
</select>
|
|
<select id="selectWorkUserCountById" parameterType="Long" resultType="Integer">
|
select count(1) from mj_work_user where id = #{id}
|
</select>
|
|
<select id="selectUserNamesByTogetherUserIds" parameterType="String" resultType="String">
|
select user_name from mj_work_user
|
where id in
|
<foreach item="id" collection="togetherUserIds" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</select>
|
|
<select id="getUserName" resultType="java.lang.String">
|
select user_name from mj_work_user where id = #{userId}
|
</select>
|
|
<select id="getUserNames" resultType="java.lang.String">
|
select user_name from mj_work_user
|
where id in
|
<foreach item="id" collection="userIds" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</select>
|
|
<select id="selectNewUser" parameterType="String" resultMap="MjWorkUserResult">
|
<include refid="selectMjWorkUserVo"/>
|
where expand_status = 1
|
</select>
|
</mapper>
|