BisInspAuditDao.xml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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="cn.com.goldenwater.dcproj.dao.BisInspAuditDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspAudit" id="bisInspAuditResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="code" column="CODE"/>
  8. <result property="nm" column="NM"/>
  9. <result property="ptype" column="PTYPE"/>
  10. <result property="lgtd" column="LGTD"/>
  11. <result property="lttd" column="LTTD"/>
  12. <result property="isSetObj" column="IS_SET_OBJ"/>
  13. <result property="rgstrId" column="RGSTR_ID"/>
  14. <result property="state" column="STATE"/>
  15. <result property="rgstrNote" column="RGSTR_NOTE"/>
  16. <result property="plmbNote" column="PLMB_NOTE"/>
  17. <result property="persId" column="PERS_ID"/>
  18. <result property="intm" column="INTM"/>
  19. <result property="uptm" column="UPTM"/>
  20. <result property="dataStat" column="DATA_STAT"/>
  21. <result property="villType" column="VILL_TYPE"/>
  22. </resultMap>
  23. <sql id="table_columns">
  24. ID,
  25. OBJ_ID,
  26. CODE,
  27. NM,
  28. PTYPE,
  29. LGTD,
  30. LTTD,
  31. IS_SET_OBJ,
  32. RGSTR_ID,
  33. STATE,
  34. RGSTR_NOTE,
  35. PLMB_NOTE,
  36. PERS_ID,
  37. INTM,
  38. UPTM,
  39. DATA_STAT,
  40. VILL_TYPE
  41. </sql>
  42. <sql id="entity_properties">
  43. #{id},
  44. #{objId},
  45. #{code},
  46. #{nm},
  47. #{ptype},
  48. #{lgtd},
  49. #{lttd},
  50. #{isSetObj},
  51. #{rgstrId},
  52. #{state},
  53. #{rgstrNote},
  54. #{plmbNote},
  55. #{persId},
  56. #{intm},
  57. #{uptm},
  58. #{dataStat},
  59. #{villType}
  60. </sql>
  61. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  62. <sql id="page_where">
  63. <trim prefix="where" prefixOverrides="and | or ">
  64. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  65. <if test="code != null and code != ''">and CODE = #{code}</if>
  66. <if test="nm != null and nm != ''">and NM = #{nm}</if>
  67. <if test="ptype != null and ptype != ''">and PTYPE = #{ptype}</if>
  68. <if test="lgtd != null and lgtd != ''">and LGTD = #{lgtd}</if>
  69. <if test="lttd != null and lttd != ''">and LTTD = #{lttd}</if>
  70. <if test="isSetObj != null and isSetObj != ''">and IS_SET_OBJ = #{isSetObj}</if>
  71. <if test="rgstrId != null and rgstrId != ''">and RGSTR_ID = #{rgstrId}</if>
  72. <if test="state != null and state != ''">and STATE = #{state}</if>
  73. <if test="rgstrNote != null and rgstrNote != ''">and RGSTR_NOTE = #{rgstrNote}</if>
  74. <if test="plmbNote != null and plmbNote != ''">and PLMB_NOTE = #{plmbNote}</if>
  75. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  76. <if test="intm != null">and INTM = #{intm}</if>
  77. <if test="uptm != null">and UPTM = #{uptm}</if>
  78. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  79. <if test="villType != null and villType != ''">and VILL_TYPE = #{villType}</if>
  80. </trim>
  81. </sql>
  82. <select id="get" resultMap="bisInspAuditResultMap" parameterType="String">
  83. select
  84. <include refid="table_columns"/>
  85. from BIS_INSP_AUDIT where ID = #{id}
  86. </select>
  87. <select id="getBy" resultMap="bisInspAuditResultMap">
  88. select
  89. <include refid="table_columns"/>
  90. from BIS_INSP_AUDIT
  91. <include refid="page_where"/>
  92. </select>
  93. <select id="findAll" resultMap="bisInspAuditResultMap">
  94. select
  95. <include refid="table_columns"/>
  96. from BIS_INSP_AUDIT
  97. </select>
  98. <select id="findList" resultMap="bisInspAuditResultMap">
  99. select
  100. <include refid="table_columns"/>
  101. from BIS_INSP_AUDIT
  102. <include refid="page_where"/>
  103. </select>
  104. <select id="selectCount" resultType="int">
  105. select count(ID) from BIS_INSP_AUDIT
  106. <include refid="page_where"/>
  107. </select>
  108. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspAudit">
  109. insert into BIS_INSP_AUDIT(
  110. <include refid="table_columns"/>
  111. )
  112. values (
  113. <include refid="entity_properties"/>
  114. )
  115. </insert>
  116. <delete id="delete" parameterType="java.lang.String">
  117. update from BIS_INSP_AUDIT set DATA_STAT='9' where ID = #{id}
  118. </delete>
  119. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspAudit">
  120. delete from BIS_INSP_AUDIT
  121. <include refid="page_where"/>
  122. </delete>
  123. <update id="deleteInFlag" parameterType="java.lang.String">
  124. update BIS_INSP_AUDIT set flag_valid = 0 where ID = #{id}
  125. </update>
  126. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspAudit">
  127. update BIS_INSP_AUDIT
  128. <trim prefix="set" suffixOverrides=",">
  129. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  130. <if test="code != null and code != ''">CODE = #{code},</if>
  131. <if test="nm != null and nm != ''">NM = #{nm},</if>
  132. <if test="ptype != null and ptype != ''">PTYPE = #{ptype},</if>
  133. <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
  134. <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
  135. <if test="isSetObj != null and isSetObj != ''">IS_SET_OBJ = #{isSetObj},</if>
  136. <if test="rgstrId != null and rgstrId != ''">RGSTR_ID = #{rgstrId},</if>
  137. <if test="state != null and state != ''">STATE = #{state},</if>
  138. <if test="rgstrNote != null and rgstrNote != ''">RGSTR_NOTE = #{rgstrNote},</if>
  139. <if test="plmbNote != null and plmbNote != ''">PLMB_NOTE = #{plmbNote},</if>
  140. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  141. <if test="intm != null">INTM = #{intm},</if>
  142. <if test="uptm != null">UPTM = #{uptm},</if>
  143. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  144. <if test="villType != null and villType != ''">VILL_TYPE = #{villType},</if>
  145. </trim>
  146. <where>ID = #{id}</where>
  147. </update>
  148. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspAudit">
  149. update BIS_INSP_AUDIT
  150. <trim prefix="set" suffixOverrides=",">
  151. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  152. <if test="code != null and code != ''">CODE = #{code},</if>
  153. <if test="nm != null and nm != ''">NM = #{nm},</if>
  154. <if test="ptype != null and ptype != ''">PTYPE = #{ptype},</if>
  155. <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
  156. <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
  157. <if test="isSetObj != null and isSetObj != ''">IS_SET_OBJ = #{isSetObj},</if>
  158. <if test="rgstrId != null and rgstrId != ''">RGSTR_ID = #{rgstrId},</if>
  159. <if test="state != null and state != ''">STATE = #{state},</if>
  160. <if test="rgstrNote != null and rgstrNote != ''">RGSTR_NOTE = #{rgstrNote},</if>
  161. <if test="plmbNote != null and plmbNote != ''">PLMB_NOTE = #{plmbNote},</if>
  162. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  163. <if test="intm != null">INTM = #{intm},</if>
  164. <if test="uptm != null">UPTM = #{uptm},</if>
  165. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  166. <if test="villType != null and villType != ''">VILL_TYPE = #{villType},</if>
  167. </trim>
  168. <include refid="page_where"/>
  169. </update>
  170. <!-- 其他自定义SQL -->
  171. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspAudit" id="resultAuditMap">
  172. <result property="id" column="ID"/>
  173. <result property="objId" column="OBJ_ID"/>
  174. <result property="code" column="CODE"/>
  175. <result property="nm" column="NM"/>
  176. <result property="ptype" column="PTYPE"/>
  177. <result property="lgtd" column="LGTD"/>
  178. <result property="lttd" column="LTTD"/>
  179. <result property="isSetObj" column="IS_SET_OBJ"/>
  180. <result property="rgstrId" column="RGSTR_ID"/>
  181. <result property="state" column="STATE"/>
  182. <result property="rgstrNote" column="RGSTR_NOTE"/>
  183. <result property="plmbNote" column="PLMB_NOTE"/>
  184. <result property="persId" column="PERS_ID"/>
  185. <result property="intm" column="INTM"/>
  186. <result property="uptm" column="UPTM"/>
  187. <result property="dataStat" column="DATA_STAT"/>
  188. <result property="villType" column="VILL_TYPE"/>
  189. <result property="persNm" column="persNm"/>
  190. <collection property="bisInspAuditPlmbs" ofType="cn.com.goldenwater.dcproj.model.BisInspAuditPlmb">
  191. <result property="id" column="AUDITPID"/>
  192. <result property="auditId" column="AUDIT_ID"/>
  193. <result property="pblmId" column="PBLM_ID"/>
  194. <result property="pblmNm" column="PBLM_NM"/>
  195. <result property="pblmPasi" column="PBLM_PASI"/>
  196. <result property="ifCasePblm" column="IF_CASE_PBLM"/>
  197. </collection>
  198. </resultMap>
  199. <!--根据督查类型提取对应的信息-->
  200. <select id="getAuditByRgsId" resultMap="resultAuditMap">
  201. SELECT A.ID,A.OBJ_ID,CODE,NM,PTYPE,LGTD,LTTD,IS_SET_OBJ,A.RGSTR_ID,STATE,RGSTR_NOTE,
  202. PLMB_NOTE,A.PERS_ID,A.INTM,A.UPTM,A.DATA_STAT,VILL_TYPE,
  203. B.ID AUDITPID,B.PBLM_ID,B.PBLM_NM,B.PBLM_PASI,c.pers_name persNm,b.if_case_pblm
  204. FROM BIS_INSP_AUDIT A
  205. LEFT JOIN BIS_INSP_AUDIT_PLMB B ON A.ID=B.AUDIT_ID and B.DATA_STAT='0'
  206. left join bis_insp_all_rlation_pers c on a.pers_id=c.guid
  207. where A.DATA_STAT='0' AND A.RGSTR_ID=#{rgsrId} and A.ptype=#{ptype}
  208. <if test="villType != null and villType != ''">AND VILL_TYPE = #{villType}</if>
  209. order by intm asc
  210. </select>
  211. </mapper>