2024-08-25 13:31:15 +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.manage.mapper.BusTrainingVideoUserMapper" >
<resultMap type= "BusTrainingVideoUser" id= "BusTrainingVideoUserResult" >
<result property= "id" column= "id" />
2024-10-07 22:43:41 +08:00
<result property= "comId" column= "com_id" />
<result property= "comName" column= "com_name" />
2024-08-25 13:31:15 +08:00
<result property= "projectId" column= "project_id" />
2024-10-07 22:43:41 +08:00
<result property= "projectName" column= "project_name" />
2024-08-25 13:31:15 +08:00
<result property= "userId" column= "user_id" />
2024-10-07 22:43:41 +08:00
<result property= "userNick" column= "user_nick" />
<result property= "userName" column= "user_name" />
2024-08-25 13:31:15 +08:00
<result property= "videoId" column= "video_id" />
<result property= "playStatus" column= "play_status" />
<result property= "sortBy" column= "sort_by" />
<result property= "isDel" column= "is_del" />
<result property= "createBy" column= "create_by" />
<result property= "createTime" column= "create_time" />
<result property= "updateBy" column= "update_by" />
<result property= "updateTime" column= "update_time" />
<result property= "remark" column= "remark" />
</resultMap>
<sql id= "selectBusTrainingVideoUserVo" >
2024-10-07 22:43:41 +08:00
select btvu.id, btvu.com_id, sd.dept_name as com_name, btvu.project_id, pi.project_name, btvu.user_id, su.nick_name as user_nick, su.user_name, btvu.video_id, btvu.play_status, btvu.sort_by, btvu.is_del, btvu.create_by, btvu.create_time, btvu.update_by, btvu.update_time, btvu.remark from bus_training_video_user btvu
left join pro_project_info pi on pi.id = btvu.project_id
left join sys_dept sd on sd.com_id = btvu.com_id
left join sys_user su on su.user_id = btvu.user_id
2024-08-25 13:31:15 +08:00
</sql>
<select id= "selectBusTrainingVideoUserList" parameterType= "BusTrainingVideoUser" resultMap= "BusTrainingVideoUserResult" >
<include refid= "selectBusTrainingVideoUserVo" />
2024-10-07 22:43:41 +08:00
<where >
btvu.is_del!=2
<if test= "comId != null " > and btvu.com_id = #{comId}</if>
<if test= "projectId != null " > and btvu.project_id = #{projectId}</if>
<if test= "activeComId != null " > and btvu.com_id = #{activeComId}</if>
<if test= "activeProjectId != null " > and btvu.project_id = #{activeProjectId}</if>
<if test= "projectName != null and projectName != ''" > and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test= "userName != null and userName != ''" > and (su.nick_name like concat('%', #{userName}, '%') or su.user_name like concat('%', #{userName}, '%') )</if>
<if test= "userId != null " > and btvu.user_id = #{userId}</if>
<if test= "isDel != null " > and btvu.is_del = #{isDel}</if>
2024-08-25 13:31:15 +08:00
</where>
2024-10-07 22:43:41 +08:00
order by btvu.id desc
2024-08-25 13:31:15 +08:00
</select>
<select id= "selectBusTrainingVideoUserById" parameterType= "Long" resultMap= "BusTrainingVideoUserResult" >
<include refid= "selectBusTrainingVideoUserVo" />
2024-10-07 22:43:41 +08:00
where btvu.id = #{id}
2024-08-25 13:31:15 +08:00
</select>
<insert id= "insertBusTrainingVideoUser" parameterType= "BusTrainingVideoUser" useGeneratedKeys= "true" keyProperty= "id" >
insert into bus_training_video_user
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
2024-10-07 22:43:41 +08:00
<if test= "comId != null" > com_id,</if>
2024-08-25 13:31:15 +08:00
<if test= "projectId != null" > project_id,</if>
<if test= "userId != null" > user_id,</if>
<if test= "videoId != null" > video_id,</if>
<if test= "playStatus != null" > play_status,</if>
<if test= "sortBy != null" > sort_by,</if>
<if test= "isDel != null" > is_del,</if>
<if test= "createBy != null" > create_by,</if>
<if test= "createTime != null" > create_time,</if>
<if test= "updateBy != null" > update_by,</if>
<if test= "updateTime != null" > update_time,</if>
<if test= "remark != null" > remark,</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
2024-10-07 22:43:41 +08:00
<if test= "comId != null" > #{comId},</if>
2024-08-25 13:31:15 +08:00
<if test= "projectId != null" > #{projectId},</if>
<if test= "userId != null" > #{userId},</if>
<if test= "videoId != null" > #{videoId},</if>
<if test= "playStatus != null" > #{playStatus},</if>
<if test= "sortBy != null" > #{sortBy},</if>
<if test= "isDel != null" > #{isDel},</if>
<if test= "createBy != null" > #{createBy},</if>
<if test= "createTime != null" > #{createTime},</if>
<if test= "updateBy != null" > #{updateBy},</if>
<if test= "updateTime != null" > #{updateTime},</if>
<if test= "remark != null" > #{remark},</if>
</trim>
</insert>
<update id= "updateBusTrainingVideoUser" parameterType= "BusTrainingVideoUser" >
update bus_training_video_user
<trim prefix= "SET" suffixOverrides= "," >
2024-10-07 22:43:41 +08:00
<if test= "comId != null" > com_id = #{comId},</if>
2024-08-25 13:31:15 +08:00
<if test= "projectId != null" > project_id = #{projectId},</if>
<if test= "userId != null" > user_id = #{userId},</if>
<if test= "videoId != null" > video_id = #{videoId},</if>
<if test= "playStatus != null" > play_status = #{playStatus},</if>
<if test= "sortBy != null" > sort_by = #{sortBy},</if>
<if test= "isDel != null" > is_del = #{isDel},</if>
<if test= "createBy != null" > create_by = #{createBy},</if>
<if test= "createTime != null" > create_time = #{createTime},</if>
<if test= "updateBy != null" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "remark != null" > remark = #{remark},</if>
</trim>
where id = #{id}
</update>
2024-10-07 22:43:41 +08:00
<update id= "deleteBusTrainingVideoUserById" parameterType= "Long" >
update bus_training_video_user set is_del=2 where id = #{id}
</update>
2024-08-25 13:31:15 +08:00
2024-10-07 22:43:41 +08:00
<update id= "deleteBusTrainingVideoUserByIds" parameterType= "String" >
update bus_training_video_user set is_del=2 where id in
2024-08-25 13:31:15 +08:00
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
2024-10-07 22:43:41 +08:00
</update>
2024-08-25 13:31:15 +08:00
</mapper>