DetectInfoMapper.xml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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.yaorong.eai.web.detect.mapper.DetectInfoMapper">
  4. <resultMap id="BaseResultMap" type="com.yaorong.eai.web.detect.vo.DetectInfo">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="phone" jdbcType="VARCHAR" property="phone"/>
  7. <result column="source_code" jdbcType="VARCHAR" property="sourceCode"/>
  8. <result column="score" jdbcType="INTEGER" property="score"/>
  9. <result column="ave_time" jdbcType="REAL" property="aveTime"/>
  10. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  11. <result column="create_by" jdbcType="VARCHAR" property="createBy"/>
  12. <result column="totalRight" jdbcType="INTEGER" property="score"/>
  13. <result column="totalWrong" jdbcType="INTEGER" property="score"/>
  14. <result column="totalTimeout" jdbcType="INTEGER" property="score"/>
  15. <result column="totalQuestion" jdbcType="INTEGER" property="score"/>
  16. </resultMap>
  17. <sql id="Base_Column_List">
  18. id, phone, source_code, score, ave_time, create_time, create_by
  19. </sql>
  20. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  21. select
  22. <include refid="Base_Column_List"/>
  23. from ea_detect_info
  24. where id = #{id,jdbcType=BIGINT}
  25. </select>
  26. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  27. delete from ea_detect_info
  28. where id = #{id,jdbcType=BIGINT}
  29. </delete>
  30. <insert id="insert" parameterType="com.yaorong.eai.web.detect.vo.DetectInfo">
  31. insert into ea_detect_info (id, phone, source_code,
  32. score, ave_time, create_time,
  33. create_by)
  34. values (#{id,jdbcType=BIGINT}, #{phone,jdbcType=VARCHAR}, #{sourceCode,jdbcType=VARCHAR},
  35. #{score,jdbcType=INTEGER}, #{aveTime,jdbcType=REAL}, #{createTime,jdbcType=TIMESTAMP},
  36. #{createBy,jdbcType=VARCHAR})
  37. </insert>
  38. <insert id="insertSelective" parameterType="com.yaorong.eai.web.detect.vo.DetectInfo" useGeneratedKeys="true"
  39. keyProperty="id">
  40. insert into ea_detect_info
  41. <trim prefix="(" suffix=")" suffixOverrides=",">
  42. <if test="id != null">
  43. id,
  44. </if>
  45. <if test="phone != null">
  46. phone,
  47. </if>
  48. <if test="sourceCode != null">
  49. source_code,
  50. </if>
  51. <if test="score != null">
  52. score,
  53. </if>
  54. <if test="aveTime != null">
  55. ave_time,
  56. </if>
  57. <if test="createTime != null">
  58. create_time,
  59. </if>
  60. <if test="createBy != null">
  61. create_by,
  62. </if>
  63. <if test="hospitalId != null">
  64. hospital_id,
  65. </if>
  66. <if test="hospitalName != null">
  67. hospital_name,
  68. </if>
  69. <if test="totalRight != null">
  70. total_right,
  71. </if>
  72. <if test="totalWrong != null">
  73. total_wrong,
  74. </if>
  75. <if test="totalTimeout != null">
  76. total_timeout,
  77. </if>
  78. <if test="totalQuestion != null">
  79. total_question,
  80. </if>
  81. </trim>
  82. <trim prefix="values (" suffix=")" suffixOverrides=",">
  83. <if test="id != null">
  84. #{id,jdbcType=BIGINT},
  85. </if>
  86. <if test="phone != null">
  87. #{phone,jdbcType=VARCHAR},
  88. </if>
  89. <if test="sourceCode != null">
  90. #{sourceCode,jdbcType=VARCHAR},
  91. </if>
  92. <if test="score != null">
  93. #{score,jdbcType=INTEGER},
  94. </if>
  95. <if test="aveTime != null">
  96. #{aveTime,jdbcType=REAL},
  97. </if>
  98. <if test="createTime != null">
  99. #{createTime,jdbcType=TIMESTAMP},
  100. </if>
  101. <if test="createBy != null">
  102. #{createBy,jdbcType=VARCHAR},
  103. </if>
  104. <if test="hospitalId != null">
  105. #{hospitalId,jdbcType=VARCHAR},
  106. </if>
  107. <if test="hospitalName != null">
  108. #{hospitalName,jdbcType=VARCHAR},
  109. </if>
  110. <if test="totalRight != null">
  111. #{totalRight,jdbcType=INTEGER},
  112. </if>
  113. <if test="totalWrong != null">
  114. #{totalWrong,jdbcType=INTEGER},
  115. </if>
  116. <if test="totalTimeout != null">
  117. #{totalTimeout,jdbcType=INTEGER},
  118. </if>
  119. <if test="totalQuestion != null">
  120. #{totalQuestion,jdbcType=INTEGER},
  121. </if>
  122. </trim>
  123. </insert>
  124. <update id="updateByPrimaryKeySelective" parameterType="com.yaorong.eai.web.detect.vo.DetectInfo">
  125. update ea_detect_info
  126. <set>
  127. <if test="phone != null">
  128. phone = #{phone,jdbcType=VARCHAR},
  129. </if>
  130. <if test="sourceCode != null">
  131. source_code = #{sourceCode,jdbcType=VARCHAR},
  132. </if>
  133. <if test="score != null">
  134. score = #{score,jdbcType=INTEGER},
  135. </if>
  136. <if test="aveTime != null">
  137. ave_time = #{aveTime,jdbcType=REAL},
  138. </if>
  139. <if test="createTime != null">
  140. create_time = #{createTime,jdbcType=TIMESTAMP},
  141. </if>
  142. <if test="createBy != null">
  143. create_by = #{createBy,jdbcType=VARCHAR},
  144. </if>
  145. </set>
  146. where id = #{id,jdbcType=BIGINT}
  147. </update>
  148. <update id="updateByPrimaryKey" parameterType="com.yaorong.eai.web.detect.vo.DetectInfo">
  149. update ea_detect_info
  150. set phone = #{phone,jdbcType=VARCHAR},
  151. source_code = #{sourceCode,jdbcType=VARCHAR},
  152. score = #{score,jdbcType=INTEGER},
  153. ave_time = #{aveTime,jdbcType=REAL},
  154. create_time = #{createTime,jdbcType=TIMESTAMP},
  155. create_by = #{createBy,jdbcType=VARCHAR}
  156. where id = #{id,jdbcType=BIGINT}
  157. </update>
  158. <select id="queryReportByPhone" parameterType="com.yaorong.eai.web.detect.vo.DetectInfo" resultType="map">
  159. select score, ave_time, create_time, total_right, total_wrong, total_timeout from ea_detect_info y
  160. where y.phone=#{phone,jdbcType=VARCHAR}
  161. <if test="null != sdate">
  162. <![CDATA[ and DATE_FORMAT(y.create_time,'%Y-%m-%d') >= #{sdate} ]]>
  163. </if>
  164. <if test="null != edate">
  165. <![CDATA[ and DATE_FORMAT(y.create_time,'%Y-%m-%d') <= #{edate} ]]>
  166. </if>
  167. ORDER BY y.create_time desc
  168. <if test="0 != endrow">
  169. limit #{startrow,jdbcType=INTEGER}, #{pageLimit,jdbcType=INTEGER}
  170. </if>
  171. </select>
  172. <select id="countReportByPhone" parameterType="com.yaorong.eai.web.detect.vo.DetectInfo" resultType="integer">
  173. select count(1) from ea_detect_info y
  174. where y.phone=#{phone,jdbcType=VARCHAR}
  175. <if test="null != sdate">
  176. <![CDATA[ and DATE_FORMAT(y.create_time,'%Y-%m-%d') >= #{sdate} ]]>
  177. </if>
  178. <if test="null != edate">
  179. <![CDATA[ and DATE_FORMAT(y.create_time,'%Y-%m-%d') <= #{edate} ]]>
  180. </if>
  181. </select>
  182. <select id="queryLastReport" parameterType="com.yaorong.eai.web.detect.vo.DetectInfo" resultMap="BaseResultMap">
  183. select * from ea_detect_info where phone=#{phone,jdbcType=VARCHAR} order by create_time desc limit 1
  184. </select>
  185. </mapper>