| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <?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.AchievementStatisticsDao">
- <resultMap type="cn.com.goldenwater.dcproj.dto.AchievementStatisticsDto" id="achStaResultMap">
- <result property="objNmae" column="obj_name"/>
- <result property="baseNmae" column="base_name"/>
- <result property="adCode" column="ad_code"/>
- <result property="adName" column="ad_name"/>
- <result property="pblmNameBz" column="pblm_name_bz"/>
- <result property="checkPointBz" column="check_point_bz"/>
- <result property="pblmDescBz" column="pblm_desc_bz"/>
- <result property="inspPblmDesc" column="insp_pblm_desc"/>
- <result property="cate" column="cate"/>
- <result property="persName" column="pers_name"/>
- <result property="collTime" column="coll_time"/>
- <result property="pc" column="pc"/>
- <result property="ptype" column="ptype"/>
- <result property="num" column="num"/>
- </resultMap>
-
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <select id="getQuestionInfoByObjtypeTimetype" resultMap="achStaResultMap" parameterType="cn.com.goldenwater.dcproj.param.AchievementStatisticsParam" >
- select b.name obj_name,b.nm base_name,b.obj_ad_code ad_code,b.ad_name,
- a.pblm_name_bz,a.check_point_bz,a.pblm_desc_bz,a.insp_pblm_desc,
- decode(a.insp_pblm_cate,0,'一般',1,'较严重',2,'严重','特别严重') cate,
- a.pers_name,a.coll_time from
- (select k.*,m.pers_name from BIS_INSP_PBLM k left join Bis_Insp_All_Rlation_Pers m on k.rec_pers = m.guid
- where k.obj_type=#{objType}
- and m.org_id=#{orgId}
- <if test="sttime != null and sttime != '' and ettime != null and ettime != '' ">
- and to_date(to_CHAR(k.coll_time, 'yyyy-MM-dd'), 'yyyy-MM-dd')
- between to_date(substr(#{sttime}, 0, 10), 'yyyy-MM-dd') and to_date(substr(#{ettime}, 0, 10), 'yyyy-MM-dd')
- </if>
- ) a
- left join
- (select s.*,q.name,x.ad_name from bis_insp_all_obj s left join att_insp_type q on s.ptype=q.ptype left join att_ad_x_base x
- on s.obj_ad_code=x.ad_code) b
- on a.obj_id=b.obj_id
- order by b.ad_code
- </select>
- <select id="getQuestionInfoByObjtypeTimetypeCate" resultMap="achStaResultMap" parameterType="cn.com.goldenwater.dcproj.param.AchievementStatisticsParam" >
- select b.name obj_name,b.nm base_name,b.obj_ad_code ad_code,b.ad_name,
- a.pblm_name_bz,a.check_point_bz,a.pblm_desc_bz,a.insp_pblm_desc,
- decode(a.insp_pblm_cate,0,'一般',1,'较严重',2,'严重','特别严重') cate,
- a.pers_name,a.coll_time from
- (select k.*,m.pers_name from BIS_INSP_PBLM k left join Bis_Insp_All_Rlation_Pers m on k.rec_pers = m.guid
- where
- 1=1
- <if test="objType != null and objType != ''">
- and k.obj_type=#{objType}
- </if>
- <if test="cate != null and cate != ''">
- and k.insp_pblm_cate=#{cate}
- </if>
- and m.org_id=#{orgId}
- <if test="sttime != null and sttime != '' and ettime != null and ettime != '' ">
- and to_date(to_CHAR(k.coll_time, 'yyyy-MM-dd'), 'yyyy-MM-dd')
- between to_date(substr(#{sttime}, 0, 10), 'yyyy-MM-dd') and to_date(substr(#{ettime}, 0, 10), 'yyyy-MM-dd')
- </if>
- ) a
- left join
- (select s.*,q.name,x.ad_name from bis_insp_all_obj s left join att_insp_type q on s.ptype=q.ptype left join att_ad_x_base x
- on s.obj_ad_code=x.ad_code) b
- on a.obj_id=b.obj_id
- order by b.ad_code
- </select>
- <select id="getQuestionInfoByObjtypeTimetypeAdcode" resultMap="achStaResultMap" parameterType="cn.com.goldenwater.dcproj.param.AchievementStatisticsParam" >
- select b.name obj_name,b.nm base_name,b.obj_ad_code ad_code,b.ad_name,
- a.pblm_name_bz,a.check_point_bz,a.pblm_desc_bz,a.insp_pblm_desc,
- decode(a.insp_pblm_cate,0,'一般',1,'较严重',2,'严重','特别严重') cate,
- a.pers_name,a.coll_time from
- (select k.*,m.pers_name from BIS_INSP_PBLM k left join Bis_Insp_All_Rlation_Pers m on k.rec_pers = m.guid
- where
- 1=1
- <if test="objType != null and objType != ''">
- and k.obj_type=#{objType}
- </if>
- <if test="cate != null and cate != ''">
- and k.insp_pblm_cate=#{cate}
- </if>
- and m.org_id=#{orgId}
- <if test="sttime != null and sttime != '' and ettime != null and ettime != '' ">
- and to_date(to_CHAR(k.coll_time, 'yyyy-MM-dd'), 'yyyy-MM-dd')
- between to_date(substr(#{sttime}, 0, 10), 'yyyy-MM-dd') and to_date(substr(#{ettime}, 0, 10), 'yyyy-MM-dd')
- </if>
- ) a
- left join
- (select s.*,q.name,x.ad_name from bis_insp_all_obj s left join att_insp_type q on s.ptype=q.ptype left join att_ad_x_base x
- on s.obj_ad_code=x.ad_code) b
- on a.obj_id=b.obj_id
- where b.obj_ad_code like concat(#{adcode},'%')
- order by b.ad_code
- </select>
- <!-- 其他自定义SQL -->
- <select id="getObjNum" resultMap="achStaResultMap" parameterType="String">
- select m.ptype,n.name obj_name,count(*) num,'第'||substr(id,9,1)||'批次' pc
- from bis_insp_all_obj m
- join att_insp_type n on m.ptype=n.ptype
- where
- org_id=#{orgId}
- and obj_intm > trunc(sysdate,'yyyy')
- group by substr(id,9,1),m.ptype,n.name
- order by pc
- </select>
- </mapper>
|