AttGnrlBaseDao.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  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.AttGnrlBaseDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttGnrlBase" id="attGnrlBaseResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="nm" column="NM"/>
  7. <result property="adCode" column="AD_CODE"/>
  8. <result property="adName" column="AD_NAME"/>
  9. <result property="loc" column="LOC"/>
  10. <result property="note" column="NOTE"/>
  11. <result property="centerX" column="CENTER_X"/>
  12. <result property="centerY" column="CENTER_Y"/>
  13. <result property="gdX" column="GD_X"/>
  14. <result property="gdY" column="GD_Y"/>
  15. <result property="intm" column="INTM"/>
  16. <result property="uptm" column="UPTM"/>
  17. <result property="dataStat" column="DATA_STAT"/>
  18. <result property="objType" column="OBJ_TYPE"/>
  19. <result property="sectName" column="SECT_NAME"/>
  20. </resultMap>
  21. <sql id="table_columns">
  22. ID,
  23. NM,
  24. AD_CODE,
  25. AD_NAME,
  26. LOC,
  27. NOTE,
  28. CENTER_X,
  29. CENTER_Y,
  30. GD_X,
  31. GD_Y,
  32. INTM,
  33. UPTM,
  34. DATA_STAT,
  35. OBJ_TYPE,
  36. SECT_NAME
  37. </sql>
  38. <sql id="entity_properties">
  39. #{id},
  40. #{nm},
  41. #{adCode},
  42. #{adName},
  43. #{loc},
  44. #{note},
  45. #{centerX},
  46. #{centerY},
  47. #{gdX},
  48. #{gdY},
  49. #{intm},
  50. #{uptm},
  51. #{dataStat},
  52. #{objType},
  53. #{sectName}
  54. </sql>
  55. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  56. <sql id="page_where">
  57. <trim prefix="where" prefixOverrides="and | or ">
  58. <if test="objType != null and objType != ''">
  59. and OBJ_TYPE = #{objType}
  60. </if>
  61. <if test="nm != null and nm != ''">
  62. and NM = #{nm}
  63. </if>
  64. <if test="adCode != null and adCode != ''">
  65. and AD_CODE = #{adCode}
  66. </if>
  67. <if test="adName != null and adName != ''">
  68. and AD_NAME = #{adName}
  69. </if>
  70. <if test="loc != null and loc != ''">
  71. and LOC = #{loc}
  72. </if>
  73. <if test="note != null and note != ''">
  74. and NOTE = #{note}
  75. </if>
  76. <if test="centerX != null and centerX != ''">
  77. and CENTER_X = #{centerX}
  78. </if>
  79. <if test="centerY != null and centerY != ''">
  80. and CENTER_Y = #{centerY}
  81. </if>
  82. <if test="gdX != null and gdX != ''">
  83. and GD_X = #{gdX}
  84. </if>
  85. <if test="gdY != null and gdY != ''">
  86. and GD_Y = #{gdY}
  87. </if>
  88. <if test="intm != null">
  89. and INTM = #{intm}
  90. </if>
  91. <if test="uptm != null">
  92. and UPTM = #{uptm}
  93. </if>
  94. <if test="dataStat != null and dataStat != ''">
  95. and DATA_STAT = #{dataStat}
  96. </if>
  97. and DATA_STAT='0'
  98. </trim>
  99. </sql>
  100. <select id="get" resultMap="attGnrlBaseResultMap" parameterType="String">
  101. select
  102. <include refid="table_columns"/>
  103. from ATT_GNRL_BASE where ID = #{id}
  104. </select>
  105. <select id="getBy" resultMap="attGnrlBaseResultMap">
  106. select
  107. <include refid="table_columns"/>
  108. from ATT_GNRL_BASE
  109. <include refid="page_where"/>
  110. </select>
  111. <select id="findAll" resultMap="attGnrlBaseResultMap">
  112. select
  113. <include refid="table_columns"/>
  114. from ATT_GNRL_BASE
  115. </select>
  116. <select id="findList" resultMap="attGnrlBaseResultMap">
  117. select
  118. <include refid="table_columns"/>
  119. from ATT_GNRL_BASE
  120. <include refid="page_where"/>
  121. </select>
  122. <select id="selectCount" resultType="int">
  123. select count(ID) from ATT_GNRL_BASE
  124. <include refid="page_where"/>
  125. </select>
  126. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttGnrlBase">
  127. insert into ATT_GNRL_BASE(
  128. <include refid="table_columns"/>
  129. )
  130. values (
  131. <include refid="entity_properties"/>
  132. )
  133. </insert>
  134. <delete id="delete" parameterType="java.lang.String">
  135. update ATT_GNRL_BASE set DATA_STAT='9' where ID = #{id}
  136. </delete>
  137. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttGnrlBase">
  138. update ATT_GNRL_BASE set DATA_STAT='9'
  139. <include refid="page_where"/>
  140. </delete>
  141. <update id="deleteInFlag" parameterType="java.lang.String">
  142. update ATT_GNRL_BASE set DATA_STAT = '9' where ID = #{id}
  143. </update>
  144. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttGnrlBase">
  145. update ATT_GNRL_BASE
  146. <trim prefix="set" suffixOverrides=",">
  147. <if test="nm != null and nm != ''">NM
  148. = #{nm},
  149. </if>
  150. <if test="adCode != null and adCode != ''">AD_CODE
  151. = #{adCode},
  152. </if>
  153. <if test="adName != null and adName != ''">AD_NAME
  154. = #{adName},
  155. </if>
  156. <if test="loc != null and loc != ''">LOC
  157. = #{loc},
  158. </if>
  159. <if test="note != null and note != ''">NOTE
  160. = #{note},
  161. </if>
  162. <if test="centerX != null and centerX != ''">CENTER_X
  163. = #{centerX},
  164. </if>
  165. <if test="centerY != null and centerY != ''">CENTER_Y
  166. = #{centerY},
  167. </if>
  168. <if test="gdX != null and gdX != ''">GD_X
  169. = #{gdX},
  170. </if>
  171. <if test="gdY != null and gdY != ''">GD_Y
  172. = #{gdY},
  173. </if>
  174. <if test="intm != null">INTM
  175. = #{intm},
  176. </if>
  177. <if test="uptm != null">UPTM
  178. = #{uptm},
  179. </if>
  180. <if test="dataStat != null and dataStat != ''">DATA_STAT
  181. = #{dataStat},
  182. </if>
  183. <if test="objType != null and objType != ''">
  184. OBJ_TYPE = #{objType},
  185. </if>
  186. </trim>
  187. <where>ID = #{id}</where>
  188. </update>
  189. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttGnrlBase">
  190. update ATT_GNRL_BASE
  191. <trim prefix="set" suffixOverrides=",">
  192. <if test="nm != null and nm != ''">NM
  193. = #{nm},
  194. </if>
  195. <if test="adCode != null and adCode != ''">AD_CODE
  196. = #{adCode},
  197. </if>
  198. <if test="adName != null and adName != ''">AD_NAME
  199. = #{adName},
  200. </if>
  201. <if test="loc != null and loc != ''">LOC
  202. = #{loc},
  203. </if>
  204. <if test="note != null and note != ''">NOTE
  205. = #{note},
  206. </if>
  207. <if test="centerX != null and centerX != ''">CENTER_X
  208. = #{centerX},
  209. </if>
  210. <if test="centerY != null and centerY != ''">CENTER_Y
  211. = #{centerY},
  212. </if>
  213. <if test="gdX != null and gdX != ''">GD_X
  214. = #{gdX},
  215. </if>
  216. <if test="gdY != null and gdY != ''">GD_Y
  217. = #{gdY},
  218. </if>
  219. <if test="intm != null">INTM
  220. = #{intm},
  221. </if>
  222. <if test="uptm != null">UPTM
  223. = #{uptm},
  224. </if>
  225. <if test="dataStat != null and dataStat != ''">DATA_STAT
  226. = #{dataStat},
  227. </if>
  228. <if test="objType != null and objType != ''">
  229. OBJ_TYPE = #{objType},
  230. </if>
  231. </trim>
  232. <include refid="page_where"/>
  233. </update>
  234. <!-- 其他自定义SQL -->
  235. <select id="getgetzichaDesc" resultType="cn.com.goldenwater.dcproj.vo.JxMapVo" >
  236. SELECT
  237. P.PBLM_NAME_BZ as DICT_TYPE,
  238. count(*) as total
  239. FROM BIS_INSP_PBLM P
  240. LEFT JOIN BIS_INSP_ALL_RLATION_PERS R ON R.GUID = P.REC_PERS
  241. LEFT JOIN BIS_INSP_ALL_OBJ BIAO ON BIAO.OBJ_ID = P.OBJ_ID
  242. LEFT JOIN ATT_GNRL_BASE AGB ON AGB.ID = BIAO.CODE
  243. LEFT JOIN GW_COM_DICT_TYPE GCDT ON GCDT.DICT_TYPE_CD = AGB.OBJ_TYPE
  244. WHERE 1=1
  245. AGB.OWNER_OFC = 'other'
  246. AND P.DATA_STAT IN ('1','2')
  247. AND AGB.AD_CODE like '${adCode}%'
  248. AND GCDT.DICT_TYPE_CD = ${ptype}
  249. group by P.PBLM_NAME_BZ
  250. </select>
  251. <select id="getgetzichaTotal" resultType="cn.com.goldenwater.dcproj.vo.JxEcharTotal">
  252. SELECT
  253. SUBSTR( A.AD_CODE, 0, 4 ) AS city_code,
  254. A.AD_NAME,
  255. nvl( E.TOTAL, 0 ) AS "TOTAL1",
  256. SUM( CASE C.STATE WHEN '1' THEN 1 WHEN '2' THEN 1 ELSE 0 END ) AS TOTAL2,
  257. SUM( CASE C.STATE WHEN '2' THEN 1 ELSE 0 END ) AS TOTAL3
  258. FROM
  259. ATT_AD_BASE A
  260. LEFT JOIN (
  261. SELECT
  262. city_code,
  263. count( * ) AS total
  264. FROM
  265. ( SELECT SUBSTR( AD_CODE, 0, 4 ) AS city_code FROM ATT_GNRL_BASE WHERE data_stat = '0' and OBJ_TYPE = ${ptype}
  266. ) B
  267. GROUP BY
  268. B.city_code
  269. ) E ON SUBSTR( A.AD_CODE, 0, 4 ) = E.city_code
  270. LEFT JOIN (
  271. SELECT
  272. SUBSTR( A.AD_CODE, 0, 4 ) AS city_code,
  273. R.STATE
  274. FROM
  275. ATT_GNRL_BASE A
  276. LEFT JOIN BIS_INSP_ALL_OBJ O ON A.ID = O.CODE
  277. LEFT JOIN BIS_INSP_GNRL_RGSTR R ON R.OBJ_ID = O.OBJ_ID
  278. WHERE
  279. O.PTYPE = '111'
  280. AND O.ID NOT LIKE '111015%'
  281. AND O.ID IN ( SELECT ID FROM BIS_INSP_ALL WHERE CHK_TYPE = '1' )
  282. AND A.OBJ_TYPE = ${ptype}
  283. ) C ON SUBSTR( A.AD_CODE, 0, 4 ) = C.city_code
  284. WHERE
  285. A.ad_grad = '2'
  286. AND A.AD_CODE LIKE '36%'
  287. OR A.AD_CODE = '369000000000'
  288. GROUP BY
  289. A.AD_CODE,
  290. A.AD_NAME,
  291. nvl( E.TOTAL, 0 )
  292. </select>
  293. </mapper>