DegreeRegistrationMapper.xml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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.ym.mec.biz.dal.dao.DegreeRegistrationDao">
  4. <resultMap id="DegreeRegistration" type="com.ym.mec.biz.dal.entity.DegreeRegistration">
  5. <!--@mbg.generated-->
  6. <!--@Table degree_registration-->
  7. <id column="id_" jdbcType="INTEGER" property="id"/>
  8. <result column="sporadic_id_" jdbcType="INTEGER" property="sporadicId"/>
  9. <result column="order_no_" jdbcType="VARCHAR" property="orderNo"/>
  10. <result column="trans_no_" jdbcType="VARCHAR" property="transNo"/>
  11. <result column="name_" jdbcType="VARCHAR" property="name"/>
  12. <result column="gender_" jdbcType="VARCHAR" property="gender"/>
  13. <result column="idcard_" jdbcType="VARCHAR" property="idcard"/>
  14. <result column="city_" jdbcType="VARCHAR" property="city"/>
  15. <result column="school_" jdbcType="VARCHAR" property="school"/>
  16. <result column="subject_" jdbcType="VARCHAR" property="subject"/>
  17. <result column="level_" jdbcType="VARCHAR" property="level"/>
  18. <result column="theory_level_" jdbcType="VARCHAR" property="theoryLevel"/>
  19. <result column="theory_money_" jdbcType="DECIMAL" property="theoryMoney"/>
  20. <result column="theory_cert_" jdbcType="VARCHAR" property="theoryCert"/>
  21. <result column="mobile_" jdbcType="VARCHAR" property="mobile"/>
  22. <result column="money_" jdbcType="DECIMAL" property="money"/>
  23. <result column="memo_" jdbcType="VARCHAR" property="memo"/>
  24. <result column="create_time_" jdbcType="TIMESTAMP" property="createTime"/>
  25. <result column="update_time_" jdbcType="TIMESTAMP" property="updateTime"/>
  26. <result column="status_" jdbcType="TINYINT" property="status"/>
  27. </resultMap>
  28. <select id="get" parameterType="java.lang.Integer" resultMap="DegreeRegistration">
  29. select *
  30. from degree_registration
  31. where id_ = #{id,jdbcType=INTEGER}
  32. </select>
  33. <!-- 全查询 -->
  34. <select id="findAll" resultMap="DegreeRegistration">
  35. SELECT *
  36. FROM degree_registration
  37. ORDER BY id_
  38. </select>
  39. <sql id="queryPageSql">
  40. <where>
  41. <if test="status != null and status=='reg'">
  42. AND <![CDATA[status_ <= 1]]>
  43. </if>
  44. <if test="status != null and status=='pay'">
  45. AND status_ = 2
  46. </if>
  47. <if test="id != null">
  48. AND id_ = #{id}
  49. </if>
  50. <if test="search != null and search != ''">
  51. AND (id_ = #{search} OR name_ LIKE CONCAT('%',#{search},'%') )
  52. </if>
  53. <if test="orderNo != null">
  54. AND order_no_ = #{orderNo}
  55. </if>
  56. <if test="transNo != null">
  57. AND trans_no_ = #{transNo}
  58. </if>
  59. <if test="name != null">
  60. AND name_ = #{name}
  61. </if>
  62. <if test="idcard != null">
  63. AND idcard_ = #{idcard}
  64. </if>
  65. <if test="school != null">
  66. AND school_ LIKE CONCAT('%', #{school},'%')
  67. </if>
  68. <if test="city != null">
  69. AND city_ LIKE CONCAT('%', #{city},'%')
  70. </if>
  71. <if test="subject != null">
  72. AND subject_= #{subject}
  73. </if>
  74. <if test="mobile != null">
  75. AND mobile_= #{mobile}
  76. </if>
  77. <if test="level != null">
  78. AND level_= #{level}
  79. </if>
  80. <if test="startTime != null">
  81. AND DATE_FORMAT(create_time_,"%Y-%m-%d") >= #{startTime}
  82. </if>
  83. <if test="endTime != null">
  84. <![CDATA[AND DATE_FORMAT(create_time_,"%Y-%m-%d") <= #{endTime}]]>
  85. </if>
  86. </where>
  87. </sql>
  88. <!-- 分页查询 -->
  89. <select id="queryPage" resultMap="DegreeRegistration" parameterType="map">
  90. SELECT * FROM degree_registration
  91. <include refid="queryPageSql"/>
  92. <include refid="global.orderby"/>
  93. <include refid="global.limit"/>
  94. </select>
  95. <!-- 查询当前表的总记录数 -->
  96. <select id="queryCount" resultType="int">
  97. SELECT COUNT(*)
  98. FROM degree_registration
  99. <include refid="queryPageSql"/>
  100. </select>
  101. <select id="getTotalAmount" parameterType="map" resultMap="DegreeRegistration">
  102. SELECT SUM(case when status_ = 2 then money_ else 0 end) money_ ,SUM(case when status_ = 2 then theory_money_ else 0 end) theory_money_ FROM degree_registration
  103. <include refid="queryPageSql"/>
  104. </select>
  105. <delete id="delete" parameterType="java.lang.Integer">
  106. delete
  107. from degree_registration
  108. where id_ = #{id,jdbcType=INTEGER}
  109. </delete>
  110. <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.DegreeRegistration"
  111. useGeneratedKeys="true">
  112. <!--@mbg.generated-->
  113. insert into degree_registration (sporadic_id_,order_no_, name_, gender_,
  114. idcard_, city_, school_,
  115. subject_,level_, theory_level_,theory_money_, theory_cert_,mobile_,
  116. money_, memo_, create_time_,
  117. update_time_, status_)
  118. values (#{sporadicId,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{gender,jdbcType=VARCHAR},
  119. #{idcard,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{school,jdbcType=VARCHAR},
  120. #{subject,jdbcType=VARCHAR},#{level,jdbcType=VARCHAR},
  121. #{theoryLevel,jdbcType=VARCHAR},#{theoryMoney,jdbcType=DECIMAL},
  122. #{theoryCert,jdbcType=VARCHAR},#{mobile,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL}, #{memo,jdbcType=VARCHAR},
  123. #{createTime}, #{updateTime}, #{status,jdbcType=TINYINT})
  124. </insert>
  125. <update id="update" parameterType="com.ym.mec.biz.dal.entity.DegreeRegistration">
  126. <!--@mbg.generated-->
  127. update degree_registration
  128. <set>
  129. <if test="sporadicId != null">
  130. sporadic_id_ = #{sporadicId,jdbcType=INTEGER},
  131. </if>
  132. <if test="orderNo != null">
  133. order_no_ = #{orderNo,jdbcType=VARCHAR},
  134. </if>
  135. <if test="transNo != null">
  136. trans_no_ = #{transNo,jdbcType=VARCHAR},
  137. </if>
  138. <if test="name != null">
  139. name_ = #{name,jdbcType=VARCHAR},
  140. </if>
  141. <if test="gender != null">
  142. gender_ = #{gender,jdbcType=VARCHAR},
  143. </if>
  144. <if test="idcard != null">
  145. idcard_ = #{idcard,jdbcType=VARCHAR},
  146. </if>
  147. <if test="city != null">
  148. city_ = #{city,jdbcType=VARCHAR},
  149. </if>
  150. <if test="school != null">
  151. school_ = #{school,jdbcType=VARCHAR},
  152. </if>
  153. <if test="subject != null">
  154. subject_ = #{subject,jdbcType=VARCHAR},
  155. </if>
  156. <if test="level != null">
  157. level_ = #{level,jdbcType=VARCHAR},
  158. </if>
  159. <if test="theoryLevel != null">
  160. theory_level_ = #{theoryLevel,jdbcType=VARCHAR},
  161. </if>
  162. <if test="theoryLevel != null">
  163. theory_money_ = #{theoryMoney,jdbcType=DECIMAL},
  164. </if>
  165. <if test="theoryLevel != null">
  166. theory_cert_ = #{theoryCert,jdbcType=VARCHAR},
  167. </if>
  168. <if test="mobile != null">
  169. mobile_ = #{mobile,jdbcType=VARCHAR},
  170. </if>
  171. <if test="money != null">
  172. money_ = #{money,jdbcType=DECIMAL},
  173. </if>
  174. <if test="memo != null">
  175. memo_ = #{memo,jdbcType=VARCHAR},
  176. </if>
  177. <if test="createTime != null">
  178. create_time_ = #{createTime},
  179. </if>
  180. <if test="updateTime != null">
  181. update_time_ = #{updateTime},
  182. </if>
  183. <if test="status != null">
  184. status_ = #{status,jdbcType=INTEGER},
  185. </if>
  186. </set>
  187. where id_ = #{id,jdbcType=INTEGER}
  188. </update>
  189. <select id="findByMobileAndSporadicId" resultMap="DegreeRegistration">
  190. SELECT *
  191. FROM degree_registration
  192. WHERE mobile_ = #{mobile}
  193. AND sporadic_id_ = #{sporadicId} FOR
  194. UPDATE
  195. </select>
  196. <select id="getLock" resultMap="DegreeRegistration">
  197. SELECT *
  198. FROM degree_registration
  199. WHERE id_ = #{id} FOR
  200. UPDATE
  201. </select>
  202. </mapper>