¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.cloud.admin; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.config.annotation.CloudRequiredPermission; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.business.model.YwWarehouse; |
| | | import com.doumee.service.business.YwWarehouseService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author æ±è¹è¹ |
| | | * @date 2025/01/06 11:05 |
| | | */ |
| | | @Api(tags = "è¿ç»´ä»åºä¿¡æ¯è¡¨") |
| | | @RestController |
| | | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/business/ywWarehouse") |
| | | public class YwWarehouseController extends BaseController { |
| | | |
| | | @Autowired |
| | | private YwWarehouseService ywWarehouseService; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | @CloudRequiredPermission("business:ywwarehouse:create") |
| | | public ApiResponse create(@RequestBody YwWarehouse ywWarehouse,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ywWarehouse.setLoginUserInfo(this.getLoginUser(token)); |
| | | return ApiResponse.success(ywWarehouseService.create(ywWarehouse)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @CloudRequiredPermission("business:ywwarehouse:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ywWarehouseService.deleteById(id,this.getLoginUser(token)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | // |
| | | // @ApiOperation("æ¹éå é¤") |
| | | // @GetMapping("/delete/batch") |
| | | // @CloudRequiredPermission("business:ywwarehouse:delete") |
| | | // public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | // String [] idArray = ids.split(","); |
| | | // List<Integer> idList = new ArrayList<>(); |
| | | // for (String id : idArray) { |
| | | // idList.add(Integer.valueOf(id)); |
| | | // } |
| | | // ywWarehouseService.deleteByIdInBatch(idList); |
| | | // return ApiResponse.success(null); |
| | | // } |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("business:ywwarehouse:update") |
| | | public ApiResponse updateById(@RequestBody YwWarehouse ywWarehouse,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ywWarehouseService.updateById(ywWarehouse); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:ywwarehouse:query") |
| | | public ApiResponse<PageData<YwWarehouse>> findPage (@RequestBody PageWrap<YwWarehouse> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywWarehouseService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("å表æ¥è¯¢") |
| | | @PostMapping("/list") |
| | | @CloudRequiredPermission("business:ywwarehouse:query") |
| | | public ApiResponse<List<YwWarehouse>> findList (@RequestBody YwWarehouse model,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywWarehouseService.findList(model)); |
| | | } |
| | | |
| | | @ApiOperation("导åºExcel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:ywwarehouse:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<YwWarehouse> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ExcelExporter.build(YwWarehouse.class).export(ywWarehouseService.findPage(pageWrap).getRecords(), "è¿ç»´ä»åºä¿¡æ¯è¡¨", response); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:ywwarehouse:query") |
| | | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywWarehouseService.findById(id)); |
| | | } |
| | | } |