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