金币系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
3.5 KiB

  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.example.demo.mapper.ConsumeMapper">
  6. <select id="getSumConsume" resultType="com.example.demo.domain.vo.SumConsume">
  7. SELECT
  8. sum(free_coin) as SumFcion,
  9. sum(task_coin) as SumTcion,
  10. sum(recharge_coin) as SumRcion,
  11. sum(recharge_coin+free_coin+task_coin) as Sumcion
  12. from detail_y
  13. left join product on detail_y.product_id= product.product_id
  14. <where>
  15. update_type = '1'
  16. <if test='jwcode!=null and jwcode.length>0'>and detail_y.jwcode =#{jwcode}</if>
  17. <if test='productName!=null and productName.length>0'>and product.name = #{productName}</if>
  18. <if test='consumePlatform!=null and consumePlatform.length>0'>and detail_y.consume_platform=#{consumePlatform}</if>
  19. <if test='consumeType!=null and consumeType.length>0'>and detail_y.consume_type= #{consumeType}</if>
  20. <if test='startDate != null and endDate != null'>AND detail_y.create_time BETWEEN #{startDate} AND #{endDate}</if>
  21. <if test='area!=null and area.length>0'>and area=#{area}</if>
  22. <if test="areas != null">
  23. AND area IN
  24. <foreach collection="areas" item="areas" open="(" separator="," close=")">
  25. #{areas}
  26. </foreach>
  27. </if>
  28. </where>
  29. </select>
  30. <select id="select" resultType="com.example.demo.domain.vo.ConsumeDetail">
  31. SELECT
  32. detail_y.*,
  33. admin.name AS adminName,
  34. /* product.name AS productName*/
  35. FROM detail_y
  36. LEFT JOIN `admin` ON detail_y.admin_id = admin.admin_id
  37. LEFT JOIN `user` ON detail_y.jwcode = user.jwcode
  38. LEFT JOIN product ON detail_y.product_id = product.product_id
  39. <where>
  40. update_type = 1
  41. <if test='jwcode != null'>
  42. AND detail_y.jwcode = #{jwcode}
  43. </if>
  44. <if test='productName != null and productName.length > 0'>
  45. AND product.name = #{productName}
  46. </if>
  47. <if test='consumePlatform != null and consumePlatform.length > 0'>
  48. AND detail_y.consume_platform = #{consumePlatform}
  49. </if>
  50. <if test='consumeType != null and consumeType.length > 0'>
  51. AND detail_y.consume_type = #{consumeType}
  52. </if>
  53. <if test='startDate != null and endDate != null'>
  54. AND detail_y.create_time BETWEEN #{startDate} AND #{endDate}
  55. </if>
  56. <if test='area != null and area.length > 0'>
  57. AND area = #{area}
  58. </if>
  59. <if test="areas != null">
  60. AND area IN
  61. <foreach collection="areas" item="areas" open="(" separator="," close=")">
  62. #{areas}
  63. </foreach>
  64. </if>
  65. </where>
  66. <choose>
  67. <when test="sortField != null and sortField.length >0 or sortOrder != null and sortOrder.length >0">
  68. ORDER BY ${sortField} ${sortOrder}
  69. </when>
  70. <otherwise>
  71. ORDER BY detail_y.create_time DESC
  72. </otherwise>
  73. </choose>
  74. </select>
  75. <select id="getConsume" resultType="java.lang.String">
  76. SELECT DISTINCT consume_type FROM detail_y where update_type = 1
  77. </select>
  78. </mapper>