TopDivideLogMapper.xml 6.5 KB

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