123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- <?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.statis.mapper.FsStatisPeriodWatchMapper">
- <!-- 通用查询结果映射 -->
- <resultMap id="BaseResultMap" type="com.fs.statis.domain.FsStatisPeriodWatch">
- <id column="id" property="id" jdbcType="INTEGER" />
- <result column="period_id" property="periodId" jdbcType="INTEGER" />
- <result column="period_num" property="periodNum" jdbcType="INTEGER" />
- <result column="not_reg_num" property="notRegNum" jdbcType="INTEGER" />
- <result column="registered_num" property="registeredNum" jdbcType="INTEGER" />
- <result column="reg_rate" property="regRate" jdbcType="DECIMAL" />
- <result column="watch_completed_rate" property="watchCompletedRate" jdbcType="DECIMAL" />
- <result column="offline_total" property="offlineTotal" jdbcType="INTEGER" />
- <result column="offline_not_reg_num" property="offlineNotRegNum" jdbcType="INTEGER" />
- <result column="offline_not_watch_num" property="offlineNotWatchNum" jdbcType="INTEGER" />
- <result column="online_total" property="onlineTotal" jdbcType="INTEGER" />
- <result column="online_rate" property="onlineRate" jdbcType="DECIMAL" />
- <result column="online_watch_completed_rate" property="onlineWatchCompletedRate" jdbcType="DECIMAL" />
- <result column="online_watch_not_completed" property="onlineWatchNotCompleted" jdbcType="INTEGER" />
- <result column="online_watch_completed" property="onlineWatchCompleted" jdbcType="INTEGER" />
- <result column="data_date" property="dataDate" jdbcType="DATE" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id, period_id, period_num, not_reg_num, registered_num, reg_rate,
- watch_completed_rate, offline_total, offline_not_reg_num, offline_not_watch_num,
- online_total, online_rate, online_watch_completed_rate, online_watch_not_completed,
- online_watch_completed, data_date
- </sql>
- <!-- 根据主键查询数据 -->
- <select id="selectById" resultMap="BaseResultMap" parameterType="java.lang.Integer">
- SELECT
- <include refid="Base_Column_List" />
- FROM fs_statis_period_watch
- WHERE id = #{id,jdbcType=INTEGER}
- </select>
- <!-- 新增数据 -->
- <insert id="insert" parameterType="com.fs.statis.domain.FsStatisPeriodWatch">
- INSERT INTO fs_statis_period_watch (
- id, period_id, period_num, not_reg_num, registered_num, reg_rate,
- watch_completed_rate, offline_total, offline_not_reg_num, offline_not_watch_num,
- online_total, online_rate, online_watch_completed_rate, online_watch_not_completed,
- online_watch_completed, data_date
- )
- VALUES (
- #{id,jdbcType=INTEGER}, #{periodId,jdbcType=INTEGER}, #{periodNum,jdbcType=INTEGER},
- #{notRegNum,jdbcType=INTEGER}, #{registeredNum,jdbcType=INTEGER}, #{regRate,jdbcType=DECIMAL},
- #{watchCompletedRate,jdbcType=DECIMAL}, #{offlineTotal,jdbcType=INTEGER},
- #{offlineNotRegNum,jdbcType=INTEGER}, #{offlineNotWatchNum,jdbcType=INTEGER},
- #{onlineTotal,jdbcType=INTEGER}, #{onlineRate,jdbcType=DECIMAL},
- #{onlineWatchCompletedRate,jdbcType=DECIMAL}, #{onlineWatchNotCompleted,jdbcType=INTEGER},
- #{onlineWatchCompleted,jdbcType=INTEGER}, #{dataDate,jdbcType=DATE}
- )
- </insert>
- <!-- 根据主键更新数据 (动态SQL,只更新非null字段) -->
- <update id="updateById" parameterType="com.fs.statis.domain.FsStatisPeriodWatch">
- UPDATE fs_statis_period_watch
- <set>
- <if test="periodId != null">
- period_id = #{periodId,jdbcType=INTEGER},
- </if>
- <if test="periodNum != null">
- period_num = #{periodNum,jdbcType=INTEGER},
- </if>
- <if test="notRegNum != null">
- not_reg_num = #{notRegNum,jdbcType=INTEGER},
- </if>
- <if test="registeredNum != null">
- registered_num = #{registeredNum,jdbcType=INTEGER},
- </if>
- <if test="regRate != null">
- reg_rate = #{regRate,jdbcType=DECIMAL},
- </if>
- <if test="watchCompletedRate != null">
- watch_completed_rate = #{watchCompletedRate,jdbcType=DECIMAL},
- </if>
- <if test="offlineTotal != null">
- offline_total = #{offlineTotal,jdbcType=INTEGER},
- </if>
- <if test="offlineNotRegNum != null">
- offline_not_reg_num = #{offlineNotRegNum,jdbcType=INTEGER},
- </if>
- <if test="offlineNotWatchNum != null">
- offline_not_watch_num = #{offlineNotWatchNum,jdbcType=INTEGER},
- </if>
- <if test="onlineTotal != null">
- online_total = #{onlineTotal,jdbcType=INTEGER},
- </if>
- <if test="onlineRate != null">
- online_rate = #{onlineRate,jdbcType=DECIMAL},
- </if>
- <if test="onlineWatchCompletedRate != null">
- online_watch_completed_rate = #{onlineWatchCompletedRate,jdbcType=DECIMAL},
- </if>
- <if test="onlineWatchNotCompleted != null">
- online_watch_not_completed = #{onlineWatchNotCompleted,jdbcType=INTEGER},
- </if>
- <if test="onlineWatchCompleted != null">
- online_watch_completed = #{onlineWatchCompleted,jdbcType=INTEGER},
- </if>
- <if test="dataDate != null">
- data_date = #{dataDate,jdbcType=DATE},
- </if>
- </set>
- WHERE id = #{id,jdbcType=INTEGER}
- </update>
- <!-- 根据主键删除数据 -->
- <delete id="deleteById" parameterType="java.lang.Integer">
- DELETE FROM fs_statis_period_watch
- WHERE id = #{id,jdbcType=INTEGER}
- </delete>
- <!-- 查询所有数据 -->
- <select id="selectAll" resultMap="BaseResultMap">
- SELECT
- <include refid="Base_Column_List" />
- FROM fs_statis_period_watch
- </select>
- <select id="queryList" resultType="com.fs.statis.domain.FsStatisPeriodWatch">
- select * from fs_statis_period_watch
- <where>
- <if test="userIds != null and userIds.length > 0">
- AND company_user_id IN
- <foreach collection="userIds" open="(" close=")" separator="," item="item">
- ${item}
- </foreach>
- </if>
- <if test="periodList != null and periodList.length > 0">
- AND period_id IN
- <foreach collection="periodList" open="(" close=")" separator="," item="item">
- ${item}
- </foreach>
- </if>
- <if test="startDate != null and endDate != null">
- AND data_date BETWEEN #{startDate} AND #{endDate}
- </if>
- </where>
- </select>
- </mapper>
|