DegreeRegistrationMapper.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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">
  40. AND status_= #{status}
  41. </if>
  42. <if test="id != null">
  43. AND id_ = #{id}
  44. </if>
  45. <if test="search != null and search != ''">
  46. AND (id_ = #{search} OR name_ LIKE CONCAT('%',#{search},'%') )
  47. </if>
  48. <if test="name != null">
  49. AND name_ = #{name}
  50. </if>
  51. <if test="idcard != null">
  52. AND idcard_ = #{idcard}
  53. </if>
  54. <if test="school != null">
  55. AND school_ LIKE CONCAT('%', #{school},'%')
  56. </if>
  57. <if test="city != null">
  58. AND city_ LIKE CONCAT('%', #{city},'%')
  59. </if>
  60. <if test="subject != null">
  61. AND subject_= #{subject}
  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. </where>
  73. </sql>
  74. <!-- 分页查询 -->
  75. <select id="queryPage" resultMap="DegreeRegistration" parameterType="map">
  76. SELECT * FROM degree_registration
  77. <include refid="queryPageSql"/>
  78. <include refid="global.orderby"/>
  79. <include refid="global.limit"/>
  80. </select>
  81. <!-- 查询当前表的总记录数 -->
  82. <select id="queryCount" resultType="int">
  83. SELECT COUNT(*)
  84. FROM degree_registration
  85. <include refid="queryPageSql"/>
  86. </select>
  87. <select id="getTotalAmount" parameterType="map" resultMap="DegreeRegistration">
  88. SELECT SUM(money_) money_ ,SUM(theory_money_) theory_money_ FROM degree_registration
  89. <include refid="queryPageSql"/>
  90. </select>
  91. <delete id="delete" parameterType="java.lang.Integer">
  92. delete
  93. from degree_registration
  94. where id_ = #{id,jdbcType=INTEGER}
  95. </delete>
  96. <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.DegreeRegistration"
  97. useGeneratedKeys="true">
  98. <!--@mbg.generated-->
  99. insert into degree_registration (sporadic_id_, name_, gender_,
  100. idcard_, city_, school_,
  101. subject_,level_, theory_level_,theory_money_, theory_cert_,mobile_,
  102. money_, memo_, create_time_,
  103. update_time_, status_)
  104. values (#{sporadicId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{gender,jdbcType=VARCHAR},
  105. #{idcard,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{school,jdbcType=VARCHAR},
  106. #{subject,jdbcType=VARCHAR},#{level,jdbcType=VARCHAR},
  107. #{theoryLevel,jdbcType=VARCHAR},#{theoryMoney,jdbcType=DECIMAL},
  108. #{theoryCert,jdbcType=VARCHAR},#{mobile,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL}, #{memo,jdbcType=VARCHAR},
  109. #{createTime}, #{updateTime}, #{status,jdbcType=TINYINT})
  110. </insert>
  111. <update id="update" parameterType="com.ym.mec.biz.dal.entity.DegreeRegistration">
  112. <!--@mbg.generated-->
  113. update degree_registration
  114. <set>
  115. <if test="sporadicId != null">
  116. sporadic_id_ = #{sporadicId,jdbcType=INTEGER},
  117. </if>
  118. <if test="name != null">
  119. name_ = #{name,jdbcType=VARCHAR},
  120. </if>
  121. <if test="gender != null">
  122. gender_ = #{gender,jdbcType=VARCHAR},
  123. </if>
  124. <if test="idcard != null">
  125. idcard_ = #{idcard,jdbcType=VARCHAR},
  126. </if>
  127. <if test="city != null">
  128. city_ = #{city,jdbcType=VARCHAR},
  129. </if>
  130. <if test="school != null">
  131. school_ = #{school,jdbcType=VARCHAR},
  132. </if>
  133. <if test="subject != null">
  134. subject_ = #{subject,jdbcType=VARCHAR},
  135. </if>
  136. <if test="level != null">
  137. level_ = #{level,jdbcType=VARCHAR},
  138. </if>
  139. <if test="theoryLevel != null">
  140. theory_level_ = #{theoryLevel,jdbcType=VARCHAR},
  141. </if>
  142. <if test="theoryLevel != null">
  143. theory_money_ = #{theoryMoney,jdbcType=DECIMAL},
  144. </if>
  145. <if test="theoryLevel != null">
  146. theory_cert_ = #{theoryCert,jdbcType=VARCHAR},
  147. </if>
  148. <if test="mobile != null">
  149. mobile_ = #{mobile,jdbcType=VARCHAR},
  150. </if>
  151. <if test="money != null">
  152. money_ = #{money,jdbcType=DECIMAL},
  153. </if>
  154. <if test="memo != null">
  155. memo_ = #{memo,jdbcType=VARCHAR},
  156. </if>
  157. <if test="createTime != null">
  158. create_time_ = #{createTime},
  159. </if>
  160. <if test="updateTime != null">
  161. update_time_ = #{updateTime},
  162. </if>
  163. <if test="status != null">
  164. status_ = #{status,jdbcType=INTEGER},
  165. </if>
  166. </set>
  167. where id_ = #{id,jdbcType=INTEGER}
  168. </update>
  169. <select id="findByMobileAndSporadicId" resultMap="DegreeRegistration">
  170. SELECT *
  171. FROM degree_registration
  172. WHERE mobile_ = #{mobile}
  173. AND sporadic_id_ = #{sporadicId} FOR
  174. UPDATE
  175. </select>
  176. <select id="getLock" resultMap="DegreeRegistration">
  177. SELECT *
  178. FROM degree_registration
  179. WHERE id_ = #{id} FOR
  180. UPDATE
  181. </select>
  182. </mapper>