123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <?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.ruoyi.mingxue.mapper.CustomerVideoWatchesMapper">
-
- <resultMap type="CustomerVideoWatches" id="CustomerVideoWatchesResult">
- <result property="id" column="id" />
- <result property="customerCode" column="customerCode" />
- <result property="type" column="type" />
- <result property="sectionId" column="section_id" />
- <result property="duration" column="duration" />
- <result property="percent" column="percent" />
- <result property="course" column="course" />
- <result property="title" column="title" />
- <result property="pict" column="pict" />
- <result property="comment" column="comment" />
- <result property="time" column="time" />
- <result property="type" column="type" />
- </resultMap>
- <sql id="selectCustomerVideoWatchesVo">
- select id, customerCode, section_id, duration, percent, course, title, pict, comment, time ,type from b_customer_video_watches
- </sql>
- <select id="selectCustomerVideoWatchesList" parameterType="CustomerVideoWatches" resultMap="CustomerVideoWatchesResult">
- <include refid="selectCustomerVideoWatchesVo"/>
- <where>
- <if test="customerCode != null and customerCode != ''"> and customerCode = #{customerCode}</if>
- <if test="sectionId != null and sectionId != ''"> and section_id = #{sectionId}</if>
- <if test="type != null"> and type = #{type}</if>
- <if test="duration != null "> and duration = #{duration}</if>
- <if test="percent != null "> and percent = #{percent}</if>
- <if test="course != null and course != ''"> and course = #{course}</if>
- <if test="title != null and title != ''"> and title = #{title}</if>
- <if test="pict != null and pict != ''"> and pict = #{pict}</if>
- <if test="comment != null and comment != ''"> and comment = #{comment}</if>
- <if test="time != null "> and time = #{time}</if>
- </where>
- </select>
-
- <select id="selectCustomerVideoWatchesById" parameterType="Long" resultMap="CustomerVideoWatchesResult">
- <include refid="selectCustomerVideoWatchesVo"/>
- where id = #{id}
- </select>
-
- <insert id="insertCustomerVideoWatches" parameterType="CustomerVideoWatches" useGeneratedKeys="true" keyProperty="id">
- insert into b_customer_video_watches
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="customerCode != null and customerCode != ''">customerCode,</if>
- <if test="sectionId != null and sectionId != ''">section_id,</if>
- <if test="duration != null">duration,</if>
- <if test="percent != null">percent,</if>
- <if test="course != null">course,</if>
- <if test="title != null">title,</if>
- <if test="pict != null">pict,</if>
- <if test="comment != null">comment,</if>
- <if test="time != null">time,</if>
- <if test="type != null">type,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="customerCode != null and customerCode != ''">#{customerCode},</if>
- <if test="sectionId != null and sectionId != ''">#{sectionId},</if>
- <if test="duration != null">#{duration},</if>
- <if test="percent != null">#{percent},</if>
- <if test="course != null">#{course},</if>
- <if test="title != null">#{title},</if>
- <if test="pict != null">#{pict},</if>
- <if test="comment != null">#{comment},</if>
- <if test="time != null">#{time},</if>
- <if test="type != null">#{type},</if>
- </trim>
- </insert>
- <update id="updateCustomerVideoWatches" parameterType="CustomerVideoWatches">
- update b_customer_video_watches
- <trim prefix="SET" suffixOverrides=",">
- <if test="customerCode != null and customerCode != ''">customerCode = #{customerCode},</if>
- <if test="sectionId != null and sectionId != ''">section_id = #{sectionId},</if>
- <if test="duration != null">duration = #{duration},</if>
- <if test="percent != null">percent = #{percent},</if>
- <if test="course != null">course = #{course},</if>
- <if test="title != null">title = #{title},</if>
- <if test="pict != null">pict = #{pict},</if>
- <if test="comment != null">comment = #{comment},</if>
- <if test="time != null">time = #{time},</if>
- <if test="type != null">type = #{type},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteCustomerVideoWatchesById" parameterType="Long">
- delete from b_customer_video_watches where id = #{id}
- </delete>
- <delete id="deleteCustomerVideoWatchesByIds" parameterType="String">
- delete from b_customer_video_watches where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
-
- <select id="countVideoWatchCount" parameterType="String" resultType="Integer">
- select count(section_id) from b_customer_video_watches
- where percent>=90 and customerCode=#{customerCode}
- </select>
-
- <select id="countVideoWatchDuration" parameterType="String" resultType="Integer">
- select ifnull(sum(duration),0) from b_customer_video_watches
- where percent>=90 and customerCode=#{customerCode}
- </select>
-
- <select id="countDurationByDate" parameterType="java.util.HashMap" resultMap="CustomerVideoWatchesResult">
- select DATE_FORMAT(time, '%Y-%m-%d') day, sum(duration) count from b_customer_video_watches
- where customerCode=#{customerCode}
- and DATE_FORMAT(time, '%Y-%m-%d') >= #{start}
- and #{end} >= DATE_FORMAT(time, '%Y-%m-%d')
- group by DATE_FORMAT(time, '%Y-%m-%d')
- </select>
-
- <select id="countDurationByDateAndSubject" parameterType="java.util.HashMap" resultMap="CustomerVideoWatchesResult">
- select course, sum(duration) count from b_customer_video_watches
- where percent>=90 and customerCode=#{customerCode}
- and DATE_FORMAT(time, '%Y-%m-%d') >= #{start}
- and #{end} >= DATE_FORMAT(time, '%Y-%m-%d')
- group by course
- </select>
-
- <select id="selectByDate" parameterType="java.util.HashMap" resultMap="CustomerVideoWatchesResult">
- select * from b_customer_video_watches
- where percent>=90 and customerCode=#{customerCode}
- and DATE_FORMAT(time, '%Y-%m-%d') >= #{start}
- and #{end} >= DATE_FORMAT(time, '%Y-%m-%d')
- order by time desc
- </select>
-
- <select id="selectTodayBySection" parameterType="java.util.HashMap" resultMap="CustomerVideoWatchesResult">
- select * from b_customer_video_watches
- where customerCode=#{customerCode}
- and to_days(time) = to_days(now())
- and section_id = #{sectionId}
- and type = #{type}
- </select>
-
- </mapper>
|