TopDivideLogMapper.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. st.bill_day
  29. FROM
  30. top_divide_log dl
  31. LEFT JOIN sys_tenant st ON dl.tenant_id = st.tenant_id
  32. WHERE
  33. dl.divide_type = 1
  34. <if test="tenantId != null and tenantId != ''">
  35. AND dl.tenant_id = #{tenantId}
  36. </if>
  37. <if test="payStatus != null ">
  38. AND dl.pay_status = #{payStatus}
  39. </if>
  40. <if test="monthTime != null and monthTime != ''">
  41. AND dl.month_time in
  42. <foreach collection="monthTime" item="item" index="index" open="(" close=")" separator=",">
  43. #{item}
  44. </foreach>
  45. </if>
  46. </select>
  47. <select id="getCheckList" parameterType="com.zhongzheng.modules.top.financial.bo.TopDivideLogQueryBo" resultType="com.zhongzheng.modules.top.financial.vo.TopDivideLogVo">
  48. SELECT
  49. dl.*,
  50. cl.check_status,
  51. cl.check_sign,
  52. r.role_name
  53. FROM
  54. top_divide_log dl LEFT JOIN
  55. top_old_order_check_log cl ON dl.id = cl.month_divide_id AND cl.check_sign = 1
  56. LEFT JOIN top_sys_role r ON cl.role_id = r.role_id
  57. WHERE
  58. 1 = 1
  59. <if test="tenantId != null and tenantId != ''">
  60. AND dl.tenant_id = #{tenantId}
  61. </if>
  62. <if test="divideType != null">
  63. AND dl.divide_type = #{divideType}
  64. </if>
  65. <if test="payStatus != null">
  66. AND dl.pay_status = #{payStatus}
  67. </if>
  68. <if test="roleId != null and roleId != ''">
  69. AND cl.role_id = #{roleId}
  70. </if>
  71. <if test="checkStatus != null and checkStatus != ''">
  72. AND cl.check_status in
  73. <foreach collection="checkStatus" item="item" index="index" open="(" close=")" separator=",">
  74. #{item}
  75. </foreach>
  76. </if>
  77. <if test="monthTime != null and monthTime != ''">
  78. AND dl.month_time in
  79. <foreach collection="monthTime" item="item" index="index" open="(" close=")" separator=",">
  80. #{item}
  81. </foreach>
  82. </if>
  83. order by dl.id
  84. </select>
  85. <select id="getSumMoney" parameterType="com.zhongzheng.modules.top.financial.bo.TopDivideLogQueryBo" resultType="com.zhongzheng.modules.top.financial.vo.TopDivideLogVo">
  86. SELECT
  87. sum(
  88. IF
  89. ( pay_status = 1, dl.pay_money, 0 )) AS pay_money_total,
  90. sum(
  91. IF
  92. ( pay_status = 1, dl.deduct_money, 0 )) AS deduct_money_total,
  93. sum(
  94. IF
  95. ( pay_status = 0, dl.pay_money, 0 )) AS un_pay_money_total,
  96. sum(
  97. IF
  98. ( pay_status = 0, dl.deduct_money, 0 )) AS un_deduct_money_total
  99. FROM
  100. top_divide_log dl
  101. WHERE
  102. 1=1
  103. <if test="divideType != null">
  104. AND dl.divide_type = #{divideType}
  105. </if>
  106. </select>
  107. <select id="getSellerList" parameterType="com.zhongzheng.modules.top.financial.bo.TopDivideLogQueryBo" resultType="com.zhongzheng.modules.top.financial.vo.TopDivideLogVo">
  108. SELECT
  109. dl.*,
  110. st.tenant_name,
  111. st.bill_day
  112. FROM
  113. top_divide_log dl
  114. LEFT JOIN sys_tenant st ON dl.tenant_id = st.tenant_id
  115. WHERE
  116. dl.divide_type = 2
  117. <if test="tenantId != null and tenantId != ''">
  118. AND dl.tenant_id = #{tenantId}
  119. </if>
  120. <if test="payStatus != null ">
  121. AND dl.pay_status = #{payStatus}
  122. </if>
  123. <if test="monthTime != null and monthTime != ''">
  124. AND dl.month_time in
  125. <foreach collection="monthTime" item="item" index="index" open="(" close=")" separator=",">
  126. #{item}
  127. </foreach>
  128. </if>
  129. </select>
  130. <select id="getCommissionList" parameterType="com.zhongzheng.modules.top.financial.bo.TopDivideOrderQueryBo" resultType="com.zhongzheng.modules.top.financial.vo.TopDivideLogVo">
  131. SELECT
  132. dl.*,
  133. st.tenant_name,
  134. st.bill_day
  135. FROM
  136. top_divide_log dl
  137. LEFT JOIN sys_tenant st ON dl.tenant_id = st.tenant_id
  138. WHERE
  139. dl.divide_type = 3
  140. <if test="tenantId != null and tenantId != ''">
  141. AND dl.tenant_id = #{tenantId}
  142. </if>
  143. <if test="payStatus != null">
  144. AND dl.pay_status = #{payStatus}
  145. </if>
  146. <if test="monthTime != null and monthTime != ''">
  147. AND dl.month_time in
  148. <foreach collection="monthTime" item="item" index="index" open="(" close=")" separator=",">
  149. #{item}
  150. </foreach>
  151. </if>
  152. </select>
  153. </mapper>