From 9d3675b12829de9ec46c210c5c8c460705206dbc Mon Sep 17 00:00:00 2001
From: qushaowei <qushaowei@163.com>
Date: 星期六, 18 十一月 2023 16:46:48 +0800
Subject: [PATCH] 问题项修改
---
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcTorqueConfigController.java | 113 +++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 82 insertions(+), 31 deletions(-)
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcTorqueConfigController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcTorqueConfigController.java
index c557d79..7981de8 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcTorqueConfigController.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcTorqueConfigController.java
@@ -1,14 +1,19 @@
package org.jeecg.modules.mdc.controller;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+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 lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
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.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.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
@@ -33,104 +38,150 @@
/**
* 鏍规嵁id鏌ヨ
+ *
* @param id
* @return
*/
@AutoLog(value = "鎵煩閰嶇疆绠$悊-鏍规嵁id鏌ヨ")
- @ApiOperation(value = "鎵煩閰嶇疆绠$悊-鏍规嵁id鏌ヨ",notes = "鎵煩閰嶇疆绠$悊-鏍规嵁id鏌ヨ")
+ @ApiOperation(value = "鎵煩閰嶇疆绠$悊-鏍规嵁id鏌ヨ", notes = "鎵煩閰嶇疆绠$悊-鏍规嵁id鏌ヨ")
@GetMapping("/queryById")
- public Result<?> queryById(@RequestParam(required = true,name = "id") String id){
- MdcTorqueConfig mdcTorqueConfig=mdcTorqueConfigService.queryById(id);
+ public Result<?> queryById(@RequestParam(required = true, name = "id") String id) {
+ MdcTorqueConfig mdcTorqueConfig = mdcTorqueConfigService.queryById(id);
//鏌ヨ涓嶄负绌哄垯杩斿洖鏁版嵁
- return null!=mdcTorqueConfig?Result.OK(mdcTorqueConfig):Result.error("鏈壘鍒板搴旀暟鎹�");
+ return null != mdcTorqueConfig ? Result.OK(mdcTorqueConfig) : Result.error("鏈壘鍒板搴旀暟鎹�");
}
/**
- * 鏂板
+ * 鎵煩閰嶇疆绠$悊-鏂板
+ *
* @param mdcTorqueConfig
* @return
*/
@AutoLog(value = "鎵煩閰嶇疆绠$悊-鏂板")
- @ApiOperation(value = "鎵煩閰嶇疆绠$悊-鏂板",notes = "鎵煩閰嶇疆绠$悊-鏂板")
+ @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 MdcTorqueConfig mdcTorqueConfig) {
+ if (StringUtils.isBlank(mdcTorqueConfig.getEquipmentIds())) {
+ return Result.error("鏈�夋嫨璁惧锛岃鎺掓煡");
+ }
+ boolean result = mdcTorqueConfigService.addTorque(mdcTorqueConfig);
+ if (!result) {
+ return Result.error("鏃堕棿娈垫暟鎹凡瀛樺湪锛岃鎺掓煡");
+ }
+ return Result.OK("鏂板鎴愬姛");
}
/**
* 淇敼
+ *
* @param mdcTorqueConfig
* @return
*/
@AutoLog(value = "鎵煩閰嶇疆绠$悊-淇敼")
- @ApiOperation(value = "鎵煩閰嶇疆绠$悊-淇敼",notes = "鎵煩閰嶇疆绠$悊-淇敼")
+ @ApiOperation(value = "鎵煩閰嶇疆绠$悊-淇敼", notes = "鎵煩閰嶇疆绠$悊-淇敼")
@PutMapping("/editMdcTorqueConfig")
- public Result<?> editMdcTorqueConfig(@RequestBody MdcTorqueConfig mdcTorqueConfig){
- boolean flag= mdcTorqueConfigService.editTorque(mdcTorqueConfig);
- return flag?Result.ok("淇敼鎴愬姛"):Result.error("淇敼澶辫触");
+ public Result<?> editMdcTorqueConfig(@RequestBody MdcTorqueConfig mdcTorqueConfig) {
+ boolean flag = mdcTorqueConfigService.editTorque(mdcTorqueConfig);
+ return flag ? Result.ok("淇敼鎴愬姛") : Result.error("淇敼澶辫触");
}
/**
* 鏍规嵁id鍒犻櫎鎵煩閰嶇疆
+ *
* @param id
* @return
*/
@AutoLog(value = "鎵煩閰嶇疆绠$悊-鏍规嵁id鍒犻櫎鎵煩閰嶇疆")
- @ApiOperation(value = "鎵煩閰嶇疆绠$悊-鏍规嵁id鍒犻櫎鎵煩閰嶇疆",notes = "鎵煩閰嶇疆绠$悊-鏍规嵁id鍒犻櫎鎵煩閰嶇疆")
+ @ApiOperation(value = "鎵煩閰嶇疆绠$悊-鏍规嵁id鍒犻櫎鎵煩閰嶇疆", notes = "鎵煩閰嶇疆绠$悊-鏍规嵁id鍒犻櫎鎵煩閰嶇疆")
@DeleteMapping("/deleteMdcTorqueConfig")
- public Result<?> deleteMdcTorqueConfig(@RequestParam(name = "id",required = true) String id){
- boolean flag= mdcTorqueConfigService.deleteTorque(id);
- return flag?Result.ok("鍒犻櫎鎴愬姛"):Result.error("鍒犻櫎澶辫触");
+ public Result<?> deleteMdcTorqueConfig(@RequestParam(name = "id", required = true) String id) {
+ boolean flag = mdcTorqueConfigService.deleteTorque(id);
+ return flag ? Result.ok("鍒犻櫎鎴愬姛") : Result.error("鍒犻櫎澶辫触");
}
/**
* 鎵归噺鍒犻櫎
+ *
* @param ids
* @return
*/
@AutoLog(value = "鎵煩閰嶇疆绠$悊-鎵归噺鍒犻櫎")
- @ApiOperation(value = "鎵煩閰嶇疆绠$悊-鎵归噺鍒犻櫎",notes = "鎵煩閰嶇疆绠$悊-鎵归噺鍒犻櫎")
+ @ApiOperation(value = "鎵煩閰嶇疆绠$悊-鎵归噺鍒犻櫎", notes = "鎵煩閰嶇疆绠$悊-鎵归噺鍒犻櫎")
@DeleteMapping("/deleteBatchMdcTorqueConfig")
- public Result<?> deleteBatchMdcTorqueConfig(@RequestParam(name = "ids",required = true) String ids){
- boolean flag= mdcTorqueConfigService.deleteBatchTorque(ids);
- return flag?Result.ok("鎵归噺鍒犻櫎鎴愬姛"):Result.error("鍒犻櫎澶辫触");
+ public Result<?> deleteBatchMdcTorqueConfig(@RequestParam(name = "ids", required = true) String ids) {
+ boolean flag = mdcTorqueConfigService.deleteBatchTorque(ids);
+ return flag ? Result.ok("鎵归噺鍒犻櫎鎴愬姛") : Result.error("鍒犻櫎澶辫触");
}
/**
* 瀵煎嚭excel
+ *
* @param request
* @param mdcTorqueConfig
* @return
*/
+ @AutoLog(value = "鎵煩閰嶇疆绠$悊-瀵煎嚭")
+ @ApiOperation(value = "鎵煩閰嶇疆绠$悊-瀵煎嚭", notes = "鎵煩閰嶇疆绠$悊-瀵煎嚭")
@RequestMapping("/exportXls")
- public ModelAndView exportXls(HttpServletRequest request,MdcTorqueConfig mdcTorqueConfig){
- return super.exportXls(request,mdcTorqueConfig,MdcTorqueConfig.class,"鎵煩閰嶇疆绠$悊瀵煎嚭");
+ public ModelAndView exportXls(HttpServletRequest request, MdcTorqueConfig mdcTorqueConfig) {
+ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+ String userId = user.getId();
+ return this.mdcTorqueConfigService.exportXls(userId, mdcTorqueConfig);
}
/**
* 瀵煎叆excel
+ *
* @param request
* @param response
* @return
*/
+ @AutoLog(value = "鎵煩閰嶇疆绠$悊-瀵煎叆")
+ @ApiOperation(value = "鎵煩閰嶇疆绠$悊-瀵煎叆", notes = "鎵煩閰嶇疆绠$悊-瀵煎叆")
@RequestMapping("/importExcel")
- public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response){
- return super.importExcel(request,response,MdcTorqueConfig.class);
+ public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+ return super.importExcel(request, response, MdcTorqueConfig.class);
}
/**
- *鏍规嵁鎵煩鍊肩敓鎴愪富杞磋繍琛屾洸绾�
+ * 鏍规嵁鎵煩鍊肩敓鎴愪富杞磋繍琛屾洸绾�
+ *
* @param torqueValue
* @return
*/
@AutoLog(value = "鎵煩閰嶇疆绠$悊-鏍规嵁鎵煩鍊肩敓鎴愪富杞磋繍琛屾洸绾�")
- @ApiOperation(value = "鎵煩閰嶇疆绠$悊-鏍规嵁鎵煩鍊肩敓鎴愪富杞磋繍琛屾洸绾�",notes = "鎵煩閰嶇疆绠$悊-鏍规嵁鎵煩鍊肩敓鎴愪富杞磋繍琛屾洸绾�")
+ @ApiOperation(value = "鎵煩閰嶇疆绠$悊-鏍规嵁鎵煩鍊肩敓鎴愪富杞磋繍琛屾洸绾�", notes = "鎵煩閰嶇疆绠$悊-鏍规嵁鎵煩鍊肩敓鎴愪富杞磋繍琛屾洸绾�")
@GetMapping("/findSpindleRunningCurve")
- public Result<List<MdcTorqueConfig>> findSpindleRunningCurve(@RequestParam(name = "torqueValue",required=true) float torqueValue,
- @RequestParam(name = "equipmentId",required = true) String equipmentId){
- List<MdcTorqueConfig> list= mdcTorqueConfigService.findSpindleRunningCurve(torqueValue, equipmentId);
+ public Result<List<MdcTorqueConfig>> findSpindleRunningCurve(@RequestParam(name = "torqueValue", required = true) float torqueValue,
+ @RequestParam(name = "equipmentId", required = true) String equipmentId) {
+ List<MdcTorqueConfig> list = mdcTorqueConfigService.findSpindleRunningCurve(torqueValue, equipmentId);
return Result.ok(list);
}
+
+ /**
+ * 鍒嗛〉鏌ヨ
+ *
+ * @param mdcTorqueConfig
+ * @param pageNo
+ * @param pageSize
+ * @param req
+ * @return
+ */
+ @AutoLog(value = "鎵煩閰嶇疆绠$悊-鍒嗛〉鏌ヨ")
+ @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) {
+ 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);
+ return Result.ok(mdcTorqueConfigIPage);
+ }
}
--
Gitblit v1.9.3