IndexTotalQhDao.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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.IndexTotalQhDao">
  4. <select id="getObjPblmData" resultType="java.util.Map">
  5. WITH O AS (
  6. SELECT
  7. SUBSTR( A.ID, 4, 3 ) AS ORG_ID,
  8. SUBSTR( A.ID, 1, 3 ) AS CODE,
  9. AT.NAME AS INSP_NAME,
  10. A.ID,
  11. O.OBJ_ID,
  12. O.OBJ_AD_CODE,
  13. P.PBLM_ID,
  14. P.INSP_PBLM_CATE,
  15. O.OBJ_INTM,
  16. A.STTM,
  17. P.COLL_TIME
  18. FROM
  19. BIS_INSP_ALL A
  20. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  21. <where>
  22. <if test="orgId != null and orgId != '' ">
  23. AND ORG_ID = #{orgId}
  24. </if>
  25. </where>
  26. )) AT ON SUBSTR( A.ID, 0, 3 ) = AT.CODE
  27. LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = A.ID
  28. LEFT JOIN BIS_INSP_PBLM P ON O.OBJ_ID = P.OBJ_ID
  29. )
  30. select * FROM O
  31. <where>
  32. <if test="orgId != null and orgId != '' ">
  33. AND ORG_ID = #{orgId}
  34. </if>
  35. <if test="objType != null and objType != '' ">
  36. AND CODE = #{objType}
  37. </if>
  38. <if test="depm != null and depm.length > 0 ">
  39. AND CODE IN (SELECT PTYPE FROM ATT_INSP_TYPE_DUTY where DUTY_DEP IN
  40. <foreach item="item" index="index" collection="depm" open="(" separator="," close=")">
  41. '${item}'
  42. </foreach>
  43. )
  44. </if>
  45. </where>
  46. </select>
  47. <select id="getPersData" resultType="java.util.Map">
  48. WITH O AS (
  49. SELECT
  50. SUBSTR( A.ID, 4, 3 ) AS ORG_ID,
  51. SUBSTR( A.ID, 1, 3 ) AS CODE,
  52. AT.NAME AS INSP_NAME,
  53. A.ID,
  54. R.PERSID,
  55. O.OBJ_AD_CODE,
  56. A.STTM AS TIME
  57. FROM
  58. BIS_INSP_ALL A
  59. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  60. <where>
  61. <if test="orgId != null and orgId != '' ">
  62. AND ORG_ID = #{orgId}
  63. </if>
  64. </where>
  65. )) AT ON SUBSTR( A.ID, 0, 3 ) = AT.CODE
  66. JOIN BIS_INSP_ALL_RLATION R ON R.ID = A.ID
  67. JOIN BIS_INSP_ALL_RLATION_PERS P ON P.GUID = R.PERSID
  68. LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = A.ID
  69. where LENGTH(A.ID) = 12
  70. )
  71. select * FROM O
  72. <where>
  73. <if test="orgId != null and orgId != '' ">
  74. AND ORG_ID = #{orgId}
  75. </if>
  76. <if test="objType != null and objType != '' ">
  77. AND CODE = #{objType}
  78. </if>
  79. <if test="depm != null and depm.length > 0 ">
  80. AND CODE IN (SELECT PTYPE FROM ATT_INSP_TYPE_DUTY where DUTY_DEP IN
  81. <foreach item="item" index="index" collection="depm" open="(" separator="," close=")">
  82. '${item}'
  83. </foreach>
  84. )
  85. </if>
  86. <if test="sttm != null">
  87. and TIME &gt;= #{sttm}
  88. </if>
  89. <if test="entm != null">
  90. and TIME &lt; #{entm}
  91. </if>
  92. </where>
  93. </select>
  94. <select id="getZgData" resultType="java.util.Map">
  95. WITH O AS (
  96. SELECT
  97. CASE LENGTH(OBJ_TYPE)
  98. when 1 then concat('00', OBJ_TYPE)
  99. when 2 then concat('0', OBJ_TYPE)
  100. ELSE OBJ_TYPE END AS CODE,
  101. OBJ_AD_CODE,
  102. ID,
  103. PBLM_OUT,
  104. INTM AS TIME
  105. FROM BIS_INSP_PBLM_PLIST
  106. WHERE DATA_STAT = '0'
  107. )
  108. select * FROM O
  109. <where>
  110. <if test="adCode != null and adCode != '' ">
  111. AND OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')
  112. </if>
  113. <if test="objType != null and objType != '' ">
  114. AND CODE = #{objType}
  115. </if>
  116. <if test="depm != null and depm.length > 0 ">
  117. AND CODE IN (SELECT PTYPE FROM ATT_INSP_TYPE_DUTY where DUTY_DEP IN
  118. <foreach item="item" index="index" collection="depm" open="(" separator="," close=")">
  119. '${item}'
  120. </foreach>
  121. )
  122. </if>
  123. <if test="sttm != null">
  124. and TIME &gt;= #{sttm}
  125. </if>
  126. <if test="entm != null">
  127. and TIME &lt; #{entm}
  128. </if>
  129. </where>
  130. </select>
  131. </mapper>