//package com.backendsys.controller.B2c;
//
//import com.backendsys.aspect.QueryNullCheck;
//import com.backendsys.aspect.QueryNullCheckAspect;
//import com.backendsys.entity.B2c.B2cGoodDTO;
//import com.backendsys.entity.PageDTO;
//import com.backendsys.modules.common.aspect.AppUserLogin;
//import com.backendsys.service.B2c.B2cGoodService;
//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 GoodController {
//
//    @Autowired
//    private B2cGoodService b2cGoodService;
//
//    @PreAuthorize("@sr.hasPermission('11.1')")
//    @GetMapping("/api/b2c/good/getGood")
//    public Result getGood(@Validated PageDTO pageDTO, @Validated B2cGoodDTO b2cGoodDTO) {
//        return Result.success(b2cGoodService.queryGoodList(pageDTO.getPage_num(), pageDTO.getPage_size(), b2cGoodDTO));
//    }
//
////    @PreAuthorize("@ss.isMember")
//    @AppUserLogin
//    @GetMapping("/api/front/b2c/good/getGood")
//    public Result getFrontGood(@Validated PageDTO pageDTO, @Validated B2cGoodDTO b2cGoodDTO) {
//        return Result.success(b2cGoodService.queryGoodList(pageDTO.getPage_num(), pageDTO.getPage_size(), b2cGoodDTO));
//    }
//    // 现有一个接口路径：/api/b2c/good/getGood，是用于后台系统获取商品列表的，想另外做一个用于前台H5或小程序调用的接口，应该怎么命名比较优雅
//
//    @PreAuthorize("@sr.hasPermission('11.1.1')")
//    @QueryNullCheck(serviceClass = B2cGoodService.class, serviceMethod = "queryGoodDetail", argField = "good_id", message = "商品不存在")
//    @GetMapping("/api/b2c/good/getGoodDetail")
//    public Result getGoodDetail(@Validated(B2cGoodDTO.Detail.class) B2cGoodDTO b2cGoodDTO) {
//        return Result.success(QueryNullCheckAspect.getQueryResult());
//    }
//
//    @PreAuthorize("@sr.hasPermission('11.1.2')")
//    @PostMapping("/api/b2c/good/createGood")
//    public Result createGood(@Validated(B2cGoodDTO.Create.class) @RequestBody B2cGoodDTO b2cGoodDTO) {
//        return Result.success(b2cGoodService.insertGood(b2cGoodDTO), "创建成功");
//    }
//
//    @PreAuthorize("@sr.hasPermission('11.1.3')")
//    @QueryNullCheck(serviceClass = B2cGoodService.class, serviceMethod = "queryGoodDetail", argField = "good_id", message = "商品不存在")
//    @PutMapping("/api/b2c/good/updateGood")
//    public Result updateGood(@Validated(B2cGoodDTO.Update.class) @RequestBody B2cGoodDTO b2cGoodDTO) {
//        return Result.success(b2cGoodService.updateGood(b2cGoodDTO), "更新成功");
//    }
//
//    @PreAuthorize("@sr.hasPermission('11.1.4')")
//    @QueryNullCheck(serviceClass = B2cGoodService.class, serviceMethod = "queryGoodDetail", argField = "good_id", message = "商品不存在")
//    @DeleteMapping("/api/b2c/good/deleteGood")
//    public Result deleteGood(@Validated(B2cGoodDTO.Delete.class) @RequestBody B2cGoodDTO b2cGoodDTO) {
//        return Result.success(b2cGoodService.deleteGood(b2cGoodDTO), "删除成功");
//    }
//}
