BisInspJspwiuDao.xml 13 KB

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