From c2fccb01b972176dc3da5a497b5e904025e9e98d Mon Sep 17 00:00:00 2001
From: bsw215583320 <baoshiwei121@163.com>
Date: 星期二, 16 四月 2024 15:06:51 +0800
Subject: [PATCH] Merge branch 'master' of http://210.22.126.130:1111/r/dry/herb

---
 jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java |  223 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 223 insertions(+), 0 deletions(-)

diff --git a/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java b/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java
new file mode 100644
index 0000000..3a172ed
--- /dev/null
+++ b/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java
@@ -0,0 +1,223 @@
+package org.jeecg.modules.dry.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.config.TenantContext;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.RedisUtil;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
+import org.jeecg.modules.dry.common.CacheConstants;
+import org.jeecg.modules.dry.entity.DryEquipment;
+import org.jeecg.modules.dry.service.IDryEqpTypeService;
+import org.jeecg.modules.dry.service.IDryEquipmentService;
+
+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;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+
+ /**
+ * @Description: 骞茬嚗鏈�
+ * @Author: jeecg-boot
+ * @Date:   2023-03-08
+ * @Version: V1.0
+ */
+@Api(tags="骞茬嚗鏈�")
+@RestController
+@RequestMapping("/dry/dryEquipment")
+@Slf4j
+public class DryEquipmentController extends JeecgController<DryEquipment, IDryEquipmentService> {
+	@Autowired
+	private IDryEquipmentService dryEquipmentService;
+
+	@Autowired
+	private IDryEqpTypeService dryEqpTypeService;
+
+
+	 @Autowired
+	 private RedisUtil redisUtil;
+	/**
+	 * 鍒嗛〉鍒楄〃鏌ヨ
+	 *
+	 * @param dryEquipment
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	//@AutoLog(value = "骞茬嚗鏈�-鍒嗛〉鍒楄〃鏌ヨ")
+	@ApiOperation(value="骞茬嚗鏈�-鍒嗛〉鍒楄〃鏌ヨ", notes="骞茬嚗鏈�-鍒嗛〉鍒楄〃鏌ヨ")
+	@GetMapping(value = "/list")
+	public Result<IPage<DryEquipment>> queryPageList(DryEquipment dryEquipment,
+								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   HttpServletRequest req) {
+		//------------------------------------------------------------------------------------------------
+		//鏄惁寮�鍚郴缁熺鐞嗘ā鍧楃殑澶氱鎴锋暟鎹殧绂汇�怱AAS澶氱鎴锋ā寮忋��
+		if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
+			dryEquipment.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(),0));
+		}
+		//------------------------------------------------------------------------------------------------
+		QueryWrapper<DryEquipment> queryWrapper = QueryGenerator.initQueryWrapper(dryEquipment, req.getParameterMap());
+		Page<DryEquipment> page = new Page<DryEquipment>(pageNo, pageSize);
+		IPage<DryEquipment> pageList = dryEquipmentService.page(page, queryWrapper);
+		return Result.OK(pageList);
+	}
+
+	 @ApiOperation(value="鏌ヨ鎵�鏈夊共鐕ユ満", notes="鏌ヨ鎵�鏈夊共鐕ユ満")
+	 @GetMapping(value = "/listAll")
+	public Result<List<DryEquipment>> queryAllEquipment(DryEquipment dryEquipment, HttpServletRequest req) {
+		//------------------------------------------------------------------------------------------------
+		//鏄惁寮�鍚郴缁熺鐞嗘ā鍧楃殑澶氱鎴锋暟鎹殧绂汇�怱AAS澶氱鎴锋ā寮忋��
+		if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
+			dryEquipment.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(),0));
+		}
+		//------------------------------------------------------------------------------------------------
+		QueryWrapper<DryEquipment> queryWrapper = QueryGenerator.initQueryWrapper(dryEquipment, req.getParameterMap());
+
+		queryWrapper.orderByAsc("code");
+		List<DryEquipment> eqps = dryEquipmentService.list(queryWrapper);
+		eqps.stream().forEach(item -> {
+			item.setType(dryEqpTypeService.getById(item.getType()).getName());
+		});
+		return Result.OK(eqps);
+	}
+
+
+
+
+
+	/**
+	 *   娣诲姞
+	 *
+	 * @param dryEquipment
+	 * @return
+	 */
+	@AutoLog(value = "骞茬嚗鏈�-娣诲姞")
+	@ApiOperation(value="骞茬嚗鏈�-娣诲姞", notes="骞茬嚗鏈�-娣诲姞")
+	@RequiresPermissions("dry:dry_equipment:add")
+	@PostMapping(value = "/add")
+	public Result<String> add(@RequestBody DryEquipment dryEquipment) {
+		dryEquipmentService.save(dryEquipment);
+		return Result.OK("娣诲姞鎴愬姛锛�");
+	}
+
+	/**
+	 *  缂栬緫
+	 *
+	 * @param dryEquipment
+	 * @return
+	 */
+	@AutoLog(value = "骞茬嚗鏈�-缂栬緫")
+	@ApiOperation(value="骞茬嚗鏈�-缂栬緫", notes="骞茬嚗鏈�-缂栬緫")
+	@RequiresPermissions("dry:dry_equipment:edit")
+	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<String> edit(@RequestBody DryEquipment dryEquipment) {
+		redisUtil.del(CacheConstants.RedisKeyEnum.EQP_MAP.getCode());
+		dryEquipmentService.updateById(dryEquipment);
+
+		return Result.OK("缂栬緫鎴愬姛!");
+	}
+
+	/**
+	 *   閫氳繃id鍒犻櫎
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "骞茬嚗鏈�-閫氳繃id鍒犻櫎")
+	@ApiOperation(value="骞茬嚗鏈�-閫氳繃id鍒犻櫎", notes="骞茬嚗鏈�-閫氳繃id鍒犻櫎")
+	@RequiresPermissions("dry:dry_equipment:delete")
+	@DeleteMapping(value = "/delete")
+	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+		redisUtil.del(CacheConstants.RedisKeyEnum.EQP_MAP.getCode());
+		dryEquipmentService.removeById(id);
+		return Result.OK("鍒犻櫎鎴愬姛!");
+	}
+
+	/**
+	 *  鎵归噺鍒犻櫎
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "骞茬嚗鏈�-鎵归噺鍒犻櫎")
+	@ApiOperation(value="骞茬嚗鏈�-鎵归噺鍒犻櫎", notes="骞茬嚗鏈�-鎵归噺鍒犻櫎")
+	@RequiresPermissions("dry:dry_equipment:deleteBatch")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		redisUtil.del(CacheConstants.RedisKeyEnum.EQP_MAP.getCode());
+		this.dryEquipmentService.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<DryEquipment> queryById(@RequestParam(name="id",required=true) String id) {
+		DryEquipment dryEquipment = dryEquipmentService.getById(id);
+		dryEquipment.setType(dryEqpTypeService.getById(dryEquipment.getType()).getName());
+		if(dryEquipment==null) {
+			return Result.error("鏈壘鍒板搴旀暟鎹�");
+		}
+		return Result.OK(dryEquipment);
+	}
+
+    /**
+    * 瀵煎嚭excel
+    *
+    * @param request
+    * @param dryEquipment
+    */
+    @RequiresPermissions("dry:dry_equipment:exportXls")
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, DryEquipment dryEquipment) {
+        return super.exportXls(request, dryEquipment, DryEquipment.class, "骞茬嚗鏈�");
+    }
+
+    /**
+      * 閫氳繃excel瀵煎叆鏁版嵁
+    *
+    * @param request
+    * @param response
+    * @return
+    */
+    @RequiresPermissions("dry:dry_equipment:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, DryEquipment.class);
+    }
+
+}

--
Gitblit v1.9.3