Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -1,39 +1,86 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package cn.ysk.cashier.mybatis.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* @author GYJ
|
||||
*/
|
||||
* @author admin
|
||||
* @date 2024-09-02
|
||||
**/
|
||||
@Entity
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("tb_shop_user_flow")
|
||||
@Table(name="tb_shop_user_flow")
|
||||
public class TbShopUserFlow extends Model<TbShopUserFlow> {
|
||||
public class TbShopUserFlow implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "`id`")
|
||||
@ApiModelProperty(value = "id")
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "`shop_user_id`")
|
||||
@ApiModelProperty(value = "shopUserId")
|
||||
private Integer shopUserId;
|
||||
|
||||
@Column(name = "`amount`")
|
||||
@ApiModelProperty(value = "amount")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Column(name = "`balance`")
|
||||
@ApiModelProperty(value = "balance")
|
||||
private BigDecimal balance;
|
||||
|
||||
@Column(name = "`biz_code`")
|
||||
@ApiModelProperty(value = "bizCode")
|
||||
private String bizCode;
|
||||
|
||||
@Column(name = "`biz_name`")
|
||||
@ApiModelProperty(value = "bizName")
|
||||
private String bizName;
|
||||
|
||||
private Date createTime;
|
||||
@Column(name = "`create_time`")
|
||||
@ApiModelProperty(value = "createTime")
|
||||
private Timestamp createTime;
|
||||
|
||||
@Column(name = "`type`")
|
||||
@ApiModelProperty(value = "type")
|
||||
private String type;
|
||||
|
||||
@Column(name = "`is_return`")
|
||||
@ApiModelProperty(value = "是否退款 1 已退款 0 未退款")
|
||||
private String isReturn;
|
||||
|
||||
@Column(name = "`update_time`")
|
||||
@ApiModelProperty(value = "updateTime")
|
||||
private Timestamp updateTime;
|
||||
|
||||
@Column(name = "`remark`")
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
public void copy(TbShopUserFlow source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@@ -41,4 +42,11 @@ public interface TbShopUserFlowMapper extends BaseMapper<TbShopUserFlow> {
|
||||
@Param("endTime") String endTime);
|
||||
|
||||
|
||||
@Select(value = "select * from tb_shop_user_flow where shop_user_id=#{userId} order by id desc limit #{page},#{size}")
|
||||
List<TbShopUserFlow> selectByUserId(@Param("userId") Integer userId,@Param("page") Integer page,@Param("size") Integer size);
|
||||
|
||||
@Select(value = "select count(0) from tb_shop_user_flow where shop_user_id=#{userId} ")
|
||||
Integer selectCountByUserId(@Param("userId") Integer userId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@ 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;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author GYJ
|
||||
@@ -13,4 +13,9 @@ import java.util.List;
|
||||
public interface TbShopUserFlowService extends IService<TbShopUserFlow> {
|
||||
|
||||
BigDecimal sumUserFlowAmountByConditions(Long shopId, String startTime, String endTime);
|
||||
|
||||
|
||||
Map selectByUserId(Integer userId, Integer page, Integer pageSize);
|
||||
|
||||
Integer selectCountByUserId(Integer userId);
|
||||
}
|
||||
|
||||
@@ -4,10 +4,13 @@ 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.data.domain.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author GYJ
|
||||
@@ -18,4 +21,29 @@ public class TbShopUserFlowServiceImpl extends ServiceImpl<TbShopUserFlowMapper,
|
||||
public BigDecimal sumUserFlowAmountByConditions(Long shopId, String startTime, String endTime) {
|
||||
return baseMapper.sumUserFlowAmountByConditions(shopId, startTime, endTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map selectByUserId(Integer userId, Integer page, Integer pageSize) {
|
||||
|
||||
Map map=new HashMap();
|
||||
int count= baseMapper.selectCountByUserId(userId);
|
||||
if(count>0){
|
||||
Pageable pageable = PageRequest.of(page, pageSize, Sort.by("id").descending());
|
||||
List<TbShopUserFlow> userFlows=baseMapper.selectByUserId(userId,pageable.getPageNumber(),pageable.getPageSize());
|
||||
map.put("totalElements",count);
|
||||
map.put("content",userFlows);
|
||||
}else {
|
||||
|
||||
map.put("totalElements",0);
|
||||
map.put("content",null);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer selectCountByUserId(Integer userId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user