YZProjectCloud/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusTrainingVideoMapper.xml

165 lines
9.5 KiB
XML
Raw Normal View History

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.BusTrainingVideoMapper">
<resultMap type="BusTrainingVideo" id="BusTrainingVideoResult">
<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="trainTitle" column="train_title" />
<result property="trainType" column="train_type" />
<result property="trainLevel" column="train_level" />
<result property="craftType" column="craft_type" />
<result property="craftPost" column="craft_post" />
<result property="trainFileType" column="train_file_type" />
<result property="trainFilePath" column="train_file_path" />
<result property="trainFileImage" column="train_file_image" />
<result property="trainFileTimes" column="train_file_times" />
2024-10-07 22:43:41 +08:00
<result property="palyTimes" column="paly_times"/>
<result property="sortBy" column="sort_by"/>
2024-08-25 13:31:15 +08:00
<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="selectBusTrainingVideoVo">
2024-10-07 22:43:41 +08:00
select btv.*, sd.dept_name as com_name, pi.project_name
from bus_training_video btv
left join pro_project_info pi on pi.id = btv.project_id
left join sys_dept sd on sd.dept_id = btv.com_id
2024-08-25 13:31:15 +08:00
</sql>
<select id="selectBusTrainingVideoList" parameterType="BusTrainingVideo" resultMap="BusTrainingVideoResult">
<include refid="selectBusTrainingVideoVo"/>
2024-10-07 22:43:41 +08:00
<where>
and btv.is_del != 2
<if test="comId != null "> and (btv.com_id = #{comId} or btv.com_id is null)</if>
<if test="projectId != null "> and (btv.project_id = #{projectId} or btv.project_id is null)</if>
<if test="activeComId != null "> and (btv.com_id = #{activeComId} or btv.com_id is null)</if>
<if test="activeProjectId != null "> and (btv.project_id = #{activeProjectId} or btv.project_id is null)</if>
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="trainTitle != null and trainTitle != ''"> and btv.train_title like concat('%', #{trainTitle}, '%')</if>
<if test="trainType != null and trainType != ''"> and btv.train_type = #{trainType}</if>
<if test="trainLevel != null and trainLevel != ''"> and btv.train_level = #{trainLevel}</if>
<if test="craftType != null and craftType != ''"> and find_in_set(#{craftType}, btv.craft_type)</if>
<if test="craftPost != null and craftPost != ''"> and find_in_set(#{craftPost}, btv.craft_post)</if>
<if test="isDel != null "> and btv.is_del = #{isDel}</if>
2024-08-25 13:31:15 +08:00
</where>
2024-10-07 22:43:41 +08:00
order by btv.id desc
</select>
<select id="findBusTrainingVideoByLevel" parameterType="BusTrainingVideo" resultType="map">
select btv.train_level as trainLevel, count(1) as total
from bus_training_video btv
left join pro_project_info pi on pi.id = btv.project_id
<where>
and btv.is_del != 2
<if test="comId != null "> and (btv.com_id = #{comId} or btv.com_id is null)</if>
<if test="projectId != null "> and (btv.project_id = #{projectId} or btv.project_id is null)</if>
<if test="activeComId != null "> and (btv.com_id = #{activeComId} or btv.com_id is null)</if>
<if test="activeProjectId != null "> and (btv.project_id = #{activeProjectId} or btv.project_id is null)</if>
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="trainTitle != null and trainTitle != ''"> and btv.train_title like concat('%', #{trainTitle}, '%')</if>
<if test="trainType != null and trainType != ''"> and btv.train_type = #{trainType}</if>
<if test="craftType != null and craftType != ''"> and find_in_set(#{craftType}, btv.craft_type)</if>
<if test="craftPost != null and craftPost != ''"> and find_in_set(#{craftPost}, btv.craft_post)</if>
<if test="isDel != null "> and btv.is_del = #{isDel}</if>
</where>
group by btv.train_level
2024-08-25 13:31:15 +08:00
</select>
<select id="selectBusTrainingVideoById" parameterType="Long" resultMap="BusTrainingVideoResult">
<include refid="selectBusTrainingVideoVo"/>
2024-10-07 22:43:41 +08:00
where btv.id = #{id}
2024-08-25 13:31:15 +08:00
</select>
<insert id="insertBusTrainingVideo" parameterType="BusTrainingVideo" useGeneratedKeys="true" keyProperty="id">
insert into bus_training_video
<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="trainTitle != null">train_title,</if>
<if test="trainType != null">train_type,</if>
<if test="trainLevel != null">train_level,</if>
<if test="craftType != null">craft_type,</if>
<if test="craftPost != null">craft_post,</if>
<if test="trainFileType != null">train_file_type,</if>
<if test="trainFilePath != null">train_file_path,</if>
<if test="trainFileImage != null">train_file_image,</if>
<if test="trainFileTimes != null">train_file_times,</if>
2024-10-07 22:43:41 +08:00
<if test="palyTimes != null">paly_times,</if>
<if test="sortBy != null">sort_by,</if>
2024-08-25 13:31:15 +08:00
<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="trainTitle != null">#{trainTitle},</if>
<if test="trainType != null">#{trainType},</if>
<if test="trainLevel != null">#{trainLevel},</if>
<if test="craftType != null">#{craftType},</if>
<if test="craftPost != null">#{craftPost},</if>
<if test="trainFileType != null">#{trainFileType},</if>
<if test="trainFilePath != null">#{trainFilePath},</if>
<if test="trainFileImage != null">#{trainFileImage},</if>
<if test="trainFileTimes != null">#{trainFileTimes},</if>
2024-10-07 22:43:41 +08:00
<if test="palyTimes != null">#{palyTimes},</if>
<if test="sortBy != null">#{sortBy},</if>
2024-08-25 13:31:15 +08:00
<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="updateBusTrainingVideo" parameterType="BusTrainingVideo">
update bus_training_video
<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="trainTitle != null">train_title = #{trainTitle},</if>
<if test="trainType != null">train_type = #{trainType},</if>
<if test="trainLevel != null">train_level = #{trainLevel},</if>
<if test="craftType != null">craft_type = #{craftType},</if>
<if test="craftPost != null">craft_post = #{craftPost},</if>
<if test="trainFileType != null">train_file_type = #{trainFileType},</if>
<if test="trainFilePath != null">train_file_path = #{trainFilePath},</if>
<if test="trainFileImage != null">train_file_image = #{trainFileImage},</if>
<if test="trainFileTimes != null">train_file_times = #{trainFileTimes},</if>
2024-10-07 22:43:41 +08:00
<if test="palyTimes != null">paly_times = #{palyTimes},</if>
<if test="sortBy != null">sort_by = #{sortBy},</if>
2024-08-25 13:31:15 +08:00
<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="deleteBusTrainingVideoById" parameterType="Long">
update bus_training_video 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="deleteBusTrainingVideoByIds" parameterType="String">
update bus_training_video 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>