BisInspWiuRgstrDao.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  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.BisInspWiuRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspWiuRgstr" id="bisInspWiuRgstrResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="wiuId" column="WIU_ID"/>
  8. <result property="wiuName" column="WIU_NAME"/>
  9. <result property="adName" column="AD_NAME"/>
  10. <result property="adCode" column="AD_CODE"/>
  11. <result property="wiuLoc" column="WIU_LOC"/>
  12. <result property="wiuLong" column="WIU_LONG"/>
  13. <result property="wiuLat" column="WIU_LAT"/>
  14. <result property="gdX" column="GD_X"/>
  15. <result property="gdY" column="GD_Y"/>
  16. <result property="watLicCode" column="WAT_LIC_CODE"/>
  17. <result property="wiuContact" column="WIU_CONTACT"/>
  18. <result property="wiuContactTel" column="WIU_CONTACT_TEL"/>
  19. <result property="apprContact" column="APPR_CONTACT"/>
  20. <result property="apprContactTel" column="APPR_CONTACT_TEL"/>
  21. <result property="note" column="NOTE"/>
  22. <result property="state" column="STATE"/>
  23. <result property="dataStat" column="DATA_STAT"/>
  24. <result property="intInfoStat" column="INT_INFO_STAT"/>
  25. <result property="apprInfoStat" column="APPR_INFO_STAT"/>
  26. <result property="persId" column="PERS_ID"/>
  27. <result property="groupId" column="GROUP_ID"/>
  28. <result property="inTm" column="IN_TM"/>
  29. <result property="upTm" column="UP_TM"/>
  30. <result property="apprUnit" column="APPR_UNIT"/>
  31. <result property="province" column="PROVINCE"/>
  32. </resultMap>
  33. <sql id="table_columns">
  34. ID,
  35. OBJ_ID,
  36. WIU_ID,
  37. WIU_NAME,
  38. AD_NAME,
  39. AD_CODE,
  40. WIU_LOC,
  41. WIU_LONG,
  42. WIU_LAT,
  43. GD_X,
  44. GD_Y,
  45. WAT_LIC_CODE,
  46. WIU_CONTACT,
  47. WIU_CONTACT_TEL,
  48. APPR_CONTACT,
  49. APPR_CONTACT_TEL,
  50. NOTE,
  51. STATE,
  52. DATA_STAT,
  53. INT_INFO_STAT,
  54. APPR_INFO_STAT,
  55. PERS_ID,
  56. GROUP_ID,
  57. IN_TM,
  58. UP_TM,
  59. APPR_UNIT,PROVINCE
  60. </sql>
  61. <sql id="entity_properties">
  62. #{id},
  63. #{objId},
  64. #{wiuId},
  65. #{wiuName},
  66. #{adName},
  67. #{adCode},
  68. #{wiuLoc},
  69. #{wiuLong},
  70. #{wiuLat},
  71. #{gdX},
  72. #{gdY},
  73. #{watLicCode},
  74. #{wiuContact},
  75. #{wiuContactTel},
  76. #{apprContact},
  77. #{apprContactTel},
  78. #{note},
  79. #{state},
  80. #{dataStat},
  81. #{intInfoStat},
  82. #{apprInfoStat},
  83. #{persId},
  84. #{groupId},
  85. #{inTm},
  86. #{upTm},
  87. #{apprUnit},#{province}
  88. </sql>
  89. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  90. <sql id="page_where">
  91. <trim prefix="where" prefixOverrides="and | or ">
  92. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  93. <choose>
  94. <when test="province !=null and province !=''">
  95. and province =#{provicne}
  96. </when>
  97. <otherwise>
  98. and province is null
  99. </otherwise>
  100. </choose>
  101. <if test="wiuId != null and wiuId != ''">and WIU_ID = #{wiuId}</if>
  102. <if test="wiuName != null and wiuName != ''">and WIU_NAME = #{wiuName}</if>
  103. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  104. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  105. <if test="wiuLoc != null and wiuLoc != ''">and WIU_LOC = #{wiuLoc}</if>
  106. <if test="wiuLong != null and wiuLong != ''">and WIU_LONG = #{wiuLong}</if>
  107. <if test="wiuLat != null and wiuLat != ''">and WIU_LAT = #{wiuLat}</if>
  108. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  109. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  110. <if test="watLicCode != null and watLicCode != ''">and WAT_LIC_CODE = #{watLicCode}</if>
  111. <if test="wiuContact != null and wiuContact != ''">and WIU_CONTACT = #{wiuContact}</if>
  112. <if test="wiuContactTel != null and wiuContactTel != ''">and WIU_CONTACT_TEL = #{wiuContactTel}</if>
  113. <if test="apprContact != null and apprContact != ''">and APPR_CONTACT = #{apprContact}</if>
  114. <if test="apprContactTel != null and apprContactTel != ''">and APPR_CONTACT_TEL = #{apprContactTel}</if>
  115. <if test="note != null and note != ''">and NOTE = #{note}</if>
  116. <if test="state != null and state != ''">and STATE = #{state}</if>
  117. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  118. <if test="intInfoStat != null and intInfoStat != ''">and INT_INFO_STAT = #{intInfoStat}</if>
  119. <if test="apprInfoStat != null and apprInfoStat != ''">and APPR_INFO_STAT = #{apprInfoStat}</if>
  120. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  121. <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
  122. <if test="inTm != null">and IN_TM = #{inTm}</if>
  123. <if test="upTm != null">and UP_TM = #{upTm}</if>
  124. <if test="apprUnit != null and apprUnit != ''">and APPR_UNIT = #{apprUnit}</if>
  125. </trim>
  126. </sql>
  127. <select id="get" resultMap="bisInspWiuRgstrResultMap" parameterType="String" >
  128. select <include refid="table_columns" /> from BIS_INSP_WIU_RGSTR where ID = #{id}
  129. </select>
  130. <select id="getBy" resultMap="bisInspWiuRgstrResultMap">
  131. select <include refid="table_columns" /> from BIS_INSP_WIU_RGSTR <include refid="page_where" />
  132. </select>
  133. <select id="findAll" resultMap="bisInspWiuRgstrResultMap">
  134. select <include refid="table_columns" /> from BIS_INSP_WIU_RGSTR
  135. </select>
  136. <select id="findList" resultMap="bisInspWiuRgstrResultMap">
  137. select <include refid="table_columns" /> from BIS_INSP_WIU_RGSTR <include refid="page_where" />
  138. </select>
  139. <select id="selectCount" resultType="int" >
  140. select count(ID) from BIS_INSP_WIU_RGSTR <include refid="page_where" />
  141. </select>
  142. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspWiuRgstr">
  143. insert into BIS_INSP_WIU_RGSTR( <include refid="table_columns" /> )
  144. values ( <include refid="entity_properties" /> )
  145. </insert>
  146. <delete id="delete" parameterType="java.lang.String">
  147. delete from BIS_INSP_WIU_RGSTR where ID = #{id}
  148. </delete>
  149. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspWiuRgstr">
  150. delete from BIS_INSP_WIU_RGSTR <include refid="page_where" />
  151. </delete>
  152. <update id="deleteInFlag" parameterType="java.lang.String">
  153. update BIS_INSP_WIU_RGSTR set flag_valid = 0 where ID = #{id}
  154. </update>
  155. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspWiuRgstr">
  156. update BIS_INSP_WIU_RGSTR
  157. <trim prefix="set" suffixOverrides=",">
  158. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  159. <if test="province != null and province != ''"> PROVINCE = #{province},</if>
  160. <if test="wiuId != null and wiuId != ''">WIU_ID = #{wiuId},</if>
  161. <if test="wiuName != null and wiuName != ''">WIU_NAME = #{wiuName},</if>
  162. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  163. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  164. <if test="wiuLoc != null and wiuLoc != ''">WIU_LOC = #{wiuLoc},</if>
  165. <if test="wiuLong != null and wiuLong != ''">WIU_LONG = #{wiuLong},</if>
  166. <if test="wiuLat != null and wiuLat != ''">WIU_LAT = #{wiuLat},</if>
  167. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  168. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  169. <if test="watLicCode != null and watLicCode != ''">WAT_LIC_CODE = #{watLicCode},</if>
  170. <if test="wiuContact != null and wiuContact != ''">WIU_CONTACT = #{wiuContact},</if>
  171. <if test="wiuContactTel != null and wiuContactTel != ''">WIU_CONTACT_TEL = #{wiuContactTel},</if>
  172. <if test="apprContact != null and apprContact != ''">APPR_CONTACT = #{apprContact},</if>
  173. <if test="apprContactTel != null and apprContactTel != ''">APPR_CONTACT_TEL = #{apprContactTel},</if>
  174. <if test="note != null and note != ''">NOTE = #{note},</if>
  175. <if test="state != null and state != ''">STATE = #{state},</if>
  176. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  177. <if test="intInfoStat != null and intInfoStat != ''">INT_INFO_STAT = #{intInfoStat},</if>
  178. <if test="apprInfoStat != null and apprInfoStat != ''">APPR_INFO_STAT = #{apprInfoStat},</if>
  179. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  180. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  181. <if test="inTm != null">IN_TM = #{inTm},</if>
  182. <if test="upTm != null">UP_TM = #{upTm},</if>
  183. <if test="apprUnit != null and apprUnit != ''">APPR_UNIT = #{apprUnit},</if>
  184. </trim>
  185. <where>ID = #{id}</where>
  186. </update>
  187. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspWiuRgstr">
  188. update BIS_INSP_WIU_RGSTR
  189. <trim prefix="set" suffixOverrides=",">
  190. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  191. <if test="province != null and province != ''"> PROVINCE = #{province},</if>
  192. <if test="wiuId != null and wiuId != ''">WIU_ID = #{wiuId},</if>
  193. <if test="wiuName != null and wiuName != ''">WIU_NAME = #{wiuName},</if>
  194. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  195. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  196. <if test="wiuLoc != null and wiuLoc != ''">WIU_LOC = #{wiuLoc},</if>
  197. <if test="wiuLong != null and wiuLong != ''">WIU_LONG = #{wiuLong},</if>
  198. <if test="wiuLat != null and wiuLat != ''">WIU_LAT = #{wiuLat},</if>
  199. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  200. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  201. <if test="watLicCode != null and watLicCode != ''">WAT_LIC_CODE = #{watLicCode},</if>
  202. <if test="wiuContact != null and wiuContact != ''">WIU_CONTACT = #{wiuContact},</if>
  203. <if test="wiuContactTel != null and wiuContactTel != ''">WIU_CONTACT_TEL = #{wiuContactTel},</if>
  204. <if test="apprContact != null and apprContact != ''">APPR_CONTACT = #{apprContact},</if>
  205. <if test="apprContactTel != null and apprContactTel != ''">APPR_CONTACT_TEL = #{apprContactTel},</if>
  206. <if test="note != null and note != ''">NOTE = #{note},</if>
  207. <if test="state != null and state != ''">STATE = #{state},</if>
  208. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  209. <if test="intInfoStat != null and intInfoStat != ''">INT_INFO_STAT = #{intInfoStat},</if>
  210. <if test="apprInfoStat != null and apprInfoStat != ''">APPR_INFO_STAT = #{apprInfoStat},</if>
  211. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  212. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  213. <if test="inTm != null">IN_TM = #{inTm},</if>
  214. <if test="upTm != null">UP_TM = #{upTm},</if>
  215. <if test="apprUnit != null and apprUnit != ''">APPR_UNIT = #{apprUnit},</if>
  216. </trim>
  217. <include refid="page_where" />
  218. </update>
  219. <sql id="choseSql">
  220. <choose>
  221. <when test="province !=null and province !=''">
  222. and B.province like '${province}%'
  223. </when>
  224. <otherwise>
  225. and B.province is null
  226. </otherwise>
  227. </choose>
  228. </sql>
  229. <select id="getListByInspGroupIdObjType" parameterType="cn.com.goldenwater.dcproj.param.PagePersObjParam"
  230. resultType="cn.com.goldenwater.dcproj.dto.BisInspWiuRgstrDto">
  231. select t.*,C.id groupId,C.PNM groupName,B.obj_id,r.wiu_loc
  232. from att_wiu_base t
  233. left join BIS_INSP_ALL_OBJ B
  234. on B.CODE = t.ID
  235. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.ID
  236. and B.ptype = #{objType}
  237. left join BIS_INSP_WIU_RGSTR r on B.obj_id=r.obj_id
  238. where 1 = 1
  239. <if test='isAll == "0"'>and B.ID = #{inspGroupId}</if>
  240. <if test='isAll == "1"'>and B.ID LIKE '${inspGroupId}%'</if>
  241. <if test="adCode != null and adCode != ''">
  242. and t.AD_CODE like '${adCode}%'
  243. </if>
  244. <choose>
  245. <when test="province != null and province != ''">
  246. and B.AD_CODE LIKE '${province}%'
  247. </when>
  248. <otherwise>
  249. and B.AD_CODE is null
  250. </otherwise>
  251. </choose>
  252. </select>
  253. <sql id="orgIdSql">
  254. <choose>
  255. <when test="orgId !=null and orgId !=''">
  256. and ORG_ID=#{orgId}
  257. </when>
  258. <otherwise>
  259. and ORG_ID is null
  260. </otherwise>
  261. </choose>
  262. </sql>
  263. <!-- 其他自定义SQL -->
  264. <select id="findWiuList" resultType="cn.com.goldenwater.dcproj.dto.BisInspRgstrDto" parameterType="cn.com.goldenwater.dcproj.param.TypeParam">
  265. SELECT * FROM (
  266. select A.CODE,A.ID nodeId,
  267. A.NM,
  268. #{pType} PTYPE,
  269. B.WIU_LONG as centerX,
  270. B.WIU_LAT as centerY,
  271. B.GD_X as lgtd,
  272. B.GD_Y as lttd,
  273. B.GD_X,
  274. B.GD_y,
  275. A.OBJ_ID,B.ID ID,B.ID AS RGSTRID,
  276. b.WIU_LOC as location,
  277. (case when b.State is null then '0' else b.state end)STATE
  278. ,B.IN_TM,
  279. x.ad_full_name as adName,
  280. ia.pnm groupName,
  281. B.INT_INFO_STAT,
  282. B.APPR_INFO_STAT,c.wint_code as wintCode
  283. from BIS_INSP_ALL_OBJ
  284. A LEFT JOIN BIS_INSP_WIU_RGSTR B ON A.OBJ_ID=B.OBJ_ID
  285. LEFT JOIN ATT_WIU_BASE C ON A.CODE=C.ID
  286. left JOin ATT_AD_X_BASE x on B.ad_code = x.ad_code
  287. LEFT JOIN BIS_INSP_ALL ia on A.ID = ia.id
  288. where A.ptype= #{pType}
  289. <if test="tabType =='2'.toString()">
  290. and ia.entm &lt; DATE_FORMAT(#{nowTime},'%Y-%m-%d')
  291. </if>
  292. <if test="tabType =='1'.toString()">
  293. and ia.entm &gt;= DATE_FORMAT(#{nowTime},'%Y-%m-%d')
  294. </if>
  295. <if test="inIdsSql != null and inIdsSql != '' ">
  296. and A.id in (${inIdsSql})
  297. </if>
  298. ) A WHERE a.PTYPE=#{pType}
  299. <if test="adName != null and adName != ''">
  300. and a.adName like '%${adName}%'
  301. </if>
  302. <if test="plnaId !=null and plnaId !=''">
  303. and a.nodeId like '${plnaId}%'
  304. </if>
  305. <if test="groupId != null and groupId != ''">
  306. AND a.nodeId like '${groupId}%'
  307. </if>
  308. <if test="state !=null and state !=''">
  309. and STATE=#{state}
  310. </if>
  311. <if test="rsName !=null and rsName !=''">
  312. and a.nm like '%${rsName}%'
  313. </if>
  314. <if test="code !=null and code !=''">
  315. and a.code = #{code}
  316. </if>
  317. <if test="sttm != null and sttm != ''">and a.IN_TM&gt;= DATE_FORMAT(#{sttm},'%Y-%m-%d')</if>
  318. <if test="entm != null and entm != ''">and a.IN_TM &lt;= DATE_FORMAT(#{entm},'%Y-%m-%d')</if>
  319. order by nodeId asc
  320. <if test="orderBy != null and orderBy != ''">
  321. ,CONVERT( nm USING gbk ) COLLATE gbk_chinese_ci ASC
  322. </if>
  323. </select>
  324. </mapper>