产品修改
parent
367639ae1b
commit
818ebf48b7
|
|
@ -3,9 +3,9 @@ package com.njzscloud.dispose.goods.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.dispose.goods.pojo.entity.GoodsEntity;
|
||||
import com.njzscloud.dispose.goods.pojo.param.AddGoodsParam;
|
||||
import com.njzscloud.dispose.goods.pojo.param.ModifyGoodsParam;
|
||||
import com.njzscloud.dispose.goods.pojo.param.SearchGoodsParam;
|
||||
import com.njzscloud.dispose.goods.pojo.result.SearchGoodsResult;
|
||||
import com.njzscloud.dispose.goods.service.GoodsService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
@ -63,7 +63,7 @@ public class GoodsController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* 启用/禁用
|
||||
*/
|
||||
@GetMapping("/enable")
|
||||
public R<?> enable(
|
||||
|
|
@ -78,8 +78,8 @@ public class GoodsController {
|
|||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/paging")
|
||||
public R<PageResult<SearchGoodsResult>> paging(PageParam pageParam, GoodsEntity goodsEntity) {
|
||||
return R.success(goodsService.paging(pageParam, goodsEntity));
|
||||
public R<PageResult<SearchGoodsResult>> paging(PageParam pageParam, SearchGoodsParam goodsParam) {
|
||||
return R.success(goodsService.paging(pageParam, goodsParam));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.njzscloud.dispose.goods.pojo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.njzscloud.dispose.common.pojo.entity.BaseEntity;
|
||||
import com.njzscloud.dispose.goods.contant.BizType;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
|
@ -20,7 +19,7 @@ import java.time.LocalDateTime;
|
|||
@ToString
|
||||
@Accessors(chain = true)
|
||||
@TableName(value = "gds_goods_category", autoResultMap = true)
|
||||
public class GoodsCategoryEntity extends BaseEntity {
|
||||
public class GoodsCategoryEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ import com.baomidou.mybatisplus.annotation.*;
|
|||
import com.njzscloud.common.core.ienum.DictItem;
|
||||
import com.njzscloud.common.core.ienum.DictKey;
|
||||
import com.njzscloud.common.mp.support.handler.j.DictItemTypeHandler;
|
||||
import com.njzscloud.dispose.common.pojo.entity.BaseEntity;
|
||||
import com.njzscloud.dispose.finance.pojo.entity.ExpenseItemEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
|
@ -23,7 +21,7 @@ import java.time.LocalDateTime;
|
|||
@ToString
|
||||
@Accessors(chain = true)
|
||||
@TableName(value = "gds_goods", autoResultMap = true)
|
||||
public class GoodsEntity extends BaseEntity {
|
||||
public class GoodsEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
|
|
@ -36,12 +34,6 @@ public class GoodsEntity extends BaseEntity {
|
|||
*/
|
||||
private Long goodsCategoryId;
|
||||
|
||||
/**
|
||||
* 产品类型名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String goodsCategoryName;
|
||||
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
|
|
@ -84,13 +76,6 @@ public class GoodsEntity extends BaseEntity {
|
|||
*/
|
||||
private String memo;
|
||||
|
||||
/**
|
||||
* 关联收费项目信息(返回用)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private ExpenseItemEntity expenseItem;
|
||||
|
||||
|
||||
/**
|
||||
* 创建人 Id;sys_user.id
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
package com.njzscloud.dispose.goods.pojo.param;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 产品
|
||||
*
|
||||
* @author ljw
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class SearchGoodsParam {
|
||||
|
||||
/**
|
||||
* 产品类型 Id
|
||||
*/
|
||||
private Long goodsCategoryId;
|
||||
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
private String sn;
|
||||
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
private String goodsName;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
private String specParams;
|
||||
|
||||
/**
|
||||
* 是否可用;0-->否、1-->是
|
||||
*/
|
||||
private Boolean canuse;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,28 +1,79 @@
|
|||
package com.njzscloud.dispose.goods.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.dispose.goods.contant.BizType;
|
||||
import com.njzscloud.dispose.goods.mapper.GoodsCategoryMapper;
|
||||
import com.njzscloud.dispose.goods.pojo.entity.GoodsCategoryEntity;
|
||||
import com.njzscloud.dispose.goods.pojo.param.SearchGoodsCategoryParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品分类
|
||||
*
|
||||
* @author ljw
|
||||
*/
|
||||
public interface GoodsCategoryService extends IService<GoodsCategoryEntity> {
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class GoodsCategoryService extends ServiceImpl<GoodsCategoryMapper, GoodsCategoryEntity> {
|
||||
|
||||
void add(GoodsCategoryEntity goodsCategoryEntity);
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public void add(GoodsCategoryEntity goodsCategoryEntity) {
|
||||
this.save(goodsCategoryEntity);
|
||||
}
|
||||
|
||||
void modify(GoodsCategoryEntity goodsCategoryEntity);
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public void modify(GoodsCategoryEntity goodsCategoryEntity) {
|
||||
this.updateById(goodsCategoryEntity);
|
||||
}
|
||||
|
||||
void del(List<Long> ids);
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void del(List<Long> ids) {
|
||||
this.removeBatchByIds(ids);
|
||||
}
|
||||
|
||||
GoodsCategoryEntity detail(Long id);
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
public GoodsCategoryEntity detail(Long id) {
|
||||
return this.getById(id);
|
||||
}
|
||||
|
||||
PageResult<GoodsCategoryEntity> paging(PageParam pageParam, SearchGoodsCategoryParam searchGoodsCategoryParam);
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
public PageResult<GoodsCategoryEntity> paging(PageParam pageParam, SearchGoodsCategoryParam searchGoodsCategoryParam) {
|
||||
String categoryName = searchGoodsCategoryParam.getCategoryName();
|
||||
BizType bizType = searchGoodsCategoryParam.getBizType();
|
||||
LocalDateTime createTimeStart = searchGoodsCategoryParam.getCreateTimeStart();
|
||||
LocalDateTime createTimeEnd = searchGoodsCategoryParam.getCreateTimeEnd();
|
||||
|
||||
Page<GoodsCategoryEntity> page = this.page(pageParam.toPage(), Wrappers.lambdaQuery(GoodsCategoryEntity.class)
|
||||
.like(StrUtil.isNotBlank(categoryName), GoodsCategoryEntity::getCategoryName, categoryName)
|
||||
.eq(bizType != null, GoodsCategoryEntity::getBizType, bizType)
|
||||
.ge(createTimeStart != null, GoodsCategoryEntity::getCreateTime, createTimeStart)
|
||||
.le(createTimeEnd != null, GoodsCategoryEntity::getCreateTime, createTimeEnd)
|
||||
);
|
||||
return PageResult.of(page);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,32 +1,122 @@
|
|||
package com.njzscloud.dispose.goods.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
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.common.sn.support.SnUtil;
|
||||
import com.njzscloud.dispose.finance.constant.ExpenseItemCategory;
|
||||
import com.njzscloud.dispose.finance.pojo.entity.ExpenseItemEntity;
|
||||
import com.njzscloud.dispose.finance.pojo.param.AddExpenseItemParam;
|
||||
import com.njzscloud.dispose.finance.pojo.param.ModifyExpenseItemParam;
|
||||
import com.njzscloud.dispose.finance.service.ExpenseItemService;
|
||||
import com.njzscloud.dispose.goods.mapper.GoodsMapper;
|
||||
import com.njzscloud.dispose.goods.pojo.entity.GoodsEntity;
|
||||
import com.njzscloud.dispose.goods.pojo.param.AddGoodsParam;
|
||||
import com.njzscloud.dispose.goods.pojo.param.ModifyGoodsParam;
|
||||
import com.njzscloud.dispose.goods.pojo.param.SearchGoodsParam;
|
||||
import com.njzscloud.dispose.goods.pojo.result.SearchGoodsResult;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品
|
||||
*
|
||||
* @author ljw
|
||||
*/
|
||||
public interface GoodsService extends IService<GoodsEntity> {
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class GoodsService extends ServiceImpl<GoodsMapper, GoodsEntity> {
|
||||
|
||||
void add(AddGoodsParam addGoodsParam);
|
||||
private final ExpenseItemService expenseItemService;
|
||||
|
||||
void modify(ModifyGoodsParam modifyGoodsParam);
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void add(AddGoodsParam addGoodsParam) {
|
||||
String sn = SnUtil.next("Goods-SN");
|
||||
addGoodsParam.setSn(sn);
|
||||
GoodsEntity goodsEntity = BeanUtil.copyProperties(addGoodsParam, GoodsEntity.class);
|
||||
this.save(goodsEntity);
|
||||
// 付费项
|
||||
AddGoodsParam.ExpenseItem expenseItem = addGoodsParam.getExpenseItem();
|
||||
if (expenseItem == null) {
|
||||
return;
|
||||
}
|
||||
String goodsName = addGoodsParam.getGoodsName();
|
||||
AddExpenseItemParam addExpenseItemParam = BeanUtil.copyProperties(expenseItem, AddExpenseItemParam.class)
|
||||
.setGoodsId(goodsEntity.getId())
|
||||
.setExpenseItemName(goodsName)
|
||||
.setExpenseItemCategory(ExpenseItemCategory.ChanPin)
|
||||
.setMemo(goodsName + "费用配置");
|
||||
expenseItemService.add(addExpenseItemParam);
|
||||
}
|
||||
|
||||
void del(List<Long> ids);
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void modify(ModifyGoodsParam modifyGoodsParam) {
|
||||
GoodsEntity goodsEntity = BeanUtil.copyProperties(modifyGoodsParam, GoodsEntity.class).setSn(null);
|
||||
this.updateById(goodsEntity);
|
||||
// 付费项
|
||||
ModifyGoodsParam.ExpenseItem expenseItem = modifyGoodsParam.getExpenseItem();
|
||||
|
||||
SearchGoodsResult detail(Long id);
|
||||
String goodsName = modifyGoodsParam.getGoodsName();
|
||||
ModifyExpenseItemParam modifyExpenseItemParam = BeanUtil.copyProperties(expenseItem, ModifyExpenseItemParam.class)
|
||||
.setExpenseItemName(goodsName)
|
||||
.setMemo(goodsName + "费用配置");
|
||||
expenseItemService.modify(modifyExpenseItemParam);
|
||||
}
|
||||
|
||||
PageResult<SearchGoodsResult> paging(PageParam pageParam, GoodsEntity goodsEntity);
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void del(List<Long> ids) {
|
||||
// 删除产品
|
||||
this.removeBatchByIds(ids);
|
||||
// 删除对应的费用配置
|
||||
expenseItemService.remove(Wrappers.<ExpenseItemEntity>lambdaQuery()
|
||||
.in(ExpenseItemEntity::getGoodsId, ids));
|
||||
}
|
||||
|
||||
void enable(Long id, Boolean enable);
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
public SearchGoodsResult detail(Long id) {
|
||||
return baseMapper.detail(Wrappers.query().eq("a.id", id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
public PageResult<SearchGoodsResult> paging(PageParam pageParam, SearchGoodsParam goodsParam) {
|
||||
return PageResult.of(baseMapper.paging(pageParam.toPage(), Wrappers.query()
|
||||
.eq("a.deleted", Boolean.FALSE)
|
||||
.eq(goodsParam.getGoodsCategoryId() != null, "a.goods_category_id", goodsParam.getGoodsCategoryId())
|
||||
.like(StrUtil.isNotBlank(goodsParam.getSn()), "a.sn", goodsParam.getSn())
|
||||
.like(StrUtil.isNotBlank(goodsParam.getGoodsName()), "a.goods_name", goodsParam.getGoodsName())
|
||||
.like(StrUtil.isNotBlank(goodsParam.getSpecParams()), "a.spec_params", goodsParam.getSpecParams())
|
||||
.eq(goodsParam.getCanuse() != null, "a.canuse", goodsParam.getCanuse())
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用/禁用
|
||||
*/
|
||||
public void enable(Long id, Boolean enable) {
|
||||
this.updateById(new GoodsEntity()
|
||||
.setId(id)
|
||||
.setCanuse(enable)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,70 +0,0 @@
|
|||
package com.njzscloud.dispose.goods.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.dispose.goods.contant.BizType;
|
||||
import com.njzscloud.dispose.goods.mapper.GoodsCategoryMapper;
|
||||
import com.njzscloud.dispose.goods.pojo.entity.GoodsCategoryEntity;
|
||||
import com.njzscloud.dispose.goods.pojo.param.SearchGoodsCategoryParam;
|
||||
import com.njzscloud.dispose.goods.service.GoodsCategoryService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品分类
|
||||
*
|
||||
* @author ljw
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class GoodsCategoryServiceImpl extends ServiceImpl<GoodsCategoryMapper, GoodsCategoryEntity> implements GoodsCategoryService {
|
||||
|
||||
@Override
|
||||
public void add(GoodsCategoryEntity goodsCategoryEntity) {
|
||||
this.save(goodsCategoryEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify(GoodsCategoryEntity goodsCategoryEntity) {
|
||||
this.updateById(goodsCategoryEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void del(List<Long> ids) {
|
||||
this.removeBatchByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GoodsCategoryEntity detail(Long id) {
|
||||
return this.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<GoodsCategoryEntity> paging(PageParam pageParam, SearchGoodsCategoryParam searchGoodsCategoryParam) {
|
||||
String categoryName = searchGoodsCategoryParam.getCategoryName();
|
||||
BizType bizType = searchGoodsCategoryParam.getBizType();
|
||||
LocalDateTime createTimeStart = searchGoodsCategoryParam.getCreateTimeStart();
|
||||
LocalDateTime createTimeEnd = searchGoodsCategoryParam.getCreateTimeEnd();
|
||||
|
||||
Page<GoodsCategoryEntity> page = this.page(pageParam.toPage(), Wrappers.lambdaQuery(GoodsCategoryEntity.class)
|
||||
.like(StrUtil.isNotBlank(categoryName), GoodsCategoryEntity::getCategoryName, categoryName)
|
||||
.eq(bizType != null, GoodsCategoryEntity::getBizType, bizType)
|
||||
.ge(createTimeStart != null, GoodsCategoryEntity::getCreateTime, createTimeStart)
|
||||
.le(createTimeEnd != null, GoodsCategoryEntity::getCreateTime, createTimeEnd)
|
||||
);
|
||||
return PageResult.of(page);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
package com.njzscloud.dispose.goods.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
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.common.sn.support.SnUtil;
|
||||
import com.njzscloud.dispose.finance.constant.ExpenseItemCategory;
|
||||
import com.njzscloud.dispose.finance.pojo.entity.ExpenseItemEntity;
|
||||
import com.njzscloud.dispose.finance.pojo.param.AddExpenseItemParam;
|
||||
import com.njzscloud.dispose.finance.pojo.param.ModifyExpenseItemParam;
|
||||
import com.njzscloud.dispose.finance.service.ExpenseItemService;
|
||||
import com.njzscloud.dispose.goods.mapper.GoodsCategoryMapper;
|
||||
import com.njzscloud.dispose.goods.mapper.GoodsMapper;
|
||||
import com.njzscloud.dispose.goods.pojo.entity.GoodsEntity;
|
||||
import com.njzscloud.dispose.goods.pojo.param.AddGoodsParam;
|
||||
import com.njzscloud.dispose.goods.pojo.param.ModifyGoodsParam;
|
||||
import com.njzscloud.dispose.goods.pojo.result.SearchGoodsResult;
|
||||
import com.njzscloud.dispose.goods.service.GoodsService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品
|
||||
*
|
||||
* @author ljw
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, GoodsEntity> implements GoodsService {
|
||||
|
||||
private final ExpenseItemService expenseItemService;
|
||||
private final GoodsCategoryMapper goodsCategoryMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void add(AddGoodsParam addGoodsParam) {
|
||||
String sn = SnUtil.next("Goods-SN");
|
||||
addGoodsParam.setSn(sn);
|
||||
GoodsEntity goodsEntity = BeanUtil.copyProperties(addGoodsParam, GoodsEntity.class);
|
||||
this.save(goodsEntity);
|
||||
// 付费项
|
||||
AddGoodsParam.ExpenseItem expenseItem = addGoodsParam.getExpenseItem();
|
||||
if (expenseItem == null) {
|
||||
return;
|
||||
}
|
||||
String goodsName = addGoodsParam.getGoodsName();
|
||||
AddExpenseItemParam addExpenseItemParam = BeanUtil.copyProperties(expenseItem, AddExpenseItemParam.class)
|
||||
.setGoodsId(goodsEntity.getId())
|
||||
.setExpenseItemName(goodsName)
|
||||
.setExpenseItemCategory(ExpenseItemCategory.ChanPin)
|
||||
.setMemo(goodsName + "费用配置");
|
||||
expenseItemService.add(addExpenseItemParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void modify(ModifyGoodsParam modifyGoodsParam) {
|
||||
GoodsEntity goodsEntity = BeanUtil.copyProperties(modifyGoodsParam, GoodsEntity.class).setSn(null);
|
||||
this.updateById(goodsEntity);
|
||||
// 付费项
|
||||
ModifyGoodsParam.ExpenseItem expenseItem = modifyGoodsParam.getExpenseItem();
|
||||
|
||||
String goodsName = modifyGoodsParam.getGoodsName();
|
||||
ModifyExpenseItemParam modifyExpenseItemParam = BeanUtil.copyProperties(expenseItem, ModifyExpenseItemParam.class)
|
||||
.setExpenseItemName(goodsName)
|
||||
.setMemo(goodsName + "费用配置");
|
||||
expenseItemService.modify(modifyExpenseItemParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void del(List<Long> ids) {
|
||||
// 删除产品
|
||||
this.removeBatchByIds(ids);
|
||||
// 删除对应的费用配置
|
||||
expenseItemService.remove(Wrappers.<ExpenseItemEntity>lambdaQuery()
|
||||
.in(ExpenseItemEntity::getGoodsId, ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchGoodsResult detail(Long id) {
|
||||
return baseMapper.detail(Wrappers.query().eq("a.id", id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<SearchGoodsResult> paging(PageParam pageParam, GoodsEntity goodsEntity) {
|
||||
return PageResult.of(baseMapper.paging(pageParam.toPage(), Wrappers.query()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable(Long id, Boolean enable) {
|
||||
this.updateById(new GoodsEntity()
|
||||
.setId(id)
|
||||
.setCanuse(enable)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue