BisInspJspwiu2024Dao.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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.BisInspJspwiu2024Dao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspJspwiu2024" id="bisInspJspwiu2024ResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="name" column="NAME"/>
  8. <result property="leglPers" column="LEGL_PERS"/>
  9. <result property="adCode" column="AD_CODE"/>
  10. <result property="adName" column="AD_NAME"/>
  11. <result property="idnt" column="IDNT"/>
  12. <result property="busAddr" column="BUS_ADDR"/>
  13. <result property="industry" column="INDUSTRY"/>
  14. <result property="industryCode" column="INDUSTRY_CODE"/>
  15. <result property="majorProduct" column="MAJOR_PRODUCT"/>
  16. <result property="waterIntake" column="WATER_INTAKE"/>
  17. <result property="conPers" column="CON_PERS"/>
  18. <result property="conPersTel" column="CON_PERS_TEL"/>
  19. <result property="centerX" column="CENTER_X"/>
  20. <result property="centerY" column="CENTER_Y"/>
  21. <result property="gdX" column="GD_X"/>
  22. <result property="gdY" column="GD_Y"/>
  23. <result property="persId" column="PERS_ID"/>
  24. <result property="intm" column="INTM"/>
  25. <result property="uptm" column="UPTM"/>
  26. <result property="note" column="NOTE"/>
  27. <result property="dataStat" column="DATA_STAT"/>
  28. <result property="unitStat" column="UNIT_STAT"/>
  29. <result property="wtruStat" column="WTRU_STAT"/>
  30. <result property="state" column="STATE"/>
  31. </resultMap>
  32. <sql id="table_columns">
  33. ID,
  34. OBJ_ID,
  35. NAME,
  36. LEGL_PERS,
  37. AD_CODE,
  38. AD_NAME,
  39. IDNT,
  40. BUS_ADDR,
  41. INDUSTRY,
  42. INDUSTRY_CODE,
  43. MAJOR_PRODUCT,
  44. WATER_INTAKE,
  45. CON_PERS,
  46. CON_PERS_TEL,
  47. CENTER_X,
  48. CENTER_Y,
  49. GD_X,
  50. GD_Y,
  51. PERS_ID,
  52. INTM,
  53. UPTM,
  54. NOTE,
  55. DATA_STAT,
  56. UNIT_STAT,
  57. WTRU_STAT,
  58. STATE
  59. </sql>
  60. <sql id="entity_properties">
  61. #{id},
  62. #{objId},
  63. #{name},
  64. #{leglPers},
  65. #{adCode},
  66. #{adName},
  67. #{idnt},
  68. #{busAddr},
  69. #{industry},
  70. #{industryCode},
  71. #{majorProduct},
  72. #{waterIntake},
  73. #{conPers},
  74. #{conPersTel},
  75. #{centerX},
  76. #{centerY},
  77. #{gdX},
  78. #{gdY},
  79. #{persId},
  80. #{intm},
  81. #{uptm},
  82. #{note},
  83. #{dataStat},
  84. #{unitStat},
  85. #{wtruStat},
  86. #{state}
  87. </sql>
  88. <!-- 浣跨敤like鐢ㄦ硶锛歝olumnName like concat('%',#columnName#,'%') -->
  89. <sql id="page_where">
  90. <trim prefix="where" prefixOverrides="and | or ">
  91. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  92. <if test="name != null and name != ''">and NAME = #{name}</if>
  93. <if test="leglPers != null and leglPers != ''">and LEGL_PERS = #{leglPers}</if>
  94. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  95. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  96. <if test="idnt != null and idnt != ''">and IDNT = #{idnt}</if>
  97. <if test="busAddr != null and busAddr != ''">and BUS_ADDR = #{busAddr}</if>
  98. <if test="industry != null and industry != ''">and INDUSTRY = #{industry}</if>
  99. <if test="industryCode != null and industryCode != ''">and INDUSTRY_CODE = #{industryCode}</if>
  100. <if test="majorProduct != null and majorProduct != ''">and MAJOR_PRODUCT = #{majorProduct}</if>
  101. <if test="waterIntake != null and waterIntake != ''">and WATER_INTAKE = #{waterIntake}</if>
  102. <if test="conPers != null and conPers != ''">and CON_PERS = #{conPers}</if>
  103. <if test="conPersTel != null and conPersTel != ''">and CON_PERS_TEL = #{conPersTel}</if>
  104. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  105. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  106. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  107. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  108. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  109. <if test="intm != null">and INTM = #{intm}</if>
  110. <if test="uptm != null">and UPTM = #{uptm}</if>
  111. <if test="note != null and note != ''">and NOTE = #{note}</if>
  112. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  113. <if test="unitStat != null and unitStat != ''">and UNIT_STAT = #{unitStat}</if>
  114. <if test="wtruStat != null and wtruStat != ''">and WTRU_STAT = #{wtruStat}</if>
  115. <if test="state != null and state != ''">and STATE = #{state}</if>
  116. </trim>
  117. </sql>
  118. <select id="get" resultMap="bisInspJspwiu2024ResultMap" parameterType="String" >
  119. select <include refid="table_columns" /> from BIS_INSP_JSPWIU2024 where ID = #{id}
  120. </select>
  121. <select id="getBy" resultMap="bisInspJspwiu2024ResultMap">
  122. select <include refid="table_columns" /> from BIS_INSP_JSPWIU2024 <include refid="page_where" />
  123. </select>
  124. <select id="findAll" resultMap="bisInspJspwiu2024ResultMap">
  125. select <include refid="table_columns" /> from BIS_INSP_JSPWIU2024
  126. </select>
  127. <select id="findList" resultMap="bisInspJspwiu2024ResultMap">
  128. select <include refid="table_columns" /> from BIS_INSP_JSPWIU2024 <include refid="page_where" />
  129. </select>
  130. <select id="selectCount" resultType="int" >
  131. select count(ID) from BIS_INSP_JSPWIU2024 <include refid="page_where" />
  132. </select>
  133. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspJspwiu2024">
  134. insert into BIS_INSP_JSPWIU2024( <include refid="table_columns" /> )
  135. values ( <include refid="entity_properties" /> )
  136. </insert>
  137. <delete id="delete" parameterType="java.lang.String">
  138. update BIS_INSP_JSPWIU2024 set DATA_STAT='9' where ID = #{id}
  139. </delete>
  140. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspJspwiu2024">
  141. delete from BIS_INSP_JSPWIU2024 <include refid="page_where" />
  142. </delete>
  143. <update id="deleteInFlag" parameterType="java.lang.String">
  144. update BIS_INSP_JSPWIU2024 set flag_valid = 0 where ID = #{id}
  145. </update>
  146. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspJspwiu2024">
  147. update BIS_INSP_JSPWIU2024
  148. <trim prefix="set" suffixOverrides=",">
  149. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  150. <if test="name != null and name != ''">NAME = #{name},</if>
  151. <if test="leglPers != null and leglPers != ''">LEGL_PERS = #{leglPers},</if>
  152. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  153. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  154. <if test="idnt != null and idnt != ''">IDNT = #{idnt},</if>
  155. <if test="busAddr != null and busAddr != ''">BUS_ADDR = #{busAddr},</if>
  156. <if test="industry != null and industry != ''">INDUSTRY = #{industry},</if>
  157. <if test="industryCode != null and industryCode != ''">INDUSTRY_CODE = #{industryCode},</if>
  158. <if test="majorProduct != null and majorProduct != ''">MAJOR_PRODUCT = #{majorProduct},</if>
  159. <if test="waterIntake != null and waterIntake != ''">WATER_INTAKE = #{waterIntake},</if>
  160. <if test="conPers != null and conPers != ''">CON_PERS = #{conPers},</if>
  161. <if test="conPersTel != null and conPersTel != ''">CON_PERS_TEL = #{conPersTel},</if>
  162. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  163. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  164. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  165. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  166. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  167. <if test="intm != null">INTM = #{intm},</if>
  168. <if test="uptm != null">UPTM = #{uptm},</if>
  169. <if test="note != null and note != ''">NOTE = #{note},</if>
  170. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  171. <if test="unitStat != null and unitStat != ''">UNIT_STAT = #{unitStat},</if>
  172. <if test="wtruStat != null and wtruStat != ''">WTRU_STAT = #{wtruStat},</if>
  173. <if test="state != null and state != ''">STATE = #{state},</if>
  174. </trim>
  175. <where>ID = #{id}</where>
  176. </update>
  177. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspJspwiu2024">
  178. update BIS_INSP_JSPWIU2024
  179. <trim prefix="set" suffixOverrides=",">
  180. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  181. <if test="name != null and name != ''">NAME = #{name},</if>
  182. <if test="leglPers != null and leglPers != ''">LEGL_PERS = #{leglPers},</if>
  183. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  184. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  185. <if test="idnt != null and idnt != ''">IDNT = #{idnt},</if>
  186. <if test="busAddr != null and busAddr != ''">BUS_ADDR = #{busAddr},</if>
  187. <if test="industry != null and industry != ''">INDUSTRY = #{industry},</if>
  188. <if test="industryCode != null and industryCode != ''">INDUSTRY_CODE = #{industryCode},</if>
  189. <if test="majorProduct != null and majorProduct != ''">MAJOR_PRODUCT = #{majorProduct},</if>
  190. <if test="waterIntake != null and waterIntake != ''">WATER_INTAKE = #{waterIntake},</if>
  191. <if test="conPers != null and conPers != ''">CON_PERS = #{conPers},</if>
  192. <if test="conPersTel != null and conPersTel != ''">CON_PERS_TEL = #{conPersTel},</if>
  193. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  194. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  195. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  196. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  197. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  198. <if test="intm != null">INTM = #{intm},</if>
  199. <if test="uptm != null">UPTM = #{uptm},</if>
  200. <if test="note != null and note != ''">NOTE = #{note},</if>
  201. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  202. <if test="unitStat != null and unitStat != ''">UNIT_STAT = #{unitStat},</if>
  203. <if test="wtruStat != null and wtruStat != ''">WTRU_STAT = #{wtruStat},</if>
  204. <if test="state != null and state != ''">STATE = #{state},</if>
  205. </trim>
  206. <include refid="page_where" />
  207. </update>
  208. <!-- 鍏朵粬鑷畾涔塖QL -->
  209. <!-- 其他自定义SQL -->
  210. <select id="findPageList" resultType="cn.com.goldenwater.dcproj.dto.BisInspJspwiu2024Dto">
  211. SELECT * FROM (
  212. select
  213. A.CODE, A.ID nodeId, B.NAME as NM, A.ptype, ia.pnm groupName,
  214. B.id as rgstrId, AW.AD_FULL_NAME,
  215. B.OBJ_ID,
  216. B.NAME,
  217. B.AD_CODE,
  218. B.AD_NAME,
  219. B.LEGL_PERS,
  220. B.IDNT,
  221. B.BUS_ADDR,
  222. B.INDUSTRY,
  223. B.INDUSTRY_CODE,
  224. B.MAJOR_PRODUCT,
  225. B.WATER_INTAKE,
  226. B.CON_PERS,
  227. B.CON_PERS_TEL,
  228. B.CENTER_X,
  229. B.CENTER_Y,
  230. B.GD_X,
  231. B.GD_Y,
  232. B.PERS_ID,
  233. B.INTM,
  234. B.UPTM,
  235. B.NOTE,
  236. B.UNIT_STAT,
  237. B.WTRU_STAT,
  238. B.STATE
  239. FROM BIS_INSP_ALL_OBJ A
  240. JOIN BIS_INSP_JSPWIU2024 B ON A.OBJ_ID=B.OBJ_ID
  241. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  242. LEFT JOIN ATT_AD_BASE AW ON B.AD_CODE = AW.AD_CODE
  243. where A.ptype = #{pType}
  244. and B.DATA_STAT= '0'
  245. <if test="adCodes ==null or adCodes ==''">
  246. <choose>
  247. <when test='isAll =="1"'>
  248. </when>
  249. <otherwise>
  250. and
  251. A.Id in (
  252. select distinct id from (
  253. SELECT P.id FROM BIS_INSP_ALL P START WITH P.PID IN (SELECT id FROM BIS_INSP_ALL_RLATION A
  254. WHERE A.PERSID = #{presId} and TYPE = #{pType} and length(id) in (3,6,9))
  255. CONNECT BY P.PID = PRIOR P.ID
  256. union all
  257. SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
  258. WHERE A.PERSID =#{presId} and TYPE = #{pType} and length(id)=12 )
  259. )
  260. )
  261. </otherwise>
  262. </choose>
  263. </if>
  264. <if test="adCodes !=null and adCodes !=''">
  265. and
  266. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  267. b.ad_code like concat('${item}','%')
  268. </foreach>
  269. </if>
  270. ) A
  271. <where>
  272. <if test="id !=null and id !=''">and nodeId like '${id}%'</if>
  273. <if test="plnaId !=null and plnaId !=''">and nodeId like '${plnaId}%'</if>
  274. <if test="groupId != null and groupId != ''">and nodeId like '${groupId}%'</if>
  275. <if test="code !=null and code !=''">and code = #{code}</if>
  276. <if test="nm !=null and nm !=''">and nm like '%${nm}%'</if>
  277. <if test="rsName !=null and rsName !=''">and nm like '%${rsName}%'</if>
  278. <if test="state !=null and state !=''">and STATE in (${state})</if>
  279. <if test="adName != null and adName != ''">and AD_NAME like '%${adName}%'</if>
  280. <if test="sttm != null and sttm != ''">and INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  281. <if test="entm != null and entm != ''">and INTM &lt; TO_DATE(#{entm},'yyyy-MM-dd') + 1</if>
  282. </where>
  283. order by nodeId asc
  284. <if test="orderBy != null and orderBy != ''">
  285. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  286. </if>
  287. </select>
  288. <!-- 查询组内添加的对象 -->
  289. <select id="getListByInspGroupIdObjType" resultType="cn.com.goldenwater.dcproj.dto.BisInspJspwiu2024Dto">
  290. select t.*, C.id groupId,C.PNM groupName,B.code code
  291. from BIS_INSP_JSPWIU2024 t
  292. left join BIS_INSP_ALL_OBJ B on t.OBJ_ID = B.OBJ_ID
  293. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.ID and B.ptype = #{objType}
  294. where 1 = 1
  295. <if test='isAll == "0"'>and B.ID = #{inspGroupId}</if>
  296. <if test='isAll == "1"'>and B.ID LIKE '${inspGroupId}%'</if>
  297. <if test="adCode != null and adCode != ''">
  298. and t.AD_CODE like '${adCode}%'
  299. </if>
  300. <if test="wtdstNm != null and wtdstNm != ''">
  301. and t.NAME like '${wtdstNm}%'
  302. </if>
  303. <choose>
  304. <when test="province != null and province != ''">
  305. and B.AD_CODE LIKE '${province}%'
  306. </when>
  307. <otherwise>
  308. and B.AD_CODE is null
  309. </otherwise>
  310. </choose>
  311. </select>
  312. </mapper>