AttGnrlBaseDao.xml 9.9 KB

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