mirror of https://github.com/elunez/eladmin
产品类别
parent
5b5e494524
commit
b27df38006
|
@ -58,9 +58,16 @@ public class MeasureUnitController {
|
||||||
return new ResponseEntity(HttpStatus.OK);
|
return new ResponseEntity(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log("查询计量单位")
|
@Log("分页查询计量单位")
|
||||||
@GetMapping(value = "/measureUnit")
|
@GetMapping(value = "/queryMeasureUnitPage")
|
||||||
public ResponseEntity getMessureUnits(MeasureUnitDTO resources, Pageable pageable){
|
public ResponseEntity queryMeasureUnitPage(MeasureUnitDTO resources, Pageable pageable){
|
||||||
return new ResponseEntity(measureUnitService.queryAll(resources,pageable),HttpStatus.OK);
|
return new ResponseEntity(measureUnitService.queryAll(resources,pageable),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Log("查询所有计量单位")
|
||||||
|
@GetMapping(value = "/queryMeasureUnitList")
|
||||||
|
public ResponseEntity queryMeasureUnitList(MeasureUnitDTO resources){
|
||||||
|
return new ResponseEntity(measureUnitService.queryAll(resources),HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,9 +48,15 @@ public class ProductCategoryController {
|
||||||
return new ResponseEntity(HttpStatus.OK);
|
return new ResponseEntity(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log("查询产品类别")
|
@Log("查询产品类别列表")
|
||||||
@GetMapping(value = "/productCategory")
|
@GetMapping(value = "/queryProductCategoryList")
|
||||||
public ResponseEntity getDicts(ProductCategoryDTO resources, Pageable pageable){
|
public ResponseEntity queryProductCategoryList(ProductCategoryDTO resources, Pageable pageable){
|
||||||
|
return new ResponseEntity(productCategoryService.queryAll(resources,pageable),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log("分页查询产品类别")
|
||||||
|
@GetMapping(value = "/queryProductCategoryPage")
|
||||||
|
public ResponseEntity queryProductCategoryPage(ProductCategoryDTO resources, Pageable pageable){
|
||||||
return new ResponseEntity(productCategoryService.queryAll(resources,pageable),HttpStatus.OK);
|
return new ResponseEntity(productCategoryService.queryAll(resources,pageable),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,9 @@ import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 黄星星
|
* @author 黄星星
|
||||||
* @date 2019-07-27
|
* @date 2019-07-27
|
||||||
|
@ -25,6 +28,19 @@ public class ProductInfoController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProductInfoService productInfoService;
|
private ProductInfoService productInfoService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Log("初始化产品编号")
|
||||||
|
@ApiOperation(value = "初始化产品编号")
|
||||||
|
@GetMapping(value = "/initProductInfoCode")
|
||||||
|
@PreAuthorize("hasAnyRole('ADMIN','BDSUPPLIERINFO_ALL','BDSUPPLIERINFO_SELECT')")
|
||||||
|
public ResponseEntity initProductInfoCode(){
|
||||||
|
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");//设置日期格式
|
||||||
|
String supplierCode = "CP"+ LocalDateTime.now().format(fmt);
|
||||||
|
return new ResponseEntity(supplierCode,HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Log("分页查询产品资料")
|
@Log("分页查询产品资料")
|
||||||
@ApiOperation(value = "分页查询产品资料")
|
@ApiOperation(value = "分页查询产品资料")
|
||||||
@GetMapping(value = "/productInfo")
|
@GetMapping(value = "/productInfo")
|
||||||
|
|
|
@ -19,4 +19,6 @@ public interface MeasureUnitService {
|
||||||
void delete(Long id);
|
void delete(Long id);
|
||||||
|
|
||||||
Object queryAll(MeasureUnitDTO measureUnit, Pageable pageable);
|
Object queryAll(MeasureUnitDTO measureUnit, Pageable pageable);
|
||||||
|
|
||||||
|
Object queryAll(MeasureUnitDTO measureUnit);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,4 +17,6 @@ public interface ProductCategoryService {
|
||||||
void delete(Long id);
|
void delete(Long id);
|
||||||
|
|
||||||
Object queryAll(ProductCategoryDTO productCategory, Pageable pageable);
|
Object queryAll(ProductCategoryDTO productCategory, Pageable pageable);
|
||||||
|
|
||||||
|
Object queryAll(ProductCategoryDTO productCategory);
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,4 +134,28 @@ public class MeasureUnitServiceImpl implements MeasureUnitService {
|
||||||
return PageUtil.toPage(page.map(measureUnitMapper::toDto));
|
return PageUtil.toPage(page.map(measureUnitMapper::toDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object queryAll(MeasureUnitDTO measureUnit) {
|
||||||
|
Specification<MeasureUnit> specification = new Specification<MeasureUnit>() {
|
||||||
|
@Override
|
||||||
|
public Predicate toPredicate(Root<MeasureUnit> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
|
||||||
|
|
||||||
|
List<Predicate> targetPredicateList = new ArrayList<>();
|
||||||
|
|
||||||
|
//状态
|
||||||
|
Predicate statusPredicate = criteriaBuilder.equal(root.get("status"), 1);
|
||||||
|
targetPredicateList.add(statusPredicate);
|
||||||
|
|
||||||
|
if(CollectionUtils.isEmpty(targetPredicateList)){
|
||||||
|
return null;
|
||||||
|
}else{
|
||||||
|
return criteriaBuilder.and(targetPredicateList.toArray(new Predicate[targetPredicateList.size()]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
List<MeasureUnit> measureUnitList = measureUnitRepository.findAll(specification);
|
||||||
|
return measureUnitMapper.toDto(measureUnitList);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,4 +103,27 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
|
||||||
return PageUtil.toPage(page.map(productCategoryMapper::toDto));
|
return PageUtil.toPage(page.map(productCategoryMapper::toDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object queryAll(ProductCategoryDTO productCategory) {
|
||||||
|
Specification<ProductCategory> specification = new Specification<ProductCategory>() {
|
||||||
|
@Override
|
||||||
|
public Predicate toPredicate(Root<ProductCategory> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
|
||||||
|
|
||||||
|
List<Predicate> targetPredicateList = new ArrayList<>();
|
||||||
|
|
||||||
|
//状态
|
||||||
|
Predicate statusPredicate = criteriaBuilder.equal(root.get("status"), 1);
|
||||||
|
targetPredicateList.add(statusPredicate);
|
||||||
|
|
||||||
|
if(CollectionUtils.isEmpty(targetPredicateList)){
|
||||||
|
return null;
|
||||||
|
}else{
|
||||||
|
return criteriaBuilder.and(targetPredicateList.toArray(new Predicate[targetPredicateList.size()]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
List<ProductCategory> productCategoryList = productCategoryRepository.findAll(specification);
|
||||||
|
return productCategoryMapper.toDto(productCategoryList);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue