| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <?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.fs.course.mapper.FsCourseRewardVideoRelationMapper">
- <resultMap type="FsCourseRewardVideoRelation" id="FsCourseRewardVideoRelationResult">
- <result property="id" column="id" />
- <result property="rewardId" column="reward_id" />
- <result property="videoSectionId" column="video_section_id" />
- <result property="mark" column="mark" />
- <result property="createId" column="create_id" />
- <result property="createTime" column="create_time" />
- <result property="updateId" column="update_id" />
- <result property="updateTime" column="update_time" />
- <result property="companyId" column="company_id" />
- </resultMap>
- <sql id="selectFsCourseRewardVideoRelationVo">
- select id, reward_id, company_id,video_section_id, mark, create_id, create_time, update_id, update_time from fs_course_reward_video_relation
- </sql>
- <select id="selectFsCourseRewardVideoRelationList" parameterType="FsCourseRewardVideoRelation" resultMap="FsCourseRewardVideoRelationResult">
- <include refid="selectFsCourseRewardVideoRelationVo"/>
- <where>
- <if test="rewardId != null and rewardId != ''"> and reward_id = #{rewardId}</if>
- <if test="videoSectionId != null and videoSectionId != ''"> and video_section_id = #{videoSectionId}</if>
- <if test="mark != null "> and mark = #{mark}</if>
- <if test="createId != null "> and create_id = #{createId}</if>
- <if test="updateId != null "> and update_id = #{updateId}</if>
- </where>
- </select>
- <select id="selectFsCourseRewardVideoRelationById" parameterType="String" resultMap="FsCourseRewardVideoRelationResult">
- <include refid="selectFsCourseRewardVideoRelationVo"/>
- where id = #{id}
- </select>
- <select id="getRewardIdByCompanyIdAndVideoIdAndType" resultType="java.lang.Long">
- select cr.id
- from fs_course_reward_video_relation crvr
- inner join fs_course_reward cr on cr.id = crvr.reward_id and cr.reward_type = #{type}
- where crvr.company_id = #{companyId} and crvr.video_section_id = #{videoId} and cr.status = 1
- limit 1
- </select>
- <select id="getRewardByCompanyIdAndVideoIdAndType" resultType="com.fs.course.domain.FsCourseReward">
- select cr.*
- from fs_course_reward cr
- inner join fs_course_reward_video_relation crvr on cr.id = crvr.reward_id
- where crvr.company_id = #{companyId} and crvr.video_section_id = #{videoId} and cr.reward_type = #{type} and cr.status = 1
- limit 1
- </select>
- <insert id="insertFsCourseRewardVideoRelation" parameterType="FsCourseRewardVideoRelation" useGeneratedKeys="true" keyProperty="id">
- insert into fs_course_reward_video_relation
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="rewardId != null and rewardId != ''">reward_id,</if>
- <if test="videoSectionId != null and videoSectionId != ''">video_section_id,</if>
- <if test="mark != null">mark,</if>
- <if test="createId != null">create_id,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateId != null">update_id,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="companyId != null">company_id,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="rewardId != null and rewardId != ''">#{rewardId},</if>
- <if test="videoSectionId != null and videoSectionId != ''">#{videoSectionId},</if>
- <if test="mark != null">#{mark},</if>
- <if test="createId != null">#{createId},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateId != null">#{updateId},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="companyId != null">#{companyId},</if>
- </trim>
- </insert>
- <update id="updateFsCourseRewardVideoRelation" parameterType="FsCourseRewardVideoRelation">
- update fs_course_reward_video_relation
- <trim prefix="SET" suffixOverrides=",">
- <if test="rewardId != null and rewardId != ''">reward_id = #{rewardId},</if>
- <if test="videoSectionId != null and videoSectionId != ''">video_section_id = #{videoSectionId},</if>
- <if test="mark != null">mark = #{mark},</if>
- <if test="createId != null">create_id = #{createId},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateId != null">update_id = #{updateId},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="companyId != null">company_id = #{companyId},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteFsCourseRewardVideoRelationById" parameterType="String">
- delete from fs_course_reward_video_relation where id = #{id}
- </delete>
- <delete id="deleteFsCourseRewardVideoRelationByIds" parameterType="String">
- delete from fs_course_reward_video_relation where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <delete id="deleteByTypes">
- delete crvr from fs_course_reward_video_relation crvr
- inner join fs_course_reward cr on cr.id = crvr.reward_id
- where crvr.video_section_id = #{videoId} and crvr.company_id = #{companyId}
- and cr.reward_type in
- <foreach item="type" collection="types" open="(" separator="," close=")">
- #{type}
- </foreach>
- </delete>
- <select id="selectFsCourseRewardVideoRelationListByType" resultMap="FsCourseRewardVideoRelationResult">
- select crvr.id, crvr.reward_id, crvr.company_id,crvr.video_section_id, crvr.mark, crvr.create_id, crvr.create_time, crvr.update_id, crvr.update_time
- from fs_course_reward_video_relation crvr
- inner join fs_course_reward cr on cr.id = crvr.reward_id
- <where>
- <if test="rewardId != null and rewardId != ''"> and crvr.reward_id = #{rewardId}</if>
- <if test="type != null and type != ''"> and cr.reward_type = #{type}</if>
- <if test="videoSectionId != null and videoSectionId != ''"> and video_section_id = #{videoSectionId}</if>
- <if test="mark != null "> and crvr.mark = #{mark}</if>
- <if test="companyId != null ">and crvr.company_id = #{companyId}</if>
- <if test="createId != null "> and crvr.create_id = #{createId}</if>
- <if test="updateId != null "> and crvr.update_id = #{updateId}</if>
- </where>
- </select>
- <select id="selectByCompanyIdAndVideoIdAndRewardId" resultType="com.fs.course.domain.FsCourseRewardVideoRelation">
- select
- *
- from fs_course_reward_video_relation
- where company_id = #{companyId} and video_section_id = #{videoId} and reward_id = #{rewardId}
- </select>
- </mapper>
|