| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <?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.IndexTotalQhDao">
- <select id="getObjPblmData" 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,
- O.OBJ_ID,
- O.OBJ_AD_CODE,
- P.PBLM_ID,
- P.INSP_PBLM_CATE,
- O.OBJ_INTM,
- A.STTM,
- P.COLL_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>
- </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.STTM 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
- JOIN BIS_INSP_ALL_RLATION_PERS P ON P.GUID = R.PERSID
- 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
- WHERE DATA_STAT = '0'
- )
- 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>
- </mapper>
|