权限guanli

pull/451/head
starrysky 2020-02-29 02:49:33 +08:00
parent 4599771f74
commit 5838787b28
10 changed files with 58 additions and 11 deletions

View File

@ -28,7 +28,7 @@ public class ConsumablesInfoController {
@Log("分页查询耗材列表")
@ApiOperation(value = "分页查询耗材列表")
@GetMapping(value = "/queryConsumablesInfoPageList")
@PreAuthorize("hasAnyRole('ADMIN','BDCONSUMABLESINFO_ALL','BDCONSUMABLESINFO_SELECT')")
@PreAuthorize("hasAnyRole('ADMIN','CONSUMABLES_INFO_ALL','CONSUMABLES_INFO_SELECT')")
public ResponseEntity queryConsumablesInfoPageList(ConsumablesInfoQueryCriteria criteria, Pageable pageable){
return new ResponseEntity(consumablesInfoService.queryAll(criteria,pageable),HttpStatus.OK);
}
@ -36,7 +36,7 @@ public class ConsumablesInfoController {
@Log("分页查询耗材列表")
@ApiOperation(value = "分页查询耗材列表")
@GetMapping(value = "/queryConsumablesInfoList")
@PreAuthorize("hasAnyRole('ADMIN','BDCONSUMABLESINFO_ALL','BDCONSUMABLESINFO_SELECT')")
@PreAuthorize("hasAnyRole('ADMIN','CONSUMABLES_INFO_ALL','CONSUMABLES_INFO_SELECT')")
public ResponseEntity queryConsumablesInfoList(ConsumablesInfoQueryCriteria criteria, Pageable pageable){
return new ResponseEntity(consumablesInfoService.queryAll(criteria,pageable),HttpStatus.OK);
}
@ -44,7 +44,7 @@ public class ConsumablesInfoController {
@Log("新增耗材")
@ApiOperation(value = "新增耗材")
@PostMapping(value = "/consumablesInfo")
@PreAuthorize("hasAnyRole('ADMIN','BDCONSUMABLESINFO_ALL','BDCONSUMABLESINFO_CREATE')")
@PreAuthorize("hasAnyRole('ADMIN','BCONSUMABLES_INFO_ALL','CONSUMABLES_INFO_CREATE')")
public ResponseEntity create(@Validated @RequestBody ConsumablesInfo resources){
return new ResponseEntity(consumablesInfoService.create(resources),HttpStatus.CREATED);
}
@ -52,7 +52,7 @@ public class ConsumablesInfoController {
@Log("修改耗材信息")
@ApiOperation(value = "修改耗材信息")
@PutMapping(value = "/consumablesInfo")
@PreAuthorize("hasAnyRole('ADMIN','BDCONSUMABLESINFO_ALL','BDCONSUMABLESINFO_EDIT')")
@PreAuthorize("hasAnyRole('ADMIN','CONSUMABLES_INFO_ALL','CONSUMABLES_INFO_EDIT')")
public ResponseEntity update(@Validated @RequestBody ConsumablesInfo resources){
consumablesInfoService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);
@ -61,7 +61,7 @@ public class ConsumablesInfoController {
@Log("删除耗材")
@ApiOperation(value = "删除耗材")
@DeleteMapping(value = "/consumablesInfo/{id}")
@PreAuthorize("hasAnyRole('ADMIN','BDCONSUMABLESINFO_ALL','BDCONSUMABLESINFO_DELETE')")
@PreAuthorize("hasAnyRole('ADMIN','CONSUMABLES_INFO_ALL','CONSUMABLES_INFO_DELETE')")
public ResponseEntity delete(@PathVariable Long id){
consumablesInfoService.delete(id);
return new ResponseEntity(HttpStatus.OK);
@ -69,6 +69,7 @@ public class ConsumablesInfoController {
@Log("查看耗材详情")
@GetMapping(value = "/consumablesInfo/{id}")
@PreAuthorize("hasAnyRole('ADMIN','CONSUMABLES_INFO_ALL','CONSUMABLES_INFO_DETAIL_BY_ID')")
public ResponseEntity getConsumablesInfo(@PathVariable Long id){
return new ResponseEntity(consumablesInfoService.findById(id), HttpStatus.OK);
}

View File

@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -28,6 +29,7 @@ public class IncomeCategoryController {
@Log("新增收入分类")
@PostMapping(value = "/incomeCategory")
@PreAuthorize("hasAnyRole('ADMIN','INCOME_CATEGORY_ALL','INCOME_CATEGORY_CREATE')")
public ResponseEntity create(@Validated @RequestBody IncomeCategory resources){
if (resources.getId() != null) {
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
@ -37,12 +39,14 @@ public class IncomeCategoryController {
@Log("查看收入分类详情")
@GetMapping(value = "/incomeCategory/{id}")
@PreAuthorize("hasAnyRole('ADMIN','INCOME_CATEGORY_ALL','INCOME_CATEGORY_DETAIL_BY_ID')")
public ResponseEntity getIncomeCategory(@PathVariable Long id){
return new ResponseEntity(incomeCategoryService.findById(id), HttpStatus.OK);
}
@Log("删除收入分类")
@DeleteMapping(value = "/incomeCategory/{id}")
@PreAuthorize("hasAnyRole('ADMIN','INCOME_CATEGORY_ALL','INCOME_CATEGORY_DELETE')")
public ResponseEntity delete(@PathVariable Long id){
incomeCategoryService.delete(id);
return new ResponseEntity(HttpStatus.OK);
@ -50,6 +54,7 @@ public class IncomeCategoryController {
@Log("分页查询收入分类")
@GetMapping(value = "/queryIncomeCategoryPage")
@PreAuthorize("hasAnyRole('ADMIN','INCOME_CATEGORY_ALL','INCOME_CATEGORY_SELECT')")
public ResponseEntity queryIncomeCategoryPage(IncomeCategoryDTO resources, Pageable pageable){
return new ResponseEntity(incomeCategoryService.queryAll(resources,pageable),HttpStatus.OK);
}

View File

@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -28,6 +29,7 @@ public class MaterialCategoryController {
@Log("新增物料类别")
@PostMapping(value = "/materialCategory")
@PreAuthorize("hasAnyRole('ADMIN','MATERIAL_CATEGORY_ALL','MATERIAL_CATEGORY_CREATE')")
public ResponseEntity create(@Validated @RequestBody MaterialCategory resources){
if (resources.getId() != null) {
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
@ -37,12 +39,14 @@ public class MaterialCategoryController {
@Log("查看物料类别")
@GetMapping(value = "/materialCategory/{id}")
@PreAuthorize("hasAnyRole('ADMIN','MATERIAL_CATEGORY_ALL','MATERIAL_CATEGORY_DETAIL_BY_ID')")
public ResponseEntity getMessureUnit(@PathVariable Long id){
return new ResponseEntity(materialCategoryService.findById(id), HttpStatus.OK);
}
@Log("删除物料类别")
@DeleteMapping(value = "/materialCategory/{id}")
@PreAuthorize("hasAnyRole('ADMIN','MATERIAL_CATEGORY_ALL','MATERIAL_CATEGORY_DELETE')")
public ResponseEntity delete(@PathVariable Long id){
materialCategoryService.delete(id);
return new ResponseEntity(HttpStatus.OK);
@ -50,12 +54,14 @@ public class MaterialCategoryController {
@Log("分页查询物料类别")
@GetMapping(value = "/queryMaterialCategoryPage")
@PreAuthorize("hasAnyRole('ADMIN','MATERIAL_CATEGORY_ALL','MATERIAL_CATEGORY_SELECT')")
public ResponseEntity queryMaterialCategoryPage(MaterialCategoryDTO resources, Pageable pageable){
return new ResponseEntity(materialCategoryService.queryAll(resources,pageable),HttpStatus.OK);
}
@Log("查询物料类别")
@GetMapping(value = "/queryMaterialCategoryList")
@PreAuthorize("hasAnyRole('ADMIN','MATERIAL_CATEGORY_ALL','MATERIAL_CATEGORY_SELECT')")
public ResponseEntity queryMaterialCategoryList(MaterialCategoryDTO resources){
return new ResponseEntity(materialCategoryService.queryAll(resources),HttpStatus.OK);
}

View File

@ -32,7 +32,6 @@ public class MaterialInfoController {
@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);
@ -42,6 +41,7 @@ public class MaterialInfoController {
@Log("分页查询物料资料")
@ApiOperation(value = "分页查询物料资料")
@GetMapping(value = "/queryMaterialInfoPage")
@PreAuthorize("hasAnyRole('ADMIN','MATERIAL_INFO_ALL','MATERIAL_INFO_SELECT')")
public ResponseEntity queryMaterialInfoPage(MaterialInfoQueryCriteria criteria, Pageable pageable){
return new ResponseEntity(materialInfoService.queryAll(criteria,pageable),HttpStatus.OK);
}
@ -49,6 +49,7 @@ public class MaterialInfoController {
@Log("查询所有物料资料")
@ApiOperation(value = "查询所有物料资料")
@GetMapping(value = "/queryMaterialInfoList")
@PreAuthorize("hasAnyRole('ADMIN','MATERIAL_INFO_ALL','MATERIAL_INFO_SELECT')")
public ResponseEntity queryMaterialInfoList(MaterialInfoQueryCriteria criteria){
return new ResponseEntity(materialInfoService.queryAll(criteria),HttpStatus.OK);
}
@ -56,6 +57,7 @@ public class MaterialInfoController {
@Log("新增物料资料")
@ApiOperation(value = "新增物料资料")
@PostMapping(value = "/materialInfo")
@PreAuthorize("hasAnyRole('ADMIN','MATERIAL_INFO_ALL','MATERIAL_INFO_CREATE')")
public ResponseEntity create(@RequestBody CreateMaterialInfoRequest createMaterialInfoRequest){
return new ResponseEntity(materialInfoService.create(createMaterialInfoRequest),HttpStatus.CREATED);
}
@ -63,6 +65,7 @@ public class MaterialInfoController {
@Log("修改物料资料")
@ApiOperation(value = "修改物料资料")
@PutMapping(value = "/materialInfo/update")
@PreAuthorize("hasAnyRole('ADMIN','MATERIAL_INFO_ALL','MATERIAL_INFO_EIDT')")
public ResponseEntity update(@RequestBody UpdateMaterialInfoRequest updateMaterialInfoRequest){
materialInfoService.update(updateMaterialInfoRequest);
return new ResponseEntity(HttpStatus.NO_CONTENT);
@ -71,6 +74,7 @@ public class MaterialInfoController {
@Log("删除物料资料")
@ApiOperation(value = "删除物料资料")
@DeleteMapping(value = "/materialInfo/{id}")
@PreAuthorize("hasAnyRole('ADMIN','MATERIAL_INFO_ALL','MATERIAL_INFO_DELETE')")
public ResponseEntity deleteMaterialInfoById(@PathVariable Integer id){
materialInfoService.delete(id);
return new ResponseEntity(HttpStatus.OK);
@ -78,6 +82,7 @@ public class MaterialInfoController {
@Log("查看物料资料详情")
@GetMapping(value = "/materialInfo/{id}")
@PreAuthorize("hasAnyRole('ADMIN','MATERIAL_INFO_ALL','MATERIAL_INFO_DETAIL_BY_IDD')")
public ResponseEntity getMaterialInfoById(@PathVariable Long id){
return new ResponseEntity(materialInfoService.findById(id), HttpStatus.OK);
}

View File

@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -29,6 +30,7 @@ public class MeasureUnitController {
@Log("新增计量单位")
@PostMapping(value = "/measureUnit")
@PreAuthorize("hasAnyRole('ADMIN','MEASUREE_UNIT_ALL','MEASUREE_UNIT_CREATE')")
public ResponseEntity create(@Validated @RequestBody MeasureUnit resources){
if (resources.getId() != null) {
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
@ -38,6 +40,7 @@ public class MeasureUnitController {
@Log("修改计量单位")
@PostMapping(value = "/measureUnit/update")
@PreAuthorize("hasAnyRole('ADMIN','MEASUREE_UNIT_ALL','MEASUREE_UNIT_EDIT')")
public ResponseEntity updateMeasureUnit(@RequestBody MeasureUnit resources){
if (resources.getId() == null) {
throw new BadRequestException("主键不能为空");
@ -47,12 +50,14 @@ public class MeasureUnitController {
@Log("查看计量单位详情")
@GetMapping(value = "/measureUnit/{id}")
@PreAuthorize("hasAnyRole('ADMIN','MEASUREE_UNIT_ALL','MEASUREE_UNIT_DETAIL_BY_ID')")
public ResponseEntity getMessureUnit(@PathVariable Long id){
return new ResponseEntity(measureUnitService.findById(id), HttpStatus.OK);
}
@Log("删除计量单位")
@DeleteMapping(value = "/measureUnit/{id}")
@PreAuthorize("hasAnyRole('ADMIN','MEASUREE_UNIT_ALL','MEASUREE_UNIT_DELETE')")
public ResponseEntity delete(@PathVariable Long id){
measureUnitService.delete(id);
return new ResponseEntity(HttpStatus.OK);
@ -60,6 +65,7 @@ public class MeasureUnitController {
@Log("分页查询计量单位")
@GetMapping(value = "/queryMeasureUnitPage")
@PreAuthorize("hasAnyRole('ADMIN','MEASUREE_UNIT_ALL','MEASUREE_UNIT_SELECT')")
public ResponseEntity queryMeasureUnitPage(MeasureUnitDTO resources, Pageable pageable){
return new ResponseEntity(measureUnitService.queryAll(resources,pageable),HttpStatus.OK);
}
@ -67,6 +73,7 @@ public class MeasureUnitController {
@Log("查询所有计量单位")
@GetMapping(value = "/queryMeasureUnitList")
@PreAuthorize("hasAnyRole('ADMIN','MEASUREE_UNIT_ALL','MEASUREE_UNIT_SELECT')")
public ResponseEntity queryMeasureUnitList(MeasureUnitDTO resources){
return new ResponseEntity(measureUnitService.queryAll(resources),HttpStatus.OK);
}

View File

@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -28,6 +29,7 @@ public class ProductCategoryController {
@Log("新增产品类别")
@PostMapping(value = "/productCategory")
@PreAuthorize("hasAnyRole('ADMIN','PRODUCT_CATEGORY_ALL','PRODUCT_CATEGORY_CREATE')")
public ResponseEntity create(@Validated @RequestBody ProductCategory resources){
if (resources.getId() != null) {
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
@ -37,12 +39,14 @@ public class ProductCategoryController {
@Log("查看产品类别详情")
@GetMapping(value = "/productCategory/{id}")
@PreAuthorize("hasAnyRole('ADMIN','PRODUCT_CATEGORY_ALL','PRODUCT_CATEGORY_DETAIL_BY_ID')")
public ResponseEntity getMessureUnits(@PathVariable Long id){
return new ResponseEntity(productCategoryService.findById(id), HttpStatus.OK);
}
@Log("删除产品类别")
@DeleteMapping(value = "/productCategory/{id}")
@PreAuthorize("hasAnyRole('ADMIN','PRODUCT_CATEGORY_ALL','PRODUCT_CATEGORY_DELETE')")
public ResponseEntity delete(@PathVariable Long id){
productCategoryService.delete(id);
return new ResponseEntity(HttpStatus.OK);
@ -50,12 +54,14 @@ public class ProductCategoryController {
@Log("查询产品类别列表")
@GetMapping(value = "/queryProductCategoryList")
@PreAuthorize("hasAnyRole('ADMIN','PRODUCT_CATEGORY_ALL','PRODUCT_CATEGORY_SELECT')")
public ResponseEntity queryProductCategoryList(ProductCategoryDTO resources){
return new ResponseEntity(productCategoryService.queryAll(resources),HttpStatus.OK);
}
@Log("分页查询产品类别")
@GetMapping(value = "/queryProductCategoryPage")
@PreAuthorize("hasAnyRole('ADMIN','PRODUCT_CATEGORY_ALL','PRODUCT_CATEGORY_SELECT')")
public ResponseEntity queryProductCategoryPage(ProductCategoryDTO resources, Pageable pageable){
return new ResponseEntity(productCategoryService.queryAll(resources,pageable),HttpStatus.OK);
}

View File

@ -28,7 +28,7 @@ public class ProductSeriesController {
@Log("分页查询产品系列")
@ApiOperation(value = "分页查询产品系列")
@GetMapping(value = "/queryProductSeriesPage")
@PreAuthorize("hasAnyRole('ADMIN','BDPRODUCTSERIES_ALL','BDPRODUCTSERIES_SELECT')")
@PreAuthorize("hasAnyRole('ADMIN','PRODUCT_SERIES_ALL','PRODUCT_SERIES_SELECT')")
public ResponseEntity queryProductSeriesPage(ProductSeriesQueryCriteria criteria, Pageable pageable){
return new ResponseEntity(productSeriesService.queryAll(criteria,pageable),HttpStatus.OK);
}
@ -36,7 +36,7 @@ public class ProductSeriesController {
@Log("产品系列列表")
@ApiOperation(value = "产品系列列表")
@GetMapping(value = "/queryProductSeriesList")
@PreAuthorize("hasAnyRole('ADMIN','BDPRODUCTSERIES_ALL','BDPRODUCTSERIES_SELECT')")
@PreAuthorize("hasAnyRole('ADMIN','PRODUCT_SERIES_ALL','PRODUCT_SERIES_SELECT')")
public ResponseEntity queryProductSeriesList(ProductSeriesQueryCriteria criteria, Pageable pageable){
return new ResponseEntity(productSeriesService.queryAll(criteria,pageable),HttpStatus.OK);
}
@ -44,7 +44,7 @@ public class ProductSeriesController {
@Log("新增产品系列")
@ApiOperation(value = "新增产品系列")
@PostMapping(value = "/productSeries")
@PreAuthorize("hasAnyRole('ADMIN','BDPRODUCTSERIES_ALL','BDPRODUCTSERIES_CREATE')")
@PreAuthorize("hasAnyRole('ADMIN','PRODUCT_SERIES_ALL','PRODUCT_SERIES_CREATE')")
public ResponseEntity create(@Validated @RequestBody ProductSeries resources){
return new ResponseEntity(productSeriesService.create(resources),HttpStatus.CREATED);
}
@ -52,7 +52,7 @@ public class ProductSeriesController {
@Log("修改产品系列")
@ApiOperation(value = "修改产品系列")
@PutMapping(value = "/productSeries")
@PreAuthorize("hasAnyRole('ADMIN','BDPRODUCTSERIES_ALL','BDPRODUCTSERIES_EDIT')")
@PreAuthorize("hasAnyRole('ADMIN','PRODUCT_SERIES_ALL','PRODUCT_SERIES_EDIT')")
public ResponseEntity update(@Validated @RequestBody ProductSeries resources){
productSeriesService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);
@ -61,7 +61,7 @@ public class ProductSeriesController {
@Log("删除产品系列")
@ApiOperation(value = "删除产品系列")
@DeleteMapping(value = "/productSeries/{id}")
@PreAuthorize("hasAnyRole('ADMIN','BDPRODUCTSERIES_ALL','BDPRODUCTSERIES_DELETE')")
@PreAuthorize("hasAnyRole('ADMIN','PRODUCT_SERIES_ALL','PRODUCT_SERIES_DELETE')")
public ResponseEntity delete(@PathVariable Long id){
productSeriesService.delete(id);
return new ResponseEntity(HttpStatus.OK);

View File

@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -28,6 +29,7 @@ public class SpendCategoryController {
@Log("新增支出类别")
@PostMapping(value = "/spendCategory")
@PreAuthorize("hasAnyRole('ADMIN','SPEND_CATEGORY_ALL','SPEND_CATEGORY_CREATE')")
public ResponseEntity create(@Validated @RequestBody SpendCategory resources){
if (resources.getId() != null) {
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
@ -37,12 +39,14 @@ public class SpendCategoryController {
@Log("查看支出类别详情")
@GetMapping(value = "/spendCategory/{id}")
@PreAuthorize("hasAnyRole('ADMIN','SPEND_CATEGORY_ALL','SPEND_CATEGORY_DETAIL_BY_ID')")
public ResponseEntity getMessureUnits(@PathVariable Long id){
return new ResponseEntity(spendCategoryService.findById(id), HttpStatus.OK);
}
@Log("删除支出类别")
@DeleteMapping(value = "/spendCategory/{id}")
@PreAuthorize("hasAnyRole('ADMIN','SPEND_CATEGORY_ALL','SPEND_CATEGORY_DELETE')")
public ResponseEntity delete(@PathVariable Long id){
spendCategoryService.delete(id);
return new ResponseEntity(HttpStatus.OK);
@ -50,6 +54,7 @@ public class SpendCategoryController {
@Log("查询支出类别")
@GetMapping(value = "/querySpendCategoryPage")
@PreAuthorize("hasAnyRole('ADMIN','SPEND_CATEGORY_ALL','SPEND_CATEGORY_SELECT)")
public ResponseEntity querySpendCategoryPage(SpendCategoryDTO resources, Pageable pageable){
return new ResponseEntity(spendCategoryService.queryAll(resources,pageable),HttpStatus.OK);
}

View File

@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -28,6 +29,7 @@ public class SupplierCategoryController {
@Log("新增供应商类别")
@PostMapping(value = "/supplierCategory")
@PreAuthorize("hasAnyRole('ADMIN','SUPPLIER_CATEGORY_ALL','SUPPLIER_CATEGORY_CREATE')")
public ResponseEntity create(@Validated @RequestBody SupplierCategory resources){
if (resources.getId() != null) {
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
@ -37,12 +39,14 @@ public class SupplierCategoryController {
@Log("查看供应商类别详情")
@GetMapping(value = "/supplierCategory/{id}")
@PreAuthorize("hasAnyRole('ADMIN','SUPPLIER_CATEGORY_ALL','SUPPLIER_CATEGORY_DETAIL_BY_ID')")
public ResponseEntity getMessureUnits(@PathVariable Long id){
return new ResponseEntity(supplierCategoryService.findById(id), HttpStatus.OK);
}
@Log("删除供应商类别")
@DeleteMapping(value = "/supplierCategory/{id}")
@PreAuthorize("hasAnyRole('ADMIN','SUPPLIER_CATEGORY_ALL','SUPPLIER_CATEGORY_DELETE')")
public ResponseEntity delete(@PathVariable Long id){
supplierCategoryService.delete(id);
return new ResponseEntity(HttpStatus.OK);
@ -50,12 +54,14 @@ public class SupplierCategoryController {
@Log("分页查询供应商类别")
@GetMapping(value = "/querySupplierCategoryPage")
@PreAuthorize("hasAnyRole('ADMIN','SUPPLIER_CATEGORY_ALL','SUPPLIER_CATEGORY_SELET')")
public ResponseEntity querySupplierCategoryPage(SupplierCategoryDTO resources, Pageable pageable){
return new ResponseEntity(supplierCategoryService.queryAll(resources,pageable),HttpStatus.OK);
}
@Log("查询所有供应商类别")
@GetMapping(value = "/queryAllCategoryList")
@PreAuthorize("hasAnyRole('ADMIN','SUPPLIER_CATEGORY_ALL','SUPPLIER_CATEGORY_SELET')")
public ResponseEntity queryAllCategoryList(SupplierCategoryDTO resources){
return new ResponseEntity(supplierCategoryService.queryAll(resources),HttpStatus.OK);
}

View File

@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
@ -30,6 +31,7 @@ public class WareHouseController {
@Log("新增仓库")
@PostMapping(value = "/wareHouse")
@PreAuthorize("hasAnyRole('ADMIN','WARE_HOUSEE_ALL','WARE_HOUSEE_CREATE')")
public ResponseEntity create(@RequestBody WareHouse resources){
if (resources.getId() != null) {
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
@ -48,12 +50,14 @@ public class WareHouseController {
@Log("查看仓库详情")
@GetMapping(value = "/wareHouse/{id}")
@PreAuthorize("hasAnyRole('ADMIN','WARE_HOUSEE_ALL','WARE_HOUSEE_DETAIL_BY_ID')")
public ResponseEntity getMessureUnits(@PathVariable Long id){
return new ResponseEntity(wareHouseService.findById(id), HttpStatus.OK);
}
@Log("删除仓库")
@DeleteMapping(value = "/wareHouse/{id}")
@PreAuthorize("hasAnyRole('ADMIN','WARE_HOUSEE_ALL','WARE_HOUSEE_DELETE')")
public ResponseEntity delete(@PathVariable Long id){
wareHouseService.delete(id);
return new ResponseEntity(HttpStatus.OK);
@ -61,12 +65,14 @@ public class WareHouseController {
@Log("分页查询仓库")
@GetMapping(value = "/queryWareHousePage")
@PreAuthorize("hasAnyRole('ADMIN','WARE_HOUSEE_ALL','WARE_HOUSEE_SELECT')")
public ResponseEntity queryWareHousePage(WareHouseQueryCriteria wareHouseQueryCriteria, Pageable pageable){
return new ResponseEntity(wareHouseService.queryAll(wareHouseQueryCriteria,pageable),HttpStatus.OK);
}
@Log("查询仓库列表")
@GetMapping(value = "/queryWareHouseList")
@PreAuthorize("hasAnyRole('ADMIN','WARE_HOUSEE_ALL','WARE_HOUSEE_SELECT')")
public ResponseEntity queryWareHouseList(WareHouseQueryCriteria wareHouseQueryCriteria){
return new ResponseEntity(wareHouseService.queryAll(wareHouseQueryCriteria),HttpStatus.OK);
}