YZProjectCloud/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/system/SysUserExtMapper.xml

77 lines
3.6 KiB
XML

<?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.yanzhu.system.mapper.SysUserExtMapper">
<resultMap type="SysUserExt" id="SysUserExtResult">
<result property="userId" column="user_id" />
<result property="projectId" column="project_id" />
<result property="comId" column="com_id" />
<result property="status" column="status" />
<result property="userType" column="user_type" />
<result property="isActive" column="is_active" />
</resultMap>
<sql id="selectSysUserExtVo">
select user_id, project_id, status, user_type,com_id,is_active from sys_user_ext
</sql>
<select id="selectSysUserExtList" parameterType="SysUserExt" resultMap="SysUserExtResult">
<include refid="selectSysUserExtVo"/>
<where>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="userType != null and userType != ''"> and user_type = #{userType}</if>
<if test="userId != null and userId != 0"> and user_id = #{userId}</if>
<if test="projectId != null and projectId != 0"> and project_id = #{projectId}</if>
<if test="comId != null and comId != 0"> and com_id = #{comId}</if>
</where>
</select>
<select id="selectSysUserExtById" parameterType="Long" resultMap="SysUserExtResult">
<include refid="selectSysUserExtVo"/>
where user_id = #{userId} and project_id=#{projectId}
</select>
<insert id="insertSysUserExt" parameterType="SysUserExt">
insert into sys_user_ext
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="projectId != null">project_id,</if>
<if test="status != null">status,</if>
<if test="userType != null">user_type,</if>
<if test="comId != null">com_id,</if>
<if test="isActive != null">is_active,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="status != null">#{status},</if>
<if test="userType != null">#{userType},</if>
<if test="comId != null">#{comId},</if>
<if test="isActive != null">#{isActive},</if>
</trim>
</insert>
<update id="updateSysUserExt" parameterType="SysUserExt">
update sys_user_ext
<trim prefix="SET" suffixOverrides=",">
<if test="projectId != null">project_id = #{projectId},</if>
<if test="status != null">status = #{status},</if>
<if test="userType != null">user_type = #{userType},</if>
<if test="comId != null">com_id = #{comId},</if>
<if test="isActive != null">is_active = #{isActive},</if>
</trim>
where user_id = #{userId}
</update>
<delete id="deleteSysUserExtById" parameterType="SysUserExt">
delete from sys_user_ext where user_id = #{userId} and project_id=#{projectId}
</delete>
<update id="clearAllActive" parameterType="SysUserExt">
update sys_user_ext set is_active=0 where user_id=#{userId} and com_id=#{comId}
</update>
<update id="setActive" parameterType="SysUserExt">
update sys_user_ext set is_active=1 where user_id=#{userId} and com_id=#{comId} and project_id=#{projectId}
</update>
</mapper>