AllocationMapper.xml 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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.imed.costaccount.mapper.AllocationMapper">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.imed.costaccount.model.Allocation" id="allocationMap">
  6. <result property="id" column="id"/>
  7. <result property="dateYear" column="date_year"/>
  8. <result property="dateMonth" column="date_month"/>
  9. <result property="levelSort" column="level_sort"/>
  10. <result property="levelName" column="level_name"/>
  11. <result property="hospId" column="hosp_id"/>
  12. <result property="responsibilityCode" column="responsibility_code"/>
  13. <result property="responsibilityName" column="responsibility_name"/>
  14. <result property="accountShareId" column="account_share_id"/>
  15. <result property="amount" column="amount"/>
  16. <result property="targetResponsibilityCode" column="target_responsibility_code"/>
  17. <result property="targetResponsibilityName" column="target_responsibility_name"/>
  18. <result property="shareParamCode" column="share_param_code"/>
  19. <result property="shareParamName" column="share_param_name"/>
  20. <result property="totalAmount" column="total_amount"/>
  21. <result property="shareParamValueNum" column="share_param_value_num"/>
  22. <result property="shareParamRate" column="share_param_rate"/>
  23. <result property="isBaseCost" column="is_base_cost"/>
  24. <result property="levelSort" column="level_sort"/>
  25. <result property="levelName" column="level_name"/>
  26. <result property="shareLevelId" column="share_level_id"/>
  27. <result property="targetShareLevelId" column="target_share_level_id"/>
  28. <result property="createTime" column="create_time"/>
  29. <result property="deleteTime" column="delete_time"/>
  30. </resultMap>
  31. <select id="queryAfterAllocationList" resultType="com.imed.costaccount.model.vo.AfterAllocationVO">
  32. select id as id , date_year as dateYear,date_month as dateMonth, level_sort as levelSort, level_name as
  33. levelName,
  34. target_responsibility_code as responsibilityCode, target_responsibility_name as responsibilityName,
  35. accounting_code as accountingCode, accounting_name as accountingName,
  36. sum(amount) as amount from cost_allocation_query where delete_time = 0 and hosp_id = #{hospId}
  37. <if test="dateYear != null">
  38. and date_year = #{dateYear} and date_month = #{dateMonth}
  39. </if>
  40. <if test="responsibilityCode != null and responsibilityCode != ''">
  41. and responsibility_code = #{responsibilityCode}
  42. </if>
  43. group by accounting_code , target_responsibility_code ,share_level_id
  44. limit #{startIndex},#{pageSize}
  45. </select>
  46. <select id="queryAfterAllocationListCount" resultType="java.lang.Integer">
  47. select count(*) from
  48. (select id from cost_allocation_query where delete_time = 0 and hosp_id = #{hospId}
  49. <if test="dateYear != null">
  50. and date_year = #{dateYear} and date_month = #{dateMonth}
  51. </if>
  52. <if test="responsibilityCode != null and responsibilityCode != ''">
  53. and responsibility_code = #{responsibilityCode}
  54. </if>
  55. group by accounting_code, target_responsibility_code,share_level_id)t
  56. </select>
  57. <select id="queryAfterAllocationListSum" resultType="java.math.BigDecimal">
  58. select sum(amount) from cost_allocation_query where delete_time = 0 and hosp_id = #{hospId}
  59. <if test="dateYear != null">
  60. and date_year = #{dateYear} and date_month = #{dateMonth}
  61. </if>
  62. <if test="responsibilityCode != null and responsibilityCode != ''">
  63. and responsibility_code = #{responsibilityCode}
  64. </if>
  65. </select>
  66. <select id="getAllSortLevel" resultType="com.imed.costaccount.model.Allocation">
  67. select distinct date_year,
  68. date_month,
  69. level_sort,
  70. share_param_code,
  71. share_param_name,
  72. create_time,
  73. id,
  74. share_level_id
  75. from cost_allocation
  76. where date_year = #{year}
  77. and date_month = #{month}
  78. and hosp_id = #{hospId}
  79. group by share_level_id
  80. </select>
  81. </mapper>