¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.YwStocktaking; |
| | | import com.doumee.service.business.YwStocktakingService; |
| | | 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/ywStocktaking") |
| | | public class YwStocktakingController extends BaseController { |
| | | |
| | | @Autowired |
| | | private YwStocktakingService ywStocktakingService; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | @CloudRequiredPermission("business:ywstocktaking:create") |
| | | public ApiResponse create(@RequestBody YwStocktaking ywStocktaking,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ywStocktaking.setLoginUserInfo(this.getLoginUser(token)); |
| | | return ApiResponse.success(ywStocktakingService.create(ywStocktaking)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @CloudRequiredPermission("business:ywstocktaking:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ywStocktakingService.deleteById(id,getLoginUser(token)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:ywstocktaking: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)); |
| | | } |
| | | ywStocktakingService.deleteByIdInBatch(idList); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("business:ywstocktaking:update") |
| | | public ApiResponse updateById(@RequestBody YwStocktaking ywStocktaking,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ywStocktakingService.updateById(ywStocktaking); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:ywstocktaking:query") |
| | | public ApiResponse<PageData<YwStocktaking>> findPage (@RequestBody PageWrap<YwStocktaking> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywStocktakingService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导åºExcel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:ywstocktaking:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<YwStocktaking> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ExcelExporter.build(YwStocktaking.class).export(ywStocktakingService.findPage(pageWrap).getRecords(), "è¿ç»´çç¹ä¿¡æ¯è¡¨", response); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:ywstocktaking:query") |
| | | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywStocktakingService.getDetail(id)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation("åæ¶çç¹å") |
| | | @GetMapping("/cancelById") |
| | | @CloudRequiredPermission("business:ywstocktaking:delete") |
| | | public ApiResponse cancelById(@RequestParam Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ywStocktakingService.cancelById(id,getLoginUser(token)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("å¼å§çç¹å") |
| | | @GetMapping("/beginById") |
| | | @CloudRequiredPermission("business:ywstocktaking:delete") |
| | | public ApiResponse beginById(@RequestParam Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ywStocktakingService.beginById(id,getLoginUser(token)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("宿çç¹å") |
| | | @GetMapping("/finishById") |
| | | @CloudRequiredPermission("business:ywstocktaking:delete") |
| | | public ApiResponse finishById(@RequestParam Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ywStocktakingService.finishById(id,getLoginUser(token)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | |
| | | } |