147 lines
8.5 KiB
XML
147 lines
8.5 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.manage.mapper.BusTrainingVideoUserMapper">
|
|
|
|
<resultMap type="BusTrainingVideoUser" id="BusTrainingVideoUserResult">
|
|
<result property="id" column="id" />
|
|
<result property="comId" column="com_id" />
|
|
<result property="comName" column="com_name" />
|
|
<result property="projectId" column="project_id" />
|
|
<result property="projectName" column="project_name" />
|
|
<result property="userId" column="user_id" />
|
|
<result property="userNick" column="user_nick" />
|
|
<result property="userName" column="user_name" />
|
|
<result property="videoId" column="video_id" />
|
|
<result property="trainTitle" column="train_title" />
|
|
<result property="trainType" column="train_type" />
|
|
<result property="trainTypeName" column="train_type_name" />
|
|
<result property="trainLevel" column="train_level" />
|
|
<result property="trainLevelName" column="train_level_name" />
|
|
<result property="trainFilePath" column="train_file_path" />
|
|
<result property="trainFileImage" column="train_file_image" />
|
|
<result property="playTimes" column="play_times" />
|
|
<result property="playStatus" column="play_status" />
|
|
<result property="playDates" column="play_dates" />
|
|
<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">
|
|
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, btv.train_title,
|
|
btv.train_type, dic1.dict_label as train_type_name, btv.train_level, dic2.dict_label as train_level_name, btv.train_file_path, btv.train_file_image, btvu.play_times, btvu.play_dates,
|
|
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 bus_training_video btv on btv.id = btvu.video_id
|
|
left join pro_project_info pi on pi.id = btvu.project_id
|
|
left join sys_dept sd on sd.dept_id = btvu.com_id
|
|
left join sys_user su on su.user_id = btvu.user_id
|
|
left join sys_dict_data dic1 ON btv.train_type = dic1.`dict_value` AND dic1.`dict_type`='edu_train_type'
|
|
left join sys_dict_data dic2 ON btv.train_level = dic2.`dict_value` AND dic2.`dict_type`='edu_train_level'
|
|
</sql>
|
|
|
|
<select id="selectBusTrainingVideoUserList" parameterType="BusTrainingVideoUser" resultMap="BusTrainingVideoUserResult">
|
|
<include refid="selectBusTrainingVideoUserVo"/>
|
|
<where>
|
|
<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>
|
|
and btvu.is_del!=2
|
|
</where>
|
|
order by btvu.id desc
|
|
</select>
|
|
|
|
<select id="selectBusTrainingVideoUserById" parameterType="Long" resultMap="BusTrainingVideoUserResult">
|
|
select * from bus_training_video_user where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertBusTrainingVideoUser" parameterType="BusTrainingVideoUser" useGeneratedKeys="true" keyProperty="id">
|
|
insert into bus_training_video_user
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="comId != null">com_id,</if>
|
|
<if test="projectId != null">project_id,</if>
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="videoId != null">video_id,</if>
|
|
<if test="playTimes != null">play_times,</if>
|
|
<if test="playStatus != null">play_status,</if>
|
|
<if test="playDates != null">play_dates,</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=",">
|
|
<if test="comId != null">#{comId},</if>
|
|
<if test="projectId != null">#{projectId},</if>
|
|
<if test="userId != null">#{userId},</if>
|
|
<if test="videoId != null">#{videoId},</if>
|
|
<if test="playTimes != null">#{playTimes},</if>
|
|
<if test="playStatus != null">#{playStatus},</if>
|
|
<if test="playDates != null">#{playDates},</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=",">
|
|
<if test="comId != null">com_id = #{comId},</if>
|
|
<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="playTimes != null">play_times = #{playTimes},</if>
|
|
<if test="playStatus != null">play_status = #{playStatus},</if>
|
|
<if test="playDates != null">play_dates = #{playDates},</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>
|
|
|
|
<update id="deleteBusTrainingVideoUserById" parameterType="Long">
|
|
update bus_training_video_user set is_del=2 where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteBusTrainingVideoUserByParams">
|
|
delete from bus_training_video_user where project_id = #{proId} and user_id = #{userId}
|
|
</delete>
|
|
|
|
<update id="deleteBusTrainingVideoUserByIds" parameterType="String">
|
|
update bus_training_video_user set is_del=2 where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<insert id="batchBusTrainingVideoUser">
|
|
insert into bus_training_video_user( id, com_id, project_id, user_id, video_id, play_times, play_status, play_dates, sort_by, is_del, create_by, create_time, update_by, update_time, remark) values
|
|
<foreach item="item" index="index" collection="list" separator=",">
|
|
( #{item.id}, #{item.comId}, #{item.projectId}, #{item.userId}, #{item.videoId}, #{item.playTimes}, #{item.playStatus}, #{item.playDates}, #{item.sortBy}, #{item.isDel}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
|
|
</foreach>
|
|
</insert>
|
|
|
|
</mapper> |