BdglDrillMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.supervision.grassrootsregistration.mapper.BdglDrillMapper">
  6. <resultMap type="BdglDrill" id="BdglDrillResult">
  7. <result property="id" column="id" />
  8. <result property="project" column="project" />
  9. <result property="drillTime" column="drill_time" />
  10. <result property="oughtTo" column="ought_to" />
  11. <result property="remark" column="remark" />
  12. <result property="unitId" column="unit_id" />
  13. <result property="filename" column="filename" />
  14. <result property="filepath" column="filepath" />
  15. <result property="equipment" column="equipment" />
  16. <result property="ammunition" column="ammunition" />
  17. <result property="mototime" column="mototime" />
  18. <result property="drillEndtime" column="drill_endtime" />
  19. <result property="trainingCategory" column="training_category" />
  20. <result property="address" column="address" />
  21. <result property="createtime" column="createtime" />
  22. <result property="createId" column="create_id" />
  23. <result property="safety" column="safety" />
  24. <result property="chiefOfficial" column="chief_official" />
  25. <result property="targeted" column="targeted" />
  26. <result property="system" column="system" />
  27. <result property="excellent" column="excellent" />
  28. <result property="pass" column="pass" />
  29. <result property="fail" column="fail" />
  30. <result property="yingxun" column="yingxun" />
  31. <result property="shixun" column="shixun" />
  32. <result property="participationRate" column="participation_rate" />
  33. <result property="assessment" column="assessment" />
  34. <result property="unitname" column="unitname" />
  35. <result property="trainingContent" column="training_content" />
  36. </resultMap>
  37. <sql id="selectBdglDrillVo">
  38. select id, project, drill_time, ought_to, remark, unit_id, filename, filepath, equipment, ammunition, mototime, drill_endtime, training_category, address, createtime, create_id, safety, chief_official, targeted, system, excellent, pass, fail, yingxun, shixun, participation_rate, assessment, unitname,training_content from bdgl_drill
  39. </sql>
  40. <select id="selectBdglDrillList" parameterType="BdglDrill" resultMap="BdglDrillResult">
  41. <include refid="selectBdglDrillVo"/>
  42. <where>
  43. <if test="project != null and project != ''"> and project = #{project}</if>
  44. <if test="drillTime != null "> and drill_time = #{drillTime}</if>
  45. <if test="oughtTo != null and oughtTo != ''"> and ought_to = #{oughtTo}</if>
  46. <if test="unitId != null and unitId != ''"> and unit_id = #{unitId}</if>
  47. <if test="filename != null and filename != ''"> and filename like concat('%', #{filename}, '%')</if>
  48. <if test="filepath != null and filepath != ''"> and filepath = #{filepath}</if>
  49. <if test="equipment != null and equipment != ''"> and equipment = #{equipment}</if>
  50. <if test="ammunition != null and ammunition != ''"> and ammunition = #{ammunition}</if>
  51. <if test="mototime != null and mototime != ''"> and mototime = #{mototime}</if>
  52. <if test="drillEndtime != null "> and drill_endtime = #{drillEndtime}</if>
  53. <if test="trainingCategory != null and trainingCategory != ''"> and training_category = #{trainingCategory}</if>
  54. <if test="address != null and address != ''"> and address = #{address}</if>
  55. <if test="createtime != null "> and createtime = #{createtime}</if>
  56. <if test="createId != null "> and create_id = #{createId}</if>
  57. <if test="safety != null and safety != ''"> and safety = #{safety}</if>
  58. <if test="chiefOfficial != null and chiefOfficial != ''"> and chief_official = #{chiefOfficial}</if>
  59. <if test="targeted != null and targeted != ''"> and targeted = #{targeted}</if>
  60. <if test="system != null and system != ''"> and system = #{system}</if>
  61. <if test="excellent != null and excellent != ''"> and excellent = #{excellent}</if>
  62. <if test="pass != null "> and pass = #{pass}</if>
  63. <if test="fail != null and fail != ''"> and fail = #{fail}</if>
  64. <if test="yingxun != null "> and yingxun = #{yingxun}</if>
  65. <if test="shixun != null "> and shixun = #{shixun}</if>
  66. <if test="participationRate != null and participationRate != ''"> and participation_rate = #{participationRate}</if>
  67. <if test="assessment != null and assessment != ''"> and assessment = #{assessment}</if>
  68. <if test="unitname != null and unitname != ''"> and unitname like concat('%', #{unitname}, '%')</if>
  69. <if test="trainingContent != null and trainingContent != ''"> and training_content like concat('%', #{trainingContent}, '%')</if>
  70. </where>
  71. order by id desc
  72. </select>
  73. <select id="selectBdglDrillById" parameterType="Integer" resultMap="BdglDrillResult">
  74. <include refid="selectBdglDrillVo"/>
  75. where id = #{id}
  76. </select>
  77. <select id="selectlDrillCountByunitId" resultType="java.lang.Integer">
  78. select count(*) from bdgl_drill where unit_id = #{unitId} and YEAR(drill_time)=#{year}
  79. </select>
  80. <select id="selectDrillByUnitId" parameterType="Integer" resultMap="BdglDrillResult">
  81. <include refid="selectBdglDrillVo"/>
  82. <where>
  83. <if test="unitId != null"> and unit_id = #{unitId}</if>
  84. <if test="year != null and year != ''"> and YEAR(drill_time)= #{year}</if>
  85. </where>
  86. order by id desc
  87. </select>
  88. <insert id="insertBdglDrill" parameterType="BdglDrill" useGeneratedKeys="true" keyProperty="id">
  89. insert into bdgl_drill
  90. <trim prefix="(" suffix=")" suffixOverrides=",">
  91. <if test="project != null">project,</if>
  92. <if test="drillTime != null">drill_time,</if>
  93. <if test="oughtTo != null">ought_to,</if>
  94. <if test="remark != null">remark,</if>
  95. <if test="unitId != null">unit_id,</if>
  96. <if test="filename != null">filename,</if>
  97. <if test="filepath != null">filepath,</if>
  98. <if test="equipment != null">equipment,</if>
  99. <if test="ammunition != null">ammunition,</if>
  100. <if test="mototime != null">mototime,</if>
  101. <if test="drillEndtime != null">drill_endtime,</if>
  102. <if test="trainingCategory != null">training_category,</if>
  103. <if test="address != null">address,</if>
  104. <if test="createtime != null">createtime,</if>
  105. <if test="createId != null">create_id,</if>
  106. <if test="safety != null">safety,</if>
  107. <if test="chiefOfficial != null">chief_official,</if>
  108. <if test="targeted != null">targeted,</if>
  109. <if test="system != null">system,</if>
  110. <if test="excellent != null">excellent,</if>
  111. <if test="pass != null">pass,</if>
  112. <if test="fail != null">fail,</if>
  113. <if test="yingxun != null">yingxun,</if>
  114. <if test="shixun != null">shixun,</if>
  115. <if test="participationRate != null">participation_rate,</if>
  116. <if test="assessment != null">assessment,</if>
  117. <if test="unitname != null">unitname,</if>
  118. <if test="trainingContent != null">training_content,</if>
  119. </trim>
  120. <trim prefix="values (" suffix=")" suffixOverrides=",">
  121. <if test="project != null">#{project},</if>
  122. <if test="drillTime != null">#{drillTime},</if>
  123. <if test="oughtTo != null">#{oughtTo},</if>
  124. <if test="remark != null">#{remark},</if>
  125. <if test="unitId != null">#{unitId},</if>
  126. <if test="filename != null">#{filename},</if>
  127. <if test="filepath != null">#{filepath},</if>
  128. <if test="equipment != null">#{equipment},</if>
  129. <if test="ammunition != null">#{ammunition},</if>
  130. <if test="mototime != null">#{mototime},</if>
  131. <if test="drillEndtime != null">#{drillEndtime},</if>
  132. <if test="trainingCategory != null">#{trainingCategory},</if>
  133. <if test="address != null">#{address},</if>
  134. <if test="createtime != null">#{createtime},</if>
  135. <if test="createId != null">#{createId},</if>
  136. <if test="safety != null">#{safety},</if>
  137. <if test="chiefOfficial != null">#{chiefOfficial},</if>
  138. <if test="targeted != null">#{targeted},</if>
  139. <if test="system != null">#{system},</if>
  140. <if test="excellent != null">#{excellent},</if>
  141. <if test="pass != null">#{pass},</if>
  142. <if test="fail != null">#{fail},</if>
  143. <if test="yingxun != null">#{yingxun},</if>
  144. <if test="shixun != null">#{shixun},</if>
  145. <if test="participationRate != null">#{participationRate},</if>
  146. <if test="assessment != null">#{assessment},</if>
  147. <if test="unitname != null">#{unitname},</if>
  148. <if test="trainingContent != null">#{trainingContent},</if>
  149. </trim>
  150. </insert>
  151. <update id="updateBdglDrill" parameterType="BdglDrill">
  152. update bdgl_drill
  153. <trim prefix="SET" suffixOverrides=",">
  154. <if test="project != null">project = #{project},</if>
  155. <if test="drillTime != null">drill_time = #{drillTime},</if>
  156. <if test="oughtTo != null">ought_to = #{oughtTo},</if>
  157. <if test="remark != null">remark = #{remark},</if>
  158. <if test="unitId != null">unit_id = #{unitId},</if>
  159. <if test="filename != null">filename = #{filename},</if>
  160. <if test="filepath != null">filepath = #{filepath},</if>
  161. <if test="equipment != null">equipment = #{equipment},</if>
  162. <if test="ammunition != null">ammunition = #{ammunition},</if>
  163. <if test="mototime != null">mototime = #{mototime},</if>
  164. <if test="drillEndtime != null">drill_endtime = #{drillEndtime},</if>
  165. <if test="trainingCategory != null">training_category = #{trainingCategory},</if>
  166. <if test="address != null">address = #{address},</if>
  167. <if test="createtime != null">createtime = #{createtime},</if>
  168. <if test="createId != null">create_id = #{createId},</if>
  169. <if test="safety != null">safety = #{safety},</if>
  170. <if test="chiefOfficial != null">chief_official = #{chiefOfficial},</if>
  171. <if test="targeted != null">targeted = #{targeted},</if>
  172. <if test="system != null">system = #{system},</if>
  173. <if test="excellent != null">excellent = #{excellent},</if>
  174. <if test="pass != null">pass = #{pass},</if>
  175. <if test="fail != null">fail = #{fail},</if>
  176. <if test="yingxun != null">yingxun = #{yingxun},</if>
  177. <if test="shixun != null">shixun = #{shixun},</if>
  178. <if test="participationRate != null">participation_rate = #{participationRate},</if>
  179. <if test="assessment != null">assessment = #{assessment},</if>
  180. <if test="unitname != null">unitname = #{unitname},</if>
  181. <if test="trainingContent != null">training_content = #{trainingContent},</if>
  182. </trim>
  183. where id = #{id}
  184. </update>
  185. <delete id="deleteBdglDrillById" parameterType="Integer">
  186. delete from bdgl_drill where id = #{id}
  187. </delete>
  188. <delete id="deleteBdglDrillByIds" parameterType="String">
  189. delete from bdgl_drill where id in
  190. <foreach item="id" collection="array" open="(" separator="," close=")">
  191. #{id}
  192. </foreach>
  193. </delete>
  194. </mapper>