IndexTotalSyDao.xml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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.IndexTotalSyDao">
  4. <select id="getObjPblmData" resultType="java.util.Map">
  5. WITH O AS (
  6. SELECT
  7. ORG_ID,
  8. INSP_NAME,
  9. CODE,
  10. ID,
  11. OBJ_ID,
  12. OBJ_AD_CODE,
  13. PBLM_ID,
  14. INSP_PBLM_CATE,
  15. DATE_FORMAT(TIME, '%Y-%m-%d') AS TIME
  16. FROM(
  17. SELECT
  18. SUBSTR( A.ID, 4, 3 ) AS ORG_ID,
  19. SUBSTR( A.ID, 1, 3 ) AS CODE,
  20. AT.NAME AS INSP_NAME,
  21. A.ID,
  22. O.OBJ_ID,
  23. O.OBJ_AD_CODE,
  24. P.PBLM_ID,
  25. P.INSP_PBLM_CATE,
  26. CASE
  27. WHEN O.OBJ_INTM IS NULL THEN
  28. A.INTM
  29. WHEN P.COLL_TIME IS NULL THEN
  30. O.OBJ_INTM ELSE P.COLL_TIME
  31. END AS TIME
  32. FROM
  33. BIS_INSP_ALL A
  34. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  35. <where>
  36. <if test="orgId != null and orgId != '' ">
  37. AND ORG_ID = #{orgId}
  38. </if>
  39. </where>
  40. )) AT ON SUBSTR( A.ID, 0, 3 ) = AT.CODE
  41. LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = A.ID
  42. LEFT JOIN BIS_INSP_PBLM P ON O.OBJ_ID = P.OBJ_ID
  43. )
  44. )
  45. select * FROM O
  46. <where>
  47. <if test="orgId != null and orgId != '' ">
  48. AND ORG_ID = #{orgId}
  49. </if>
  50. <if test="objType != null and objType != '' ">
  51. AND CODE = #{objType}
  52. </if>
  53. <if test="depm != null and depm.length > 0 ">
  54. AND CODE IN (SELECT PTYPE FROM ATT_INSP_TYPE_DUTY where DUTY_DEP IN
  55. <foreach item="item" index="index" collection="depm" open="(" separator="," close=")">
  56. '${item}'
  57. </foreach>
  58. )
  59. </if>
  60. <if test="sttm != null">
  61. and TIME &gt;= #{sttm}
  62. </if>
  63. <if test="entm != null">
  64. and TIME &lt; #{entm}
  65. </if>
  66. </where>
  67. </select>
  68. <select id="getPersData" resultType="java.util.Map">
  69. WITH O AS (
  70. SELECT
  71. SUBSTR( A.ID, 4, 3 ) AS ORG_ID,
  72. SUBSTR( A.ID, 1, 3 ) AS CODE,
  73. AT.NAME AS INSP_NAME,
  74. A.ID,
  75. R.PERSID,
  76. O.OBJ_AD_CODE,
  77. A.INTM AS TIME
  78. FROM
  79. BIS_INSP_ALL A
  80. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  81. <where>
  82. <if test="orgId != null and orgId != '' ">
  83. AND ORG_ID = #{orgId}
  84. </if>
  85. </where>
  86. )) AT ON SUBSTR( A.ID, 0, 3 ) = AT.CODE
  87. JOIN BIS_INSP_ALL_RLATION R ON R.ID = A.ID
  88. LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = A.ID
  89. where LENGTH(A.ID) = 12
  90. )
  91. select * FROM O
  92. <where>
  93. <if test="orgId != null and orgId != '' ">
  94. AND ORG_ID = #{orgId}
  95. </if>
  96. <if test="objType != null and objType != '' ">
  97. AND CODE = #{objType}
  98. </if>
  99. <if test="depm != null and depm.length > 0 ">
  100. AND CODE IN (SELECT PTYPE FROM ATT_INSP_TYPE_DUTY where DUTY_DEP IN
  101. <foreach item="item" index="index" collection="depm" open="(" separator="," close=")">
  102. '${item}'
  103. </foreach>
  104. )
  105. </if>
  106. <if test="sttm != null">
  107. and TIME &gt;= #{sttm}
  108. </if>
  109. <if test="entm != null">
  110. and TIME &lt; #{entm}
  111. </if>
  112. </where>
  113. </select>
  114. <select id="getZgData" resultType="java.util.Map">
  115. WITH O AS (
  116. SELECT
  117. CASE LENGTH(OBJ_TYPE)
  118. when 1 then concat('00', OBJ_TYPE)
  119. when 2 then concat('0', OBJ_TYPE)
  120. ELSE OBJ_TYPE END AS CODE,
  121. OBJ_AD_CODE,
  122. ID,
  123. PBLM_OUT,
  124. INTM AS TIME
  125. FROM BIS_INSP_PBLM_PLIST
  126. )
  127. select * FROM O
  128. <where>
  129. <if test="adCode != null and adCode != '' ">
  130. AND OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')
  131. </if>
  132. <if test="objType != null and objType != '' ">
  133. AND CODE = #{objType}
  134. </if>
  135. <if test="depm != null and depm.length > 0 ">
  136. AND CODE IN (SELECT PTYPE FROM ATT_INSP_TYPE_DUTY where DUTY_DEP IN
  137. <foreach item="item" index="index" collection="depm" open="(" separator="," close=")">
  138. '${item}'
  139. </foreach>
  140. )
  141. </if>
  142. <if test="sttm != null">
  143. and TIME &gt;= #{sttm}
  144. </if>
  145. <if test="entm != null">
  146. and TIME &lt; #{entm}
  147. </if>
  148. </where>
  149. </select>
  150. <select id="getTopPblm" resultType="cn.com.goldenwater.dcproj.dto.FileDto">
  151. select w.* from (
  152. select A.*,
  153. B.OBJ_NAME,
  154. AD.AD_FULL_NAME,
  155. B.PBLM_DESC_BZ,
  156. B.INSP_PBLM_CATE
  157. from gw_com_file A LEFT JOIN bis_insp_pblm B ON A.BIZ_ID=B.pblm_id
  158. LEFT JOIN BIS_INSP_ALL_OBJ O ON O.OBJ_ID=B.OBJ_ID
  159. LEFT JOIN ATT_AD_BASE AD ON AD.AD_CODE=O.CODE
  160. where A.biz_id is not null
  161. and A.FILE_EXT IN ('jpg','JPG','PNG','png')
  162. AND B.obj_ad_code like CONCAT(#{currentAdCode}, '%')
  163. AND B.OBJ_NAME IS NOT NULL
  164. <if test="pType != null and pType != '' ">
  165. and B.obj_type=#{pType}
  166. </if>
  167. <if test="adCode != null and adCode != '' ">
  168. and B.obj_ad_code like CONCAT(#{adCode}, '%')
  169. </if>
  170. order by create_date desc
  171. )w limit 5
  172. </select>
  173. <select id="getObj" resultType="cn.com.goldenwater.dcproj.dto.ObjDto">
  174. select
  175. O.NM,
  176. AB.AD_FULL_NAME,
  177. F.FILE_PATH,
  178. (SELECT COUNT(PBLM_ID) FROM BIS_INSP_PBLM where OBJ_ID = #{objId} ) AS PBLM_SIZE
  179. from BIS_INSP_ALL_OBJ O
  180. LEFT JOIN ATT_AD_BASE AB ON O.OBJ_AD_CODE = AB.AD_CODE
  181. LEFT JOIN ${tableName} R ON R.OBJ_ID = O.OBJ_ID
  182. LEFT JOIN GW_COM_FILE F ON R.${idName} = F.ID
  183. WHERE O.OBJ_ID = #{objId}
  184. </select>
  185. <select id="getSkObj" resultType="cn.com.goldenwater.dcproj.dto.ObjDto">
  186. select
  187. O.NM,
  188. AB.AD_FULL_NAME,
  189. (case cast(R.ENG_SCAL as char ) when '1' then '大(1)型' when '2' then '大(2)型' when '3' then
  190. '中型' when '4' then '小(1)型' when '5' then '小(2)型' end ) AS SCAL,
  191. F.FILE_PATH as face,
  192. (SELECT COUNT(PBLM_ID) FROM BIS_INSP_PBLM where OBJ_ID = #{objId}) AS PBLM_SIZE
  193. from BIS_INSP_ALL_OBJ O
  194. LEFT JOIN ATT_AD_BASE AB ON O.OBJ_AD_CODE = AB.AD_CODE
  195. LEFT JOIN ${tableName} R ON R.OBJ_ID = O.OBJ_ID
  196. LEFT JOIN GW_COM_FILE F ON R.${idName} = F.ID
  197. WHERE O.OBJ_ID = #{objId}
  198. </select>
  199. <select id="getEmpwtrunObj" resultType="cn.com.goldenwater.dcproj.dto.ObjDto">
  200. select
  201. O.NM,
  202. AB.AD_FULL_NAME,
  203. (SELECT COUNT(PBLM_ID) FROM BIS_INSP_PBLM where OBJ_ID = #{objId}) AS PBLM_SIZE
  204. from BIS_INSP_ALL_OBJ O
  205. LEFT JOIN ATT_AD_BASE AB ON O.OBJ_AD_CODE = AB.AD_CODE
  206. WHERE O.OBJ_ID = #{objId}
  207. </select>
  208. <select id="getTableName" resultType="String">
  209. select T.RGSTR_TABLE_NAME
  210. from BIS_INSP_ALL_OBJ O
  211. LEFT JOIN ATT_INSP_TYPE T ON O.PTYPE = T.PTYPE
  212. WHERE OBJ_ID = #{objId}
  213. </select>
  214. <select id="getObjPtype" resultType="String">
  215. select O.PTYPE
  216. from BIS_INSP_ALL_OBJ O
  217. WHERE OBJ_ID = #{objId}
  218. </select>
  219. </mapper>