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.
 
 
 
 
 

115 lines
5.0 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.iformall.mapper.WxVtwoActivityGrantMapper">
  6. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxVtwoActivityGrant">
  7. <id property="id" column="id" jdbcType="BIGINT"/>
  8. <result property="tenantId" column="tenant_id" jdbcType="VARCHAR"/>
  9. <result property="parentTenantId" column="parent_tenant_id" jdbcType="VARCHAR"/>
  10. <result property="activityId" column="activity_id" jdbcType="BIGINT"/>
  11. <result property="activityType" column="activity_type" jdbcType="SMALLINT"/>
  12. <result property="activityName" column="activity_name" jdbcType="VARCHAR"/>
  13. <result property="orderMoneySum" column="order_money_sum" jdbcType="DECIMAL"/>
  14. <result property="orderCount" column="order_count" jdbcType="INTEGER"/>
  15. <result property="cusName" column="cus_name" jdbcType="VARCHAR"/>
  16. <result property="cusPhone" column="cus_phone" jdbcType="VARCHAR"/>
  17. <result property="lotteryNum" column="lottery_num" jdbcType="VARCHAR"/>
  18. <result property="lotteryCount" column="lottery_count" jdbcType="INTEGER"/>
  19. <result property="anniversaryLotteryNum" column="anniversary_lottery_num" jdbcType="VARCHAR"/>
  20. <result property="realName" column="real_name" jdbcType="VARCHAR"/>
  21. <result property="realCard" column="real_card" jdbcType="VARCHAR"/>
  22. <result property="remark" column="remark" jdbcType="VARCHAR"/>
  23. <result property="signImg" column="sign_img" jdbcType="VARCHAR"/>
  24. <result property="status" column="status" jdbcType="SMALLINT"/>
  25. <result property="createBy" column="create_by" jdbcType="BIGINT"/>
  26. <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
  27. <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
  28. </resultMap>
  29. <sql id="allColumns">
  30. id,tenant_id,parent_tenant_id,
  31. activity_id,activity_type,activity_name,order_money_sum,
  32. order_count,cus_name,cus_phone,
  33. lottery_num,lottery_count,anniversary_lottery_num,
  34. real_name,real_card,remark,sign_img,
  35. status,create_by,create_date,
  36. update_date
  37. </sql>
  38. <sql id="dynamicWhereConditions">
  39. where 1 = 1
  40. <if test=" null != id ">
  41. and `id` = #{id}
  42. </if>
  43. <if test=" null != tenantId and '' != tenantId">
  44. and `tenant_id` = #{tenantId}
  45. </if>
  46. <if test=" null != parentTenantId and '' != parentTenantId">
  47. and `parent_tenant_id` = #{parentTenantId}
  48. </if>
  49. <if test=" null != activityId ">
  50. and `activity_id` = #{activityId}
  51. </if>
  52. <if test=" null != activityType ">
  53. and `activity_type` = #{activityType}
  54. </if>
  55. <if test=" null != cusPhone and cusPhone != '' ">
  56. and `cus_phone` = #{cusPhone}
  57. </if>
  58. <if test=" null != createDateBegin">
  59. and `create_date` &gt;= #{createDateBegin}
  60. </if>
  61. <if test=" null != createDateEnd">
  62. and `create_date` &lt;= #{createDateEnd}
  63. </if>
  64. <if test=" null != status ">
  65. and `status` = #{status}
  66. </if>
  67. <if test=" null != ids ">
  68. and id in
  69. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  70. #{idItem}
  71. </foreach>
  72. </if>
  73. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  74. </sql>
  75. <select id="findList" parameterType="com.iformall.domain.po.WxVtwoActivityGrant" resultMap="BaseResultMap">
  76. select <include refid="allColumns" /> from wx_vtwo_activity_grant
  77. <include refid="dynamicWhereConditions" />
  78. </select>
  79. <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  80. select <include refid="allColumns" /> from wx_vtwo_activity_grant
  81. where id = #{id} and tenant_id=#{tenantId}
  82. </select>
  83. <select id="activityAwardStatistics" parameterType="com.iformall.domain.po.WxVtwoActivityGrant" resultType="com.iformall.domain.vo.WxVtwoAwardStatistics">
  84. SELECT count(1) as 'grantCount',
  85. IFNULL(sum(order_count),0) as 'orderCount',
  86. IFNULL(sum(order_money_sum),0) as 'orderMoney'
  87. FROM wx_vtwo_activity_grant
  88. <include refid="dynamicWhereConditions" />
  89. </select>
  90. <select id="activityAwardStatisticsChart" parameterType="com.iformall.domain.po.WxVtwoActivityGrant" resultType="com.iformall.domain.vo.WxVtwoAwardStatistics">
  91. SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime,
  92. count(1) as 'grantCount',
  93. IFNULL(sum(order_count),0) as 'orderCount',
  94. IFNULL(sum(order_money_sum),0) as 'orderMoney'
  95. FROM wx_vtwo_activity_grant
  96. <include refid="dynamicWhereConditions" />
  97. group by xTime
  98. </select>
  99. </mapper>