//package com.backendsys.controller.B2c;
//
//import com.backendsys.aspect.QueryNullCheck;
//import com.backendsys.aspect.QueryNullCheckAspect;
//import com.backendsys.entity.B2c.B2cGoodUnitDTO;
//import com.backendsys.entity.PageDTO;
//import com.backendsys.service.B2c.B2cGoodUnitService;
//import com.backendsys.utils.response.Result;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.access.prepost.PreAuthorize;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.*;
//
///**
// * 商品单位
// */
//@Validated
//@RestController
//public class B2cGoodUnitController {
//
//    @Autowired
//    private B2cGoodUnitService b2cGoodUnitService;
//
//    @PreAuthorize("@sr.hasPermission('11.4')")
//    @GetMapping("/api/b2c/good/getGoodUnit")
//    public Result getGoodUnit(@Validated PageDTO pageDTO, @Validated B2cGoodUnitDTO b2cGoodUnitDTO) {
//        return Result.success(b2cGoodUnitService.queryGoodUnitList(pageDTO.getPage_num(), pageDTO.getPage_size(), b2cGoodUnitDTO));
//    }
//
//    @PreAuthorize("@sr.hasPermission('11.4.1')")
//    @QueryNullCheck(serviceClass = B2cGoodUnitService.class, serviceMethod = "queryGoodUnitDetail", argField = "good_unit_id", message = "商品单位不存在")
//    @GetMapping("/api/b2c/good/getGoodUnitDetail")
//    public Result getGoodUnitDetail(@Validated(B2cGoodUnitDTO.Detail.class) B2cGoodUnitDTO b2cGoodUnitDTO) {
//        return Result.success(QueryNullCheckAspect.getQueryResult());
//    }
//
//    @PreAuthorize("@sr.hasPermission('11.4.2')")
//    @PostMapping("/api/b2c/good/createGoodUnit")
//    public Result createGoodUnit(@Validated(B2cGoodUnitDTO.Create.class) @RequestBody B2cGoodUnitDTO b2cGoodUnitDTO) {
//        return Result.success(b2cGoodUnitService.insertGoodUnit(b2cGoodUnitDTO), "创建成功");
//    }
//
//    @PreAuthorize("@sr.hasPermission('11.4.3')")
//    @QueryNullCheck(serviceClass = B2cGoodUnitService.class, serviceMethod = "queryGoodUnitDetail", argField = "good_unit_id", message = "商品单位不存在")
//    @PutMapping("/api/b2c/good/updateGoodUnit")
//    public Result updateGoodUnit(@Validated(B2cGoodUnitDTO.Update.class) @RequestBody B2cGoodUnitDTO b2cGoodUnitDTO) {
//        return Result.success(b2cGoodUnitService.updateGoodUnit(b2cGoodUnitDTO), "更新成功");
//    }
//
//    @PreAuthorize("@sr.hasPermission('11.4.4')")
//    @QueryNullCheck(serviceClass = B2cGoodUnitService.class, serviceMethod = "queryGoodUnitDetail", argField = "good_unit_id", message = "商品单位不存在")
//    @DeleteMapping("/api/b2c/good/deleteGoodUnit")
//    public Result deleteGoodUnit(@Validated(B2cGoodUnitDTO.Delete.class) @RequestBody B2cGoodUnitDTO b2cGoodUnitDTO) {
//        return Result.success(b2cGoodUnitService.deleteGoodUnit(b2cGoodUnitDTO), "删除成功");
//    }
//}
