优惠管理
parent
4816edf028
commit
9a9df93792
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.njzscloud.supervisory.discount.controller;
|
||||||
|
|
||||||
|
import com.njzscloud.common.core.utils.R;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.supervisory.discount.pojo.DiscountManageEntity;
|
||||||
|
import com.njzscloud.supervisory.discount.service.DiscountManageService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠管理
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/discount")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DiscountManageController {
|
||||||
|
|
||||||
|
private final DiscountManageService discountManageService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public R<?> add(@RequestBody DiscountManageEntity discountManageEntity) {
|
||||||
|
discountManageService.add(discountManageEntity);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@PostMapping("/modify")
|
||||||
|
public R<?> modify(@RequestBody DiscountManageEntity discountManageEntity) {
|
||||||
|
discountManageService.modify(discountManageEntity);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@PostMapping("/del")
|
||||||
|
public R<?> del(@RequestBody List<Long> ids) {
|
||||||
|
discountManageService.del(ids);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail")
|
||||||
|
public R<DiscountManageEntity> detail(@RequestParam Long id) {
|
||||||
|
return R.success(discountManageService.detail(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
@GetMapping("/paging")
|
||||||
|
public R<PageResult<DiscountManageEntity>> paging(PageParam pageParam, DiscountManageEntity discountManageEntity) {
|
||||||
|
return R.success(discountManageService.paging(pageParam, discountManageEntity));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.njzscloud.supervisory.discount.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njzscloud.supervisory.discount.pojo.DiscountManageEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠管理
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface DiscountManageMapper extends BaseMapper<DiscountManageEntity> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
package com.njzscloud.supervisory.discount.pojo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.njzscloud.common.mp.support.handler.j.JsonTypeHandler;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠管理
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName(value = "discount_manage", autoResultMap = true)
|
||||||
|
public class DiscountManageEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Id
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司id
|
||||||
|
*/
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 费用类型:goods 产品 service 服务费
|
||||||
|
*/
|
||||||
|
private String feeType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务费id
|
||||||
|
*/
|
||||||
|
private Long expenseId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品ids
|
||||||
|
*/
|
||||||
|
@TableField(value = "goods_ids", typeHandler = JsonTypeHandler.class)
|
||||||
|
private List<String> goodsIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠类型:discount 优惠 raise加价
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 变化金额
|
||||||
|
*/
|
||||||
|
private BigDecimal money;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警信息
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人 Id; sys_user.id
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Long creatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人 Id; sys_user.id
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Long modifierId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private LocalDateTime modifyTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除; 0-->未删除、1-->已删除
|
||||||
|
*/
|
||||||
|
@TableLogic
|
||||||
|
private Boolean deleted;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.njzscloud.supervisory.discount.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.supervisory.discount.pojo.DiscountManageEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠管理
|
||||||
|
*/
|
||||||
|
public interface DiscountManageService extends IService<DiscountManageEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
void add(DiscountManageEntity discountManageEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
void modify(DiscountManageEntity discountManageEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
void del(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
DiscountManageEntity detail(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
PageResult<DiscountManageEntity> paging(PageParam pageParam, DiscountManageEntity discountManageEntity);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.njzscloud.supervisory.discount.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.supervisory.discount.mapper.DiscountManageMapper;
|
||||||
|
import com.njzscloud.supervisory.discount.pojo.DiscountManageEntity;
|
||||||
|
import com.njzscloud.supervisory.discount.service.DiscountManageService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠管理
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class DiscountManageServiceImpl extends ServiceImpl<DiscountManageMapper, DiscountManageEntity> implements DiscountManageService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void add(DiscountManageEntity discountManageEntity) {
|
||||||
|
this.save(discountManageEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void modify(DiscountManageEntity discountManageEntity) {
|
||||||
|
this.updateById(discountManageEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void del(List<Long> ids) {
|
||||||
|
this.removeBatchByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DiscountManageEntity detail(Long id) {
|
||||||
|
return this.getById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult<DiscountManageEntity> paging(PageParam pageParam, DiscountManageEntity discountManageEntity) {
|
||||||
|
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<DiscountManageEntity>lambdaQuery()
|
||||||
|
.eq(discountManageEntity.getCompanyId() != null, DiscountManageEntity::getCompanyId, discountManageEntity.getCompanyId())
|
||||||
|
.eq(StrUtil.isNotBlank(discountManageEntity.getFeeType()), DiscountManageEntity::getFeeType, discountManageEntity.getFeeType())
|
||||||
|
.eq(discountManageEntity.getExpenseId() != null, DiscountManageEntity::getExpenseId, discountManageEntity.getExpenseId())
|
||||||
|
.eq(StrUtil.isNotBlank(discountManageEntity.getType()), DiscountManageEntity::getType, discountManageEntity.getType())
|
||||||
|
.eq(discountManageEntity.getDeleted() != null, DiscountManageEntity::getDeleted, Boolean.FALSE)
|
||||||
|
.orderByDesc(DiscountManageEntity::getCreateTime)));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue