mirror of https://github.com/elunez/eladmin
新增物料信息
parent
ff5ec90246
commit
a7e80e0ed7
|
@ -48,9 +48,15 @@ public class MaterialCategoryController {
|
||||||
return new ResponseEntity(HttpStatus.OK);
|
return new ResponseEntity(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log("查询物料类别")
|
@Log("分页查询物料类别")
|
||||||
@GetMapping(value = "/queryMaterialCategoryPage")
|
@GetMapping(value = "/queryMaterialCategoryPage")
|
||||||
public ResponseEntity queryMaterialCategoryPage(MaterialCategoryDTO resources, Pageable pageable){
|
public ResponseEntity queryMaterialCategoryPage(MaterialCategoryDTO resources, Pageable pageable){
|
||||||
return new ResponseEntity(materialCategoryService.queryAll(resources,pageable),HttpStatus.OK);
|
return new ResponseEntity(materialCategoryService.queryAll(resources,pageable),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Log("查询物料类别")
|
||||||
|
@GetMapping(value = "/queryMaterialCategoryList")
|
||||||
|
public ResponseEntity queryMaterialCategoryList(MaterialCategoryDTO resources){
|
||||||
|
return new ResponseEntity(materialCategoryService.queryAll(resources),HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,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,15 @@ public class MaterialInfoController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MaterialInfoService materialInfoService;
|
private MaterialInfoService materialInfoService;
|
||||||
|
@Log("初始化物料资料编号")
|
||||||
|
@ApiOperation(value = "初始化物料资料编号")
|
||||||
|
@GetMapping(value = "/initMaterialInfoCode")
|
||||||
|
@PreAuthorize("hasAnyRole('ADMIN','BDSUPPLIERINFO_ALL','BDSUPPLIERINFO_SELECT')")
|
||||||
|
public ResponseEntity initMaterialInfoCode(){
|
||||||
|
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");//设置日期格式
|
||||||
|
String supplierCode = "WL"+ LocalDateTime.now().format(fmt);
|
||||||
|
return new ResponseEntity(supplierCode,HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
@Log("分页查询物料资料")
|
@Log("分页查询物料资料")
|
||||||
@ApiOperation(value = "分页查询物料资料")
|
@ApiOperation(value = "分页查询物料资料")
|
||||||
|
@ -58,14 +70,14 @@ public class MaterialInfoController {
|
||||||
@Log("删除物料资料")
|
@Log("删除物料资料")
|
||||||
@ApiOperation(value = "删除物料资料")
|
@ApiOperation(value = "删除物料资料")
|
||||||
@DeleteMapping(value = "/materialInfo/{id}")
|
@DeleteMapping(value = "/materialInfo/{id}")
|
||||||
public ResponseEntity delete(@PathVariable Integer id){
|
public ResponseEntity deleteMaterialInfoById(@PathVariable Integer id){
|
||||||
materialInfoService.delete(id);
|
materialInfoService.delete(id);
|
||||||
return new ResponseEntity(HttpStatus.OK);
|
return new ResponseEntity(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log("查看物料资料详情")
|
@Log("查看物料资料详情")
|
||||||
@GetMapping(value = "/materialInfo/{id}")
|
@GetMapping(value = "/materialInfo/{id}")
|
||||||
public ResponseEntity getMaterialInfo(@PathVariable Long id){
|
public ResponseEntity getMaterialInfoById(@PathVariable Long id){
|
||||||
return new ResponseEntity(materialInfoService.findById(id), HttpStatus.OK);
|
return new ResponseEntity(materialInfoService.findById(id), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -53,7 +53,7 @@ public class ProductInfoController {
|
||||||
|
|
||||||
@Log("查询产品资料列表")
|
@Log("查询产品资料列表")
|
||||||
@ApiOperation(value = "查询产品资料列表")
|
@ApiOperation(value = "查询产品资料列表")
|
||||||
@GetMapping(value = "/productInfo/all")
|
@GetMapping(value = "/queryProductInfoList")
|
||||||
public ResponseEntity queryProductInfoList(ProductInfoQueryCriteria criteria){
|
public ResponseEntity queryProductInfoList(ProductInfoQueryCriteria criteria){
|
||||||
return new ResponseEntity(productInfoService.queryAll(criteria),HttpStatus.OK);
|
return new ResponseEntity(productInfoService.queryAll(criteria),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,4 +17,6 @@ public interface MaterialCategoryService {
|
||||||
void delete(Long id);
|
void delete(Long id);
|
||||||
|
|
||||||
Object queryAll(MaterialCategoryDTO materialCategory, Pageable pageable);
|
Object queryAll(MaterialCategoryDTO materialCategory, Pageable pageable);
|
||||||
|
|
||||||
|
Object queryAll(MaterialCategoryDTO materialCategory);
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,4 +106,27 @@ public class MaterialCategoryServiceImpl implements MaterialCategoryService {
|
||||||
return PageUtil.toPage(page.map(materialCategoryMapper::toDto));
|
return PageUtil.toPage(page.map(materialCategoryMapper::toDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object queryAll(MaterialCategoryDTO materialCategory) {
|
||||||
|
Specification<MaterialCategory> specification = new Specification<MaterialCategory>() {
|
||||||
|
@Override
|
||||||
|
public Predicate toPredicate(Root<MaterialCategory> 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<MaterialCategory> materialCategoryList = materialCategoryRepository.findAll(specification);
|
||||||
|
return materialCategoryMapper.toDto(materialCategoryList);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue