RotateProgressMapper.xml 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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="com.unis.cbl.server.dao.irpt.RotateProgressDao">
  4. <resultMap id="tableHeadMap" type="java.util.Map">
  5. <result property="dictCode" column="dict_code"/>
  6. <result property="dictName" column="dict_name"/>
  7. <result property="orderBy" column="order_by"/>
  8. </resultMap>
  9. <select id="listTableHead" resultMap="tableHeadMap">
  10. select parent_dict.dict_code,
  11. parent_dict.order_by,
  12. parent_dict.dict_name
  13. from ty_jhhz t1
  14. inner join usercenter.sys_dictionary dict on dict.dict_code = t1.lcpzbm and dict.group_id = 'PM001'
  15. left join usercenter.sys_dictionary parent_dict on parent_dict.dict_code = dict.pdict_code and parent_dict.group_id = 'PM001'
  16. where t1.jhnd = #{currentYear} and t1.ph_status = '1'
  17. group by parent_dict.dict_code, parent_dict.dict_name, parent_dict.order_by
  18. </select>
  19. <resultMap id="tableBodyDataMap" type="com.unis.cbl.common.entity.RotateProgressDetail">
  20. <result property="name" column="name"/>
  21. <result property="code" column="code"/>
  22. <result property="businessType" column="business_type"/>
  23. <result property="dictCode" column="dict_code"/>
  24. <result property="amount" column="amount"/>
  25. <result property="orderBy" column="order_by"/>
  26. </resultMap>
  27. <select id="listTableBodyData" resultMap="tableBodyDataMap">
  28. select
  29. sskddm code, t5.qymc name, ywlx business_type,
  30. t3.order_by,
  31. dict_code, cast(amount as decimal(17,3)) amount
  32. from (
  33. select
  34. sskddm, ywlx,
  35. dict_code, if(phhds is not null, phhds, lcds) amount
  36. from (
  37. select
  38. case when t1.sskddm = '911202245661145255001' then '91120224712876078R001'
  39. else t1.sskddm
  40. end as sskddm, t1.ywlx,
  41. parent_dict.dict_code,
  42. sum(t1.lcds) as lcds, sum(t1.phhds) as phhds
  43. from ty_jhhz t1
  44. inner join usercenter.sys_dictionary dict on dict.dict_code = t1.lcpzbm and dict.group_id = 'PM001'
  45. left join usercenter.sys_dictionary parent_dict on parent_dict.dict_code = dict.pdict_code and dict.group_id = 'PM001'
  46. where t1.jhnd = #{currentYear, jdbcType=VARCHAR} and t1.lcds is not null and t1.ph_status = '1'
  47. group by t1.ywlx, parent_dict.dict_code, parent_dict.dict_name, t1.sskddm
  48. )
  49. union all
  50. select
  51. sskddm, 41 as ywlx,
  52. parent_dict.dict_code,
  53. cast(sum(ifnull(lsyqsl, 0)) as decimal(17,3)) amount
  54. from db_utf8.ty_lhtzd t1
  55. inner join usercenter.sys_dictionary dict on dict.dict_name = t1.pzmc and dict.group_id = 'PM001'
  56. left join usercenter.sys_dictionary parent_dict on parent_dict.dict_code = dict.pdict_code and parent_dict.group_id = 'PM001'
  57. where DATE_FORMAT(ckqx, '%Y-%m') = #{month, jdbcType=VARCHAR} and zt = '91000004' and status = 1 and tzdlx = '01' and ywlx= '4'
  58. group by ywlx, tzdlx,parent_dict.dict_code, parent_dict.dict_name, sskddm
  59. union all
  60. select
  61. sskd, 21 as ywlx,
  62. parent_dict.dict_code,
  63. cast(sum(ifnull(rksl, 0)) as decimal(17,3)) amount
  64. from db_utf8.ty_crkyszb t1
  65. inner join usercenter.sys_dictionary dict on dict.dict_code = t1.lspzbm and dict.group_id = 'PM001'
  66. left join usercenter.sys_dictionary parent_dict on parent_dict.dict_code = dict.pdict_code and dict.group_id = 'PM001'
  67. where DATE_FORMAT(zgjlspsj, '%Y-%m') = #{month, jdbcType=VARCHAR} and status = 1 and shzt = '91000900' and yslx = '1'
  68. group by yslx,parent_dict.dict_code, sskd
  69. ) t2
  70. left join base.d_kdxxsjy t4 on t4.kddm = t2.sskddm
  71. left join base.tz_slqy t5 on t5.tyshxydm = t4.tyshxydm
  72. left join usercenter.sys_orgainze t3 on t3.org_code = t5.qyjgdm
  73. order by t3.order_by
  74. </select>
  75. </mapper>