AchievementStatisticsDao.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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.AchievementStatisticsDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.dto.AchievementStatisticsDto" id="achStaResultMap">
  5. <result property="objNmae" column="obj_name"/>
  6. <result property="baseNmae" column="base_name"/>
  7. <result property="adCode" column="ad_code"/>
  8. <result property="adName" column="ad_name"/>
  9. <result property="pblmNameBz" column="pblm_name_bz"/>
  10. <result property="checkPointBz" column="check_point_bz"/>
  11. <result property="pblmDescBz" column="pblm_desc_bz"/>
  12. <result property="inspPblmDesc" column="insp_pblm_desc"/>
  13. <result property="cate" column="cate"/>
  14. <result property="persName" column="pers_name"/>
  15. <result property="collTime" column="coll_time"/>
  16. <result property="pc" column="pc"/>
  17. <result property="ptype" column="ptype"/>
  18. <result property="num" column="num"/>
  19. </resultMap>
  20. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  21. <select id="getQuestionInfoByObjtypeTimetype" resultMap="achStaResultMap" parameterType="cn.com.goldenwater.dcproj.param.AchievementStatisticsParam" >
  22. select b.name obj_name,b.nm base_name,b.obj_ad_code ad_code,b.ad_name,
  23. a.pblm_name_bz,a.check_point_bz,a.pblm_desc_bz,a.insp_pblm_desc,
  24. decode(a.insp_pblm_cate,0,'一般',1,'较严重',2,'严重','特别严重') cate,
  25. a.pers_name,a.coll_time from
  26. (select k.*,m.pers_name from BIS_INSP_PBLM k left join Bis_Insp_All_Rlation_Pers m on k.rec_pers = m.guid
  27. where k.obj_type=#{objType}
  28. and m.org_id=#{orgId}
  29. <if test="sttime != null and sttime != '' and ettime != null and ettime != '' ">
  30. and to_date(to_CHAR(k.coll_time, 'yyyy-MM-dd'), 'yyyy-MM-dd')
  31. between to_date(substr(#{sttime}, 0, 10), 'yyyy-MM-dd') and to_date(substr(#{ettime}, 0, 10), 'yyyy-MM-dd')
  32. </if>
  33. ) a
  34. left join
  35. (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
  36. on s.obj_ad_code=x.ad_code) b
  37. on a.obj_id=b.obj_id
  38. order by b.ad_code
  39. </select>
  40. <select id="getQuestionInfoByObjtypeTimetypeCate" resultMap="achStaResultMap" parameterType="cn.com.goldenwater.dcproj.param.AchievementStatisticsParam" >
  41. select b.name obj_name,b.nm base_name,b.obj_ad_code ad_code,b.ad_name,
  42. a.pblm_name_bz,a.check_point_bz,a.pblm_desc_bz,a.insp_pblm_desc,
  43. decode(a.insp_pblm_cate,0,'一般',1,'较严重',2,'严重','特别严重') cate,
  44. a.pers_name,a.coll_time from
  45. (select k.*,m.pers_name from BIS_INSP_PBLM k left join Bis_Insp_All_Rlation_Pers m on k.rec_pers = m.guid
  46. where
  47. 1=1
  48. <if test="objType != null and objType != ''">
  49. and k.obj_type=#{objType}
  50. </if>
  51. <if test="cate != null and cate != ''">
  52. and k.insp_pblm_cate=#{cate}
  53. </if>
  54. and m.org_id=#{orgId}
  55. <if test="sttime != null and sttime != '' and ettime != null and ettime != '' ">
  56. and to_date(to_CHAR(k.coll_time, 'yyyy-MM-dd'), 'yyyy-MM-dd')
  57. between to_date(substr(#{sttime}, 0, 10), 'yyyy-MM-dd') and to_date(substr(#{ettime}, 0, 10), 'yyyy-MM-dd')
  58. </if>
  59. ) a
  60. left join
  61. (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
  62. on s.obj_ad_code=x.ad_code) b
  63. on a.obj_id=b.obj_id
  64. order by b.ad_code
  65. </select>
  66. <select id="getQuestionInfoByObjtypeTimetypeAdcode" resultMap="achStaResultMap" parameterType="cn.com.goldenwater.dcproj.param.AchievementStatisticsParam" >
  67. select b.name obj_name,b.nm base_name,b.obj_ad_code ad_code,b.ad_name,
  68. a.pblm_name_bz,a.check_point_bz,a.pblm_desc_bz,a.insp_pblm_desc,
  69. decode(a.insp_pblm_cate,0,'一般',1,'较严重',2,'严重','特别严重') cate,
  70. a.pers_name,a.coll_time from
  71. (select k.*,m.pers_name from BIS_INSP_PBLM k left join Bis_Insp_All_Rlation_Pers m on k.rec_pers = m.guid
  72. where
  73. 1=1
  74. <if test="objType != null and objType != ''">
  75. and k.obj_type=#{objType}
  76. </if>
  77. <if test="cate != null and cate != ''">
  78. and k.insp_pblm_cate=#{cate}
  79. </if>
  80. and m.org_id=#{orgId}
  81. <if test="sttime != null and sttime != '' and ettime != null and ettime != '' ">
  82. and to_date(to_CHAR(k.coll_time, 'yyyy-MM-dd'), 'yyyy-MM-dd')
  83. between to_date(substr(#{sttime}, 0, 10), 'yyyy-MM-dd') and to_date(substr(#{ettime}, 0, 10), 'yyyy-MM-dd')
  84. </if>
  85. ) a
  86. left join
  87. (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
  88. on s.obj_ad_code=x.ad_code) b
  89. on a.obj_id=b.obj_id
  90. where b.obj_ad_code like concat(#{adcode},'%')
  91. order by b.ad_code
  92. </select>
  93. <!-- 其他自定义SQL -->
  94. <select id="getObjNum" resultMap="achStaResultMap" parameterType="String">
  95. select m.ptype,n.name obj_name,count(*) num,'第'||substr(id,9,1)||'批次' pc
  96. from bis_insp_all_obj m
  97. join att_insp_type n on m.ptype=n.ptype
  98. where
  99. org_id=#{orgId}
  100. and obj_intm > trunc(sysdate,'yyyy')
  101. group by substr(id,9,1),m.ptype,n.name
  102. order by pc
  103. </select>
  104. </mapper>