localizer
parent
77fcdad50f
commit
41337d5db1
|
|
@ -6,6 +6,7 @@ import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
import org.simpleframework.xml.Transient;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
@ -26,6 +27,11 @@ public class GoodsInfoEntity {
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
private String goodsCategoryId;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String goodsCategoryName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 产品名称
|
* 产品名称
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,18 @@
|
||||||
package com.njzscloud.supervisory.goods.service;
|
package com.njzscloud.supervisory.goods.service;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
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.supervisory.goods.mapper.GoodsInfoMapper;
|
import com.njzscloud.supervisory.goods.mapper.GoodsInfoMapper;
|
||||||
|
import com.njzscloud.supervisory.goods.pojo.entity.GoodsCategoryEntity;
|
||||||
import com.njzscloud.supervisory.goods.pojo.entity.GoodsInfoEntity;
|
import com.njzscloud.supervisory.goods.pojo.entity.GoodsInfoEntity;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.ehcache.shadow.org.terracotta.offheapstore.paging.Page;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
|
@ -21,6 +25,9 @@ import java.util.List;
|
||||||
@Service
|
@Service
|
||||||
public class GoodsInfoService extends ServiceImpl<GoodsInfoMapper, GoodsInfoEntity> implements IService<GoodsInfoEntity> {
|
public class GoodsInfoService extends ServiceImpl<GoodsInfoMapper, GoodsInfoEntity> implements IService<GoodsInfoEntity> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private GoodsCategoryService goodsCategoryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增
|
* 新增
|
||||||
*/
|
*/
|
||||||
|
|
@ -47,16 +54,37 @@ public class GoodsInfoService extends ServiceImpl<GoodsInfoMapper, GoodsInfoEnti
|
||||||
* 详情
|
* 详情
|
||||||
*/
|
*/
|
||||||
public GoodsInfoEntity detail(Long id) {
|
public GoodsInfoEntity detail(Long id) {
|
||||||
return this.getById(id);
|
GoodsInfoEntity entity = this.getById(id);
|
||||||
|
if (null != entity) {
|
||||||
|
GoodsCategoryEntity categoryEntity = goodsCategoryService.detail(Long.valueOf(entity.getGoodsCategoryId()));
|
||||||
|
if (null != categoryEntity) {
|
||||||
|
entity.setGoodsCategoryName(categoryEntity.getCategoryName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
*/
|
*/
|
||||||
public PageResult<GoodsInfoEntity> paging(PageParam pageParam, GoodsInfoEntity goodsInfoEntity) {
|
public PageResult<GoodsInfoEntity> paging(PageParam pageParam, GoodsInfoEntity goodsInfoEntity) {
|
||||||
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<GoodsInfoEntity>lambdaQuery()
|
String strategy = "";
|
||||||
|
if (null != goodsInfoEntity.getMoneyStrategy()) {
|
||||||
|
strategy = goodsInfoEntity.getMoneyStrategy().getVal();
|
||||||
|
}
|
||||||
|
IPage<GoodsInfoEntity> page = this.page(pageParam.toPage(), Wrappers.<GoodsInfoEntity>lambdaQuery()
|
||||||
.like(StrUtil.isNotBlank(goodsInfoEntity.getGoodsName()), GoodsInfoEntity::getGoodsName,
|
.like(StrUtil.isNotBlank(goodsInfoEntity.getGoodsName()), GoodsInfoEntity::getGoodsName,
|
||||||
goodsInfoEntity.getGoodsName())));
|
goodsInfoEntity.getGoodsName())
|
||||||
|
.eq(StrUtil.isNotBlank(strategy), GoodsInfoEntity::getMoneyStrategy, strategy)
|
||||||
|
.eq(StrUtil.isNotBlank(goodsInfoEntity.getGoodsCategoryId()), GoodsInfoEntity::getGoodsCategoryId,
|
||||||
|
goodsInfoEntity.getGoodsCategoryId()));
|
||||||
|
for (GoodsInfoEntity entity: page.getRecords()) {
|
||||||
|
GoodsCategoryEntity categoryEntity = goodsCategoryService.getById(entity.getGoodsCategoryId());
|
||||||
|
if (null != categoryEntity) {
|
||||||
|
entity.setGoodsCategoryName(categoryEntity.getCategoryName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PageResult.of(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue