TopDivideLogMapper.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.zhongzheng.modules.top.financial.mapper.TopDivideLogMapper">
  6. <resultMap type="com.zhongzheng.modules.top.financial.domain.TopDivideLog" id="TopDivideLogResult">
  7. <result property="id" column="id"/>
  8. <result property="year" column="year"/>
  9. <result property="month" column="month"/>
  10. <result property="payMoney" column="pay_money"/>
  11. <result property="sellerId" column="seller_id"/>
  12. <result property="status" column="status"/>
  13. <result property="createTime" column="create_time"/>
  14. <result property="updateTime" column="update_time"/>
  15. <result property="divideType" column="divide_type"/>
  16. <result property="payStatus" column="pay_status"/>
  17. <result property="remark" column="remark"/>
  18. <result property="deductMoney" column="deduct_money"/>
  19. <result property="createUsername" column="create_username"/>
  20. <result property="createSysUserId" column="create_sys_user_id"/>
  21. <result property="createNo" column="create_no"/>
  22. </resultMap>
  23. <select id="getCompanyList" parameterType="com.zhongzheng.modules.top.financial.bo.TopDivideLogQueryBo" resultType="com.zhongzheng.modules.top.financial.vo.TopDivideLogVo">
  24. SELECT
  25. dl.*,
  26. st.tenant_name,
  27. st.bill_type
  28. FROM
  29. top_divide_log dl
  30. LEFT JOIN sys_tenant st ON dl.tenant_id = st.tenant_id
  31. WHERE
  32. dl.divide_type = 1
  33. <if test="tenantId != null and tenantId != ''">
  34. AND dl.tenant_id = #{tenantId}
  35. </if>
  36. <if test="monthTime != null and monthTime != ''">
  37. AND dl.month_time in
  38. <foreach collection="monthTime" item="item" index="index" open="(" close=")" separator=",">
  39. #{item}
  40. </foreach>
  41. </if>
  42. </select>
  43. <select id="getCheckList" parameterType="com.zhongzheng.modules.top.financial.bo.TopDivideLogQueryBo" resultType="com.zhongzheng.modules.top.financial.vo.TopDivideLogVo">
  44. SELECT
  45. dl.*,
  46. cl.check_status,
  47. cl.check_sign,
  48. r.role_name
  49. FROM
  50. top_divide_log dl LEFT JOIN
  51. top_old_order_check_log cl ON dl.id = cl.month_divide_id AND cl.check_sign = 1
  52. LEFT JOIN top_sys_role r ON cl.role_id = r.role_id
  53. WHERE
  54. 1 = 1
  55. <if test="tenantId != null and tenantId != ''">
  56. AND dl.tenant_id = #{tenantId}
  57. </if>
  58. <if test="divideType != null">
  59. AND dl.divide_type = #{divideType}
  60. </if>
  61. <if test="payStatus != null">
  62. AND dl.pay_status = #{payStatus}
  63. </if>
  64. <if test="roleId != null and roleId != ''">
  65. AND cl.role_id = #{roleId}
  66. </if>
  67. <if test="checkStatus != null and checkStatus != ''">
  68. AND cl.check_status in
  69. <foreach collection="checkStatus" item="item" index="index" open="(" close=")" separator=",">
  70. #{item}
  71. </foreach>
  72. </if>
  73. <if test="monthTime != null and monthTime != ''">
  74. AND dl.month_time in
  75. <foreach collection="monthTime" item="item" index="index" open="(" close=")" separator=",">
  76. #{item}
  77. </foreach>
  78. </if>
  79. order by dl.id
  80. </select>
  81. <select id="getSumMoney" parameterType="com.zhongzheng.modules.top.financial.bo.TopDivideLogQueryBo" resultType="com.zhongzheng.modules.top.financial.vo.TopDivideLogVo">
  82. SELECT
  83. sum(
  84. IF
  85. ( pay_status = 1, dl.pay_money, 0 )) AS pay_money_total,
  86. sum(
  87. IF
  88. ( pay_status = 1, dl.deduct_money, 0 )) AS deduct_money_total,
  89. sum(
  90. IF
  91. ( pay_status = 0, dl.pay_money, 0 )) AS un_pay_money_total,
  92. sum(
  93. IF
  94. ( pay_status = 0, dl.deduct_money, 0 )) AS un_deduct_money_total
  95. FROM
  96. top_divide_log dl
  97. WHERE
  98. 1=1
  99. <if test="divideType != null">
  100. AND dl.divide_type = #{divideType}
  101. </if>
  102. </select>
  103. <select id="getSellerList" parameterType="com.zhongzheng.modules.top.financial.bo.TopDivideLogQueryBo" resultType="com.zhongzheng.modules.top.financial.vo.TopDivideLogVo">
  104. SELECT
  105. dl.*,
  106. st.tenant_name
  107. FROM
  108. top_divide_log dl
  109. LEFT JOIN sys_tenant st ON dl.tenant_id = st.tenant_id
  110. WHERE
  111. dl.divide_type = 2
  112. <if test="tenantId != null and tenantId != ''">
  113. AND dl.tenant_id = #{tenantId}
  114. </if>
  115. <if test="monthTime != null and monthTime != ''">
  116. AND dl.month_time in
  117. <foreach collection="monthTime" item="item" index="index" open="(" close=")" separator=",">
  118. #{item}
  119. </foreach>
  120. </if>
  121. </select>
  122. <select id="getCommissionList" parameterType="com.zhongzheng.modules.top.financial.bo.TopDivideLogQueryBo" resultType="com.zhongzheng.modules.top.financial.vo.TopDivideLogVo">
  123. SELECT
  124. dl.*,
  125. st.tenant_name
  126. FROM
  127. top_divide_log dl
  128. LEFT JOIN sys_tenant st ON dl.tenant_id = st.tenant_id
  129. WHERE
  130. dl.divide_type = 3
  131. <if test="tenantId != null and tenantId != ''">
  132. AND dl.tenant_id = #{tenantId}
  133. </if>
  134. <if test="monthTime != null and monthTime != ''">
  135. AND dl.month_time in
  136. <foreach collection="monthTime" item="item" index="index" open="(" close=")" separator=",">
  137. #{item}
  138. </foreach>
  139. </if>
  140. GROUP BY
  141. dl.tenant_id
  142. </select>
  143. </mapper>