| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="cn.com.goldenwater.dcproj.dao.IndexTotalSyDao">
- <select id="getObjPblmData" resultType="java.util.Map">
- WITH O AS (
- SELECT
- ORG_ID,
- INSP_NAME,
- CODE,
- ID,
- OBJ_ID,
- OBJ_AD_CODE,
- PBLM_ID,
- INSP_PBLM_CATE,
- TO_CHAR(TIME, 'YYYY-MM-DD') AS TIME
- FROM(
- SELECT
- SUBSTR( A.ID, 4, 3 ) AS ORG_ID,
- SUBSTR( A.ID, 1, 3 ) AS CODE,
- AT.NAME AS INSP_NAME,
- A.ID,
- O.OBJ_ID,
- O.OBJ_AD_CODE,
- P.PBLM_ID,
- P.INSP_PBLM_CATE,
- CASE
- WHEN O.OBJ_INTM IS NULL THEN
- A.INTM
- WHEN P.COLL_TIME IS NULL THEN
- O.OBJ_INTM ELSE P.COLL_TIME
- END AS TIME
- FROM
- BIS_INSP_ALL A
- JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
- <where>
- <if test="orgId != null and orgId != '' ">
- AND ORG_ID = #{orgId}
- </if>
- </where>
- )) AT ON SUBSTR( A.ID, 0, 3 ) = AT.CODE
- LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = A.ID
- LEFT JOIN BIS_INSP_PBLM P ON O.OBJ_ID = P.OBJ_ID
- )
- )
- select * FROM O
- <where>
- <if test="orgId != null and orgId != '' ">
- AND ORG_ID = #{orgId}
- </if>
- <if test="objType != null and objType != '' ">
- AND CODE = #{objType}
- </if>
- <if test="depm != null and depm.length > 0 ">
- AND CODE IN (SELECT PTYPE FROM ATT_INSP_TYPE_DUTY where DUTY_DEP IN
- <foreach item="item" index="index" collection="depm" open="(" separator="," close=")">
- '${item}'
- </foreach>
- )
- </if>
- <if test="sttm != null">
- and TIME >= #{sttm}
- </if>
- <if test="entm != null">
- and TIME < #{entm}
- </if>
- </where>
- </select>
- <select id="getPersData" resultType="java.util.Map">
- WITH O AS (
- SELECT
- SUBSTR( A.ID, 4, 3 ) AS ORG_ID,
- SUBSTR( A.ID, 1, 3 ) AS CODE,
- AT.NAME AS INSP_NAME,
- A.ID,
- R.PERSID,
- O.OBJ_AD_CODE,
- A.INTM AS TIME
- FROM
- BIS_INSP_ALL A
- JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
- <where>
- <if test="orgId != null and orgId != '' ">
- AND ORG_ID = #{orgId}
- </if>
- </where>
- )) AT ON SUBSTR( A.ID, 0, 3 ) = AT.CODE
- JOIN BIS_INSP_ALL_RLATION R ON R.ID = A.ID
- LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = A.ID
- where LENGTH(A.ID) = 12
- )
- select * FROM O
- <where>
- <if test="orgId != null and orgId != '' ">
- AND ORG_ID = #{orgId}
- </if>
- <if test="objType != null and objType != '' ">
- AND CODE = #{objType}
- </if>
- <if test="depm != null and depm.length > 0 ">
- AND CODE IN (SELECT PTYPE FROM ATT_INSP_TYPE_DUTY where DUTY_DEP IN
- <foreach item="item" index="index" collection="depm" open="(" separator="," close=")">
- '${item}'
- </foreach>
- )
- </if>
- <if test="sttm != null">
- and TIME >= #{sttm}
- </if>
- <if test="entm != null">
- and TIME < #{entm}
- </if>
- </where>
- </select>
- <select id="getZgData" resultType="java.util.Map">
- WITH O AS (
- SELECT
- CASE LENGTH(OBJ_TYPE)
- when 1 then concat('00', OBJ_TYPE)
- when 2 then concat('0', OBJ_TYPE)
- ELSE OBJ_TYPE END AS CODE,
- OBJ_AD_CODE,
- ID,
- PBLM_OUT,
- INTM AS TIME
- FROM BIS_INSP_PBLM_PLIST
- )
- select * FROM O
- <where>
- <if test="adCode != null and adCode != '' ">
- AND OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')
- </if>
- <if test="objType != null and objType != '' ">
- AND CODE = #{objType}
- </if>
- <if test="depm != null and depm.length > 0 ">
- AND CODE IN (SELECT PTYPE FROM ATT_INSP_TYPE_DUTY where DUTY_DEP IN
- <foreach item="item" index="index" collection="depm" open="(" separator="," close=")">
- '${item}'
- </foreach>
- )
- </if>
- <if test="sttm != null">
- and TIME >= #{sttm}
- </if>
- <if test="entm != null">
- and TIME < #{entm}
- </if>
- </where>
- </select>
- <select id="getTopPblm" resultType="cn.com.goldenwater.dcproj.dto.FileDto">
- select * from (
- select A.*,
- B.OBJ_NAME,
- AD.AD_FULL_NAME,
- B.PBLM_DESC_BZ,
- B.INSP_PBLM_CATE
- from gw_com_file A LEFT JOIN bis_insp_pblm B ON A.BIZ_ID=B.pblm_id
- LEFT JOIN BIS_INSP_ALL_OBJ O ON O.OBJ_ID=B.OBJ_ID
- LEFT JOIN ATT_AD_BASE AD ON AD.AD_CODE=O.CODE
- where A.biz_id is not null
- and A.FILE_EXT IN ('jpg','JPG','PNG','png')
- AND B.obj_ad_code like CONCAT(#{currentAdCode}, '%')
- AND B.OBJ_NAME IS NOT NULL
- <if test="pType != null and pType != '' ">
- and B.obj_type=#{pType}
- </if>
- <if test="adCode != null and adCode != '' ">
- and B.obj_ad_code like CONCAT(#{adCode}, '%')
- </if>
- order by create_date desc
- ) WHERE rownum <= 5
- </select>
- <select id="getObj" resultType="cn.com.goldenwater.dcproj.dto.ObjDto">
- select
- O.NM,
- AB.AD_FULL_NAME,
- F.FILE_PATH,
- (SELECT COUNT(PBLM_ID) FROM BIS_INSP_PBLM where OBJ_ID = #{objId} ) AS PBLM_SIZE
- from BIS_INSP_ALL_OBJ O
- LEFT JOIN ATT_AD_BASE AB ON O.OBJ_AD_CODE = AB.AD_CODE
- LEFT JOIN ${tableName} R ON R.OBJ_ID = O.OBJ_ID
- LEFT JOIN GW_COM_FILE F ON R.${idName} = F.ID
- WHERE O.OBJ_ID = #{objId}
- </select>
- <select id="getSkObj" resultType="cn.com.goldenwater.dcproj.dto.ObjDto">
- select
- O.NM,
- AB.AD_FULL_NAME,
- (case to_char(R.ENG_SCAL) when '1' then '大(1)型' when '2' then '大(2)型' when '3' then
- '中型' when '4' then '小(1)型' when '5' then '小(2)型' end ) AS SCAL,
- F.FILE_PATH as face,
- (SELECT COUNT(PBLM_ID) FROM BIS_INSP_PBLM where OBJ_ID = #{objId}) AS PBLM_SIZE
- from BIS_INSP_ALL_OBJ O
- LEFT JOIN ATT_AD_BASE AB ON O.OBJ_AD_CODE = AB.AD_CODE
- LEFT JOIN ${tableName} R ON R.OBJ_ID = O.OBJ_ID
- LEFT JOIN GW_COM_FILE F ON R.${idName} = F.ID
- WHERE O.OBJ_ID = #{objId}
- </select>
- <select id="getEmpwtrunObj" resultType="cn.com.goldenwater.dcproj.dto.ObjDto">
- select
- O.NM,
- AB.AD_FULL_NAME,
- (SELECT COUNT(PBLM_ID) FROM BIS_INSP_PBLM where OBJ_ID = #{objId}) AS PBLM_SIZE
- from BIS_INSP_ALL_OBJ O
- LEFT JOIN ATT_AD_BASE AB ON O.OBJ_AD_CODE = AB.AD_CODE
- WHERE O.OBJ_ID = #{objId}
- </select>
- <select id="getTableName" resultType="String">
- select T.RGSTR_TABLE_NAME
- from BIS_INSP_ALL_OBJ O
- LEFT JOIN ATT_INSP_TYPE T ON O.PTYPE = T.PTYPE
- WHERE OBJ_ID = #{objId}
- </select>
- <select id="getObjPtype" resultType="String">
- select O.PTYPE
- from BIS_INSP_ALL_OBJ O
- WHERE OBJ_ID = #{objId}
- </select>
- </mapper>
|