IncomeCollectionMapper.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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.IncomeCollectionMapper">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.imed.costaccount.model.IncomeCollection" id="incomeCollectionMap">
  6. <result property="id" column="id"/>
  7. <result property="year" column="year"/>
  8. <result property="month" column="month"/>
  9. <result property="departmentCode" column="department_code"/>
  10. <result property="departmentName" column="department_name"/>
  11. <result property="responsibilityCode" column="responsibility_code"/>
  12. <result property="responsibilityName" column="responsibility_name"/>
  13. <result property="accountingCode" column="accounting_code"/>
  14. <result property="accountingName" column="accounting_name"/>
  15. <result property="productCode" column="product_code"/>
  16. <result property="productName" column="product_name"/>
  17. <result property="isDirectIncome" column="is_direct_income"/>
  18. <result property="amount" column="amount"/>
  19. <result property="fileId" column="file_id"/>
  20. <result property="hospId" column="hosp_id"/>
  21. <result property="createTime" column="create_time"/>
  22. <result property="deleteTime" column="delete_time"/>
  23. </resultMap>
  24. <select id="getCollectList" resultType="com.imed.costaccount.model.vo.CollectedVO">
  25. select * from cost_income_collection
  26. where delete_time = 0 and hosp_id = #{collectDTO.hospId}
  27. <if test="collectDTO.date != null and collectDTO.date != ''">
  28. and `year` = YEAR(concat(#{collectDTO.date},'01')) and `month` = MONTH(concat(#{collectDTO.date},'01'))
  29. </if>
  30. <if test="collectDTO.responsibilityCode != null and collectDTO.responsibilityCode != ''">
  31. and responsibility_code = #{collectDTO.responsibilityCode}
  32. </if>
  33. <if test="collectDTO.productCode != null and collectDTO.productCode != ''">
  34. and product_code = #{collectDTO.productCode}
  35. </if>
  36. limit #{collectDTO.current},#{collectDTO.pageSize};
  37. </select>
  38. <select id="getCollectListCount" resultType="java.lang.Integer">
  39. select count(*) from cost_income_collection
  40. where delete_time = 0 and hosp_id = #{collectDTO.hospId}
  41. <if test="collectDTO.date != null and collectDTO.date != ''">
  42. and `year` = YEAR(concat(#{collectDTO.date},'01')) and `month` = MONTH(concat(#{collectDTO.date},'01'))
  43. </if>
  44. <if test="collectDTO.responsibilityCode != null and collectDTO.responsibilityCode != ''">
  45. and responsibility_code = #{collectDTO.responsibilityCode}
  46. </if>
  47. <if test="collectDTO.productCode != null and collectDTO.productCode != ''">
  48. and product_code = #{collectDTO.productCode}
  49. </if>
  50. </select>
  51. <select id="getTotalAmount" resultType="java.math.BigDecimal">
  52. select IFNULL(sum(amount),0) as totalAmount from cost_income_collection
  53. where delete_time = 0 and hosp_id = #{collectDTO.hospId}
  54. <if test="collectDTO.date != null and collectDTO.date != ''">
  55. and `year` = YEAR(concat(#{collectDTO.date},'01')) and `month` = MONTH(concat(#{collectDTO.date},'01'))
  56. </if>
  57. <if test="collectDTO.responsibilityCode != null and collectDTO.responsibilityCode != ''">
  58. and responsibility_code = #{collectDTO.responsibilityCode}
  59. </if>
  60. <if test="collectDTO.productCode != null and collectDTO.productCode != ''">
  61. and product_code = #{collectDTO.productCode}
  62. </if>
  63. </select>
  64. <select id="getCountByResponseAndAccounts" resultType="java.math.BigDecimal">
  65. select IFNULL(sum(amount), 0) as totalAmount
  66. from cost_income_collection
  67. where delete_time = 0 and hosp_id = #{hospId} and responsibility_code = #{responsibilityCode}
  68. <if test="date != null and date != ''">
  69. and `year` = YEAR(concat(#{date},'01')) and `month` = MONTH(concat(#{date},'01'))
  70. </if>
  71. and accounting_code in
  72. <foreach collection="accountingCodes" item="item" open="(" separator="," close=")">
  73. #{item}
  74. </foreach>
  75. </select>
  76. <select id="getResponsibility" resultType="com.imed.costaccount.model.vo.CodeAndNameVO">
  77. select responsibility_code as code ,responsibility_name as name from cost_income_collection
  78. where delete_time = 0 and hosp_id = #{hospId}
  79. <if test="responsibilityCode != null and responsibilityCode != ''">
  80. and responsibility_code = #{responsibilityCode}
  81. </if>
  82. <if test="date != null and date != ''">
  83. and `year` = YEAR(concat(#{date},'01')) and `month` = MONTH(concat(#{date},'01'))
  84. </if>
  85. </select>
  86. <select id="getAccount" resultType="com.imed.costaccount.model.vo.CodeAndNameVO">
  87. select accounting_code as code ,accounting_name as name from cost_income_collection
  88. where delete_time = 0 and hosp_id = #{hospId}
  89. <if test="date != null and date != ''">
  90. and `year` = YEAR(concat(#{date},'01')) and `month` = MONTH(concat(#{date},'01'))
  91. </if>
  92. </select>
  93. <select id="getCountAccountAndResponsibilities" resultType="java.math.BigDecimal">
  94. select IFNULL(sum(amount), 0) as totalAmount
  95. from cost_income_collection
  96. where delete_time = 0 and hosp_id = #{hospId} and accounting_code = #{code}
  97. <if test="date != null and date != ''">
  98. and `year` = YEAR(concat(#{date},'01')) and `month` = MONTH(concat(#{date},'01'))
  99. </if>
  100. and responsibility_code in
  101. <foreach collection="responsibilityCodes" item="item" open="(" separator="," close=")">
  102. #{item}
  103. </foreach>
  104. </select>
  105. <select id="getCountByResponsibilitiesAndAccounts" resultType="java.math.BigDecimal">
  106. select IFNULL(sum(amount), 0) as totalAmount
  107. from cost_income_collection
  108. where delete_time = 0 and hosp_id = #{hospId} and responsibility_code in
  109. <foreach collection="responsibilityCodes" item="item" open="(" separator="," close=")">
  110. #{item}
  111. </foreach>
  112. <if test="date != null and date != ''">
  113. and `year` = YEAR(concat(#{date},'01')) and `month` = MONTH(concat(#{date},'01'))
  114. </if>
  115. and accounting_code in
  116. <foreach collection="accountingCodes" item="item" open="(" separator="," close=")">
  117. #{item}
  118. </foreach>
  119. </select>
  120. </mapper>