diff --git a/ant-design-vue-jeecg/src/views/sensor/SensorList.vue b/ant-design-vue-jeecg/src/views/sensor/SensorList.vue index f9e6a2fd..102df392 100644 --- a/ant-design-vue-jeecg/src/views/sensor/SensorList.vue +++ b/ant-design-vue-jeecg/src/views/sensor/SensorList.vue @@ -1,229 +1,244 @@ - - - - \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/sensor/modules/SensorForm.vue b/ant-design-vue-jeecg/src/views/sensor/modules/SensorForm.vue index 3d935f09..81d4d8c3 100644 --- a/ant-design-vue-jeecg/src/views/sensor/modules/SensorForm.vue +++ b/ant-design-vue-jeecg/src/views/sensor/modules/SensorForm.vue @@ -1,147 +1,155 @@ - - - \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/team/StationList.vue b/ant-design-vue-jeecg/src/views/team/StationList.vue index 0946155e..2c4713ae 100644 --- a/ant-design-vue-jeecg/src/views/team/StationList.vue +++ b/ant-design-vue-jeecg/src/views/team/StationList.vue @@ -1,319 +1,335 @@ - - - - - + + + + + \ No newline at end of file diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/sensor/controller/SensorController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/sensor/controller/SensorController.java index afed121b..875d873b 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/sensor/controller/SensorController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/sensor/controller/SensorController.java @@ -1,173 +1,174 @@ -package org.jeecg.modules.demo.sensor.controller; - - - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -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.system.query.QueryGenerator; -import org.jeecg.common.util.oConvertUtils; -import org.jeecg.modules.demo.sensor.entity.Sensor; -import org.jeecg.modules.demo.sensor.service.ISensorService; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import lombok.extern.slf4j.Slf4j; - -import org.jeecgframework.poi.excel.ExcelImportUtil; -import org.jeecgframework.poi.excel.def.NormalExcelConstants; -import org.jeecgframework.poi.excel.entity.ExportParams; -import org.jeecgframework.poi.excel.entity.ImportParams; -import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; -import org.jeecg.common.system.base.controller.JeecgController; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; -import org.springframework.web.servlet.ModelAndView; -import com.alibaba.fastjson.JSON; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.jeecg.common.aspect.annotation.AutoLog; - - /** - * @Description: 传感器表 - * @Author: jeecg-boot - * @Date: 2023-02-10 - * @Version: V1.0 - */ -@Api(tags="传感器表") -@RestController -@RequestMapping("/sensor/sensor") -@Slf4j -public class SensorController extends JeecgController { - @Autowired - private ISensorService sensorService; - - /** - * 分页列表查询 - * - * @param sensor - * @param pageNo - * @param pageSize - * @param req - * @return - */ - @AutoLog(value = "传感器表-分页列表查询") - @ApiOperation(value="传感器表-分页列表查询", notes="传感器表-分页列表查询") - @GetMapping(value = "/list") - public Result queryPageList(Sensor sensor, - @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, - HttpServletRequest req) { - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(sensor, req.getParameterMap()); - Page page = new Page(pageNo, pageSize); - IPage pageList = sensorService.page(page, queryWrapper); - return Result.OK(pageList); - } - - /** - * 添加 - * - * @param sensor - * @return - */ - @AutoLog(value = "传感器表-添加") - @ApiOperation(value="传感器表-添加", notes="传感器表-添加") - @PostMapping(value = "/add") - public Result add(@RequestBody Sensor sensor) { - sensorService.save(sensor); - return Result.OK("添加成功!"); - } - - /** - * 编辑 - * - * @param sensor - * @return - */ - @AutoLog(value = "传感器表-编辑") - @ApiOperation(value="传感器表-编辑", notes="传感器表-编辑") - @PutMapping(value = "/edit") - public Result edit(@RequestBody Sensor sensor) { - sensorService.updateById(sensor); - return Result.OK("编辑成功!"); - } - - /** - * 通过id删除 - * - * @param id - * @return - */ - @AutoLog(value = "传感器表-通过id删除") - @ApiOperation(value="传感器表-通过id删除", notes="传感器表-通过id删除") - @DeleteMapping(value = "/delete") - public Result delete(@RequestParam(name="id",required=true) String id) { - sensorService.removeById(id); - return Result.OK("删除成功!"); - } - - /** - * 批量删除 - * - * @param ids - * @return - */ - @AutoLog(value = "传感器表-批量删除") - @ApiOperation(value="传感器表-批量删除", notes="传感器表-批量删除") - @DeleteMapping(value = "/deleteBatch") - public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { - this.sensorService.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 queryById(@RequestParam(name="id",required=true) String id) { - Sensor sensor = sensorService.getById(id); - if(sensor==null) { - return Result.error("未找到对应数据"); - } - return Result.OK(sensor); - } - - /** - * 导出excel - * - * @param request - * @param sensor - */ - @RequestMapping(value = "/exportXls") - public ModelAndView exportXls(HttpServletRequest request, Sensor sensor) { - return super.exportXls(request, sensor, Sensor.class, "传感器表"); - } - - /** - * 通过excel导入数据 - * - * @param request - * @param response - * @return - */ - @RequestMapping(value = "/importExcel", method = RequestMethod.POST) - public Result importExcel(HttpServletRequest request, HttpServletResponse response) { - return super.importExcel(request, response, Sensor.class); - } - -} +package org.jeecg.modules.demo.sensor.controller; + + + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +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.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.demo.sensor.entity.Sensor; +import org.jeecg.modules.demo.sensor.service.ISensorService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: 传感器表 + * @Author: jeecg-boot + * @Date: 2023-02-10 + * @Version: V1.0 + */ +@Api(tags="传感器表") +@RestController +@RequestMapping("/sensor/sensor") +@Slf4j +public class SensorController extends JeecgController { + @Autowired + private ISensorService sensorService; + + /** + * 分页列表查询 + * + * @param sensor + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "传感器表-分页列表查询") + @ApiOperation(value="传感器表-分页列表查询", notes="传感器表-分页列表查询") + @GetMapping(value = "/list") + public Result queryPageList(Sensor sensor, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(sensor, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + queryWrapper.orderByAsc("create_time"); + IPage pageList = sensorService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param sensor + * @return + */ + @AutoLog(value = "传感器表-添加") + @ApiOperation(value="传感器表-添加", notes="传感器表-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody Sensor sensor) { + sensorService.save(sensor); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param sensor + * @return + */ + @AutoLog(value = "传感器表-编辑") + @ApiOperation(value="传感器表-编辑", notes="传感器表-编辑") + @PutMapping(value = "/edit") + public Result edit(@RequestBody Sensor sensor) { + sensorService.updateById(sensor); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "传感器表-通过id删除") + @ApiOperation(value="传感器表-通过id删除", notes="传感器表-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + sensorService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "传感器表-批量删除") + @ApiOperation(value="传感器表-批量删除", notes="传感器表-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.sensorService.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 queryById(@RequestParam(name="id",required=true) String id) { + Sensor sensor = sensorService.getById(id); + if(sensor==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(sensor); + } + + /** + * 导出excel + * + * @param request + * @param sensor + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, Sensor sensor) { + return super.exportXls(request, sensor, Sensor.class, "传感器表"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, Sensor.class); + } + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/controller/StationController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/controller/StationController.java index c0fe44ff..c757f4e5 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/controller/StationController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/controller/StationController.java @@ -1,215 +1,216 @@ -package org.jeecg.modules.team.controller; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.jeecg.common.api.vo.Result; -import org.jeecg.common.aspect.annotation.AutoLog; -import org.jeecg.common.system.base.controller.JeecgController; -import org.jeecg.common.system.query.QueryGenerator; -import org.jeecg.modules.system.entity.SysDepart; -import org.jeecg.modules.system.service.ISysDepartService; -import org.jeecg.modules.team.entity.Station; -import org.jeecg.modules.team.entity.StationMachine; -import org.jeecg.modules.team.entity.StationTool; -import org.jeecg.modules.team.service.IStationMachineService; -import org.jeecg.modules.team.service.IStationService; -import org.jeecg.modules.team.service.IStationToolService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.util.ObjectUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.ModelAndView; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.stream.Collectors; - -/** - * @Description: 车间工位管理 - * @Author: jeecg-boot - * @Date: 2022-12-05 - * @Version: V1.0 - */ -@Slf4j -@Api(tags = "车间工位管理") -@RestController -@RequestMapping("/team/station") -public class StationController extends JeecgController { - @Autowired - private IStationService stationService; - - @Autowired - private ISysDepartService iSysDepartService; - - @Autowired - private IStationToolService iStationToolService; - - @Autowired - private IStationMachineService iStationMachineService; - - /** - * 分页列表查询 - * - * @param station - * @param pageNo - * @param pageSize - * @param req - * @return - */ - @AutoLog(value = "车间工位管理-分页列表查询") - @ApiOperation(value = "车间工位管理-分页列表查询", notes = "车间工位管理-分页列表查询") - @GetMapping(value = "/list") - public Result queryPageList(Station station, - @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, - HttpServletRequest req) { - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(station, req.getParameterMap()); - Page page = new Page(pageNo, pageSize); - IPage pageList = stationService.page(page, queryWrapper); - if (!ObjectUtils.isEmpty(pageList.getRecords())) { - List records = pageList.getRecords(); - //按工位序号顺序排序 - Collections.sort(records, Comparator.comparingInt(Station::getStationNum)); - List ids = records.stream().map(o -> o.getDepartId()).collect(Collectors.toList()); - List departList = iSysDepartService.list(new LambdaQueryWrapper().in(SysDepart::getId, ids)); - records.stream().forEach(e -> { - List stationTools = iStationToolService.list(new LambdaQueryWrapper().eq(StationTool::getStationId, e.getId())); - e.setToolsIds(stationTools.stream().map(StationTool::getToolsId).collect(Collectors.joining(","))); - List machineList = iStationMachineService.list(new LambdaQueryWrapper().eq(StationMachine::getStationId, e.getId())); - e.setMachineIds(machineList.stream().map(StationMachine::getMachineId).collect(Collectors.joining(","))); - departList.forEach(j -> { - if (e.getDepartId().equals(j.getId())) { - e.setDepartName(j.getDepartName()); - return; - } - }); - }); - } - return Result.OK(pageList); - } - - - @ApiOperation(value = "车间工位管理-查询车间工位能否删除", notes = "车间工位管理-查询车间工位能否删除") - @GetMapping(value = "/queryIsCanDelete") - public Result queryIsCanDelete(Station station, - HttpServletRequest req) { - return Result.OK(stationService.queryIsCanDelete(station)); - } - - /** - * 添加 - * - * @param station - * @return - */ - @AutoLog(value = "车间工位管理-添加") - @ApiOperation(value = "车间工位管理-添加", notes = "车间工位管理-添加") - @PostMapping(value = "/add") - public Result add(@RequestBody Station station) { - stationService.save(station); - return Result.OK("添加成功!"); - } - - /** - * 编辑 - * - * @param station - * @return - */ - @AutoLog(value = "车间工位管理-编辑") - @ApiOperation(value = "车间工位管理-编辑", notes = "车间工位管理-编辑") - @PutMapping(value = "/edit") - public Result edit(@RequestBody Station station) { - stationService.updateById(station); - return Result.OK("编辑成功!"); - } - - /** - * 通过id删除 - * - * @param id - * @return - */ - @AutoLog(value = "车间工位管理-通过id删除") - @ApiOperation(value = "车间工位管理-通过id删除", notes = "车间工位管理-通过id删除") - @DeleteMapping(value = "/delete") - public Result delete(@RequestParam(name = "id", required = true) String id) { - stationService.removeById(id); - return Result.OK("删除成功!"); - } - - /** - * 批量删除 - * - * @param ids - * @return - */ - @AutoLog(value = "车间工位管理-批量删除") - @ApiOperation(value = "车间工位管理-批量删除", notes = "车间工位管理-批量删除") - @DeleteMapping(value = "/deleteBatch") - public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { - this.stationService.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 queryById(@RequestParam(name = "id", required = true) String id) { - Station station = stationService.getById(id); - return Result.OK(station); - } - - /** - * 导出excel - * - * @param request - * @param station - */ - @RequestMapping(value = "/exportXls") - public ModelAndView exportXls(HttpServletRequest request, Station station) { - return super.exportXls(request, station, Station.class, "车间工位管理"); - } - - /** - * 通过excel导入数据 - * - * @param request - * @param response - * @return - */ - @RequestMapping(value = "/importExcel", method = RequestMethod.POST) - public Result importExcel(HttpServletRequest request, HttpServletResponse response) { - return super.importExcel(request, response, Station.class); - } - - @ApiOperation(value = "排序", notes = "排序") - @GetMapping(value = "/up") - public Result up(@RequestParam(name = "id", required = true) String id) { - stationService.up(id); - return Result.OK(); - } - - @AutoLog(value = "排序") - @ApiOperation(value = "排序", notes = "排序") - @GetMapping(value = "/down") - public Result down(@RequestParam(name = "id", required = true) String id) { - stationService.down(id); - return Result.OK(); - } - -} +package org.jeecg.modules.team.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.modules.system.entity.SysDepart; +import org.jeecg.modules.system.service.ISysDepartService; +import org.jeecg.modules.team.entity.Station; +import org.jeecg.modules.team.entity.StationMachine; +import org.jeecg.modules.team.entity.StationTool; +import org.jeecg.modules.team.service.IStationMachineService; +import org.jeecg.modules.team.service.IStationService; +import org.jeecg.modules.team.service.IStationToolService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.ObjectUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @Description: 车间工位管理 + * @Author: jeecg-boot + * @Date: 2022-12-05 + * @Version: V1.0 + */ +@Slf4j +@Api(tags = "车间工位管理") +@RestController +@RequestMapping("/team/station") +public class StationController extends JeecgController { + @Autowired + private IStationService stationService; + + @Autowired + private ISysDepartService iSysDepartService; + + @Autowired + private IStationToolService iStationToolService; + + @Autowired + private IStationMachineService iStationMachineService; + + /** + * 分页列表查询 + * + * @param station + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "车间工位管理-分页列表查询") + @ApiOperation(value = "车间工位管理-分页列表查询", notes = "车间工位管理-分页列表查询") + @GetMapping(value = "/list") + public Result queryPageList(Station station, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(station, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + queryWrapper.orderByAsc("station_num"); + IPage pageList = stationService.page(page, queryWrapper); + if (!ObjectUtils.isEmpty(pageList.getRecords())) { + List records = pageList.getRecords(); + //按工位序号顺序排序 + Collections.sort(records, Comparator.comparingInt(Station::getStationNum)); + List ids = records.stream().map(o -> o.getDepartId()).collect(Collectors.toList()); + List departList = iSysDepartService.list(new LambdaQueryWrapper().in(SysDepart::getId, ids)); + records.stream().forEach(e -> { + List stationTools = iStationToolService.list(new LambdaQueryWrapper().eq(StationTool::getStationId, e.getId())); + e.setToolsIds(stationTools.stream().map(StationTool::getToolsId).collect(Collectors.joining(","))); + List machineList = iStationMachineService.list(new LambdaQueryWrapper().eq(StationMachine::getStationId, e.getId())); + e.setMachineIds(machineList.stream().map(StationMachine::getMachineId).collect(Collectors.joining(","))); + departList.forEach(j -> { + if (e.getDepartId().equals(j.getId())) { + e.setDepartName(j.getDepartName()); + return; + } + }); + }); + } + return Result.OK(pageList); + } + + + @ApiOperation(value = "车间工位管理-查询车间工位能否删除", notes = "车间工位管理-查询车间工位能否删除") + @GetMapping(value = "/queryIsCanDelete") + public Result queryIsCanDelete(Station station, + HttpServletRequest req) { + return Result.OK(stationService.queryIsCanDelete(station)); + } + + /** + * 添加 + * + * @param station + * @return + */ + @AutoLog(value = "车间工位管理-添加") + @ApiOperation(value = "车间工位管理-添加", notes = "车间工位管理-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody Station station) { + stationService.save(station); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param station + * @return + */ + @AutoLog(value = "车间工位管理-编辑") + @ApiOperation(value = "车间工位管理-编辑", notes = "车间工位管理-编辑") + @PutMapping(value = "/edit") + public Result edit(@RequestBody Station station) { + stationService.updateById(station); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "车间工位管理-通过id删除") + @ApiOperation(value = "车间工位管理-通过id删除", notes = "车间工位管理-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name = "id", required = true) String id) { + stationService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "车间工位管理-批量删除") + @ApiOperation(value = "车间工位管理-批量删除", notes = "车间工位管理-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + this.stationService.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 queryById(@RequestParam(name = "id", required = true) String id) { + Station station = stationService.getById(id); + return Result.OK(station); + } + + /** + * 导出excel + * + * @param request + * @param station + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, Station station) { + return super.exportXls(request, station, Station.class, "车间工位管理"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, Station.class); + } + + @ApiOperation(value = "排序", notes = "排序") + @GetMapping(value = "/up") + public Result up(@RequestParam(name = "id", required = true) String id) { + stationService.up(id); + return Result.OK(); + } + + @AutoLog(value = "排序") + @ApiOperation(value = "排序", notes = "排序") + @GetMapping(value = "/down") + public Result down(@RequestParam(name = "id", required = true) String id) { + stationService.down(id); + return Result.OK(); + } + +}