Compare commits
5 Commits
a521d1c674
...
b24c6d3157
Author | SHA1 | Date | |
---|---|---|---|
b24c6d3157 | |||
67459fe554 | |||
c58893d335 | |||
aa3d6de962 | |||
f6b2ffb401 |
@ -132,10 +132,10 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
|
||||
return selectList(wrapperX);
|
||||
}
|
||||
|
||||
@Select(" SELECT a.status,d.label,a.create_time,a.pay_price,a.use_point,c.name,c.pic_url,b.count FROM trade_order a " +
|
||||
@Select(" SELECT a.id,a.status,d.label,a.create_time,a.pay_price,a.use_point,c.name,c.pic_url,b.count FROM trade_order a " +
|
||||
" inner join trade_order_item b on a.id = b.order_id " +
|
||||
" inner join (SELECT sort, label, value, dict_type, css_class FROM system_dict_data WHERE dict_type = 'trade_order_status') d on d.sort = a.status "+
|
||||
" inner join product_spu c on b.spu_id = c.id " +
|
||||
" where a.user_id = #{userId} and a.use_point > 0 order by a.create_time ASC ")
|
||||
" where a.user_id = #{userId} and a.use_point > 0 order by a.create_time DESC ")
|
||||
List<AppPointOrderVO> getPointOrder(Long userId);
|
||||
}
|
||||
|
@ -41,4 +41,15 @@ public class AppMemberPointRecordController {
|
||||
return success(BeanUtils.toBean(pageResult, AppMemberPointRecordRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/getPointInfo")
|
||||
public CommonResult<MemberPointRecordDO> getPointInfo() {
|
||||
MemberPointRecordDO pointInfo = pointRecordService.getPointInfo(getLoginUserId());
|
||||
return success(pointInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.member.dal.dataobject.point;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
@ -66,4 +67,13 @@ public class MemberPointRecordDO extends BaseDO {
|
||||
*/
|
||||
private Integer totalPoint;
|
||||
|
||||
|
||||
//总共获得的积分
|
||||
@TableField(exist = false)
|
||||
private Integer addUp;
|
||||
|
||||
//总共消费的积分
|
||||
@TableField(exist = false)
|
||||
private Integer reduce;
|
||||
|
||||
}
|
||||
|
@ -39,4 +39,6 @@ public interface MemberPointRecordService {
|
||||
* @param bizId 业务编号
|
||||
*/
|
||||
void createPointRecord(Long userId, Integer point, MemberPointBizTypeEnum bizType, String bizId);
|
||||
|
||||
MemberPointRecordDO getPointInfo(Long userId);
|
||||
}
|
||||
|
@ -92,4 +92,24 @@ public class MemberPointRecordServiceImpl implements MemberPointRecordService {
|
||||
memberPointRecordMapper.insert(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberPointRecordDO getPointInfo(Long userId) {
|
||||
List<MemberPointRecordDO> memberPointRecordDOList = memberPointRecordMapper.selectList("user_id", userId);
|
||||
Integer addUp = 0;
|
||||
Integer reduce = 0;
|
||||
for (int i = 0; i < memberPointRecordDOList.size(); i++) {
|
||||
MemberPointRecordDO memberPointRecordDO = memberPointRecordDOList.get(i);
|
||||
if (memberPointRecordDO.getPoint() > 0){ //获得积分
|
||||
addUp = addUp + memberPointRecordDO.getPoint();
|
||||
}
|
||||
if (memberPointRecordDO.getPoint() < 0){ //消费积分
|
||||
reduce = reduce + memberPointRecordDO.getPoint();
|
||||
}
|
||||
}
|
||||
MemberPointRecordDO memberPointRecordDO = new MemberPointRecordDO();
|
||||
memberPointRecordDO.setAddUp(addUp);
|
||||
memberPointRecordDO.setReduce(reduce);
|
||||
return memberPointRecordDO;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user