master
parent
c8858b57dd
commit
f0e5dda619
|
|
@ -4,6 +4,7 @@ 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.GoodsCategoryEntity;
|
||||
import com.njzscloud.dispose.goods.pojo.param.SearchGoodsCategoryParam;
|
||||
import com.njzscloud.dispose.goods.service.GoodsCategoryService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -62,8 +63,8 @@ public class GoodsCategoryController {
|
|||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/paging")
|
||||
public R<PageResult<GoodsCategoryEntity>> paging(PageParam pageParam, GoodsCategoryEntity goodsCategoryEntity) {
|
||||
return R.success(goodsCategoryService.paging(pageParam, goodsCategoryEntity));
|
||||
public R<PageResult<GoodsCategoryEntity>> paging(PageParam pageParam, SearchGoodsCategoryParam searchGoodsCategoryParam) {
|
||||
return R.success(goodsCategoryService.paging(pageParam, searchGoodsCategoryParam));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 产品
|
||||
*
|
||||
* @author ljw
|
||||
*/
|
||||
@Slf4j
|
||||
|
|
@ -60,6 +61,18 @@ public class GoodsController {
|
|||
return R.success(goodsService.detail(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/enable")
|
||||
public R<?> enable(
|
||||
@RequestParam("id") Long id,
|
||||
@RequestParam("enable") Boolean enable
|
||||
) {
|
||||
goodsService.enable(id, enable);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.njzscloud.dispose.goods.pojo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.njzscloud.dispose.common.pojo.entity.BaseEntity;
|
||||
import com.njzscloud.dispose.goods.contant.BizType;
|
||||
import lombok.Getter;
|
||||
|
|
@ -9,8 +8,11 @@ import lombok.Setter;
|
|||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 产品分类
|
||||
*
|
||||
* @author ljw
|
||||
*/
|
||||
@Getter
|
||||
|
|
@ -19,14 +21,16 @@ import lombok.experimental.Accessors;
|
|||
@Accessors(chain = true)
|
||||
@TableName(value = "gds_goods_category", autoResultMap = true)
|
||||
public class GoodsCategoryEntity extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 业务类型;字典代码:biz_type
|
||||
*/
|
||||
private String bizType;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String bizTypeName;
|
||||
private BizType bizType;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
|
|
@ -43,19 +47,35 @@ public class GoodsCategoryEntity extends BaseEntity {
|
|||
*/
|
||||
private Integer sort;
|
||||
|
||||
public String getBizTypeName() {
|
||||
if (bizType == null) {
|
||||
return null;
|
||||
}
|
||||
for (BizType type : BizType.values()) {
|
||||
if (type.getVal().equals(bizType)) {
|
||||
bizTypeName = type.getTxt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return bizTypeName;
|
||||
}
|
||||
/**
|
||||
* 创建人 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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.njzscloud.dispose.goods.pojo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
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;
|
||||
|
|
@ -12,6 +11,8 @@ import lombok.Setter;
|
|||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 产品
|
||||
*
|
||||
|
|
@ -24,6 +25,12 @@ import lombok.experimental.Accessors;
|
|||
@TableName(value = "gds_goods", autoResultMap = true)
|
||||
public class GoodsEntity extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 产品类型 Id
|
||||
*/
|
||||
|
|
@ -83,6 +90,36 @@ public class GoodsEntity extends BaseEntity {
|
|||
@TableField(exist = false)
|
||||
private ExpenseItemEntity expenseItem;
|
||||
|
||||
|
||||
/**
|
||||
* 创建人 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,38 @@
|
|||
package com.njzscloud.dispose.goods.pojo.param;
|
||||
|
||||
import com.njzscloud.dispose.goods.contant.BizType;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 产品分类
|
||||
*
|
||||
* @author ljw
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class SearchGoodsCategoryParam {
|
||||
|
||||
/**
|
||||
* 业务类型;字典代码:biz_type
|
||||
*/
|
||||
private BizType bizType;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
private String categoryName;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTimeStart;
|
||||
private LocalDateTime createTimeEnd;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
import com.njzscloud.common.mp.support.PageParam;
|
||||
import com.njzscloud.common.mp.support.PageResult;
|
||||
import com.njzscloud.dispose.goods.pojo.entity.GoodsCategoryEntity;
|
||||
import com.njzscloud.dispose.goods.pojo.param.SearchGoodsCategoryParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -21,7 +22,7 @@ public interface GoodsCategoryService extends IService<GoodsCategoryEntity> {
|
|||
|
||||
GoodsCategoryEntity detail(Long id);
|
||||
|
||||
PageResult<GoodsCategoryEntity> paging(PageParam pageParam, GoodsCategoryEntity goodsCategoryEntity);
|
||||
PageResult<GoodsCategoryEntity> paging(PageParam pageParam, SearchGoodsCategoryParam searchGoodsCategoryParam);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ public interface GoodsService extends IService<GoodsEntity> {
|
|||
GoodsEntity detail(Long id);
|
||||
|
||||
PageResult<GoodsEntity> paging(PageParam pageParam, GoodsEntity goodsEntity);
|
||||
|
||||
void enable(Long id, Boolean enable);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,22 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
|
|
@ -46,8 +51,19 @@ public class GoodsCategoryServiceImpl extends ServiceImpl<GoodsCategoryMapper, G
|
|||
}
|
||||
|
||||
@Override
|
||||
public PageResult<GoodsCategoryEntity> paging(PageParam pageParam, GoodsCategoryEntity goodsCategoryEntity) {
|
||||
return PageResult.of(this.page(pageParam.toPage(), Wrappers.query(goodsCategoryEntity)));
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -105,6 +105,14 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, GoodsEntity> impl
|
|||
}
|
||||
return PageResult.of(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable(Long id, Boolean enable) {
|
||||
this.updateById(new GoodsEntity()
|
||||
.setId(id)
|
||||
.setCanuse(enable)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue