From ffe9c08011d25c39880d107a5f3de249d309c1b4 Mon Sep 17 00:00:00 2001 From: qushaowei <qushaowei@163.com> Date: 星期一, 13 十一月 2023 12:37:56 +0800 Subject: [PATCH] Merge branch 'master' of http://117.34.109.166:18448/r/mdc_430 into develop --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentThresholdController.java | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 164 insertions(+), 0 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentThresholdController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentThresholdController.java new file mode 100644 index 0000000..3010565 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentThresholdController.java @@ -0,0 +1,164 @@ +package org.jeecg.modules.mdc.controller; + + +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.mdc.entity.MdcEquipmentThreshold; +import org.jeecg.modules.mdc.service.IMdcEquipmentThresholdService; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; + +/** + * @Description: 璁惧鍙傛暟闃堝�艰〃 + * @Author: Lius + * @Date: 2023-11-08 + * @Version: V1.0 + */ +@Slf4j +@Api(tags = "璁惧鍙傛暟闃堝�艰〃") +@RestController +@RequestMapping("/mdc/mdcEquipmentThreshold") +public class MdcEquipmentThresholdController extends JeecgController<MdcEquipmentThreshold, IMdcEquipmentThresholdService> { + + @Resource + private IMdcEquipmentThresholdService mdcEquipmentThresholdService; + + /** + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param mdcEquipmentThreshold + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "璁惧鍙傛暟闃堝�艰〃-鍒嗛〉鍒楄〃鏌ヨ") + @ApiOperation(value = "璁惧鍙傛暟闃堝�艰〃-鍒嗛〉鍒楄〃鏌ヨ", notes = "璁惧鍙傛暟闃堝�艰〃-鍒嗛〉鍒楄〃鏌ヨ") + @GetMapping(value = "/list") + public Result<?> queryPageList(MdcEquipmentThreshold mdcEquipmentThreshold, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper<MdcEquipmentThreshold> queryWrapper = QueryGenerator.initQueryWrapper(mdcEquipmentThreshold, req.getParameterMap()); + Page<MdcEquipmentThreshold> page = new Page<MdcEquipmentThreshold>(pageNo, pageSize); + IPage<MdcEquipmentThreshold> pageList = mdcEquipmentThresholdService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 娣诲姞 + * + * @param mdcEquipmentThreshold + * @return + */ + @AutoLog(value = "璁惧鍙傛暟闃堝�艰〃-娣诲姞") + @ApiOperation(value = "璁惧鍙傛暟闃堝�艰〃-娣诲姞", notes = "璁惧鍙傛暟闃堝�艰〃-娣诲姞") + @PostMapping(value = "/add") + public Result<?> add(@RequestBody MdcEquipmentThreshold mdcEquipmentThreshold) { + String chineseName = mdcEquipmentThreshold.getChineseName(); + mdcEquipmentThreshold.setEnglishName(chineseName.substring(0, chineseName.indexOf("("))); + mdcEquipmentThreshold.setChineseName(chineseName.substring(mdcEquipmentThreshold.getEnglishName().length() + 1, chineseName.length() - 1)); + mdcEquipmentThresholdService.save(mdcEquipmentThreshold); + return Result.OK("娣诲姞鎴愬姛锛�"); + } + + /** + * 缂栬緫 + * + * @param mdcEquipmentThreshold + * @return + */ + @AutoLog(value = "璁惧鍙傛暟闃堝�艰〃-缂栬緫") + @ApiOperation(value = "璁惧鍙傛暟闃堝�艰〃-缂栬緫", notes = "璁惧鍙傛暟闃堝�艰〃-缂栬緫") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result<?> edit(@RequestBody MdcEquipmentThreshold mdcEquipmentThreshold) { + String chineseName = mdcEquipmentThreshold.getChineseName(); + mdcEquipmentThreshold.setEnglishName(chineseName.substring(0, chineseName.indexOf("("))); + mdcEquipmentThreshold.setChineseName(chineseName.substring(mdcEquipmentThreshold.getEnglishName().length() + 1, chineseName.length() - 1)); + mdcEquipmentThresholdService.save(mdcEquipmentThreshold); + mdcEquipmentThresholdService.updateById(mdcEquipmentThreshold); + 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) { + mdcEquipmentThresholdService.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.mdcEquipmentThresholdService.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) { + MdcEquipmentThreshold mdcEquipmentThreshold = mdcEquipmentThresholdService.getById(id); + String englishName = mdcEquipmentThreshold.getEnglishName(); + String chineseName = mdcEquipmentThreshold.getChineseName(); + mdcEquipmentThreshold.setChineseName(englishName + "(" + chineseName + ")"); + return Result.OK(mdcEquipmentThreshold); + } + + /** + * 瀵煎嚭excel + * + * @param request + * @param mdcEquipmentThreshold + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, MdcEquipmentThreshold mdcEquipmentThreshold) { + return super.exportXls(request, mdcEquipmentThreshold, MdcEquipmentThreshold.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, MdcEquipmentThreshold.class); + } + +} -- Gitblit v1.9.3