BdglSecrecyMapper.xml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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.BdglSecrecyMapper">
  6. <resultMap type="BdglSecrecy" id="BdglSecrecyResult">
  7. <result property="id" column="id" />
  8. <result property="secrecyType" column="secrecy_type" />
  9. <result property="number" column="number" />
  10. <result property="name" column="name" />
  11. <result property="kind" column="kind" />
  12. <result property="version" column="version" />
  13. <result property="confidential" column="confidential" />
  14. <result property="peopleId" column="people_id" />
  15. <result property="peopleId1" column="people_id1" />
  16. <result property="peopleId2" column="people_id2" />
  17. <result property="startTime" column="start_time" />
  18. <result property="endTime" column="end_time" />
  19. <result property="hindOverTime" column="hind_over_time" />
  20. <result property="unitId" column="unit_id" />
  21. <result property="peopleName" column="people_name" />
  22. <result property="people1Name" column="people1_name" />
  23. <result property="people2Name" column="people2_name" />
  24. <result property="deptName" column="dept_name" />
  25. <result property="createtime" column="createtime" />
  26. </resultMap>
  27. <sql id="selectBdglSecrecyVo">
  28. select id, secrecy_type, number, name, kind, version, confidential, people_id, people_id1, people_id2, start_time, end_time, hind_over_time, unit_id, people_name, people1_name, people2_name,dept_name from bdgl_secrecy
  29. </sql>
  30. <select id="selectBdglSecrecyList" parameterType="BdglSecrecy" resultMap="BdglSecrecyResult">
  31. select id, secrecy_type, number, name, kind, version, confidential, people_id, people_id1, people_id2, start_time, end_time, hind_over_time, unit_id, people_name, people1_name, people2_name,s.dept_name,createtime
  32. from bdgl_secrecy s left join sys_dept t
  33. on s.unit_id=t.dept_id
  34. <where>
  35. <if test="unitId != null ">
  36. and (s.unit_id=#{unitId} or find_in_set(#{unitId}, t.ancestors))
  37. </if>
  38. <if test="secrecyType != null "> and s.secrecy_type = #{secrecyType}</if>
  39. <if test="number != null and number != ''"> and s.number = #{number}</if>
  40. <if test="name != null and name != ''"> and s.name like concat('%', #{name}, '%')</if>
  41. <if test="kind != null and kind != ''"> and s.kind = #{kind}</if>
  42. <if test="version != null and version != ''"> and s.version = #{version}</if>
  43. <if test="confidential != null and confidential != ''"> and s.confidential = #{confidential}</if>
  44. <if test="peopleId != null "> and s.people_id = #{peopleId}</if>
  45. <if test="peopleId1 != null "> and s.people_id1 = #{peopleId1}</if>
  46. <if test="peopleId2 != null "> and s.people_id2 = #{peopleId2}</if>
  47. <if test="startTime != null "> and s.start_time = #{startTime}</if>
  48. <if test="endTime != null "> and s.end_time = #{endTime}</if>
  49. <if test="hindOverTime != null "> and s.hind_over_time = #{hindOverTime}</if>
  50. <if test="peopleName != null and peopleName != ''"> and s.people_name like concat('%', #{peopleName}, '%')</if>
  51. <if test="people1Name != null and people1Name != ''"> and s.people1_name like concat('%', #{people1Name}, '%')</if>
  52. <if test="people2Name != null and people2Name != ''"> and s.people2_name like concat('%', #{people2Name}, '%')</if>
  53. <if test="deptName != null and deptName != ''"> and s.dept_name like concat('%', #{deptName}, '%')</if>
  54. </where>
  55. order by s.id desc
  56. </select>
  57. <select id="selectBdglSecrecyById" parameterType="Integer" resultMap="BdglSecrecyResult">
  58. <include refid="selectBdglSecrecyVo"/>
  59. where id = #{id}
  60. </select>
  61. <select id="selectBdglSecrecyBunitId" parameterType="Integer" resultMap="BdglSecrecyResult">
  62. <include refid="selectBdglSecrecyVo"/>
  63. <where>
  64. <if test="unitId != null"> and unit_id = #{unitId}</if>
  65. <if test="year != null and year != ''"> and YEAR(start_time)= #{year}</if>
  66. </where>
  67. order by id desc
  68. </select>
  69. <select id="selectlSecrecyCountByunitId" resultType="java.lang.Integer">
  70. select count(*) from bdgl_secrecy where unit_id = #{unitId} and YEAR(start_time)= #{year}
  71. </select>
  72. <select id="selectlSecrecyStartTimeByunitId"
  73. resultMap="BdglSecrecyResult">
  74. select start_time from bdgl_secrecy where unit_id = #{unitId} and YEAR(start_time)= #{year} order by id desc
  75. </select>
  76. <insert id="insertBdglSecrecy" parameterType="BdglSecrecy" useGeneratedKeys="true" keyProperty="id">
  77. insert into bdgl_secrecy
  78. <trim prefix="(" suffix=")" suffixOverrides=",">
  79. <if test="secrecyType != null">secrecy_type,</if>
  80. <if test="number != null">number,</if>
  81. <if test="name != null">name,</if>
  82. <if test="kind != null">kind,</if>
  83. <if test="version != null">version,</if>
  84. <if test="confidential != null">confidential,</if>
  85. <if test="peopleId != null">people_id,</if>
  86. <if test="peopleId1 != null">people_id1,</if>
  87. <if test="peopleId2 != null">people_id2,</if>
  88. <if test="startTime != null">start_time,</if>
  89. <if test="endTime != null">end_time,</if>
  90. <if test="hindOverTime != null">hind_over_time,</if>
  91. <if test="unitId != null">unit_id,</if>
  92. <if test="peopleName != null">people_name,</if>
  93. <if test="people1Name != null">people1_name,</if>
  94. <if test="people2Name != null">people2_name,</if>
  95. <if test="deptName != null">dept_name,</if>
  96. <if test="createtime != null">createtime</if>
  97. </trim>
  98. <trim prefix="values (" suffix=")" suffixOverrides=",">
  99. <if test="secrecyType != null">#{secrecyType},</if>
  100. <if test="number != null">#{number},</if>
  101. <if test="name != null">#{name},</if>
  102. <if test="kind != null">#{kind},</if>
  103. <if test="version != null">#{version},</if>
  104. <if test="confidential != null">#{confidential},</if>
  105. <if test="peopleId != null">#{peopleId},</if>
  106. <if test="peopleId1 != null">#{peopleId1},</if>
  107. <if test="peopleId2 != null">#{peopleId2},</if>
  108. <if test="startTime != null">#{startTime},</if>
  109. <if test="endTime != null">#{endTime},</if>
  110. <if test="hindOverTime != null">#{hindOverTime},</if>
  111. <if test="unitId != null">#{unitId},</if>
  112. <if test="peopleName != null">#{peopleName},</if>
  113. <if test="people1Name != null">#{people1Name},</if>
  114. <if test="people2Name != null">#{people2Name},</if>
  115. <if test="deptName != null">#{deptName},</if>
  116. <if test="createtime != null">#{createtime}</if>
  117. </trim>
  118. </insert>
  119. <update id="updateBdglSecrecy" parameterType="BdglSecrecy">
  120. update bdgl_secrecy
  121. <trim prefix="SET" suffixOverrides=",">
  122. <if test="secrecyType != null">secrecy_type = #{secrecyType},</if>
  123. <if test="number != null">number = #{number},</if>
  124. <if test="name != null">name = #{name},</if>
  125. <if test="kind != null">kind = #{kind},</if>
  126. <if test="version != null">version = #{version},</if>
  127. <if test="confidential != null">confidential = #{confidential},</if>
  128. <if test="peopleId != null">people_id = #{peopleId},</if>
  129. <if test="peopleId1 != null">people_id1 = #{peopleId1},</if>
  130. <if test="peopleId2 != null">people_id2 = #{peopleId2},</if>
  131. <if test="startTime != null">start_time = #{startTime},</if>
  132. <if test="endTime != null">end_time = #{endTime},</if>
  133. <if test="hindOverTime != null">hind_over_time = #{hindOverTime},</if>
  134. <if test="unitId != null">unit_id = #{unitId},</if>
  135. <if test="peopleName != null">people_name = #{peopleName},</if>
  136. <if test="people1Name != null">people1_name = #{people1Name},</if>
  137. <if test="people2Name != null">people2_name = #{people2Name},</if>
  138. <if test="deptName != null">dept_name = #{deptName},</if>
  139. </trim>
  140. where id = #{id}
  141. </update>
  142. <delete id="deleteBdglSecrecyById" parameterType="Integer">
  143. delete from bdgl_secrecy where id = #{id}
  144. </delete>
  145. <delete id="deleteBdglSecrecyByIds" parameterType="String">
  146. delete from bdgl_secrecy where id in
  147. <foreach item="id" collection="array" open="(" separator="," close=")">
  148. #{id}
  149. </foreach>
  150. </delete>
  151. </mapper>