| | |
| | | package org.jeecg.modules.mdc.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.mdc.entity.MdcTorqueConfig; |
| | | import org.jeecg.modules.mdc.service.IMdcTorqueConfigService; |
| | | import org.jeecg.modules.mdc.service.impl.MdcTorqueConfigServiceImpl; |
| | | import org.jeecg.modules.mdc.vo.MdcTorqueConfigVo; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | * 扭矩配置管理-新增 |
| | | * |
| | | * @param mdcTorqueConfig |
| | | * @param torqueVo |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "扭矩配置管理-新增") |
| | | @ApiOperation(value = "扭矩配置管理-新增", notes = "扭矩配置管理-新增") |
| | | @PostMapping("/addMdcTorqueConfig") |
| | | public Result<?> addMdcTorqueConfig(@RequestBody MdcTorqueConfig mdcTorqueConfig) { |
| | | boolean flag = mdcTorqueConfigService.addTorque(mdcTorqueConfig); |
| | | return flag ? Result.ok("新增成功") : Result.error("新增失败"); |
| | | public Result addMdcTorqueConfig(@RequestBody MdcTorqueConfigVo torqueVo) { |
| | | if (StringUtils.isBlank(torqueVo.getEquipmentIds())) { |
| | | return Result.error("未选择设备,请排查"); |
| | | } |
| | | boolean result = mdcTorqueConfigService.addTorque(torqueVo); |
| | | if (!result) { |
| | | return Result.error("时间段数据已存在,请排查"); |
| | | } |
| | | return Result.OK("新增成功"); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param mdcTorqueConfig |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "扭矩配置管理-导出") |
| | | @ApiOperation(value = "扭矩配置管理-导出", notes = "扭矩配置管理-导出") |
| | | @RequestMapping("/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, MdcTorqueConfig mdcTorqueConfig) { |
| | | return super.exportXls(request, mdcTorqueConfig, MdcTorqueConfig.class, "扭矩配置管理导出"); |
| | |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "扭矩配置管理-导入") |
| | | @ApiOperation(value = "扭矩配置管理-导入", notes = "扭矩配置管理-导入") |
| | | @RequestMapping("/importExcel") |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | return super.importExcel(request, response, MdcTorqueConfig.class); |
| | |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * |
| | | * @param mdcTorqueConfig |
| | | * @param pageNo |
| | | * @param pageSize |
| | |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "扭矩配置管理-分页查询") |
| | | @ApiOperation(value = "扭矩配置管理-分页查询",notes = "扭矩配置管理-分页查询") |
| | | @ApiOperation(value = "扭矩配置管理-分页查询", notes = "扭矩配置管理-分页查询") |
| | | @GetMapping("/pageList") |
| | | public Result pageList(MdcTorqueConfig mdcTorqueConfig, |
| | | @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | if (mdcTorqueConfig==null){ |
| | | @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | if (mdcTorqueConfig == null) { |
| | | return Result.error("请传递有效参数"); |
| | | } |
| | | LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId= user.getId(); |
| | | Page page=new Page(pageNo,pageSize); |
| | | IPage<MdcTorqueConfig> mdcTorqueConfigIPage= mdcTorqueConfigService.pageList(userId,page,req,mdcTorqueConfig); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | | Page page = new Page(pageNo, pageSize); |
| | | IPage<MdcTorqueConfig> mdcTorqueConfigIPage = mdcTorqueConfigService.pageList(userId, page, req, mdcTorqueConfig); |
| | | return Result.ok(mdcTorqueConfigIPage); |
| | | } |
| | | } |