2025-01-10 17:45:27 +08:00
|
|
|
<?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.SysUserComMapper">
|
|
|
|
|
|
|
|
<resultMap type="SysUserCom" id="SysUserComResult">
|
|
|
|
<result property="userId" column="user_id" />
|
|
|
|
<result property="comId" column="com_id" />
|
|
|
|
<result property="comName" column="com_name" />
|
|
|
|
<result property="status" column="status" />
|
|
|
|
<result property="isActive" column="is_active" />
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
2025-01-11 17:14:40 +08:00
|
|
|
<insert id="insertUserCom" parameterType="SysUserCom" >
|
|
|
|
insert into sys_user_com(
|
|
|
|
<if test="userId != null and userId != 0">user_id,</if>
|
|
|
|
<if test="comId != null and comId != 0">com_id,</if>
|
|
|
|
<if test="status != null and status!=''">status,</if>
|
|
|
|
is_active
|
|
|
|
|
|
|
|
)values(
|
|
|
|
<if test="userId != null and userId != 0">#{userId},</if>
|
|
|
|
<if test="comId != null and comId != 0">#{comId},</if>
|
|
|
|
<if test="status != null and status!=''">#{status},</if>
|
|
|
|
#{isActive}
|
|
|
|
)
|
|
|
|
</insert>
|
2025-01-10 17:45:27 +08:00
|
|
|
<select id="selectUserComs" parameterType="SysUserCom" resultMap="SysUserComResult">
|
|
|
|
select uc.*,sd.dept_name com_name
|
|
|
|
from sys_user_com uc left join sys_dept sd on uc.com_id=sd.dept_id
|
|
|
|
<where>
|
|
|
|
<if test="userId != null and userId != 0"> and uc.user_id = #{userId}</if>
|
|
|
|
<if test="comId != null and comId != 0"> and uc.com_id = #{comId}</if>
|
|
|
|
</where>
|
|
|
|
|
|
|
|
</select>
|
2025-01-11 17:14:40 +08:00
|
|
|
<select id="selectAdminComs" resultMap="SysUserComResult">
|
|
|
|
select uc.*, sd.dept_name com_name
|
|
|
|
from (
|
|
|
|
select DISTINCT com_id
|
|
|
|
from pro_project_info) uc
|
|
|
|
left join sys_dept sd on uc.com_id=sd.dept_id
|
|
|
|
</select>
|
2025-01-10 17:45:27 +08:00
|
|
|
<update id="updateActiveTo0" parameterType="SysUserCom">
|
|
|
|
update sys_user_com set is_active=0 where user_id=#{userId}
|
|
|
|
</update>
|
|
|
|
<update id="updateActive" parameterType="SysUserCom">
|
|
|
|
update sys_user_com set is_active=#{isActive} where user_id=#{userId} and com_id=#{comId}
|
|
|
|
</update>
|
|
|
|
<update id="updateStatus" parameterType="SysUserCom">
|
|
|
|
update sys_user_com set status=#{status} where user_id=#{userId} and com_id=#{comId}
|
|
|
|
</update>
|
|
|
|
</mapper>
|