BisInspWtcrrRgstrDao.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  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.BisInspWtcrrRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspWtcrrRgstr" id="bisInspWtcrrRgstrResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="wtuntId" column="WTUNT_ID"/>
  8. <result property="utName" column="UT_NAME"/>
  9. <result property="utCode" column="UT_CODE"/>
  10. <result property="adName" column="AD_NAME"/>
  11. <result property="adCode" column="AD_CODE"/>
  12. <result property="utType" column="UT_TYPE"/>
  13. <result property="utPpt" column="UT_PPT"/>
  14. <result property="utLead" column="UT_LEAD"/>
  15. <result property="utAttn" column="UT_ATTN"/>
  16. <result property="utCont" column="UT_CONT"/>
  17. <result property="appDepTm" column="APP_DEP_TM" />
  18. <result property="appDep" column="APP_DEP" />
  19. <result property="principalTel" column="PRINCIPAL_TEL" />
  20. <result property="note" column="NOTE" />
  21. <result property="signAddr" column="SIGN_ADDR"/>
  22. <result property="utAddr" column="UT_ADDR"/>
  23. <result property="centerX" column="CENTER_X"/>
  24. <result property="centerY" column="CENTER_Y"/>
  25. <result property="gdX" column="GD_X"/>
  26. <result property="gdY" column="GD_Y"/>
  27. <result property="chkUnit" column="CHK_UNIT"/>
  28. <result property="chkPers" column="CHK_PERS"/>
  29. <result property="chkTm" column="CHK_TM"/>
  30. <result property="state" column="STATE"/>
  31. <result property="wtuntStat" column="WTUNT_STAT"/>
  32. <result property="persId" column="PERS_ID"/>
  33. <result property="groupId" column="GROUP_ID"/>
  34. <result property="intm" column="INTM"/>
  35. <result property="uptm" column="UPTM"/>
  36. <result property="dataStat" column="DATA_STAT"/>
  37. </resultMap>
  38. <sql id="table_columns">
  39. ID,
  40. OBJ_ID,
  41. WTUNT_ID,
  42. UT_NAME,
  43. UT_CODE,
  44. AD_NAME,
  45. AD_CODE,
  46. UT_TYPE,
  47. UT_PPT,
  48. UT_LEAD,
  49. UT_ATTN,
  50. UT_CONT,
  51. APP_DEP_TM,
  52. APP_DEP,
  53. PRINCIPAL_TEL,
  54. NOTE,
  55. SIGN_ADDR,
  56. UT_ADDR,
  57. CENTER_X,
  58. CENTER_Y,
  59. GD_X,
  60. GD_Y,
  61. CHK_UNIT,
  62. CHK_PERS,
  63. CHK_TM,
  64. STATE,
  65. WTUNT_STAT,
  66. PERS_ID,
  67. GROUP_ID,
  68. INTM,
  69. UPTM,
  70. DATA_STAT
  71. </sql>
  72. <sql id="entity_properties">
  73. #{id},
  74. #{objId},
  75. #{wtuntId},
  76. #{utName},
  77. #{utCode},
  78. #{adName},
  79. #{adCode},
  80. #{utType},
  81. #{utPpt},
  82. #{utLead},
  83. #{utAttn},
  84. #{utCont},
  85. #{appDepTm},
  86. #{appDep},
  87. #{principalTel},
  88. #{note},
  89. #{signAddr},
  90. #{utAddr},
  91. #{centerX},
  92. #{centerY},
  93. #{gdX},
  94. #{gdY},
  95. #{chkUnit},
  96. #{chkPers},
  97. #{chkTm},
  98. #{state},
  99. #{wtuntStat},
  100. #{persId},
  101. #{groupId},
  102. #{intm},
  103. #{uptm},
  104. #{dataStat}
  105. </sql>
  106. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  107. <sql id="page_where">
  108. <trim prefix="where" prefixOverrides="and | or ">
  109. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  110. <if test="wtuntId != null and wtuntId != ''">and WTUNT_ID = #{wtuntId}</if>
  111. <if test="utName != null and utName != ''">and UT_NAME LIKE concat('%' , #{utName} , '%')</if>
  112. <if test="utCode != null and utCode != ''">and UT_CODE = #{utCode}</if>
  113. <if test="adName != null and adName != ''">and AD_NAME LIKE concat('%' , #{adName} , '%')</if>
  114. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  115. <if test="utType != null and utType != ''">and UT_TYPE = #{utType}</if>
  116. <if test="utPpt != null and utPpt != ''">and UT_PPT = #{utPpt}</if>
  117. <if test="utLead != null and utLead != ''">and UT_LEAD = #{utLead}</if>
  118. <if test="utAttn != null and utAttn != ''">and UT_ATTN = #{utAttn}</if>
  119. <if test="utCont != null and utCont != ''">and UT_CONT = #{utCont}</if>
  120. <if test="appDepTm != null and appDepTm != ''">and APP_DEP_TM = #{appDepTm}</if>
  121. <if test="appDep != null and appDep != ''">and APP_DEP LIKE concat('%' , #{appDep} , '%')</if>
  122. <if test="principalTel != null and principalTel != ''">and PRINCIPAL_TEL LIKE concat('%' , #{principalTel} , '%')</if>
  123. <if test="note != null and note != ''">and NOTE = #{note}</if>
  124. <if test="signAddr != null and signAddr != ''">and SIGN_ADDR = #{signAddr}</if>
  125. <if test="utAddr != null and utAddr != ''">and UT_ADDR LIKE concat('%' , #{utAddr} , '%')</if>
  126. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  127. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  128. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  129. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  130. <if test="chkUnit != null and chkUnit != ''">and CHK_UNIT = #{chkUnit}</if>
  131. <if test="chkPers != null and chkPers != ''">and CHK_PERS = #{chkPers}</if>
  132. <if test="chkTm != null">and CHK_TM = #{chkTm}</if>
  133. <if test="state != null and state != ''">and STATE = #{state}</if>
  134. <if test="wtuntStat != null and wtuntStat != ''">and WTUNT_STAT = #{wtuntStat}</if>
  135. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  136. <if test="sttm != null and sttm != ''">and INTM &gt;= STR_TO_DATE(#{sttm},'%Y-%m-%d')</if>
  137. <if test="entm != null and entm != ''">and INTM &lt;= STR_TO_DATE(#{entm},'%Y-%m-%d')</if>
  138. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  139. and DATA_STAT='0'
  140. </trim>
  141. </sql>
  142. <sql id="page_where2">
  143. <trim prefix="where" prefixOverrides="and | or ">
  144. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  145. <if test="wtuntId != null and wtuntId != ''">and WTUNT_ID = #{wtuntId}</if>
  146. <if test="utName != null and utName != ''">and UT_NAME LIKE concat('%' , #{utName} , '%')</if>
  147. <if test="utCode != null and utCode != ''">and UT_CODE = #{utCode}</if>
  148. <if test="adName != null and adName != ''">and AD_NAME LIKE concat('%' , #{adName} , '%')</if>
  149. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  150. <if test="utType != null and utType != ''">and UT_TYPE = #{utType}</if>
  151. <if test="utPpt != null and utPpt != ''">and UT_PPT = #{utPpt}</if>
  152. <if test="utLead != null and utLead != ''">and UT_LEAD = #{utLead}</if>
  153. <if test="utAttn != null and utAttn != ''">and UT_ATTN = #{utAttn}</if>
  154. <if test="utCont != null and utCont != ''">and UT_CONT = #{utCont}</if>
  155. <if test="appDepTm != null and appDepTm != ''">and APP_DEP_TM = #{appDepTm}</if>
  156. <if test="appDep != null and appDep != ''">and APP_DEP LIKE concat('%' , #{appDep} , '%')</if>
  157. <if test="principalTel != null and principalTel != ''">and PRINCIPAL_TEL LIKE concat('%' , #{principalTel} , '%')</if>
  158. <if test="note != null and note != ''">and NOTE = #{note}</if>
  159. <if test="signAddr != null and signAddr != ''">and SIGN_ADDR = #{signAddr}</if>
  160. <if test="utAddr != null and utAddr != ''">and UT_ADDR LIKE concat('%' , #{utAddr} , '%')</if>
  161. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  162. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  163. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  164. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  165. <if test="chkUnit != null and chkUnit != ''">and CHK_UNIT = #{chkUnit}</if>
  166. <if test="chkPers != null and chkPers != ''">and CHK_PERS = #{chkPers}</if>
  167. <if test="chkTm != null">and CHK_TM = #{chkTm}</if>
  168. <if test="state != null and state != ''">and STATE = #{state}</if>
  169. <if test="wtuntStat != null and wtuntStat != ''">and WTUNT_STAT = #{wtuntStat}</if>
  170. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  171. <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
  172. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  173. and DATA_STAT='0'
  174. </trim>
  175. </sql>
  176. <select id="get" resultMap="bisInspWtcrrRgstrResultMap" parameterType="String" >
  177. select <include refid="table_columns" /> from BIS_INSP_WTCRR_RGSTR where ID = #{id}
  178. </select>
  179. <select id="getBy" resultMap="bisInspWtcrrRgstrResultMap">
  180. select <include refid="table_columns" /> from BIS_INSP_WTCRR_RGSTR <include refid="page_where2" />
  181. </select>
  182. <select id="findAll" resultMap="bisInspWtcrrRgstrResultMap">
  183. select <include refid="table_columns" /> from BIS_INSP_WTCRR_RGSTR
  184. </select>
  185. <select id="findList" resultMap="bisInspWtcrrRgstrResultMap">
  186. SELECT
  187. B.*,A.PNM groupName, B.ID as "rgstrId"
  188. FROM
  189. (
  190. select <include refid="table_columns" />
  191. from BIS_INSP_WTCRR_RGSTR <include refid="page_where" />
  192. ) B
  193. LEFT JOIN BIS_INSP_ALL_OBJ O ON B.OBJ_ID = O.OBJ_ID
  194. LEFT JOIN BIS_INSP_ALL A ON A.ID = O.ID
  195. <where>
  196. <if test="groupName != null and groupName != ''">and A.PNM = #{groupName}</if>
  197. <if test="id != null and id != ''">and A.ID like '${id}%' </if>
  198. <if test="groupId != null and groupId != ''">and A.ID = #{groupId}</if>
  199. <if test="province != null and province != ''">and B.AD_CODE LIKE concat(#{province} , '%') </if>
  200. <if test="groupIds != null and groupIds.length &gt; 0">
  201. <foreach collection="groupIds" index="index" item="gId" separator=" OR " open="and (" close=")">
  202. A.ID LIKE '${gId}%'
  203. </foreach>
  204. </if>
  205. <if test="plnaId !=null and plnaId !=''">
  206. and A.ID like '${plnaId}%'
  207. </if>
  208. <if test="tabType =='2'.toString()">
  209. and A.entm &lt; DATE_ADD(STR_TO_DATE(#{nowTime},'%Y-%m-%d'), INTERVAL 1 DAY)
  210. </if>
  211. <if test="tabType =='1'.toString()">
  212. and A.entm &gt;=str_to_date(#{nowTime},'%Y-%m-%d')
  213. </if>
  214. <if test="null != pType">
  215. and O.PTYPE = #{pType}
  216. </if>
  217. </where>
  218. </select>
  219. <select id="selectCount" resultType="int" >
  220. select count(ID) from BIS_INSP_WTCRR_RGSTR <include refid="page_where" />
  221. </select>
  222. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspWtcrrRgstr">
  223. insert into BIS_INSP_WTCRR_RGSTR( <include refid="table_columns" /> )
  224. values ( <include refid="entity_properties" /> )
  225. </insert>
  226. <delete id="delete" parameterType="java.lang.String">
  227. update BIS_INSP_WTCRR_RGSTR set DATA_STAT='9' where ID = #{id}
  228. </delete>
  229. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspWtcrrRgstr">
  230. update BIS_INSP_WTCRR_RGSTR set DATA_STAT='9' <include refid="page_where2" />
  231. </delete>
  232. <update id="deleteInFlag" parameterType="java.lang.String">
  233. update BIS_INSP_WTCRR_RGSTR set DATA_STAT = '9' where ID = #{id}
  234. </update>
  235. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspWtcrrRgstr">
  236. update BIS_INSP_WTCRR_RGSTR
  237. <trim prefix="set" suffixOverrides=",">
  238. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  239. <if test="wtuntId != null and wtuntId != ''">WTUNT_ID = #{wtuntId},</if>
  240. <if test="utName != null and utName != ''">UT_NAME = #{utName},</if>
  241. <if test="utCode != null and utCode != ''">UT_CODE = #{utCode},</if>
  242. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  243. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  244. <if test="utType != null and utType != ''">UT_TYPE = #{utType},</if>
  245. <if test="utPpt != null and utPpt != ''">UT_PPT = #{utPpt},</if>
  246. <if test="utLead != null and utLead != ''">UT_LEAD = #{utLead},</if>
  247. <if test="utAttn != null and utAttn != ''">UT_ATTN = #{utAttn},</if>
  248. <if test="utCont != null and utCont != ''">UT_CONT = #{utCont},</if>
  249. <if test="appDepTm != null and appDepTm != ''">APP_DEP_TM = #{appDepTm},</if>
  250. <if test="appDep != null and appDep != ''">APP_DEP = #{appDep},</if>
  251. <if test="principalTel != null and principalTel != ''">PRINCIPAL_TEL = #{principalTel},</if>
  252. <if test="note != null and note != ''">NOTE = #{note},</if>
  253. <if test="signAddr != null and signAddr != ''">SIGN_ADDR = #{signAddr},</if>
  254. <if test="utAddr != null and utAddr != ''">UT_ADDR = #{utAddr},</if>
  255. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  256. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  257. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  258. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  259. <if test="chkUnit != null and chkUnit != ''">CHK_UNIT = #{chkUnit},</if>
  260. <if test="chkPers != null and chkPers != ''">CHK_PERS = #{chkPers},</if>
  261. <if test="chkTm != null">CHK_TM = #{chkTm},</if>
  262. <if test="state != null and state != ''">STATE = #{state},</if>
  263. <if test="wtuntStat != null and wtuntStat != ''">WTUNT_STAT = #{wtuntStat},</if>
  264. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  265. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  266. <if test="intm != null">INTM = #{intm},</if>
  267. <if test="uptm != null">UPTM = #{uptm},</if>
  268. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  269. </trim>
  270. <where>ID = #{id}</where>
  271. </update>
  272. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspWtcrrRgstr">
  273. update BIS_INSP_WTCRR_RGSTR
  274. <trim prefix="set" suffixOverrides=",">
  275. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  276. <if test="wtuntId != null and wtuntId != ''">WTUNT_ID = #{wtuntId},</if>
  277. <if test="utName != null and utName != ''">UT_NAME = #{utName},</if>
  278. <if test="utCode != null and utCode != ''">UT_CODE = #{utCode},</if>
  279. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  280. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  281. <if test="utType != null and utType != ''">UT_TYPE = #{utType},</if>
  282. <if test="utPpt != null and utPpt != ''">UT_PPT = #{utPpt},</if>
  283. <if test="utLead != null and utLead != ''">UT_LEAD = #{utLead},</if>
  284. <if test="utAttn != null and utAttn != ''">UT_ATTN = #{utAttn},</if>
  285. <if test="utCont != null and utCont != ''">UT_CONT = #{utCont},</if>
  286. <if test="appDepTm != null and appDepTm != ''">APP_DEP_TM = #{appDepTm},</if>
  287. <if test="appDep != null and appDep != ''">APP_DEP = #{appDep},</if>
  288. <if test="principalTel != null and principalTel != ''">PRINCIPAL_TEL = #{principalTel},</if>
  289. <if test="note != null and note != ''">NOTE = #{note},</if>
  290. <if test="signAddr != null and signAddr != ''">SIGN_ADDR = #{signAddr},</if>
  291. <if test="utAddr != null and utAddr != ''">UT_ADDR = #{utAddr},</if>
  292. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  293. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  294. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  295. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  296. <if test="chkUnit != null and chkUnit != ''">CHK_UNIT = #{chkUnit},</if>
  297. <if test="chkPers != null and chkPers != ''">CHK_PERS = #{chkPers},</if>
  298. <if test="chkTm != null">CHK_TM = #{chkTm},</if>
  299. <if test="state != null and state != ''">STATE = #{state},</if>
  300. <if test="wtuntStat != null and wtuntStat != ''">WTUNT_STAT = #{wtuntStat},</if>
  301. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  302. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  303. <if test="intm != null">INTM = #{intm},</if>
  304. <if test="uptm != null">UPTM = #{uptm},</if>
  305. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  306. </trim>
  307. <include refid="page_where2" />
  308. </update>
  309. <!-- 其他自定义SQL -->
  310. <select id="getListByInspGroupIdObjType" resultType="cn.com.goldenwater.dcproj.model.BisInspWtcrrRgstr"
  311. parameterType="cn.com.goldenwater.dcproj.param.PagePersObjParam">
  312. SELECT
  313. C.id groupId,C.PNM groupName,B.obj_id,
  314. T.WTUNT_ID, T.UT_NAME, T.UT_CODE, T.AD_NAME,
  315. T.AD_CODE, T.UT_TYPE, T.UT_PPT, T.UT_LEAD,
  316. T.UT_ATTN, T.UT_CONT, T.SIGN_ADDR, T.UT_ADDR,
  317. T.CENTER_X, T.CENTER_Y, T.GD_X, T.GD_Y,
  318. T.CHK_UNIT, T.CHK_PERS, T.CHK_TM, T.STATE,
  319. T.WTUNT_STAT, T.PERS_ID, T.GROUP_ID, T.APP_DEP_TM, T.APP_DEP,
  320. T.PRINCIPAL_TEL, T.NOTE, T.INTM, T.UPTM
  321. FROM BIS_INSP_ALL_OBJ B
  322. LEFT JOIN BIS_INSP_WTCRR_RGSTR t ON B.OBJ_ID = t.OBJ_ID
  323. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.ID
  324. where B.ptype = #{objType}
  325. and t.DATA_STAT='0'
  326. <if test='isAll == "0"'>and B.ID = #{inspGroupId}</if>
  327. <if test='isAll == "1"'>and B.ID LIKE '${inspGroupId}%'</if>
  328. <if test="adCode != null and adCode != ''">
  329. and t.AD_CODE like '${adCode}%'
  330. </if>
  331. <if test="rsName != null and rsName != ''">
  332. and t.UT_NAME like '${rsName}%'
  333. </if>
  334. <if test="wtdstState != null and wtdstState != ''">
  335. and t.STATE like #{wtdstState}
  336. </if>
  337. <if test="wtdstType != null and wtdstType != ''">and t.UT_TYPE = #{wtdstType}</if>
  338. <choose>
  339. <when test="province != null and province != ''">
  340. and B.AD_CODE LIKE '${province}%'
  341. </when>
  342. <otherwise>
  343. and B.AD_CODE is null
  344. </otherwise>
  345. </choose>
  346. </select>
  347. <select id="findWtuntPage" resultType="cn.com.goldenwater.dcproj.dto.BisInspWtcrrRgstrDto">
  348. SELECT * FROM (
  349. select
  350. A.CODE,
  351. A.ID nodeId,
  352. A.NM,
  353. #{pType} pType,
  354. A.OBJ_ID,
  355. B.ID ID,
  356. b.id as rgstrId,
  357. aw.id as baseId,
  358. (case when b.STATE is null then '0' else b.state end) STATE,
  359. b.AD_NAME,
  360. b.WTUNT_STAT,
  361. b.PRINCIPAL_TEL, b.NOTE, B.APP_DEP_TM, B.APP_DEP,
  362. b.ut_Type as type,
  363. B.INTM,B.UPTM,
  364. ia.pnm groupName
  365. FROM BIS_INSP_ALL_OBJ A
  366. LEFT JOIN BIS_INSP_WTCRR_RGSTR B ON A.OBJ_ID=B.OBJ_ID
  367. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  368. LEFT JOIN ATT_WTUNT_BASE AW ON B.WTUNT_ID = AW.ID
  369. where A.ptype= #{pType}
  370. and B.DATA_STAT='0'
  371. <if test="adCodes ==null or adCodes ==''">
  372. <choose>
  373. <when test='isAll =="1"'>
  374. </when>
  375. <otherwise>
  376. and
  377. A.Id in (
  378. select distinct w.id from (
  379. SELECT P.id FROM BIS_INSP_ALL P
  380. WHERE FIND_IN_SET(P.id, getSubNodes_bis_insp_all( (SELECT group_concat(A.id) FROM BIS_INSP_ALL_RLATION A
  381. WHERE A.PERSID = #{presId} and A.TYPE = #{pType} and length(A.id) in (3,6,9) group by A.PERSID ),0,0) ) &gt; 0
  382. union all
  383. SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
  384. WHERE A.PERSID =#{presId} and TYPE = #{pType} and length(id)=12 )
  385. )w
  386. )
  387. </otherwise>
  388. </choose>
  389. </if>
  390. <if test="adCodes !=null and adCodes !=''">
  391. and
  392. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  393. b.ad_code like concat('${item}','%')
  394. </foreach>
  395. </if>
  396. ) A WHERE a.PTYPE=#{pType}
  397. <if test="plnaId !=null and plnaId !=''">
  398. and a.nodeId like '${plnaId}%'
  399. </if>
  400. <if test="state !=null and state !=''">
  401. and STATE in (${state})
  402. </if>
  403. <if test="rsName !=null and rsName !=''">
  404. and a.nm like '%${rsName}%'
  405. </if>
  406. <if test="code !=null and code !=''">
  407. and a.code = #{code}
  408. </if>
  409. <if test="adName != null and adName != ''">and a.adName like '%${adName}%'</if>
  410. <if test="sttm != null and sttm != ''">and a.Intm&gt;= STR_TO_DATE(#{sttm},'%Y-%m-%d')</if>
  411. <if test="entm != null and entm != ''">and a.Intm &lt; DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') ,INTERVAL 1 DAY)</if>
  412. <if test="groupId != null and groupId != ''">and a.nodeId = #{groupId}</if>
  413. order by nodeId asc
  414. <if test="orderBy != null and orderBy != ''">
  415. ,CONVERT( nm USING gbk ) COLLATE gbk_chinese_ci ASC
  416. </if>
  417. </select>
  418. </mapper>