BdglEquipMapper.xml 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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.BdglEquipMapper">
  6. <resultMap type="BdglEquip" id="BdglEquipResult">
  7. <result property="id" column="id" />
  8. <result property="type" column="type" />
  9. <result property="title" column="title" />
  10. <result property="unitId" column="unit_id" />
  11. <result property="granttime" column="granttime" />
  12. <result property="grantnum" column="grantnum" />
  13. <result property="ownnum" column="ownnum" />
  14. <result property="stocknum" column="stocknum" />
  15. <result property="intime" column="intime" />
  16. <result property="innum" column="innum" />
  17. <result property="peopleId" column="people_id" />
  18. <result property="outtime" column="outtime" />
  19. <result property="outnum" column="outnum" />
  20. <result property="peopleId1" column="people_id1" />
  21. <result property="quality" column="quality" />
  22. <result property="info" column="info" />
  23. <result property="unitId1" column="unit_id1" />
  24. <result property="createtime" column="createtime" />
  25. <result property="adminId" column="admin_id" />
  26. <result property="unitName" column="unit_name" />
  27. <result property="peopleName" column="people_name" />
  28. <result property="people1Name" column="people1_name" />
  29. <result property="unitName1" column="unit_name1" />
  30. </resultMap>
  31. <sql id="selectBdglEquipVo">
  32. select id, type, title, unit_id, granttime, grantnum, ownnum, stocknum, intime, innum, people_id, outtime, outnum, people_id1, quality, info, unit_id1, createtime, admin_id, unit_name, people_name, people1_name, unit_name1 from bdgl_equip
  33. </sql>
  34. <select id="selectBdglEquipList" parameterType="BdglEquip" resultMap="BdglEquipResult">
  35. select id, e.type, title, unit_id, granttime, grantnum, ownnum, stocknum, intime, innum, people_id, outtime, outnum, people_id1, quality, info, unit_id1, createtime, admin_id, unit_name, people_name, people1_name, unit_name1
  36. from bdgl_equip e left join sys_dept t
  37. on e.unit_id=t.dept_id
  38. <where>
  39. <if test="unitId1 != null ">
  40. and (e.unit_id1=#{unitId1} or find_in_set(#{unitId1}, t.ancestors))
  41. </if>
  42. <if test="type != null and type != ''"> and e.type = #{type}</if>
  43. <if test="title != null and title != ''"> and e.title = #{title}</if>
  44. <if test="unitId != null "> and e.unit_id = #{unitId}</if>
  45. <if test="granttime != null and granttime != ''"> and e.granttime = #{granttime}</if>
  46. <if test="grantnum != null "> and e.grantnum = #{grantnum}</if>
  47. <if test="ownnum != null "> and e.ownnum = #{ownnum}</if>
  48. <if test="stocknum != null "> and e.stocknum = #{stocknum}</if>
  49. <if test="intime != null and intime != ''"> and e.intime = #{intime}</if>
  50. <if test="innum != null "> and e.innum = #{innum}</if>
  51. <if test="peopleId != null "> and e.people_id = #{peopleId}</if>
  52. <if test="outtime != null and outtime != ''"> and e.outtime = #{outtime}</if>
  53. <if test="outnum != null "> and e.outnum = #{outnum}</if>
  54. <if test="peopleId1 != null and peopleId1 != ''"> and e.people_id1 = #{peopleId1}</if>
  55. <if test="quality != null and quality != ''"> and e.quality = #{quality}</if>
  56. <if test="info != null and info != ''"> and e.info = #{info}</if>
  57. <if test="createtime != null and createtime != ''"> and e.createtime = #{createtime}</if>
  58. <if test="adminId != null "> and e.admin_id = #{adminId}</if>
  59. <if test="unitName != null and unitName != ''"> and e.unit_name like concat('%', #{unitName}, '%')</if>
  60. <if test="peopleName != null and peopleName != ''"> and e.people_name like concat('%', #{peopleName}, '%')</if>
  61. <if test="people1Name != null and people1Name != ''"> and e.people1_name like concat('%', #{people1Name}, '%')</if>
  62. <if test="unitName1 != null and unitName1 != ''"> and e.unit_name1 = #{unitName1}</if>
  63. </where>
  64. order by e.id desc
  65. </select>
  66. <select id="selectBdglEquipById" parameterType="Long" resultMap="BdglEquipResult">
  67. <include refid="selectBdglEquipVo"/>
  68. where id = #{id}
  69. </select>
  70. <select id="selectBdglByunitid" parameterType="Integer" resultMap="BdglEquipResult">
  71. <include refid="selectBdglEquipVo"/>
  72. where unit_id = #{id} and YEAR(createtime)=YEAR(NOW())
  73. order by type,id desc
  74. </select>
  75. <select id="selectlEquipCountByunitId" resultType="java.lang.Integer">
  76. select count(*) from bdgl_equip where unit_id = #{unitId} and YEAR(createtime)=#{year}
  77. </select>
  78. <select id="selectEquIpByunitId" resultMap="BdglEquipResult">
  79. <include refid="selectBdglEquipVo"/>
  80. <where>
  81. <if test="unitId != null"> and unit_id = #{unitId}</if>
  82. <if test="year != null and year != ''"> and YEAR(createtime)= #{year}</if>
  83. </where>
  84. order by type,id desc
  85. </select>
  86. <insert id="insertBdglEquip" parameterType="BdglEquip" useGeneratedKeys="true" keyProperty="id">
  87. insert into bdgl_equip
  88. <trim prefix="(" suffix=")" suffixOverrides=",">
  89. <if test="type != null">type,</if>
  90. <if test="title != null">title,</if>
  91. <if test="unitId != null">unit_id,</if>
  92. <if test="granttime != null">granttime,</if>
  93. <if test="grantnum != null">grantnum,</if>
  94. <if test="ownnum != null">ownnum,</if>
  95. <if test="stocknum != null">stocknum,</if>
  96. <if test="intime != null">intime,</if>
  97. <if test="innum != null">innum,</if>
  98. <if test="peopleId != null">people_id,</if>
  99. <if test="outtime != null">outtime,</if>
  100. <if test="outnum != null">outnum,</if>
  101. <if test="peopleId1 != null">people_id1,</if>
  102. <if test="quality != null">quality,</if>
  103. <if test="info != null">info,</if>
  104. <if test="unitId1 != null">unit_id1,</if>
  105. <if test="createtime != null">createtime,</if>
  106. <if test="adminId != null">admin_id,</if>
  107. <if test="unitName != null">unit_name,</if>
  108. <if test="peopleName != null">people_name,</if>
  109. <if test="people1Name != null">people1_name,</if>
  110. <if test="unitName1 != null">unit_name1,</if>
  111. </trim>
  112. <trim prefix="values (" suffix=")" suffixOverrides=",">
  113. <if test="type != null">#{type},</if>
  114. <if test="title != null">#{title},</if>
  115. <if test="unitId != null">#{unitId},</if>
  116. <if test="granttime != null">#{granttime},</if>
  117. <if test="grantnum != null">#{grantnum},</if>
  118. <if test="ownnum != null">#{ownnum},</if>
  119. <if test="stocknum != null">#{stocknum},</if>
  120. <if test="intime != null">#{intime},</if>
  121. <if test="innum != null">#{innum},</if>
  122. <if test="peopleId != null">#{peopleId},</if>
  123. <if test="outtime != null">#{outtime},</if>
  124. <if test="outnum != null">#{outnum},</if>
  125. <if test="peopleId1 != null">#{peopleId1},</if>
  126. <if test="quality != null">#{quality},</if>
  127. <if test="info != null">#{info},</if>
  128. <if test="unitId1 != null">#{unitId1},</if>
  129. <if test="createtime != null">#{createtime},</if>
  130. <if test="adminId != null">#{adminId},</if>
  131. <if test="unitName != null">#{unitName},</if>
  132. <if test="peopleName != null">#{peopleName},</if>
  133. <if test="people1Name != null">#{people1Name},</if>
  134. <if test="unitName1 != null">#{unitName1},</if>
  135. </trim>
  136. </insert>
  137. <update id="updateBdglEquip" parameterType="BdglEquip">
  138. update bdgl_equip
  139. <trim prefix="SET" suffixOverrides=",">
  140. <if test="type != null">type = #{type},</if>
  141. <if test="title != null">title = #{title},</if>
  142. <if test="unitId != null">unit_id = #{unitId},</if>
  143. <if test="granttime != null">granttime = #{granttime},</if>
  144. <if test="grantnum != null">grantnum = #{grantnum},</if>
  145. <if test="ownnum != null">ownnum = #{ownnum},</if>
  146. <if test="stocknum != null">stocknum = #{stocknum},</if>
  147. <if test="intime != null">intime = #{intime},</if>
  148. <if test="innum != null">innum = #{innum},</if>
  149. <if test="peopleId != null">people_id = #{peopleId},</if>
  150. <if test="outtime != null">outtime = #{outtime},</if>
  151. <if test="outnum != null">outnum = #{outnum},</if>
  152. <if test="peopleId1 != null">people_id1 = #{peopleId1},</if>
  153. <if test="quality != null">quality = #{quality},</if>
  154. <if test="info != null">info = #{info},</if>
  155. <if test="unitId1 != null">unit_id1 = #{unitId1},</if>
  156. <if test="createtime != null">createtime = #{createtime},</if>
  157. <if test="adminId != null">admin_id = #{adminId},</if>
  158. <if test="unitName != null">unit_name = #{unitName},</if>
  159. <if test="peopleName != null">people_name = #{peopleName},</if>
  160. <if test="people1Name != null">people1_name = #{people1Name},</if>
  161. <if test="unitName1 != null">unit_name1 = #{unitName1},</if>
  162. </trim>
  163. where id = #{id}
  164. </update>
  165. <delete id="deleteBdglEquipById" parameterType="Long">
  166. delete from bdgl_equip where id = #{id}
  167. </delete>
  168. <delete id="deleteBdglEquipByIds" parameterType="String">
  169. delete from bdgl_equip where id in
  170. <foreach item="id" collection="array" open="(" separator="," close=")">
  171. #{id}
  172. </foreach>
  173. </delete>
  174. </mapper>