2
0

AllocationQueryMapper.xml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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.AllocationQueryMapper">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.imed.costaccount.model.AllocationQuery" id="allocationQueryMap">
  6. <result property="id" column="id"/>
  7. <result property="dateYear" column="date_year"/>
  8. <result property="dateMonth" column="date_month"/>
  9. <result property="hospId" column="hosp_id"/>
  10. <result property="responsibilityCode" column="responsibility_code"/>
  11. <result property="responsibilityName" column="responsibility_name"/>
  12. <result property="originId" column="origin_id"/>
  13. <result property="originType" column="origin_type"/>
  14. <result property="amount" column="amount"/>
  15. <result property="accountingCode" column="accounting_code"/>
  16. <result property="accountingName" column="accounting_name"/>
  17. <result property="createTime" column="create_time"/>
  18. <result property="deleteTime" column="delete_time"/>
  19. </resultMap>
  20. <select id="getTotalMoney" resultType="java.math.BigDecimal">
  21. select sum(amount)
  22. from cost_allocation_query
  23. where date_year = #{dateYear}
  24. and date_month = #{month}
  25. and hosp_id = #{hospId}
  26. </select>
  27. <select id="getRespCodeAndName" resultType="com.imed.costaccount.model.vo.CodeAndNameVO">
  28. select responsibility_code as code, responsibility_name as name
  29. from cost_allocation_query
  30. where date_year = #{dateYear}
  31. and date_month = #{month}
  32. and hosp_id = #{hospId}
  33. </select>
  34. <select id="getAccountCodeAndName" resultType="com.imed.costaccount.model.vo.CodeAndNameVO">
  35. select accounting_code as code, accounting_name as name
  36. from cost_allocation_query
  37. where date_year = #{dateYear}
  38. and date_month = #{month}
  39. and hosp_id = #{hospId}
  40. </select>
  41. <select id="getCountByRespAndAccounts" resultType="java.math.BigDecimal">
  42. select IFNULL(sum(amount), 0)
  43. from cost_allocation_query
  44. where date_year = #{dateYear}
  45. and date_month = #{month}
  46. and hosp_id = #{hospId}
  47. and responsibility_code = #{code}
  48. and accounting_code in
  49. <foreach collection="accountCodes" item="item" open="(" separator="," close=")">
  50. #{item}
  51. </foreach>
  52. </select>
  53. <select id="getTotalByAccountAndResps" resultType="java.math.BigDecimal">
  54. select IFNULL(sum(amount), 0)
  55. from cost_allocation_query
  56. where date_year = #{dateYear}
  57. and date_month = #{month}
  58. and hosp_id = #{hospId}
  59. and accounting_code = #{code}
  60. and responsibility_code in
  61. <foreach collection="respCodes" item="item" open="(" separator="," close=")">
  62. #{item}
  63. </foreach>
  64. </select>
  65. <select id="getTotalByAccountAndRespCode" resultType="java.math.BigDecimal">
  66. select IFNULL(sum(amount), 0)
  67. from cost_allocation_query
  68. where date_year = #{dateYear}
  69. and date_month = #{month}
  70. and hosp_id = #{hospId}
  71. and accounting_code = #{accountCode}
  72. and responsibility_code = #{responsibilityCode}
  73. </select>
  74. </mapper>