pull/1/head
parent
fbc8ffd49c
commit
2361a07f48
@ -0,0 +1,80 @@
|
||||
package com.cyl.manager.act.controller;
|
||||
|
||||
import com.cyl.h5.config.SecurityUtil;
|
||||
import com.cyl.manager.act.domain.IntegralHistory;
|
||||
import com.cyl.manager.act.pojo.query.IntegralHistoryQuery;
|
||||
import com.cyl.manager.act.pojo.vo.IntegralStatVO;
|
||||
import com.cyl.manager.act.service.IntegralHistoryService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 积分流水表Controller
|
||||
*
|
||||
* @author zcc
|
||||
* @date 2024-03-01
|
||||
*/
|
||||
@Api(description ="积分流水表接口列表")
|
||||
@RestController
|
||||
@RequestMapping("/h5/act/integral")
|
||||
public class H5IntegralHistoryController extends BaseController {
|
||||
@Autowired
|
||||
private IntegralHistoryService service;
|
||||
|
||||
@ApiOperation("查询积分流水表列表")
|
||||
@GetMapping("/list")
|
||||
public ResponseEntity<List<IntegralHistory>> list(Integer month) {
|
||||
IntegralHistoryQuery query = new IntegralHistoryQuery();
|
||||
query.setMemberId(SecurityUtil.getLocalMember().getId());
|
||||
query.setOpType(1);
|
||||
query.setSubOpType(11);
|
||||
List<LocalDateTime> timeDiff = DateUtils.getTimeDiff(month);
|
||||
query.setStart(timeDiff.get(0));
|
||||
query.setEnd(timeDiff.get(1));
|
||||
List<IntegralHistory> list = service.selectList2(query);
|
||||
return ResponseEntity.ok(list);
|
||||
}
|
||||
|
||||
@ApiOperation("新增积分流水表")
|
||||
@Log(title = "积分流水表", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
public ResponseEntity<Integer> add(BigDecimal amount) {
|
||||
|
||||
IntegralHistory history = new IntegralHistory();
|
||||
history.setOpType(1);
|
||||
history.setSubOpType(11);
|
||||
history.setAmount(amount);
|
||||
history.setMemberId(SecurityUtil.getLocalMember().getId());
|
||||
history.setCreateTime(LocalDateTime.now());
|
||||
return ResponseEntity.ok(service.insert2(history));
|
||||
}
|
||||
|
||||
@ApiOperation("积分流水")
|
||||
@PostMapping("/history/list")
|
||||
public ResponseEntity<Page<IntegralHistory>> list(@RequestBody IntegralHistoryQuery query, Pageable page) {
|
||||
List<IntegralHistory> list = service.selectListByH5(query, page);
|
||||
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("积分统计")
|
||||
@PostMapping("/stat")
|
||||
public ResponseEntity<IntegralStatVO> statIntegral(@RequestBody IntegralHistoryQuery query) {
|
||||
IntegralStatVO res = service.statIntegral(query);
|
||||
return ResponseEntity.ok(res);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
package com.cyl.manager.act.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.cyl.manager.act.convert.IntegralHistoryConvert;
|
||||
import com.cyl.manager.act.domain.IntegralHistory;
|
||||
import com.cyl.manager.act.pojo.query.IntegralHistoryQuery;
|
||||
import com.cyl.manager.act.service.IntegralHistoryService;
|
||||
import com.cyl.manager.act.pojo.vo.IntegralHistoryVO;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
/**
|
||||
* 积分流水表Controller
|
||||
*
|
||||
* @author zcc
|
||||
* @date 2024-03-01
|
||||
*/
|
||||
@Api(description ="积分流水表接口列表")
|
||||
@RestController
|
||||
@RequestMapping("/act/integralHistory")
|
||||
public class IntegralHistoryController extends BaseController {
|
||||
@Autowired
|
||||
private IntegralHistoryService service;
|
||||
@Autowired
|
||||
private IntegralHistoryConvert convert;
|
||||
|
||||
@ApiOperation("查询积分流水表列表")
|
||||
@PreAuthorize("@ss.hasPermi('act:integralHistory:list')")
|
||||
@PostMapping("/list")
|
||||
public ResponseEntity<Page<IntegralHistory>> list(@RequestBody IntegralHistoryQuery query, Pageable page) {
|
||||
List<IntegralHistory> list = service.selectList(query, page);
|
||||
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("导出积分流水表列表")
|
||||
@PreAuthorize("@ss.hasPermi('act:integralHistory:export')")
|
||||
@Log(title = "积分流水表", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public ResponseEntity<String> export(IntegralHistoryQuery query) {
|
||||
List<IntegralHistory> list = service.selectList(query, null);
|
||||
ExcelUtil<IntegralHistoryVO> util = new ExcelUtil<>(IntegralHistoryVO.class);
|
||||
return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "积分流水表数据"));
|
||||
}
|
||||
|
||||
@ApiOperation("获取积分流水表详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('act:integralHistory:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResponseEntity<IntegralHistory> getInfo(@PathVariable("id") Long id) {
|
||||
return ResponseEntity.ok(service.selectById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("新增积分流水表")
|
||||
@PreAuthorize("@ss.hasPermi('act:integralHistory:add')")
|
||||
@Log(title = "积分流水表", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public ResponseEntity<Integer> add(@RequestBody IntegralHistory integralHistory) {
|
||||
return ResponseEntity.ok(service.insert(integralHistory));
|
||||
}
|
||||
|
||||
@ApiOperation("修改积分流水表")
|
||||
@PreAuthorize("@ss.hasPermi('act:integralHistory:edit')")
|
||||
@Log(title = "积分流水表", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public ResponseEntity<Integer> edit(@RequestBody IntegralHistory integralHistory) {
|
||||
return ResponseEntity.ok(service.update(integralHistory));
|
||||
}
|
||||
|
||||
@ApiOperation("删除积分流水表")
|
||||
@PreAuthorize("@ss.hasPermi('act:integralHistory:remove')")
|
||||
@Log(title = "积分流水表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseEntity<Integer> remove(@PathVariable Long id) {
|
||||
return ResponseEntity.ok(service.deleteById(id));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.cyl.manager.act.convert;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import com.cyl.manager.act.domain.IntegralHistory;
|
||||
import com.cyl.manager.act.pojo.vo.IntegralHistoryVO;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 积分流水表 DO <=> DTO <=> VO / BO / Query
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface IntegralHistoryConvert {
|
||||
|
||||
List<IntegralHistoryVO> dos2vos(List<IntegralHistory> list);
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.cyl.manager.act.mapper;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.cyl.manager.act.pojo.vo.IntegralStatVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.cyl.manager.act.domain.IntegralHistory;
|
||||
|
||||
/**
|
||||
* 积分流水表Mapper接口
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
public interface IntegralHistoryMapper extends BaseMapper<IntegralHistory> {
|
||||
/**
|
||||
* 查询积分流水表列表
|
||||
*
|
||||
* @param integralHistory 积分流水表
|
||||
* @return 积分流水表集合
|
||||
*/
|
||||
List<IntegralHistory> selectByEntity(IntegralHistory integralHistory);
|
||||
|
||||
IntegralStatVO statIntegral(LocalDateTime start, LocalDateTime end, Long memberId);
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.cyl.manager.act.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class IntegralRule {
|
||||
private Integer signStatus = 1;
|
||||
private BigDecimal signCount = BigDecimal.valueOf(1);
|
||||
private BigDecimal orderAmount = BigDecimal.valueOf(1);
|
||||
private BigDecimal orderCount = BigDecimal.valueOf(1);
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.cyl.manager.act.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class IntegralStatVO {
|
||||
private BigDecimal balance = BigDecimal.ZERO;
|
||||
|
||||
private BigDecimal income = BigDecimal.ZERO;
|
||||
|
||||
private BigDecimal expenditure = BigDecimal.ZERO;
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
package com.cyl.manager.ums.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.cyl.manager.ums.convert.MemberAccountConvert;
|
||||
import com.cyl.manager.ums.domain.MemberAccount;
|
||||
import com.cyl.manager.ums.pojo.query.MemberAccountQuery;
|
||||
import com.cyl.manager.ums.service.MemberAccountService;
|
||||
import com.cyl.manager.ums.pojo.vo.MemberAccountVO;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
/**
|
||||
* 会员账户表Controller
|
||||
*
|
||||
* @author zcc
|
||||
* @date 2024-03-01
|
||||
*/
|
||||
@Api(description ="会员账户表接口列表")
|
||||
@RestController
|
||||
@RequestMapping("/ums/memberAccount")
|
||||
public class MemberAccountController extends BaseController {
|
||||
@Autowired
|
||||
private MemberAccountService service;
|
||||
@Autowired
|
||||
private MemberAccountConvert convert;
|
||||
|
||||
@ApiOperation("查询会员账户表列表")
|
||||
@PreAuthorize("@ss.hasPermi('ums:memberAccount:list')")
|
||||
@PostMapping("/list")
|
||||
public ResponseEntity<Page<MemberAccount>> list(@RequestBody MemberAccountQuery query, Pageable page) {
|
||||
List<MemberAccount> list = service.selectList(query, page);
|
||||
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("导出会员账户表列表")
|
||||
@PreAuthorize("@ss.hasPermi('ums:memberAccount:export')")
|
||||
@Log(title = "会员账户表", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public ResponseEntity<String> export(MemberAccountQuery query) {
|
||||
List<MemberAccount> list = service.selectList(query, null);
|
||||
ExcelUtil<MemberAccountVO> util = new ExcelUtil<>(MemberAccountVO.class);
|
||||
return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "会员账户表数据"));
|
||||
}
|
||||
|
||||
@ApiOperation("获取会员账户表详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('ums:memberAccount:query')")
|
||||
@GetMapping(value = "/{memberId}")
|
||||
public ResponseEntity<MemberAccount> getInfo(@PathVariable("memberId") Long memberId) {
|
||||
return ResponseEntity.ok(service.selectByMemberId(memberId));
|
||||
}
|
||||
|
||||
@ApiOperation("新增会员账户表")
|
||||
@PreAuthorize("@ss.hasPermi('ums:memberAccount:add')")
|
||||
@Log(title = "会员账户表", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public ResponseEntity<Integer> add(@RequestBody MemberAccount memberAccount) {
|
||||
return ResponseEntity.ok(service.insert(memberAccount));
|
||||
}
|
||||
|
||||
@ApiOperation("修改会员账户表")
|
||||
@PreAuthorize("@ss.hasPermi('ums:memberAccount:edit')")
|
||||
@Log(title = "会员账户表", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public ResponseEntity<Integer> edit(@RequestBody MemberAccount memberAccount) {
|
||||
return ResponseEntity.ok(service.update(memberAccount));
|
||||
}
|
||||
|
||||
@ApiOperation("删除会员账户表")
|
||||
@PreAuthorize("@ss.hasPermi('ums:memberAccount:remove')")
|
||||
@Log(title = "会员账户表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{memberId}")
|
||||
public ResponseEntity<Integer> remove(@PathVariable Long memberId) {
|
||||
return ResponseEntity.ok(service.deleteByMemberId(memberId));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.cyl.manager.ums.convert;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import com.cyl.manager.ums.domain.MemberAccount;
|
||||
import com.cyl.manager.ums.pojo.vo.MemberAccountVO;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 会员账户表 DO <=> DTO <=> VO / BO / Query
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface MemberAccountConvert {
|
||||
|
||||
List<MemberAccountVO> dos2vos(List<MemberAccount> list);
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.cyl.manager.ums.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
/**
|
||||
* 会员账户表对象 ums_member_account
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@ApiModel(description="会员账户表对象")
|
||||
@Data
|
||||
@TableName("ums_member_account")
|
||||
public class MemberAccount {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("MEMBER_ID")
|
||||
@TableId(value="member_id", type = IdType.ASSIGN_ID)
|
||||
private Long memberId;
|
||||
|
||||
@ApiModelProperty("积分余额")
|
||||
@Excel(name = "积分余额")
|
||||
private BigDecimal integralBalance;
|
||||
|
||||
@ApiModelProperty("历史总共积分")
|
||||
@Excel(name = "历史总共积分")
|
||||
private BigDecimal totalIntegralBalance;
|
||||
|
||||
@ApiModelProperty("修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.cyl.manager.ums.mapper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.cyl.manager.ums.domain.MemberAccount;
|
||||
|
||||
/**
|
||||
* 会员账户表Mapper接口
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
public interface MemberAccountMapper extends BaseMapper<MemberAccount> {
|
||||
/**
|
||||
* 查询会员账户表列表
|
||||
*
|
||||
* @param memberAccount 会员账户表
|
||||
* @return 会员账户表集合
|
||||
*/
|
||||
List<MemberAccount> selectByEntity(MemberAccount memberAccount);
|
||||
|
||||
int updateIntegralBalance(@Param("amount") BigDecimal amount, @Param("memberId") Long memberId);
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package com.cyl.manager.ums.pojo.query;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 会员账户表 查询 对象
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@ApiModel(description="会员账户表 查询 对象")
|
||||
@Data
|
||||
public class MemberAccountQuery {
|
||||
@ApiModelProperty("积分余额 精确匹配")
|
||||
private BigDecimal integralBalance;
|
||||
|
||||
@ApiModelProperty("历史总共积分 精确匹配")
|
||||
private BigDecimal totalIntegralBalance;
|
||||
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.cyl.manager.ums.pojo.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
/**
|
||||
* 会员账户表 数据视图对象
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@Data
|
||||
public class MemberAccountVO {
|
||||
/** MEMBER_ID */
|
||||
private Long memberId;
|
||||
/** 积分余额 */
|
||||
@Excel(name = "积分余额")
|
||||
private BigDecimal integralBalance;
|
||||
/** 历史总共积分 */
|
||||
@Excel(name = "历史总共积分")
|
||||
private BigDecimal totalIntegralBalance;
|
||||
/** 修改时间 */
|
||||
private LocalDateTime updateTime;
|
||||
/** 创建时间 */
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
@ -0,0 +1,92 @@
|
||||
package com.cyl.manager.ums.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.cyl.manager.ums.mapper.MemberAccountMapper;
|
||||
import com.cyl.manager.ums.domain.MemberAccount;
|
||||
import com.cyl.manager.ums.pojo.query.MemberAccountQuery;
|
||||
|
||||
/**
|
||||
* 会员账户表Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@Service
|
||||
public class MemberAccountService {
|
||||
@Autowired
|
||||
private MemberAccountMapper memberAccountMapper;
|
||||
|
||||
/**
|
||||
* 查询会员账户表
|
||||
*
|
||||
* @param memberId 会员账户表主键
|
||||
* @return 会员账户表
|
||||
*/
|
||||
public MemberAccount selectByMemberId(Long memberId) {
|
||||
return memberAccountMapper.selectById(memberId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询会员账户表列表
|
||||
*
|
||||
* @param query 查询条件
|
||||
* @param page 分页条件
|
||||
* @return 会员账户表
|
||||
*/
|
||||
public List<MemberAccount> selectList(MemberAccountQuery query, Pageable page) {
|
||||
if (page != null) {
|
||||
PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize());
|
||||
}
|
||||
QueryWrapper<MemberAccount> qw = new QueryWrapper<>();
|
||||
BigDecimal integralBalance = query.getIntegralBalance();
|
||||
if (integralBalance != null) {
|
||||
qw.eq("integral_balance", integralBalance);
|
||||
}
|
||||
BigDecimal totalIntegralBalance = query.getTotalIntegralBalance();
|
||||
if (totalIntegralBalance != null) {
|
||||
qw.eq("total_integral_balance", totalIntegralBalance);
|
||||
}
|
||||
return memberAccountMapper.selectList(qw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增会员账户表
|
||||
*
|
||||
* @param memberAccount 会员账户表
|
||||
* @return 结果
|
||||
*/
|
||||
public int insert(MemberAccount memberAccount) {
|
||||
memberAccount.setCreateTime(LocalDateTime.now());
|
||||
return memberAccountMapper.insert(memberAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改会员账户表
|
||||
*
|
||||
* @param memberAccount 会员账户表
|
||||
* @return 结果
|
||||
*/
|
||||
public int update(MemberAccount memberAccount) {
|
||||
return memberAccountMapper.updateById(memberAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除会员账户表信息
|
||||
*
|
||||
* @param memberId 会员账户表主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByMemberId(Long memberId) {
|
||||
return memberAccountMapper.deleteById(memberId);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cyl.manager.act.mapper.IntegralHistoryMapper">
|
||||
|
||||
<resultMap type="IntegralHistory" id="IntegralHistoryResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="memberId" column="member_id"/>
|
||||
<result property="amount" column="amount"/>
|
||||
<result property="opType" column="op_type"/>
|
||||
<result property="subOpType" column="sub_op_type"/>
|
||||
<result property="orderAmount" column="order_amount"/>
|
||||
<result property="orderId" column="order_id"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectIntegralHistoryVo">
|
||||
select id, member_id, amount, op_type, sub_op_type, order_amount, order_id, create_time from act_integral_history
|
||||
</sql>
|
||||
|
||||
<select id="selectByEntity" parameterType="IntegralHistory" resultMap="IntegralHistoryResult">
|
||||
<include refid="selectIntegralHistoryVo"/>
|
||||
<where>
|
||||
<if test="memberId != null "> and member_id = #{memberId}</if>
|
||||
<if test="amount != null "> and amount = #{amount}</if>
|
||||
<if test="opType != null "> and op_type = #{opType}</if>
|
||||
<if test="subOpType != null "> and sub_op_type = #{subOpType}</if>
|
||||
<if test="orderAmount != null "> and order_amount = #{orderAmount}</if>
|
||||
<if test="orderId != null "> and order_id = #{orderId}</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="statIntegral" resultType="com.cyl.manager.act.pojo.vo.IntegralStatVO">
|
||||
select sum(case when op_type = 1 then amount else 0 end) as income,
|
||||
sum(case when op_type = 2 then amount else 0 end) as expenditure
|
||||
from act_integral_history
|
||||
where member_id = #{param3}
|
||||
and create_time >= #{param1}
|
||||
and create_time <![CDATA[ <= ]]> #{param2}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cyl.manager.ums.mapper.MemberAccountMapper">
|
||||
|
||||
<resultMap type="MemberAccount" id="MemberAccountResult">
|
||||
<result property="memberId" column="member_id"/>
|
||||
<result property="integralBalance" column="integral_balance"/>
|
||||
<result property="totalIntegralBalance" column="total_integral_balance"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMemberAccountVo">
|
||||
select member_id, integral_balance, total_integral_balance, update_time, create_time from ums_member_account
|
||||
</sql>
|
||||
<update id="updateIntegralBalance">
|
||||
update ums_member_account set integral_balance = integral_balance + #{amount},total_integral_balance = total_integral_balance + #{amount},update_time = now()
|
||||
where member_id = #{memberId}
|
||||
</update>
|
||||
|
||||
<select id="selectByEntity" parameterType="MemberAccount" resultMap="MemberAccountResult">
|
||||
<include refid="selectMemberAccountVo"/>
|
||||
<where>
|
||||
<if test="integralBalance != null "> and integral_balance = #{integralBalance}</if>
|
||||
<if test="totalIntegralBalance != null "> and total_integral_balance = #{totalIntegralBalance}</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in new issue