BisInspSwhsjsDao.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  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.BisInspSwhsjsDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspSwhsjs" id="bisInspSwhsjsResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="swhsCode" column="SWHS_CODE"/>
  8. <result property="swhsName" column="SWHS_NAME"/>
  9. <result property="adCode" column="AD_CODE"/>
  10. <result property="adName" column="AD_NAME"/>
  11. <result property="wainWasoType" column="WAIN_WASO_TYPE"/>
  12. <result property="swhsUse" column="SWHS_USE"/>
  13. <result property="swhsLevel" column="SWHS_LEVEL"/>
  14. <result property="wainLoc" column="WAIN_LOC"/>
  15. <result property="insName" column="INS_NAME"/>
  16. <result property="insPer" column="INS_PER"/>
  17. <result property="insPerPhone" column="INS_PER_PHONE"/>
  18. <result property="dept" column="DEPT"/>
  19. <result property="deptPer" column="DEPT_PER"/>
  20. <result property="deptPerPhone" column="DEPT_PER_PHONE"/>
  21. <result property="centerX" column="CENTER_X"/>
  22. <result property="centerY" column="CENTER_Y"/>
  23. <result property="gdX" column="GD_X"/>
  24. <result property="gdY" column="GD_Y"/>
  25. <result property="persId" column="PERS_ID"/>
  26. <result property="note" column="NOTE"/>
  27. <result property="intm" column="INTM"/>
  28. <result property="uptm" column="UPTM"/>
  29. <result property="dataStat" column="DATA_STAT"/>
  30. <result property="state" column="STATE"/>
  31. <result property="mgtStat" column="MGT_STAT"/>
  32. </resultMap>
  33. <sql id="table_columns">
  34. ID,
  35. OBJ_ID,
  36. SWHS_CODE,
  37. SWHS_NAME,
  38. AD_CODE,
  39. AD_NAME,
  40. WAIN_WASO_TYPE,
  41. SWHS_USE,
  42. SWHS_LEVEL,
  43. WAIN_LOC,
  44. INS_NAME,
  45. INS_PER,
  46. INS_PER_PHONE,
  47. DEPT,
  48. DEPT_PER,
  49. DEPT_PER_PHONE,
  50. CENTER_X,
  51. CENTER_Y,
  52. GD_X,
  53. GD_Y,
  54. PERS_ID,
  55. NOTE,
  56. INTM,
  57. UPTM,
  58. DATA_STAT,
  59. STATE,
  60. MGT_STAT
  61. </sql>
  62. <sql id="entity_properties">
  63. #{id},
  64. #{objId},
  65. #{swhsCode},
  66. #{swhsName},
  67. #{adCode},
  68. #{adName},
  69. #{wainWasoType},
  70. #{swhsUse},
  71. #{swhsLevel},
  72. #{wainLoc},
  73. #{insName},
  74. #{insPer},
  75. #{insPerPhone},
  76. #{dept},
  77. #{deptPer},
  78. #{deptPerPhone},
  79. #{centerX},
  80. #{centerY},
  81. #{gdX},
  82. #{gdY},
  83. #{persId},
  84. #{note},
  85. #{intm},
  86. #{uptm},
  87. #{dataStat},
  88. #{state},
  89. #{mgtStat}
  90. </sql>
  91. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  92. <sql id="page_where">
  93. <trim prefix="where" prefixOverrides="and | or ">
  94. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  95. <if test="swhsCode != null and swhsCode != ''">and SWHS_CODE = #{swhsCode}</if>
  96. <if test="swhsName != null and swhsName != ''">and SWHS_NAME = #{swhsName}</if>
  97. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  98. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  99. <if test="wainWasoType != null and wainWasoType != ''">and WAIN_WASO_TYPE = #{wainWasoType}</if>
  100. <if test="swhsUse != null and swhsUse != ''">and SWHS_USE = #{swhsUse}</if>
  101. <if test="swhsLevel != null and swhsLevel != ''">and SWHS_LEVEL = #{swhsLevel}</if>
  102. <if test="wainLoc != null and wainLoc != ''">and WAIN_LOC = #{wainLoc}</if>
  103. <if test="insName != null and insName != ''">and INS_NAME = #{insName}</if>
  104. <if test="insPer != null and insPer != ''">and INS_PER = #{insPer}</if>
  105. <if test="insPerPhone != null and insPerPhone != ''">and INS_PER_PHONE = #{insPerPhone}</if>
  106. <if test="dept != null and dept != ''">and DEPT = #{dept}</if>
  107. <if test="deptPer != null and deptPer != ''">and DEPT_PER = #{deptPer}</if>
  108. <if test="deptPerPhone != null and deptPerPhone != ''">and DEPT_PER_PHONE = #{deptPerPhone}</if>
  109. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  110. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  111. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  112. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  113. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  114. <if test="note != null and note != ''">and NOTE = #{note}</if>
  115. <if test="intm != null">and INTM = #{intm}</if>
  116. <if test="uptm != null">and UPTM = #{uptm}</if>
  117. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  118. <if test="state != null and state != ''">and STATE = #{state}</if>
  119. <if test="mgtStat != null and mgtStat != ''">and MGT_STAT = #{mgtStat}</if>
  120. and DATA_STAT='0'
  121. </trim>
  122. </sql>
  123. <select id="get" resultMap="bisInspSwhsjsResultMap" parameterType="String">
  124. select
  125. <include refid="table_columns"/>
  126. from BIS_INSP_SWHSJS where ID = #{id}
  127. </select>
  128. <select id="getBy" resultMap="bisInspSwhsjsResultMap">
  129. select
  130. <include refid="table_columns"/>
  131. from BIS_INSP_SWHSJS
  132. <include refid="page_where"/>
  133. </select>
  134. <select id="findAll" resultMap="bisInspSwhsjsResultMap">
  135. select
  136. <include refid="table_columns"/>
  137. from BIS_INSP_SWHSJS
  138. </select>
  139. <select id="findList" resultMap="bisInspSwhsjsResultMap">
  140. select
  141. <include refid="table_columns"/>
  142. from BIS_INSP_SWHSJS
  143. <include refid="page_where"/>
  144. </select>
  145. <select id="selectCount" resultType="int">
  146. select count(ID) from BIS_INSP_SWHSJS
  147. <include refid="page_where"/>
  148. </select>
  149. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspSwhsjs">
  150. insert into BIS_INSP_SWHSJS(
  151. <include refid="table_columns"/>
  152. )
  153. values (
  154. <include refid="entity_properties"/>
  155. )
  156. </insert>
  157. <delete id="delete" parameterType="java.lang.String">
  158. update BIS_INSP_SWHSJS set DATA_STAT='9' where ID = #{id}
  159. </delete>
  160. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspSwhsjs">
  161. update BIS_INSP_SWHSJS set DATA_STAT='9'
  162. <include refid="page_where"/>
  163. </delete>
  164. <update id="deleteInFlag" parameterType="java.lang.String">
  165. update BIS_INSP_SWHSJS set DATA_STAT = '9' where ID = #{id}
  166. </update>
  167. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspSwhsjs">
  168. update BIS_INSP_SWHSJS
  169. <trim prefix="set" suffixOverrides=",">
  170. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  171. <if test="swhsCode != null and swhsCode != ''">SWHS_CODE = #{swhsCode},</if>
  172. <if test="swhsName != null and swhsName != ''">SWHS_NAME = #{swhsName},</if>
  173. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  174. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  175. <if test="wainWasoType != null and wainWasoType != ''">WAIN_WASO_TYPE = #{wainWasoType},</if>
  176. <if test="swhsUse != null and swhsUse != ''">SWHS_USE = #{swhsUse},</if>
  177. <if test="swhsLevel != null and swhsLevel != ''">SWHS_LEVEL = #{swhsLevel},</if>
  178. <if test="wainLoc != null and wainLoc != ''">WAIN_LOC = #{wainLoc},</if>
  179. <if test="insName != null and insName != ''">INS_NAME = #{insName},</if>
  180. <if test="insPer != null and insPer != ''">INS_PER = #{insPer},</if>
  181. <if test="insPerPhone != null and insPerPhone != ''">INS_PER_PHONE = #{insPerPhone},</if>
  182. <if test="dept != null and dept != ''">DEPT = #{dept},</if>
  183. <if test="deptPer != null and deptPer != ''">DEPT_PER = #{deptPer},</if>
  184. <if test="deptPerPhone != null and deptPerPhone != ''">DEPT_PER_PHONE = #{deptPerPhone},</if>
  185. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  186. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  187. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  188. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  189. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  190. <if test="note != null and note != ''">NOTE = #{note},</if>
  191. <if test="intm != null">INTM = #{intm},</if>
  192. <if test="uptm != null">UPTM = #{uptm},</if>
  193. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  194. <if test="state != null and state != ''">STATE = #{state},</if>
  195. <if test="mgtStat != null and mgtStat != ''">MGT_STAT = #{mgtStat},</if>
  196. </trim>
  197. <where>ID = #{id}</where>
  198. </update>
  199. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspSwhsjs">
  200. update BIS_INSP_SWHSJS
  201. <trim prefix="set" suffixOverrides=",">
  202. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  203. <if test="swhsCode != null and swhsCode != ''">SWHS_CODE = #{swhsCode},</if>
  204. <if test="swhsName != null and swhsName != ''">SWHS_NAME = #{swhsName},</if>
  205. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  206. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  207. <if test="wainWasoType != null and wainWasoType != ''">WAIN_WASO_TYPE = #{wainWasoType},</if>
  208. <if test="swhsUse != null and swhsUse != ''">SWHS_USE = #{swhsUse},</if>
  209. <if test="swhsLevel != null and swhsLevel != ''">SWHS_LEVEL = #{swhsLevel},</if>
  210. <if test="wainLoc != null and wainLoc != ''">WAIN_LOC = #{wainLoc},</if>
  211. <if test="insName != null and insName != ''">INS_NAME = #{insName},</if>
  212. <if test="insPer != null and insPer != ''">INS_PER = #{insPer},</if>
  213. <if test="insPerPhone != null and insPerPhone != ''">INS_PER_PHONE = #{insPerPhone},</if>
  214. <if test="dept != null and dept != ''">DEPT = #{dept},</if>
  215. <if test="deptPer != null and deptPer != ''">DEPT_PER = #{deptPer},</if>
  216. <if test="deptPerPhone != null and deptPerPhone != ''">DEPT_PER_PHONE = #{deptPerPhone},</if>
  217. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  218. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  219. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  220. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  221. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  222. <if test="note != null and note != ''">NOTE = #{note},</if>
  223. <if test="intm != null">INTM = #{intm},</if>
  224. <if test="uptm != null">UPTM = #{uptm},</if>
  225. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  226. <if test="state != null and state != ''">STATE = #{state},</if>
  227. <if test="mgtStat != null and mgtStat != ''">MGT_STAT = #{mgtStat},</if>
  228. </trim>
  229. <include refid="page_where"/>
  230. </update>
  231. <!-- 其他自定义SQL -->
  232. <select id="findPageList" resultType="cn.com.goldenwater.dcproj.dto.BisInspSwhsjsDto">
  233. SELECT * FROM (
  234. select
  235. A.CODE, A.ID nodeId, A.NM, A.ptype, ia.pnm groupName,
  236. B.id as rgstrId, AW.AD_FULL_NAME,
  237. B.ID,
  238. B.OBJ_ID,
  239. B.SWHS_CODE,
  240. B.SWHS_NAME,
  241. B.AD_CODE,
  242. B.AD_NAME,
  243. B.WAIN_WASO_TYPE,
  244. B.SWHS_USE,
  245. B.SWHS_LEVEL,
  246. B.WAIN_LOC,
  247. B.INS_NAME,
  248. B.INS_PER,
  249. B.INS_PER_PHONE,
  250. B.DEPT,
  251. B.DEPT_PER,
  252. B.DEPT_PER_PHONE,
  253. B.CENTER_X,
  254. B.CENTER_Y,
  255. B.GD_X,
  256. B.GD_Y,
  257. B.PERS_ID,
  258. B.NOTE,
  259. B.INTM,
  260. B.UPTM,
  261. B.DATA_STAT,
  262. B.STATE,
  263. B.MGT_STAT
  264. FROM BIS_INSP_ALL_OBJ A
  265. JOIN BIS_INSP_SWHSJS B ON A.OBJ_ID=B.OBJ_ID
  266. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  267. LEFT JOIN ATT_AD_BASE AW ON B.AD_CODE = AW.AD_CODE
  268. where A.ptype = #{pType}
  269. and B.DATA_STAT= '0'
  270. <if test="adCodes ==null or adCodes ==''">
  271. <choose>
  272. <when test='isAll =="1"'>
  273. </when>
  274. <otherwise>
  275. and
  276. A.Id in (
  277. select distinct w.id from (
  278. SELECT P.id FROM BIS_INSP_ALL P
  279. WHERE FIND_IN_SET(P.id, getSubNodes_bis_insp_all( (SELECT group_concat(A.id) FROM BIS_INSP_ALL_RLATION A
  280. WHERE A.PERSID = #{presId} and A.TYPE = #{pType} and length(A.id) in (3,6,9) group by A.PERSID ),0,0) ) &gt; 0
  281. union all
  282. SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
  283. WHERE A.PERSID =#{presId} and TYPE = #{pType} and length(id)=12 )
  284. ) w
  285. )
  286. </otherwise>
  287. </choose>
  288. </if>
  289. <if test="adCodes !=null and adCodes !=''">
  290. and
  291. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  292. b.ad_code like concat('${item}','%')
  293. </foreach>
  294. </if>
  295. ) A
  296. <where>
  297. <if test="id !=null and id !=''">and nodeId like '${id}%'</if>
  298. <if test="plnaId !=null and plnaId !=''">and nodeId like '${plnaId}%'</if>
  299. <if test="groupId != null and groupId != ''">and nodeId like '${groupId}%'</if>
  300. <if test="code !=null and code !=''">and code = #{code}</if>
  301. <if test="nm !=null and nm !=''">and nm like '%${nm}%'</if>
  302. <if test="rsName !=null and rsName !=''">and nm like '%${rsName}%'</if>
  303. <if test="state !=null and state !=''">and STATE in (${state})</if>
  304. <if test="adName != null and adName != ''">and AD_NAME like '%${adName}%'</if>
  305. <if test="sttm != null and sttm != ''">and INTM &gt;= STR_TO_DATE(#{sttm},'%Y-%m-%d')</if>
  306. <if test="entm != null and entm != ''">and INTM &lt; DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') ,INTERVAL 1 DAY)</if>
  307. </where>
  308. order by nodeId asc
  309. <if test="orderBy != null and orderBy != ''">
  310. ,CONVERT( nm USING gbk ) COLLATE gbk_chinese_ci ASC
  311. </if>
  312. </select>
  313. </mapper>