| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- <?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,
- CASE a.insp_pblm_cate
- when 0 then '一般'
- when 1 then '较严重'
- when 2 then '严重'
- ELSE '特别严重' END AS 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 STR_TO_DATE(DATE_FORMAT(k.coll_time, '%Y-%m-%d'), '%Y-%m-%d')
- between STR_TO_DATE(substr(#{sttime}, 1, 10), '%Y-%m-%d') and STR_TO_DATE(substr(#{ettime}, 1, 10), '%Y-%m-%d')
- </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,
- CASE a.insp_pblm_cate
- when 0 then '一般'
- when 1 then '较严重'
- when 2 then '严重'
- ELSE '特别严重' END AS 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 STR_TO_DATE(DATE_FORMAT(k.coll_time, '%Y-%m-%d'), '%Y-%m-%d')
- between STR_TO_DATE(substr(#{sttime}, 1, 10), '%Y-%m-%d') and STR_TO_DATE(substr(#{ettime}, 1, 10), '%Y-%m-%d')
- </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,
- CASE a.insp_pblm_cate
- when 0 then '一般'
- when 1 then '较严重'
- when 2 then '严重'
- ELSE '特别严重' END AS 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 STR_TO_DATE(DATE_FORMAT(k.coll_time, '%Y-%m-%d'), '%Y-%m-%d')
- between STR_TO_DATE(substr(#{sttime}, 1, 10), '%Y-%m-%d') and STR_TO_DATE(substr(#{ettime}, 1, 10), '%Y-%m-%d')
- </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,concat('第',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 > str_to_date(date_format(now(), '%Y0101'), '%Y%m%d')
- group by substr(id,9,1),m.ptype,n.name
- order by pc
- </select>
- </mapper>
|