视频监控
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

145 lines
7.2 KiB

<?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.cjy.emergencycommand.mapper.GroupingUserInfoMapper">
<resultMap type="GroupingUserInfo" id="GroupingUserInfoResult">
<result property="id" column="id" />
<result property="createdTime" column="created_time" />
<result property="updateTime" column="update_time" />
<result property="groupingId" column="grouping_id" />
<result property="userId" column="user_id" />
<result property="delFlag" column="del_flag" />
<result property="organCode" column="organ_code" />
</resultMap>
<sql id="selectGroupingUserInfoVo">
select id, created_time, update_time, grouping_id, user_id, del_flag, organ_code from ec_grouping_user_info
</sql>
<select id="selectGroupingUserInfoList" parameterType="GroupingUserInfo" resultMap="GroupingUserInfoResult">
<include refid="selectGroupingUserInfoVo"/>
<where>
<if test="createdTime != null "> and created_time = #{createdTime}</if>
<if test="groupingId != null "> and grouping_id = #{groupingId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="organCode != null and organCode != ''"> and organ_code = #{organCode}</if>
</where>
</select>
<select id="selectGroupingUserInfoById" parameterType="Long" resultMap="GroupingUserInfoResult">
<include refid="selectGroupingUserInfoVo"/>
where id = #{id} and del_flag !=2
</select>
<insert id="insertGroupingUserInfo" parameterType="GroupingUserInfo" useGeneratedKeys="true" keyProperty="id">
insert into ec_grouping_user_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createdTime != null">created_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="groupingId != null">grouping_id,</if>
<if test="userId != null">user_id,</if>
<if test="delFlag != null">del_flag,</if>
<if test="organCode != null">organ_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="createdTime != null">#{createdTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="groupingId != null">#{groupingId},</if>
<if test="userId != null">#{userId},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="organCode != null">#{organCode},</if>
</trim>
</insert>
<update id="updateGroupingUserInfo" parameterType="GroupingUserInfo">
update ec_grouping_user_info
<trim prefix="SET" suffixOverrides=",">
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="groupingId != null">grouping_id = #{groupingId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="organCode != null">organ_code = #{organCode},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteGroupingUserInfoById" parameterType="Long">
delete from ec_grouping_user_info where id = #{id}
</delete>
<delete id="deleteGroupingUserInfoByIds" parameterType="String">
delete from ec_grouping_user_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectGroupingUserInfoListByUserInfo" parameterType="GroupUserDTO" resultType="GroupingUserInfoVO">
select t1.id,as id t1.user_id as userId,t4.`name`as groupingName,t5.organ_name as organizationName, t3.dept_name
as deptName,
t2.nick_name as userName,t2.phonenumber as userPhone
from ec_grouping_user_info t1
LEFT JOIN sys_user t2 on t1.user_id = t2.user_id AND t2.del_flag!=2
LEFT JOIN sys_dept t3 ON t2.dept_id = t3.dept_id
LEFT JOIN ec_grouping_config t4 ON t1.grouping_id = t4.id and t2.organ_code = t4.organ_code AND t4.del_flag!=2
LEFT JOIN ti_enterprise_info t5 ON t1.organ_code = t5.organ_code
<where>
<if test="groupingId != null ">and t1.grouping_id = #{groupingId}</if>
<if test="userName != null ">and t2.nick_name = #{userId}</if>
<if test="userPhone != null ">and t2.phonenumber = #{userId}</if>
<if test="organCode != null ">and t2.organ_code = #{organCode}</if>
<if test="delFlag != null ">and t1.del_flag = #{delFlag}</if>
</where>
</select>
<select id="getUndistributedGroupingUsers" parameterType="GroupUserDTO" resultType="GroupingUserInfoVO">
select t1.id,as id t1.user_id as userId,t5.organ_name as organizationName, t3.dept_name as deptName,
t2.nick_name as userName
from sys_user t2
LEFT JOIN ec_grouping_user_info t1 on t1.user_id = t2.user_id AND t2.del_flag!=2
LEFT JOIN sys_dept t3 ON t2.dept_id = t3.dept_id
LEFT JOIN ec_grouping_config t4 ON t1.grouping_id = t4.id and t2.organ_code = t4.organ_code AND t4.del_flag!=2
LEFT JOIN ti_enterprise_info t5 ON t1.organ_code = t5.organ_code
<where>
<if test="groupingId != null ">and t1.grouping_id = #{groupingId}</if>
<if test="userName != null ">and t2.nick_name like concat('%',#{userName},'%')</if>
<if test="deptId != null ">and t3.id =#{deptId}</if>
<if test="organCode != null ">and t2.organ_code = #{organCode}</if>
</where>
</select>
<select id="getDistributedGroupingUsers" parameterType="GroupUserDTO" resultType="GroupingUserInfoVO">
select t1.id,as id t1.user_id as userId,t5.organ_name as organizationName, t3.dept_name as deptName,
t2.nick_name as userName
from ec_grouping_user_info t1
LEFT JOIN sys_user t2 on t1.user_id = t2.user_id AND t2.del_flag!=2
LEFT JOIN sys_dept t3 ON t2.dept_id = t3.dept_id
LEFT JOIN ec_grouping_config t4 ON t1.grouping_id = t4.id and t2.organ_code = t4.organ_code AND t4.del_flag!=2
LEFT JOIN ti_enterprise_info t5 ON t1.organ_code = t5.organ_code
<where>
<if test="groupingId != null ">and t1.grouping_id = #{groupingId}</if>
<if test="userName != null ">and t2.nick_name like concat('%',#{userName},'%')</if>
</where>
</select>
<insert id="insertGroupingUserList" parameterType="GroupingUserInfo" useGeneratedKeys="true" keyProperty="id">
insert into ec_grouping_user_info
created_time, update_time, grouping_id,user_id
<foreach item="item" collection="list" open="(" separator="," close=")">
(#{item.createdTime}, #{item.updateTime}, #{item.groupingId}, #{item.userId})
</foreach>>
</insert>
<delete id="updateGroupingUserByIds" parameterType="String">
update ec_grouping_user_info set del_flag = 2
where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>