| | |
| | | package org.jeecg.modules.base.controller; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | |
| | | import java.net.URLDecoder; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.base.entity.LineSideWarehouse; |
| | | import org.jeecg.modules.base.entity.Supplier; |
| | | import org.jeecg.modules.base.service.ILineSideWarehouseService; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | |
| | | /** |
| | | /** |
| | | * @Description: 线边仓库信息 |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-06-24 |
| | | * @Date: 2025-06-24 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Api(tags="线边仓库信息") |
| | | @Api(tags = "线边仓库信息") |
| | | @RestController |
| | | @RequestMapping("/base/lineSideWarehouse") |
| | | @Slf4j |
| | | public class LineSideWarehouseController extends JeecgController<LineSideWarehouse, ILineSideWarehouseService> { |
| | | @Autowired |
| | | private ILineSideWarehouseService lineSideWarehouseService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | | * |
| | | * @param lineSideWarehouse |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "线边仓库信息-分页列表查询") |
| | | @ApiOperation(value="线边仓库信息-分页列表查询", notes="线边仓库信息-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public Result<IPage<LineSideWarehouse>> queryPageList(LineSideWarehouse lineSideWarehouse, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<LineSideWarehouse> queryWrapper = QueryGenerator.initQueryWrapper(lineSideWarehouse, req.getParameterMap()); |
| | | Page<LineSideWarehouse> page = new Page<LineSideWarehouse>(pageNo, pageSize); |
| | | IPage<LineSideWarehouse> pageList = lineSideWarehouseService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param lineSideWarehouse |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "线边仓库信息-添加") |
| | | @ApiOperation(value="线边仓库信息-添加", notes="线边仓库信息-添加") |
| | | //@RequiresPermissions("org.jeecg.modules:base_line_side_warehouse:add") |
| | | @PostMapping(value = "/add") |
| | | public Result<String> add(@RequestBody LineSideWarehouse lineSideWarehouse) { |
| | | lineSideWarehouseService.save(lineSideWarehouse); |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |
| | | * @param lineSideWarehouse |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "线边仓库信息-编辑") |
| | | @ApiOperation(value="线边仓库信息-编辑", notes="线边仓库信息-编辑") |
| | | //@RequiresPermissions("org.jeecg.modules:base_line_side_warehouse:edit") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
| | | public Result<String> edit(@RequestBody LineSideWarehouse lineSideWarehouse) { |
| | | lineSideWarehouseService.updateById(lineSideWarehouse); |
| | | return Result.OK("编辑成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "线边仓库信息-通过id删除") |
| | | @ApiOperation(value="线边仓库信息-通过id删除", notes="线边仓库信息-通过id删除") |
| | | //@RequiresPermissions("org.jeecg.modules:base_line_side_warehouse:delete") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<String> delete(@RequestParam(name="id",required=true) String id) { |
| | | lineSideWarehouseService.removeById(id); |
| | | return Result.OK("删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "线边仓库信息-批量删除") |
| | | @ApiOperation(value="线边仓库信息-批量删除", notes="线边仓库信息-批量删除") |
| | | //@RequiresPermissions("org.jeecg.modules:base_line_side_warehouse:deleteBatch") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
| | | this.lineSideWarehouseService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.OK("批量删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id查询 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "线边仓库信息-通过id查询") |
| | | @ApiOperation(value="线边仓库信息-通过id查询", notes="线边仓库信息-通过id查询") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<LineSideWarehouse> queryById(@RequestParam(name="id",required=true) String id) { |
| | | LineSideWarehouse lineSideWarehouse = lineSideWarehouseService.getById(id); |
| | | if(lineSideWarehouse==null) { |
| | | return Result.error("未找到对应数据"); |
| | | } |
| | | return Result.OK(lineSideWarehouse); |
| | | } |
| | | @Autowired |
| | | private ILineSideWarehouseService lineSideWarehouseService; |
| | | |
| | | /** |
| | | * 导出excel |
| | | * |
| | | * @param request |
| | | * @param lineSideWarehouse |
| | | */ |
| | | * 分页列表查询 |
| | | * |
| | | * @param lineSideWarehouse |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "线边仓库信息-分页列表查询") |
| | | @ApiOperation(value = "线边仓库信息-分页列表查询", notes = "线边仓库信息-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public Result<IPage<LineSideWarehouse>> queryPageList(LineSideWarehouse lineSideWarehouse, |
| | | @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<LineSideWarehouse> queryWrapper = QueryGenerator.initQueryWrapper(lineSideWarehouse, req.getParameterMap()); |
| | | Page<LineSideWarehouse> page = new Page<LineSideWarehouse>(pageNo, pageSize); |
| | | IPage<LineSideWarehouse> pageList = lineSideWarehouseService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param lineSideWarehouse |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "线边仓库信息-添加") |
| | | @ApiOperation(value = "线边仓库信息-添加", notes = "线边仓库信息-添加") |
| | | //@RequiresPermissions("org.jeecg.modules:base_line_side_warehouse:add") |
| | | @PostMapping(value = "/add") |
| | | public Result<String> add(@RequestBody LineSideWarehouse lineSideWarehouse) { |
| | | lineSideWarehouse.setWarehouseStatus(CommonConstant.STATUS_1); |
| | | lineSideWarehouseService.save(lineSideWarehouse); |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |
| | | * @param lineSideWarehouse |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "线边仓库信息-编辑") |
| | | @ApiOperation(value = "线边仓库信息-编辑", notes = "线边仓库信息-编辑") |
| | | //@RequiresPermissions("org.jeecg.modules:base_line_side_warehouse:edit") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public Result<String> edit(@RequestBody LineSideWarehouse lineSideWarehouse) { |
| | | lineSideWarehouseService.updateById(lineSideWarehouse); |
| | | return Result.OK("编辑成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "线边仓库信息-通过id删除") |
| | | @ApiOperation(value = "线边仓库信息-通过id删除", notes = "线边仓库信息-通过id删除") |
| | | //@RequiresPermissions("org.jeecg.modules:base_line_side_warehouse:delete") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<String> delete(@RequestParam(name = "id", required = true) String id) { |
| | | lineSideWarehouseService.removeById(id); |
| | | return Result.OK("删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "线边仓库信息-批量删除") |
| | | @ApiOperation(value = "线边仓库信息-批量删除", notes = "线边仓库信息-批量删除") |
| | | //@RequiresPermissions("org.jeecg.modules:base_line_side_warehouse:deleteBatch") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
| | | this.lineSideWarehouseService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.OK("批量删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id查询 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "线边仓库信息-通过id查询") |
| | | @ApiOperation(value = "线边仓库信息-通过id查询", notes = "线边仓库信息-通过id查询") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<LineSideWarehouse> queryById(@RequestParam(name = "id", required = true) String id) { |
| | | LineSideWarehouse lineSideWarehouse = lineSideWarehouseService.getById(id); |
| | | if (lineSideWarehouse == null) { |
| | | return Result.error("未找到对应数据"); |
| | | } |
| | | return Result.OK(lineSideWarehouse); |
| | | } |
| | | |
| | | /** |
| | | * 导出excel |
| | | * |
| | | * @param request |
| | | * @param lineSideWarehouse |
| | | */ |
| | | //@RequiresPermissions("org.jeecg.modules:base_line_side_warehouse:exportXls") |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, LineSideWarehouse lineSideWarehouse) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 通过excel导入数据 |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | * 通过excel导入数据 |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | //@RequiresPermissions("base_line_side_warehouse:importExcel") |
| | | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | return super.importExcel(request, response, LineSideWarehouse.class); |
| | | } |
| | | |
| | | @AutoLog(value = "线边库-启用&禁用") |
| | | @ApiOperation(value = "线边库-启用&禁用", notes = "线边库-启用&禁用") |
| | | @PutMapping(value = "/active") |
| | | public Result<?> active(@RequestParam(name = "id", required = true) String id) { |
| | | LineSideWarehouse lineSideWarehouse = lineSideWarehouseService.getById(id); |
| | | if (CommonConstant.STATUS_1.equals(lineSideWarehouse.getWarehouseStatus())) { |
| | | lineSideWarehouse.setWarehouseStatus(CommonConstant.STATUS_0); |
| | | } else { |
| | | lineSideWarehouse.setWarehouseStatus(CommonConstant.STATUS_1); |
| | | } |
| | | lineSideWarehouseService.updateById(lineSideWarehouse); |
| | | return Result.ok("操作成功!"); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "线边仓库信息-通过产线ID查询", notes = "线边仓库信息-通过产线ID查询") |
| | | @GetMapping(value = "/queryByFactoryId") |
| | | public Result<LineSideWarehouse> queryByFactoryId(@RequestParam(name = "factoryId") String factoryId) { |
| | | LineSideWarehouse lineSideWarehouse = lineSideWarehouseService.queryByFactoryId(factoryId); |
| | | if (lineSideWarehouse == null) { |
| | | return Result.error("未找到对应数据"); |
| | | } |
| | | return Result.OK(lineSideWarehouse); |
| | | } |
| | | |
| | | @ApiOperation(value = "线边仓库信息-通过产线分类查询", notes = "线边仓库信息-通过产线分类查询") |
| | | @GetMapping(value = "/queryByProductionType") |
| | | public Result<List<LineSideWarehouse>> queryByProductionType(@RequestParam(name = "productionType") String productionType) { |
| | | List<LineSideWarehouse> list = lineSideWarehouseService.queryByProductionType(productionType); |
| | | if (list == null) { |
| | | return Result.OK(Collections.emptyList()); |
| | | } |
| | | return Result.OK(list); |
| | | } |
| | | |
| | | } |