数据统计加退款和充值 修改
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package cn.ysk.cashier.mybatis.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author GYJ
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("tb_shop_user_flow")
|
||||
public class TbShopUserFlow extends Model<TbShopUserFlow> {
|
||||
private Integer id;
|
||||
|
||||
private Integer shopUserId;
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
private BigDecimal balance;
|
||||
|
||||
private String bizCode;
|
||||
|
||||
private String bizName;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private String type;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package cn.ysk.cashier.mybatis.mapper;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopUserFlow;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author GYJ
|
||||
*/
|
||||
public interface TbShopUserFlowMapper extends BaseMapper<TbShopUserFlow> {
|
||||
|
||||
/**
|
||||
* 根据条件查询用户流水总金额
|
||||
*
|
||||
* @param shopId 店铺ID
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param types 流水类型
|
||||
* @return 用户流水总金额
|
||||
*/
|
||||
@Select("<script>" +
|
||||
"SELECT IFNULL(SUM(uf.amount), 0) FROM tb_shop_user_flow as uf " +
|
||||
"JOIN tb_shop_user su ON uf.shop_user_id = su.user_id " +
|
||||
"WHERE su.shop_id = #{shopId} " +
|
||||
"AND uf.create_time BETWEEN #{startTime} AND #{endTime} " +
|
||||
"AND uf.biz_code IN " +
|
||||
"<foreach collection='types' item='type' open='(' separator=',' close=')'> " +
|
||||
"#{type} " +
|
||||
"</foreach> " +
|
||||
"</script>")
|
||||
BigDecimal sumUserFlowAmountByConditions(@Param("shopId") Long shopId,
|
||||
@Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime,
|
||||
@Param("types") List<String> types);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cn.ysk.cashier.mybatis.service;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopUserFlow;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author GYJ
|
||||
*/
|
||||
public interface TbShopUserFlowService extends IService<TbShopUserFlow> {
|
||||
|
||||
BigDecimal sumUserFlowAmountByConditions(Long shopId, String startTime, String endTime, List<String> types);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.ysk.cashier.mybatis.service.impl;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopUserFlow;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbShopUserFlowMapper;
|
||||
import cn.ysk.cashier.mybatis.service.TbShopUserFlowService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author GYJ
|
||||
*/
|
||||
@Service
|
||||
public class TbShopUserFlowServiceImpl extends ServiceImpl<TbShopUserFlowMapper, TbShopUserFlow> implements TbShopUserFlowService {
|
||||
@Override
|
||||
public BigDecimal sumUserFlowAmountByConditions(Long shopId, String startTime, String endTime, List<String> types) {
|
||||
return baseMapper.sumUserFlowAmountByConditions(shopId, startTime, endTime, types);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user