|
|
@@ -72,27 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</select>
|
|
|
|
|
|
<select id="businessPage" resultType="com.ruoyi.shop.business.domain.vo.BusinessIntegralVo">
|
|
|
- select r.business_id, max(b.business_name), max(b.business_type),
|
|
|
- sum(case when i.bill_type = 1 then i.value else 0 end) totalGrantIntegral,
|
|
|
- sum(case when i.bill_type = 0 then i.value else 0 end) usedIntegral
|
|
|
- from tb_user_business_integral_record i
|
|
|
- join tb_user_business_role r on r.id = i.business_role_id
|
|
|
- join tb_business b on b.business_id = r.business_id
|
|
|
- <where>
|
|
|
- <if test="bo.businessName != null and bo.businessName != ''">
|
|
|
- and b.business_name like concat('%', #{bo.businessName}, '%')
|
|
|
- </if>
|
|
|
- <if test="bo.businessType != null">
|
|
|
- and b.business_type = #{bo.businessType}
|
|
|
- </if>
|
|
|
- <if test="bo.startTime!=null">
|
|
|
- and i.create_time >= #{bo.startTime}
|
|
|
- </if>
|
|
|
- <if test="bo.endTime!=null">
|
|
|
- and i.create_time <= #{bo.endTime}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- group by r.business_id
|
|
|
+ <include refid="integralBusiness"/>
|
|
|
</select>
|
|
|
|
|
|
<select id="businessTotalIntegral" resultType="java.math.BigDecimal">
|
|
|
@@ -107,6 +87,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<include refid="queryBusiness"/>
|
|
|
</select>
|
|
|
|
|
|
+ <sql id="integralBusiness">
|
|
|
+ select r.business_id, max(b.business_name) businessName, max(b.business_type) businessType,
|
|
|
+ sum(case when i.bill_type = 1 then i.value else 0 end) totalGrantIntegral,
|
|
|
+ sum(case when i.bill_type = 0 then i.value else 0 end) usedIntegral
|
|
|
+ from tb_user_business_integral_record i
|
|
|
+ join tb_user_business_role r on r.id = i.business_role_id
|
|
|
+ join tb_business b on b.business_id = r.business_id
|
|
|
+ <where>
|
|
|
+ <if test="bo.businessName != null and bo.businessName != ''">
|
|
|
+ and b.business_name like concat('%', #{bo.businessName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="bo.businessType != null">
|
|
|
+ and b.business_type = #{bo.businessType}
|
|
|
+ </if>
|
|
|
+ <if test="bo.startTime!=null">
|
|
|
+ and i.create_time >= #{bo.startTime}
|
|
|
+ </if>
|
|
|
+ <if test="bo.endTime!=null">
|
|
|
+ and i.create_time <= #{bo.endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by r.business_id
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="businessList" resultType="com.ruoyi.shop.business.domain.vo.BusinessIntegralVo">
|
|
|
+ <include refid="integralBusiness"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
<sql id="queryBusiness">
|
|
|
select r.*, b.business_name, b.business_type, b.parent_business_id,
|
|
|
b.location, b.province_name, b.city_name, b.area_name,
|