DegreeRegistrationMapper.xml 7.8 KB

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