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.PageParam;
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
import com.njzscloud.dispose.goods.pojo.entity.GoodsCategoryEntity;
|
import com.njzscloud.dispose.goods.pojo.entity.GoodsCategoryEntity;
|
||||||
|
import com.njzscloud.dispose.goods.pojo.param.SearchGoodsCategoryParam;
|
||||||
import com.njzscloud.dispose.goods.service.GoodsCategoryService;
|
import com.njzscloud.dispose.goods.service.GoodsCategoryService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -62,8 +63,8 @@ public class GoodsCategoryController {
|
||||||
* 分页查询
|
* 分页查询
|
||||||
*/
|
*/
|
||||||
@GetMapping("/paging")
|
@GetMapping("/paging")
|
||||||
public R<PageResult<GoodsCategoryEntity>> paging(PageParam pageParam, GoodsCategoryEntity goodsCategoryEntity) {
|
public R<PageResult<GoodsCategoryEntity>> paging(PageParam pageParam, SearchGoodsCategoryParam searchGoodsCategoryParam) {
|
||||||
return R.success(goodsCategoryService.paging(pageParam, goodsCategoryEntity));
|
return R.success(goodsCategoryService.paging(pageParam, searchGoodsCategoryParam));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 产品
|
* 产品
|
||||||
|
*
|
||||||
* @author ljw
|
* @author ljw
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
@ -60,6 +61,18 @@ public class GoodsController {
|
||||||
return R.success(goodsService.detail(id));
|
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;
|
package com.njzscloud.dispose.goods.pojo.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.njzscloud.dispose.common.pojo.entity.BaseEntity;
|
import com.njzscloud.dispose.common.pojo.entity.BaseEntity;
|
||||||
import com.njzscloud.dispose.goods.contant.BizType;
|
import com.njzscloud.dispose.goods.contant.BizType;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
@ -9,8 +8,11 @@ import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 产品分类
|
* 产品分类
|
||||||
|
*
|
||||||
* @author ljw
|
* @author ljw
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
|
|
@ -19,14 +21,16 @@ import lombok.experimental.Accessors;
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName(value = "gds_goods_category", autoResultMap = true)
|
@TableName(value = "gds_goods_category", autoResultMap = true)
|
||||||
public class GoodsCategoryEntity extends BaseEntity {
|
public class GoodsCategoryEntity extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务类型;字典代码:biz_type
|
* 业务类型;字典代码:biz_type
|
||||||
*/
|
*/
|
||||||
private String bizType;
|
private BizType bizType;
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private String bizTypeName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分类名称
|
* 分类名称
|
||||||
|
|
@ -43,19 +47,35 @@ public class GoodsCategoryEntity extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
public String getBizTypeName() {
|
/**
|
||||||
if (bizType == null) {
|
* 创建人 Id;sys_user.id
|
||||||
return null;
|
*/
|
||||||
}
|
@TableField(fill = FieldFill.INSERT)
|
||||||
for (BizType type : BizType.values()) {
|
private Long creatorId;
|
||||||
if (type.getVal().equals(bizType)) {
|
|
||||||
bizTypeName = type.getTxt();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bizTypeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人 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;
|
package com.njzscloud.dispose.goods.pojo.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.njzscloud.common.core.ienum.DictItem;
|
import com.njzscloud.common.core.ienum.DictItem;
|
||||||
import com.njzscloud.common.core.ienum.DictKey;
|
import com.njzscloud.common.core.ienum.DictKey;
|
||||||
import com.njzscloud.common.mp.support.handler.j.DictItemTypeHandler;
|
import com.njzscloud.common.mp.support.handler.j.DictItemTypeHandler;
|
||||||
|
|
@ -12,6 +11,8 @@ import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 产品
|
* 产品
|
||||||
*
|
*
|
||||||
|
|
@ -24,6 +25,12 @@ import lombok.experimental.Accessors;
|
||||||
@TableName(value = "gds_goods", autoResultMap = true)
|
@TableName(value = "gds_goods", autoResultMap = true)
|
||||||
public class GoodsEntity extends BaseEntity {
|
public class GoodsEntity extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 产品类型 Id
|
* 产品类型 Id
|
||||||
*/
|
*/
|
||||||
|
|
@ -83,6 +90,36 @@ public class GoodsEntity extends BaseEntity {
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private ExpenseItemEntity expenseItem;
|
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.PageParam;
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
import com.njzscloud.dispose.goods.pojo.entity.GoodsCategoryEntity;
|
import com.njzscloud.dispose.goods.pojo.entity.GoodsCategoryEntity;
|
||||||
|
import com.njzscloud.dispose.goods.pojo.param.SearchGoodsCategoryParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -21,7 +22,7 @@ public interface GoodsCategoryService extends IService<GoodsCategoryEntity> {
|
||||||
|
|
||||||
GoodsCategoryEntity detail(Long id);
|
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);
|
GoodsEntity detail(Long id);
|
||||||
|
|
||||||
PageResult<GoodsEntity> paging(PageParam pageParam, GoodsEntity goodsEntity);
|
PageResult<GoodsEntity> paging(PageParam pageParam, GoodsEntity goodsEntity);
|
||||||
|
|
||||||
|
void enable(Long id, Boolean enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,22 @@
|
||||||
package com.njzscloud.dispose.goods.service.impl;
|
package com.njzscloud.dispose.goods.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njzscloud.common.mp.support.PageParam;
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
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.mapper.GoodsCategoryMapper;
|
||||||
import com.njzscloud.dispose.goods.pojo.entity.GoodsCategoryEntity;
|
import com.njzscloud.dispose.goods.pojo.entity.GoodsCategoryEntity;
|
||||||
|
import com.njzscloud.dispose.goods.pojo.param.SearchGoodsCategoryParam;
|
||||||
import com.njzscloud.dispose.goods.service.GoodsCategoryService;
|
import com.njzscloud.dispose.goods.service.GoodsCategoryService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -46,8 +51,19 @@ public class GoodsCategoryServiceImpl extends ServiceImpl<GoodsCategoryMapper, G
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<GoodsCategoryEntity> paging(PageParam pageParam, GoodsCategoryEntity goodsCategoryEntity) {
|
public PageResult<GoodsCategoryEntity> paging(PageParam pageParam, SearchGoodsCategoryParam searchGoodsCategoryParam) {
|
||||||
return PageResult.of(this.page(pageParam.toPage(), Wrappers.query(goodsCategoryEntity)));
|
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);
|
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