src/main/java/com/mzl/flower/constant/Constants.java
@@ -430,4 +430,52 @@ } } public enum POINT_GOOD_STATUS { up("上架"), off("下架"); POINT_GOOD_STATUS(String desc) { this.desc = desc; } private String desc; public String getDesc() { return desc; } } public enum POINT_CHANGE_TYPE { add("增加"), reduce("减少"); POINT_CHANGE_TYPE(String desc) { this.desc = desc; } private String desc; public String getDesc() { return desc; } } public enum POINT_TYPE { consume("消费获取"), activity("活动获取"), giveaway("积分赠送"), deduction("积分扣减"), exchange("积分兑换"); POINT_TYPE(String desc) { this.desc = desc; } private String desc; public String getDesc() { return desc; } } } src/main/java/com/mzl/flower/dto/request/menber/MemberDTO.java
@@ -37,6 +37,4 @@ @ApiModelProperty("未消费产生的下降值") private int downgradeValue; @ApiModelProperty("成长值规则") private String growthRule; } src/main/java/com/mzl/flower/dto/request/point/CustomerPointDetailDTO.java
对比新文件 @@ -0,0 +1,50 @@ package com.mzl.flower.dto.request.point; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; /** * packageName com.mzl.flower.dto.request.point * @author fanghaowei * @version version2.0 * @className CustomerPointDetailDTO * @date 2024/8/29 * @description TODO */ @Data public class CustomerPointDetailDTO { @ApiModelProperty(value = "ID") private Long id; @ApiModelProperty("记录日期") private Date recordDate; @ApiModelProperty("用户ID") private String userId; @ApiModelProperty("商户ID") private Long customerId; @ApiModelProperty("积分变更类型(point_change_type)增加、减少") private String changeType; @ApiModelProperty("积分类型:增加(消费获取、活动获取、积分赠送),减少(积分扣减、积分兑换)") private String type; @ApiModelProperty("积分(积分=使用积分+过期积分)") private Integer point; @ApiModelProperty("使用积分") private Integer usePoint; @ApiModelProperty("过期积分") private Integer expiredPoint; @ApiModelProperty("备注(可记录积分的来源或去向,如订单号、兑换内容、活动名称等)") private String remarks; } src/main/java/com/mzl/flower/dto/request/point/CustomerPointDetailQueryDTO.java
对比新文件 @@ -0,0 +1,32 @@ package com.mzl.flower.dto.request.point; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data public class CustomerPointDetailQueryDTO { @ApiModelProperty("用户ID") private String userId; @ApiModelProperty("商户ID") private Long customerId; @ApiModelProperty("积分变更类型(point_change_type)增加、减少") private String changeType; @ApiModelProperty("积分类型:增加(消费获取、活动获取、积分赠送),减少(积分扣减、积分兑换)") private String type; // @ApiModelProperty("创建日期(yyyy-mm-dd)") // private String createDateBeginStr; // // @ApiModelProperty("创建日期(yyyy-mm-dd)") // private String createDateEndStr; // // @ApiModelProperty(value = "创建日期(yyyy-mm-dd)",hidden = true) // private LocalDateTime createDateBegin; // // @ApiModelProperty(value = "创建日期(yyyy-mm-dd)", hidden = true) // private LocalDateTime createDateEnd; } src/main/java/com/mzl/flower/dto/request/point/PointGoodDTO.java
对比新文件 @@ -0,0 +1,32 @@ package com.mzl.flower.dto.request.point; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data public class PointGoodDTO { @ApiModelProperty(value = "积分商品表ID") private Long id; @ApiModelProperty("商品名称") private String name; @ApiModelProperty("商品描述") private String description; @ApiModelProperty("库存") private Integer stock; @ApiModelProperty("封面图") private String cover; @ApiModelProperty("商品图片") private String pictures; @ApiModelProperty("兑换积分") private Integer point; @ApiModelProperty("状态") private String status; } src/main/java/com/mzl/flower/dto/request/point/PointGoodQueryDTO.java
对比新文件 @@ -0,0 +1,27 @@ package com.mzl.flower.dto.request.point; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data public class PointGoodQueryDTO { @ApiModelProperty("名称") private String name; @ApiModelProperty("状态") private String status; // @ApiModelProperty("创建日期(yyyy-mm-dd)") // private String createDateBeginStr; // // @ApiModelProperty("创建日期(yyyy-mm-dd)") // private String createDateEndStr; // // @ApiModelProperty(value = "创建日期(yyyy-mm-dd)",hidden = true) // private LocalDateTime createDateBegin; // // @ApiModelProperty(value = "创建日期(yyyy-mm-dd)", hidden = true) // private LocalDateTime createDateEnd; } src/main/java/com/mzl/flower/dto/response/member/MemberVO.java
对比新文件 @@ -0,0 +1,4 @@ package com.mzl.flower.dto.response.member; public class MemberVO { } src/main/java/com/mzl/flower/dto/response/point/CustomerPointDetailVO.java
对比新文件 @@ -0,0 +1,54 @@ package com.mzl.flower.dto.response.point; import com.mzl.flower.base.AbstractTransDTO; import com.mzl.flower.base.annotation.DictTrans; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.time.LocalDateTime; import java.util.Date; @Data public class CustomerPointDetailVO extends AbstractTransDTO { private Long id; @ApiModelProperty("记录日期") private Date recordDate; @ApiModelProperty("用户ID") private String userId; @ApiModelProperty("商户ID") private Long customerId; @ApiModelProperty("积分变更类型(point_change_type)增加、减少") @DictTrans(target = "changeTypeStr", codeType = "POINT_CHANGE_TYPE") private String changeType; private String changeTypeStr; @ApiModelProperty("积分类型:增加(消费获取、活动获取、积分赠送),减少(积分扣减、积分兑换)") @DictTrans(target = "typeStr", codeType = "POINT_TYPE") private String type; private String typeStr; @ApiModelProperty("积分(积分=使用积分+过期积分)") private Integer point; @ApiModelProperty("使用积分") private Integer usePoint; @ApiModelProperty("过期积分") private Integer expiredPoint; @ApiModelProperty("备注(可记录积分的来源或去向,如订单号、兑换内容、活动名称等)") private String remarks; @ApiModelProperty("创建日期") private LocalDateTime createTime; @ApiModelProperty("修改日期") private LocalDateTime updateTime; } src/main/java/com/mzl/flower/dto/response/point/PointGoodVO.java
对比新文件 @@ -0,0 +1,44 @@ package com.mzl.flower.dto.response.point; import com.mzl.flower.base.AbstractTransDTO; import com.mzl.flower.base.annotation.DictTrans; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.time.LocalDateTime; @Data public class PointGoodVO extends AbstractTransDTO { private Long id; @ApiModelProperty("商品名称") private String name; @ApiModelProperty("商品描述") private String description; @ApiModelProperty("库存") private Integer stock; @ApiModelProperty("封面图") private String cover; @ApiModelProperty("商品图片") private String pictures; @ApiModelProperty("兑换积分") private Integer point; @ApiModelProperty("状态") @DictTrans(target = "statusStr", codeType = "POINT_GOOD_STATUS") private String status; private String statusStr; @ApiModelProperty("创建日期") private LocalDateTime createTime; @ApiModelProperty("修改日期") private LocalDateTime updateTime; } src/main/java/com/mzl/flower/entity/menber/Member.java
@@ -44,7 +44,4 @@ @ApiModelProperty("未消费产生的下降值") private int downgradeValue; @ApiModelProperty("成长值规则") private String growthRule; } src/main/java/com/mzl/flower/entity/point/CustomerPointDetail.java
对比新文件 @@ -0,0 +1,51 @@ package com.mzl.flower.entity.point; import com.baomidou.mybatisplus.annotation.TableName; import com.mzl.flower.base.BaseAutoEntity; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; /** * packageName com.mzl.flower.entity.point * @author fanghaowei * @version version2.0 * @className CustomerPointDetail * @date 2024/8/29 * @description 用户积分统计 */ @Data @TableName("t_customer_point_detail") public class CustomerPointDetail extends BaseAutoEntity { @ApiModelProperty("记录日期") private Date recordDate; @ApiModelProperty("用户ID") private String userId; @ApiModelProperty("商户ID") private Long customerId; @ApiModelProperty("积分变更类型(point_change_type)增加、减少") private String changeType; @ApiModelProperty("积分类型:增加(消费获取、活动获取、积分赠送),减少(积分扣减、积分兑换)") private String type; @ApiModelProperty("积分(积分=使用积分+过期积分)") private Integer point; @ApiModelProperty("使用积分") private Integer usePoint; @ApiModelProperty("过期积分") private Integer expiredPoint; @ApiModelProperty("备注(可记录积分的来源或去向,如订单号、兑换内容、活动名称等)") private String remarks; } src/main/java/com/mzl/flower/entity/point/PointGood.java
对比新文件 @@ -0,0 +1,42 @@ package com.mzl.flower.entity.point; import com.baomidou.mybatisplus.annotation.TableName; import com.mzl.flower.base.BaseAutoEntity; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; /** * @author fanghaowei * @version version2.0 * @className Member * @date 2024/8/27 * @description 积分商品表 */ @Data @TableName("t_point_goods") public class PointGood extends BaseAutoEntity { @ApiModelProperty("商品名称") private String name; @ApiModelProperty("商品描述") private String description; @ApiModelProperty("库存") private Integer stock; @ApiModelProperty("封面图") private String cover; @ApiModelProperty("商品图片") private String pictures; @ApiModelProperty("兑换积分") private Integer point; @ApiModelProperty("状态") private String status; } src/main/java/com/mzl/flower/mapper/point/CustomerPointDetailMapper.java
对比新文件 @@ -0,0 +1,30 @@ package com.mzl.flower.mapper.point; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzl.flower.dto.request.point.CustomerPointDetailQueryDTO; import com.mzl.flower.dto.request.point.PointGoodQueryDTO; import com.mzl.flower.dto.response.point.CustomerPointDetailVO; import com.mzl.flower.dto.response.point.PointGoodVO; import com.mzl.flower.entity.point.CustomerPointDetail; import com.mzl.flower.entity.point.PointGood; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; /** * @author fanghaowei * @version version2.0 * @className CustomerPointDetailMapper * @date 2024/8/29 * @description CustomerPointDetailMapper */ @SuppressWarnings("ALL") @Repository public interface CustomerPointDetailMapper extends BaseMapper<CustomerPointDetail> { List<CustomerPointDetailVO> queryPage(@Param("dto") CustomerPointDetailQueryDTO dto, Page page); } src/main/java/com/mzl/flower/mapper/point/PointGoodMapper.java
对比新文件 @@ -0,0 +1,36 @@ package com.mzl.flower.mapper.point; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzl.flower.dto.request.content.QueryAnnouncementDTO; import com.mzl.flower.dto.request.point.PointGoodQueryDTO; import com.mzl.flower.dto.response.content.AnnouncementDTO; import com.mzl.flower.dto.response.point.PointGoodVO; import com.mzl.flower.entity.menber.Member; import com.mzl.flower.entity.point.PointGood; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository; import java.util.List; /** * @author fanghaowei * @version version2.0 * @className MemberMapper * @date 2024/8/26 * @description PointGoodMapper */ @SuppressWarnings("ALL") @Repository public interface PointGoodMapper extends BaseMapper<PointGood> { // @Select("select * from t_member where name = #{name} and deleted = '0' limit 1") // Member getMemberByName(@Param("name") String name); List<PointGoodVO> queryPage(@Param("dto") PointGoodQueryDTO dto, Page page); } src/main/java/com/mzl/flower/service/menber/impl/MemberGrowthRecordServiceImpl.java
@@ -14,6 +14,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.ArrayList; @@ -28,6 +29,7 @@ * @description 会员记录功能逻辑层 */ @Service @Transactional @RequiredArgsConstructor public class MemberGrowthRecordServiceImpl extends ServiceImpl<MemberGrowthRecordMapper, MemberGrowthRecord> implements MemberGrowthRecordService { src/main/java/com/mzl/flower/service/menber/impl/MemberServiceImpl.java
@@ -10,6 +10,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; @@ -21,6 +22,7 @@ * @description 会员管理功能逻辑层 */ @Service @Transactional @RequiredArgsConstructor public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> implements MemberService { src/main/java/com/mzl/flower/service/point/CustomerPointDetailService.java
对比新文件 @@ -0,0 +1,21 @@ package com.mzl.flower.service.point; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.mzl.flower.dto.request.point.CustomerPointDetailDTO; import com.mzl.flower.dto.request.point.CustomerPointDetailQueryDTO; import com.mzl.flower.dto.response.point.CustomerPointDetailVO; import com.mzl.flower.entity.point.CustomerPointDetail; public interface CustomerPointDetailService extends IService<CustomerPointDetail> { void save(CustomerPointDetailDTO customerPointDetailDTO); void update(CustomerPointDetailDTO customerPointDetailDTO); void delete(Long id); Page<CustomerPointDetailVO> queryPage(CustomerPointDetailQueryDTO customerPointDetailQueryDTO, Page page); } src/main/java/com/mzl/flower/service/point/PointGoodService.java
对比新文件 @@ -0,0 +1,36 @@ package com.mzl.flower.service.point; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.mzl.flower.dto.BatchDTO; import com.mzl.flower.dto.request.menber.MemberDTO; import com.mzl.flower.dto.request.point.PointGoodDTO; import com.mzl.flower.dto.request.point.PointGoodQueryDTO; import com.mzl.flower.dto.response.content.AnnouncementDTO; import com.mzl.flower.dto.response.point.PointGoodVO; import com.mzl.flower.entity.menber.Member; import com.mzl.flower.entity.point.PointGood; public interface PointGoodService extends IService<PointGood> { void save(PointGoodDTO pointGoodDTO); void update(PointGoodDTO pointGoodDTO); void batchDelete(BatchDTO batchDTO); void batchPublish(BatchDTO batchDTO); void batchOff(BatchDTO batchDTO); void delete(Long id); void copy(Long id); void changeStatus(Long id); PointGoodVO detail(Long id); Page<PointGoodVO> queryPage(PointGoodQueryDTO pointGoodQueryDTO,Page page); } src/main/java/com/mzl/flower/service/point/impl/CustomerPointDetailServiceImpl.java
对比新文件 @@ -0,0 +1,76 @@ package com.mzl.flower.service.point.impl; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.mzl.flower.config.exception.ValidationException; import com.mzl.flower.config.security.SecurityUtils; import com.mzl.flower.dto.request.point.CustomerPointDetailDTO; import com.mzl.flower.dto.request.point.CustomerPointDetailQueryDTO; import com.mzl.flower.dto.response.point.CustomerPointDetailVO; import com.mzl.flower.entity.point.CustomerPointDetail; import com.mzl.flower.mapper.point.CustomerPointDetailMapper; import com.mzl.flower.service.point.CustomerPointDetailService; import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; /** * @author fanghaowei * @version version2.0 * @className MemberServiceImpl * @date 2024/8/26 * @description 积分记录 */ @Service @Transactional @RequiredArgsConstructor public class CustomerPointDetailServiceImpl extends ServiceImpl<CustomerPointDetailMapper, CustomerPointDetail> implements CustomerPointDetailService { private final CustomerPointDetailMapper customerPointDetailMapper; @Override public void save(CustomerPointDetailDTO customerPointDetailDTO) { if (customerPointDetailDTO.getId() != null) { throw new ValidationException("id必须为空"); } CustomerPointDetail customerPointDetail = new CustomerPointDetail(); BeanUtils.copyProperties(customerPointDetailDTO, customerPointDetail); customerPointDetail.create(SecurityUtils.getUserId()); customerPointDetailMapper.insert(customerPointDetail); } @Override public void update(CustomerPointDetailDTO customerPointDetailDTO) { if (customerPointDetailDTO.getId() == null || customerPointDetailDTO.getId() == 0) { throw new ValidationException("id不能为空"); } CustomerPointDetail customerPointDetail = customerPointDetailMapper.selectById(customerPointDetailDTO.getId()); if (customerPointDetail == null) { throw new ValidationException("找不到id为" + customerPointDetail.getId() + "的积分记录"); } BeanUtils.copyProperties(customerPointDetailDTO, customerPointDetail, "id", "createTime", "createBy", "deleted", "status"); customerPointDetail.update(SecurityUtils.getUserId()); customerPointDetailMapper.updateById(customerPointDetail); } @Override public void delete(Long id) { CustomerPointDetail customerPointDetail = customerPointDetailMapper.selectById(id); if (customerPointDetail == null) { throw new ValidationException("找不到id为" + id + "的积分记录"); } customerPointDetailMapper.deleteById(id); } @Override public Page<CustomerPointDetailVO> queryPage(CustomerPointDetailQueryDTO customerPointDetailQueryDTO, Page page) { List<CustomerPointDetailVO> list = customerPointDetailMapper.queryPage(customerPointDetailQueryDTO, page); page.setRecords(list); return page; } } src/main/java/com/mzl/flower/service/point/impl/PointGoodServiceImpl.java
对比新文件 @@ -0,0 +1,163 @@ package com.mzl.flower.service.point.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.mzl.flower.config.exception.ValidationException; import com.mzl.flower.config.security.SecurityUtils; import com.mzl.flower.constant.Constants; import com.mzl.flower.dto.BatchDTO; import com.mzl.flower.dto.request.menber.MemberDTO; import com.mzl.flower.dto.request.point.PointGoodDTO; import com.mzl.flower.dto.request.point.PointGoodQueryDTO; import com.mzl.flower.dto.response.content.AnnouncementDTO; import com.mzl.flower.dto.response.point.PointGoodVO; import com.mzl.flower.entity.content.Announcement; import com.mzl.flower.entity.menber.Member; import com.mzl.flower.entity.point.PointGood; import com.mzl.flower.mapper.member.MemberMapper; import com.mzl.flower.mapper.point.PointGoodMapper; import com.mzl.flower.service.menber.MemberService; import com.mzl.flower.service.point.PointGoodService; import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; import java.time.LocalDate; import java.util.List; /** * @author fanghaowei * @version version2.0 * @className MemberServiceImpl * @date 2024/8/26 * @description 会员管理功能逻辑层 */ @Service @Transactional @RequiredArgsConstructor public class PointGoodServiceImpl extends ServiceImpl<PointGoodMapper, PointGood> implements PointGoodService { private final PointGoodMapper pointGoodMapper; @Override public void save(PointGoodDTO pointGoodDTO) { if (pointGoodDTO.getId() != null) { throw new ValidationException("id必须为空"); } if (pointGoodDTO.getStock() < 0) { throw new ValidationException("库存不能小于0"); } if (pointGoodDTO.getPoint() < 0) { throw new ValidationException("积分不能小于0"); } PointGood pointGood = new PointGood(); BeanUtils.copyProperties(pointGoodDTO, pointGood); pointGood.setStatus(Constants.POINT_GOOD_STATUS.off.name()); pointGood.create(SecurityUtils.getUserId()); pointGoodMapper.insert(pointGood); } @Override public void update(PointGoodDTO pointGoodDTO) { if (pointGoodDTO.getId() == null || pointGoodDTO.getId() == 0) { throw new ValidationException("id不能为空"); } if (pointGoodDTO.getStock() < 0) { throw new ValidationException("库存不能小于0"); } if (pointGoodDTO.getPoint() < 0) { throw new ValidationException("积分不能小于0"); } PointGood pointGood = pointGoodMapper.selectById(pointGoodDTO.getId()); if (pointGood == null) { throw new ValidationException("找不到id为" + pointGood.getId() + "的商品"); } BeanUtils.copyProperties(pointGoodDTO, pointGood, "id", "createTime", "createBy", "deleted", "status"); pointGood.update(SecurityUtils.getUserId()); pointGoodMapper.updateById(pointGood); } @Override public void batchDelete(BatchDTO batchDTO) { pointGoodMapper.deleteBatchIds(batchDTO.getIds()); } @Override public void batchPublish(BatchDTO batchDTO) { List<PointGood> list = pointGoodMapper.selectList(new LambdaQueryWrapper<PointGood>().in(PointGood::getId, batchDTO.getIds())); for (PointGood pointGood : list) { pointGood.setStatus(Constants.POINT_GOOD_STATUS.up.name()); pointGoodMapper.updateById(pointGood); } } @Override public void batchOff(BatchDTO batchDTO) { List<PointGood> list = pointGoodMapper.selectList(new LambdaQueryWrapper<PointGood>().in(PointGood::getId, batchDTO.getIds())); for (PointGood pointGood : list) { pointGood.setStatus(Constants.POINT_GOOD_STATUS.off.name()); pointGoodMapper.updateById(pointGood); } } @Override public void delete(Long id) { PointGood pointGood = pointGoodMapper.selectById(id); if (pointGood == null) { throw new ValidationException("找不到id为" + id + "的商品"); } pointGoodMapper.deleteById(id); } @Override public void copy(Long id) { PointGood pointGoodTmp = pointGoodMapper.selectById(id); if (pointGoodTmp == null) { throw new ValidationException("找不到id为" + id + "的商品"); } PointGood pointGood = new PointGood(); BeanUtils.copyProperties(pointGoodTmp, pointGood,"id","createTime", "createBy", "deleted", "status"); pointGood.setStatus(Constants.POINT_GOOD_STATUS.off.name()); pointGood.create(SecurityUtils.getUserId()); pointGoodMapper.deleteById(id); } @Override public void changeStatus(Long id) { PointGood pointGood = pointGoodMapper.selectById(id); if (pointGood == null) { throw new ValidationException("找不到id为" + id + "的商品"); } if (Constants.COMMON_PUBLISH_STATUS.published.name().equals(pointGood.getStatus())) { pointGood.setStatus(Constants.COMMON_PUBLISH_STATUS.unpublished.name()); } else { pointGood.setStatus(Constants.COMMON_PUBLISH_STATUS.published.name()); } pointGoodMapper.updateById(pointGood); } @Override public PointGoodVO detail(Long id) { PointGood pointGood = pointGoodMapper.selectById(id); if (pointGood == null) { return null; } PointGoodVO vo = new PointGoodVO(); BeanUtils.copyProperties(pointGood, vo); return vo; } @Override public Page<PointGoodVO> queryPage(PointGoodQueryDTO pointGoodQueryDTO, Page page) { List<PointGoodVO> list = pointGoodMapper.queryPage(pointGoodQueryDTO, page); page.setRecords(list); return page; } } src/main/java/com/mzl/flower/vo/member/MemberVO.java
文件已删除 src/main/java/com/mzl/flower/web/point/CustomerPointDetailController.java
对比新文件 @@ -0,0 +1,62 @@ package com.mzl.flower.web.point; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzl.flower.base.BaseController; import com.mzl.flower.base.R; import com.mzl.flower.base.ReturnDataDTO; import com.mzl.flower.dto.request.point.CustomerPointDetailDTO; import com.mzl.flower.dto.request.point.CustomerPointDetailQueryDTO; import com.mzl.flower.dto.response.point.CustomerPointDetailVO; import com.mzl.flower.service.point.CustomerPointDetailService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.validation.constraints.NotNull; @RestController @RequestMapping("/api/customer") @Api(value = "用户积分记录", tags = "用户积分记录") @Validated @Slf4j @RequiredArgsConstructor public class CustomerPointDetailController extends BaseController { private final CustomerPointDetailService customerPointDetailService; @PostMapping("/point/save") @ApiOperation(value = "新增", notes = "新增") public ResponseEntity<ReturnDataDTO> save(@Validated @RequestBody CustomerPointDetailDTO customerPointDetailDTO) { customerPointDetailService.save(customerPointDetailDTO); return returnData(R.SUCCESS.getCode(), null); } @PostMapping("/point/update") @ApiOperation(value = "修改", notes = "修改") public ResponseEntity<ReturnDataDTO> update(@Validated @RequestBody CustomerPointDetailDTO customerPointDetailDTO) { customerPointDetailService.update(customerPointDetailDTO); return returnData(R.SUCCESS.getCode(), null); } @GetMapping("/point/delete") @ApiOperation(value = "删除", notes = "删除") public ResponseEntity<ReturnDataDTO> delete(@NotNull(message = "id不能为空") Long id) { customerPointDetailService.delete(id); return returnData(R.SUCCESS.getCode(), null); } @GetMapping("/point/page") @ApiOperation(value = "查询-分页", notes = "查询-分页") public ResponseEntity<ReturnDataDTO<Page<CustomerPointDetailVO>>> queryPage(CustomerPointDetailQueryDTO dto, Page page) { return returnData(R.SUCCESS.getCode(), customerPointDetailService.queryPage(dto, page)); } } src/main/java/com/mzl/flower/web/point/PointGoodController.java
对比新文件 @@ -0,0 +1,104 @@ package com.mzl.flower.web.point; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzl.flower.base.BaseController; import com.mzl.flower.base.R; import com.mzl.flower.base.ReturnDataDTO; import com.mzl.flower.dto.BatchDTO; import com.mzl.flower.dto.request.point.PointGoodDTO; import com.mzl.flower.dto.request.point.PointGoodQueryDTO; import com.mzl.flower.dto.response.point.PointGoodVO; import com.mzl.flower.service.point.PointGoodService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.validation.constraints.NotNull; @RestController @RequestMapping("/api/point") @Api(value = "积分商品管理", tags = "积分商品管理") @Validated @Slf4j @RequiredArgsConstructor public class PointGoodController extends BaseController { private final PointGoodService pointGoodService; @PostMapping("/good/save") @ApiOperation(value = "新增", notes = "新增") public ResponseEntity<ReturnDataDTO> save(@Validated @RequestBody PointGoodDTO pointGoodDTO) { pointGoodService.save(pointGoodDTO); return returnData(R.SUCCESS.getCode(),null); } @PostMapping("/good/update") @ApiOperation(value = "修改", notes = "修改") public ResponseEntity<ReturnDataDTO> update(@Validated @RequestBody PointGoodDTO pointGoodDTO) { pointGoodService.update(pointGoodDTO); return returnData(R.SUCCESS.getCode(),null); } @PostMapping("/good/delete/batch") @ApiOperation(value = "批量删除", notes = "批量删除") public ResponseEntity<ReturnDataDTO> batchDelete(@Validated @RequestBody BatchDTO dto) { pointGoodService.batchDelete(dto); return returnData(R.SUCCESS.getCode(),null); } @PostMapping("/good/publish/batch") @ApiOperation(value = "批量上架", notes = "批量上架") public ResponseEntity<ReturnDataDTO> batchPublish(@Validated @RequestBody BatchDTO dto) { pointGoodService.batchPublish(dto); return returnData(R.SUCCESS.getCode(),null); } @PostMapping("/good/off/batch") @ApiOperation(value = "批量下架", notes = "批量下架") public ResponseEntity<ReturnDataDTO> batchoff(@Validated @RequestBody BatchDTO dto) { pointGoodService.batchOff(dto); return returnData(R.SUCCESS.getCode(),null); } @GetMapping("/good/delete") @ApiOperation(value = "删除", notes = "删除") public ResponseEntity<ReturnDataDTO> delete(@NotNull(message = "id不能为空") Long id) { pointGoodService.delete(id); return returnData(R.SUCCESS.getCode(),null); } @GetMapping("/good/copy") @ApiOperation(value = "复制", notes = "复制") public ResponseEntity<ReturnDataDTO> copy(@NotNull(message = "id不能为空") Long id) { pointGoodService.delete(id); return returnData(R.SUCCESS.getCode(), null); } @GetMapping("/good/view") @ApiOperation(value = "详情", notes = "详情") public ResponseEntity<ReturnDataDTO<PointGoodVO>> detail(@NotNull(message = "id不能为空") Long id) { return returnData(R.SUCCESS.getCode(),pointGoodService.detail(id)); } @GetMapping("/good/page") @ApiOperation(value = "查询-分页", notes = "查询-分页") public ResponseEntity<ReturnDataDTO<Page<PointGoodVO>>> queryPage(PointGoodQueryDTO dto, Page page) { return returnData(R.SUCCESS.getCode(), pointGoodService.queryPage(dto,page)); } @GetMapping("/good/changeStatus") @ApiOperation(value = "修改上架下架状态", notes = "修改上架下架状态") public ResponseEntity<ReturnDataDTO> changeStatus(@NotNull(message = "id不能为空") Long id) { pointGoodService.changeStatus(id); return returnData(R.SUCCESS.getCode(), null); } } src/main/resources/mapper/point/CustomerPointDetailMapper.xml
对比新文件 @@ -0,0 +1,20 @@ <?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.mzl.flower.mapper.point.CustomerPointDetailMapper"> <select id="queryPage" resultType="com.mzl.flower.dto.response.point.CustomerPointDetailVO"> select * from t_customer_point_detail t where t.deleted= 0 <if test="dto.userId != null and dto.userId != ''"> and t.userId = #{dto.userId} </if> <if test="dto.customerId != null and dto.customerId != ''"> and t.customerId = #{dto.customerId} </if> <if test="dto.changeType != null and dto.changeType != ''"> and t.changeType = #{dto.changeType} </if> <if test="dto.type != null and dto.type != ''"> and t.type = #{dto.type} </if> order by t.update_time desc </select> </mapper> src/main/resources/mapper/point/PointGoodMapper.xml
对比新文件 @@ -0,0 +1,26 @@ <?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.mzl.flower.mapper.point.PointGoodMapper"> <select id="queryPage" resultType="com.mzl.flower.dto.response.point.PointGoodVO"> select * from t_point_goods t where t.deleted= 0 <if test="dto.name != null and dto.name != ''"> and t.name like concat('%', #{dto.name}, '%') </if> <if test="dto.status != null and dto.status != ''"> and t.status = #{dto.status} </if> order by t.update_time desc </select> <select id="queryList" resultType="com.mzl.flower.dto.response.point.PointGoodVO" parameterType="com.mzl.flower.dto.request.point.PointGoodQueryDTO"> select * from t_point_goods t where t.deleted= 0 <if test="dto.name != null and dto.name != ''"> and t.name like concat('%', #{dto.name}, '%') </if> <if test="dto.status != null and dto.status != ''"> and t.status = #{dto.status} </if> order by t.update_time desc </select> </mapper>