BdglArmamentMapper.xml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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.BdglArmamentMapper">
  6. <resultMap type="BdglArmament" id="BdglArmamentResult">
  7. <result property="id" column="id" />
  8. <result property="name" column="name" />
  9. <result property="recordDate" column="record_date" />
  10. <result property="metering" column="metering" />
  11. <result property="gist" column="gist" />
  12. <result property="prepareNumber" column="prepare_number" />
  13. <result property="sum" column="sum" />
  14. <result property="intactNumber" column="intact_number" />
  15. <result property="repairNumber" column="repair_number" />
  16. <result property="sendNumber" column="send_number" />
  17. <result property="standard" column="standard" />
  18. <result property="existing" column="existing" />
  19. <result property="flaw" column="flaw" />
  20. <result property="peopleId" column="people_id" />
  21. <result property="peopleId1" column="people_id1" />
  22. <result property="unitId" column="unit_id" />
  23. <result property="createtime" column="createtime" />
  24. <result property="updatetime" column="updatetime" />
  25. <result property="peopleName" column="people_name" />
  26. <result property="people1Name" column="people1_name" />
  27. <result property="unitName" column="unit_name" />
  28. </resultMap>
  29. <sql id="selectBdglArmamentVo">
  30. select id, name, record_date, metering, gist, prepare_number, sum, intact_number, repair_number, send_number, standard, existing, flaw, people_id, people_id1, unit_id, createtime, updatetime, people_name, people1_name, unit_name from bdgl_armament
  31. </sql>
  32. <select id="selectBdglArmamentList" parameterType="BdglArmament" resultMap="BdglArmamentResult">
  33. select id, name, record_date, metering, gist, prepare_number, sum, intact_number, repair_number, send_number, standard, existing, flaw, people_id, people_id1, unit_id, createtime, updatetime, people_name, people1_name, unit_name
  34. from bdgl_armament a left join sys_dept t
  35. on a.unit_id=t.dept_id
  36. <where>
  37. <if test="unitId != null ">
  38. and (a.unit_id=#{unitId} or find_in_set(#{unitId}, t.ancestors))
  39. </if>
  40. <if test="name != null and name != ''"> and a.name like concat('%', #{name}, '%')</if>
  41. <if test="recordDate != null "> and a.record_date = #{recordDate}</if>
  42. <if test="metering != null and metering != ''"> and a.metering = #{metering}</if>
  43. <if test="gist != null and gist != ''"> and a.gist = #{gist}</if>
  44. <if test="prepareNumber != null "> and a.prepare_number = #{prepareNumber}</if>
  45. <if test="sum != null "> and a.sum = #{sum}</if>
  46. <if test="intactNumber != null "> and a.intact_number = #{intactNumber}</if>
  47. <if test="repairNumber != null "> and a.repair_number = #{repairNumber}</if>
  48. <if test="sendNumber != null "> and a.send_number = #{sendNumber}</if>
  49. <if test="standard != null and standard != ''"> and a.standard = #{standard}</if>
  50. <if test="existing != null and existing != ''"> and a.existing = #{existing}</if>
  51. <if test="flaw != null and flaw != ''"> and a.flaw = #{flaw}</if>
  52. <if test="peopleId != null "> and a.people_id = #{peopleId}</if>
  53. <if test="peopleId1 != null "> and a.people_id1 = #{peopleId1}</if>
  54. <if test="createtime != null and createtime != ''"> and a.createtime = #{createtime}</if>
  55. <if test="updatetime != null and updatetime != ''"> and a.updatetime = #{updatetime}</if>
  56. <if test="peopleName != null and peopleName != ''"> and a.people_name like concat('%', #{peopleName}, '%')</if>
  57. <if test="people1Name != null and people1Name != ''"> and a.people1_name like concat('%', #{people1Name}, '%')</if>
  58. <if test="unitName != null and unitName != ''"> and a.unit_name like concat('%', #{unitName}, '%')</if>
  59. </where>
  60. order by a.record_date desc
  61. </select>
  62. <select id="selectBdglArmamentById" parameterType="Integer" resultMap="BdglArmamentResult">
  63. <include refid="selectBdglArmamentVo"/>
  64. where id = #{id}
  65. </select>
  66. <select id="selectArmamentunitid" parameterType="Integer" resultMap="BdglArmamentResult">
  67. <include refid="selectBdglArmamentVo"/>
  68. <where>
  69. <if test="unitId != null"> and unit_id = #{unitId}</if>
  70. <if test="year != null and year != ''"> and YEAR(record_date)= #{year}</if>
  71. </where>
  72. order by id desc
  73. </select>
  74. <select id="selectlArmamentCountByunitId" resultType="java.lang.Integer">
  75. select count(*) from bdgl_armament where unit_id = #{unitId} and YEAR(record_date)=#{year}
  76. </select>
  77. <insert id="insertBdglArmament" parameterType="BdglArmament" useGeneratedKeys="true" keyProperty="id">
  78. insert into bdgl_armament
  79. <trim prefix="(" suffix=")" suffixOverrides=",">
  80. <if test="name != null">name,</if>
  81. <if test="recordDate != null">record_date,</if>
  82. <if test="metering != null">metering,</if>
  83. <if test="gist != null">gist,</if>
  84. <if test="prepareNumber != null">prepare_number,</if>
  85. <if test="sum != null">sum,</if>
  86. <if test="intactNumber != null">intact_number,</if>
  87. <if test="repairNumber != null">repair_number,</if>
  88. <if test="sendNumber != null">send_number,</if>
  89. <if test="standard != null">standard,</if>
  90. <if test="existing != null">existing,</if>
  91. <if test="flaw != null">flaw,</if>
  92. <if test="peopleId != null">people_id,</if>
  93. <if test="peopleId1 != null">people_id1,</if>
  94. <if test="unitId != null">unit_id,</if>
  95. <if test="createtime != null">createtime,</if>
  96. <if test="updatetime != null">updatetime,</if>
  97. <if test="peopleName != null">people_name,</if>
  98. <if test="people1Name != null">people1_name,</if>
  99. <if test="unitName != null">unit_name,</if>
  100. </trim>
  101. <trim prefix="values (" suffix=")" suffixOverrides=",">
  102. <if test="name != null">#{name},</if>
  103. <if test="recordDate != null">#{recordDate},</if>
  104. <if test="metering != null">#{metering},</if>
  105. <if test="gist != null">#{gist},</if>
  106. <if test="prepareNumber != null">#{prepareNumber},</if>
  107. <if test="sum != null">#{sum},</if>
  108. <if test="intactNumber != null">#{intactNumber},</if>
  109. <if test="repairNumber != null">#{repairNumber},</if>
  110. <if test="sendNumber != null">#{sendNumber},</if>
  111. <if test="standard != null">#{standard},</if>
  112. <if test="existing != null">#{existing},</if>
  113. <if test="flaw != null">#{flaw},</if>
  114. <if test="peopleId != null">#{peopleId},</if>
  115. <if test="peopleId1 != null">#{peopleId1},</if>
  116. <if test="unitId != null">#{unitId},</if>
  117. <if test="createtime != null">#{createtime},</if>
  118. <if test="updatetime != null">#{updatetime},</if>
  119. <if test="peopleName != null">#{peopleName},</if>
  120. <if test="people1Name != null">#{people1Name},</if>
  121. <if test="unitName != null">#{unitName},</if>
  122. </trim>
  123. </insert>
  124. <update id="updateBdglArmament" parameterType="BdglArmament">
  125. update bdgl_armament
  126. <trim prefix="SET" suffixOverrides=",">
  127. <if test="name != null">name = #{name},</if>
  128. <if test="recordDate != null">record_date = #{recordDate},</if>
  129. <if test="metering != null">metering = #{metering},</if>
  130. <if test="gist != null">gist = #{gist},</if>
  131. <if test="prepareNumber != null">prepare_number = #{prepareNumber},</if>
  132. <if test="sum != null">sum = #{sum},</if>
  133. <if test="intactNumber != null">intact_number = #{intactNumber},</if>
  134. <if test="repairNumber != null">repair_number = #{repairNumber},</if>
  135. <if test="sendNumber != null">send_number = #{sendNumber},</if>
  136. <if test="standard != null">standard = #{standard},</if>
  137. <if test="existing != null">existing = #{existing},</if>
  138. <if test="flaw != null">flaw = #{flaw},</if>
  139. <if test="peopleId != null">people_id = #{peopleId},</if>
  140. <if test="peopleId1 != null">people_id1 = #{peopleId1},</if>
  141. <if test="unitId != null">unit_id = #{unitId},</if>
  142. <if test="createtime != null">createtime = #{createtime},</if>
  143. <if test="updatetime != null">updatetime = #{updatetime},</if>
  144. <if test="peopleName != null">people_name = #{peopleName},</if>
  145. <if test="people1Name != null">people1_name = #{people1Name},</if>
  146. <if test="unitName != null">unit_name = #{unitName},</if>
  147. </trim>
  148. where id = #{id}
  149. </update>
  150. <delete id="deleteBdglArmamentById" parameterType="Integer">
  151. delete from bdgl_armament where id = #{id}
  152. </delete>
  153. <delete id="deleteBdglArmamentByIds" parameterType="String">
  154. delete from bdgl_armament where id in
  155. <foreach item="id" collection="array" open="(" separator="," close=")">
  156. #{id}
  157. </foreach>
  158. </delete>
  159. </mapper>