FsStatisEveryDayMapper.xml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.fs.statis.mapper.FsStatisEveryDayWatchMapper">
  4. <!-- 结果集映射 -->
  5. <resultMap id="BaseResultMap" type="com.fs.statis.domain.FsStatisEveryDayWatch">
  6. <id column="id" jdbcType="INTEGER" property="id" />
  7. <result column="data_date" jdbcType="TIMESTAMP" property="dataDate" />
  8. <result column="period_id" jdbcType="INTEGER" property="periodId" />
  9. <result column="period_num" jdbcType="INTEGER" property="periodNum" />
  10. <result column="not_reg_num" jdbcType="INTEGER" property="notRegNum" />
  11. <result column="registered_num" jdbcType="INTEGER" property="registeredNum" />
  12. <result column="reg_rate" jdbcType="REAL" property="regRate" /> <!-- Use REAL or FLOAT for float type -->
  13. <result column="completed_rate" jdbcType="REAL" property="completedRate" />
  14. <result column="offline_total" jdbcType="INTEGER" property="offlineTotal" />
  15. <result column="offline_not_reg_num" jdbcType="INTEGER" property="offlineNotRegNum" />
  16. <result column="offline_not_watch_num" jdbcType="INTEGER" property="offlineNotWatchNum" />
  17. <result column="online_total" jdbcType="INTEGER" property="onlineTotal" />
  18. <result column="online_rate" jdbcType="REAL" property="onlineRate" />
  19. <result column="online_completed_rate" jdbcType="REAL" property="onlineCompletedRate" />
  20. <result column="online_not_comp_rate_num" jdbcType="INTEGER" property="onlineNotCompRateNum" />
  21. <result column="online_completed_num" jdbcType="INTEGER" property="onlineCompletedNum" />
  22. <result column="company_user_id" jdbcType="INTEGER" property="companyUserId" />
  23. </resultMap>
  24. <!-- 通用查询结果列 -->
  25. <sql id="Base_Column_List">
  26. id, data_date, period_id, period_num, not_reg_num, registered_num, reg_rate,
  27. completed_rate, offline_total, offline_not_reg_num, offline_not_watch_num,
  28. online_total, online_rate, online_completed_rate, online_not_comp_rate_num,
  29. online_completed_num, company_user_id
  30. </sql>
  31. <!-- 根据主键查询 -->
  32. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  33. select
  34. <include refid="Base_Column_List" />
  35. from fs_statis_every_day_watch
  36. where id = #{id,jdbcType=INTEGER}
  37. </select>
  38. <!-- 根据主键删除 -->
  39. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  40. delete from fs_statis_every_day_watch
  41. where id = #{id,jdbcType=INTEGER}
  42. </delete>
  43. <!-- 选择性插入记录 (只插入非空字段) -->
  44. <insert id="insertSelective" parameterType="com.fs.statis.domain.FsStatisEveryDayWatch" useGeneratedKeys="true" keyProperty="id">
  45. insert into fs_statis_every_day_watch
  46. <trim prefix="(" suffix=")" suffixOverrides=",">
  47. <if test="dataDate != null">data_date,</if>
  48. <if test="periodId != null">period_id,</if>
  49. <if test="periodNum != null">period_num,</if>
  50. <if test="notRegNum != null">not_reg_num,</if>
  51. <if test="registeredNum != null">registered_num,</if>
  52. <if test="regRate != null">reg_rate,</if>
  53. <if test="completedRate != null">completed_rate,</if>
  54. <if test="offlineTotal != null">offline_total,</if>
  55. <if test="offlineNotRegNum != null">offline_not_reg_num,</if>
  56. <if test="offlineNotWatchNum != null">offline_not_watch_num,</if>
  57. <if test="onlineTotal != null">online_total,</if>
  58. <if test="onlineRate != null">online_rate,</if>
  59. <if test="onlineCompletedRate != null">online_completed_rate,</if>
  60. <if test="onlineNotCompRateNum != null">online_not_comp_rate_num,</if>
  61. <if test="onlineCompletedNum != null">online_completed_num,</if>
  62. <if test="companyUserId != null">company_user_id,</if>
  63. </trim>
  64. <trim prefix="values (" suffix=")" suffixOverrides=",">
  65. <if test="dataDate != null">#{dataDate,jdbcType=TIMESTAMP},</if>
  66. <if test="periodId != null">#{periodId,jdbcType=INTEGER},</if>
  67. <if test="periodNum != null">#{periodNum,jdbcType=INTEGER},</if>
  68. <if test="notRegNum != null">#{notRegNum,jdbcType=INTEGER},</if>
  69. <if test="registeredNum != null">#{registeredNum,jdbcType=INTEGER},</if>
  70. <if test="regRate != null">#{regRate,jdbcType=REAL},</if>
  71. <if test="completedRate != null">#{completedRate,jdbcType=REAL},</if>
  72. <if test="offlineTotal != null">#{offlineTotal,jdbcType=INTEGER},</if>
  73. <if test="offlineNotRegNum != null">#{offlineNotRegNum,jdbcType=INTEGER},</if>
  74. <if test="offlineNotWatchNum != null">#{offlineNotWatchNum,jdbcType=INTEGER},</if>
  75. <if test="onlineTotal != null">#{onlineTotal,jdbcType=INTEGER},</if>
  76. <if test="onlineRate != null">#{onlineRate,jdbcType=REAL},</if>
  77. <if test="onlineCompletedRate != null">#{onlineCompletedRate,jdbcType=REAL},</if>
  78. <if test="onlineNotCompRateNum != null">#{onlineNotCompRateNum,jdbcType=INTEGER},</if>
  79. <if test="onlineCompletedNum != null">#{onlineCompletedNum,jdbcType=INTEGER},</if>
  80. <if test="companyUserId != null">#{companyUserId,jdbcType=INTEGER},</if>
  81. </trim>
  82. </insert>
  83. <!-- 根据主键选择性更新 (只更新非空字段) -->
  84. <update id="updateByPrimaryKeySelective" parameterType="com.fs.statis.domain.FsStatisEveryDayWatch">
  85. update fs_statis_every_day_watch
  86. <set>
  87. <if test="dataDate != null">data_date = #{dataDate,jdbcType=TIMESTAMP},</if>
  88. <if test="periodId != null">period_id = #{periodId,jdbcType=INTEGER},</if>
  89. <if test="periodNum != null">period_num = #{periodNum,jdbcType=INTEGER},</if>
  90. <if test="notRegNum != null">not_reg_num = #{notRegNum,jdbcType=INTEGER},</if>
  91. <if test="registeredNum != null">registered_num = #{registeredNum,jdbcType=INTEGER},</if>
  92. <if test="regRate != null">reg_rate = #{regRate,jdbcType=REAL},</if>
  93. <if test="completedRate != null">completed_rate = #{completedRate,jdbcType=REAL},</if>
  94. <if test="offlineTotal != null">offline_total = #{offlineTotal,jdbcType=INTEGER},</if>
  95. <if test="offlineNotRegNum != null">offline_not_reg_num = #{offlineNotRegNum,jdbcType=INTEGER},</if>
  96. <if test="offlineNotWatchNum != null">offline_not_watch_num = #{offlineNotWatchNum,jdbcType=INTEGER},</if>
  97. <if test="onlineTotal != null">online_total = #{onlineTotal,jdbcType=INTEGER},</if>
  98. <if test="onlineRate != null">online_rate = #{onlineRate,jdbcType=REAL},</if>
  99. <if test="onlineCompletedRate != null">online_completed_rate = #{onlineCompletedRate,jdbcType=REAL},</if>
  100. <if test="onlineNotCompRateNum != null">online_not_comp_rate_num = #{onlineNotCompRateNum,jdbcType=INTEGER},</if>
  101. <if test="onlineCompletedNum != null">online_completed_num = #{onlineCompletedNum,jdbcType=INTEGER},</if>
  102. <if test="companyUserId != null">company_user_id = #{companyUserId,jdbcType=INTEGER},</if>
  103. </set>
  104. where id = #{id,jdbcType=INTEGER}
  105. </update>
  106. <!-- 根据主键更新 (所有字段) -->
  107. <update id="updateByPrimaryKey" parameterType="com.fs.statis.domain.FsStatisEveryDayWatch">
  108. update fs_statis_every_day_watch
  109. set data_date = #{dataDate,jdbcType=TIMESTAMP},
  110. period_id = #{periodId,jdbcType=INTEGER},
  111. period_num = #{periodNum,jdbcType=INTEGER},
  112. not_reg_num = #{notRegNum,jdbcType=INTEGER},
  113. registered_num = #{registeredNum,jdbcType=INTEGER},
  114. reg_rate = #{regRate,jdbcType=REAL},
  115. completed_rate = #{completedRate,jdbcType=REAL},
  116. offline_total = #{offlineTotal,jdbcType=INTEGER},
  117. offline_not_reg_num = #{offlineNotRegNum,jdbcType=INTEGER},
  118. offline_not_watch_num = #{offlineNotWatchNum,jdbcType=INTEGER},
  119. online_total = #{onlineTotal,jdbcType=INTEGER},
  120. online_rate = #{onlineRate,jdbcType=REAL},
  121. online_completed_rate = #{onlineCompletedRate,jdbcType=REAL},
  122. online_not_comp_rate_num = #{onlineNotCompRateNum,jdbcType=INTEGER},
  123. online_completed_num = #{onlineCompletedNum,jdbcType=INTEGER},
  124. company_user_id = #{companyUserId,jdbcType=INTEGER}
  125. where id = #{id,jdbcType=INTEGER}
  126. </update>
  127. <!-- 查询所有记录 -->
  128. <select id="selectAll" resultMap="BaseResultMap">
  129. select
  130. <include refid="Base_Column_List" />
  131. from fs_statis_every_day_watch
  132. </select>
  133. <select id="queryList" resultType="com.fs.statis.domain.FsStatisSalerWatch">
  134. select * from fs_statis_every_day_watch
  135. <where>
  136. <if test="userIds != null and userIds.length > 0">
  137. AND company_user_id IN
  138. <foreach collection="userIds" open="(" close=")" separator="," item="item">
  139. ${item}
  140. </foreach>
  141. </if>
  142. <if test="periodList != null and periodList.size() > 0">
  143. AND period_id IN
  144. <foreach collection="periodList" open="(" close=")" separator="," item="item">
  145. ${item}
  146. </foreach>
  147. </if>
  148. <if test="startDate != null and endDate != null">
  149. AND data_date BETWEEN #{startDate} AND #{endDate}
  150. </if>
  151. </where>
  152. </select>
  153. </mapper>