Browse Source

根据设备id查询设备参数

sl 2 months ago
parent
commit
5b856f25a4

+ 13 - 0
module_tpm/src/main/java/org/jeecg/modules/tpmparams/controller/TpmParamsController.java

@@ -170,4 +170,17 @@ public class TpmParamsController extends JeecgController<TpmParams, ITpmParamsSe
         return super.importExcel(request, response, TpmParams.class);
     }
 
+	 /**
+	  * 通过设备id查询相关参数
+	  *
+	  * @param equipmentid
+	  * @return
+	  */
+	 //@AutoLog(value = "设备参数-通过设备id查询相关参数")
+	 @ApiOperation(value="设备参数-通过设备id查询相关参数", notes="设备参数-通过设备id查询相关参数")
+	 @GetMapping(value = "/queryByEquipId")
+	 public Result<List<TpmParams>> queryByEquipId(@RequestParam(name="equipmentid",required=true) String equipmentid) {
+		 return tpmParamsService.queryByEquipId(equipmentid);
+	 }
+
 }

+ 3 - 0
module_tpm/src/main/java/org/jeecg/modules/tpmparams/mapper/TpmParamsMapper.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.tpmparams.mapper;
 
 import java.util.List;
 
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.tpmparams.entity.TpmParams;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
@@ -18,4 +19,6 @@ public interface TpmParamsMapper extends BaseMapper<TpmParams> {
      * */
     public List<TpmParams> selectTpmParamsList(TpmParams params);
 
+    List<TpmParams> queryByEquipId(String equipmentid);
+
 }

+ 4 - 0
module_tpm/src/main/java/org/jeecg/modules/tpmparams/mapper/xml/TpmParamsMapper.xml

@@ -29,4 +29,8 @@
         order by tagname asc
     </select>
 
+    <select id="queryByEquipId" resultMap="TpmParamsResult">
+        select t2.* from tpm_params t2 where t2.equipmentcode=(select equipmentcode from tpm_equipment where id=#{equipmentid});
+    </select>
+
 </mapper>

+ 4 - 0
module_tpm/src/main/java/org/jeecg/modules/tpmparams/service/ITpmParamsService.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.tpmparams.service;
 
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.tpmparams.entity.TpmParams;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -18,4 +19,7 @@ public interface ITpmParamsService extends IService<TpmParams> {
      * */
     List<TpmParams> selectTpmParamsList(TpmParams params);
 
+    //通过设备id查询相关参数
+    Result<List<TpmParams>>  queryByEquipId(String equipmentid);
+
 }

+ 13 - 0
module_tpm/src/main/java/org/jeecg/modules/tpmparams/service/impl/TpmParamsServiceImpl.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.tpmparams.service.impl;
 
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.tpmparams.entity.TpmParams;
 import org.jeecg.modules.tpmparams.mapper.TpmParamsMapper;
 import org.jeecg.modules.tpmparams.service.ITpmParamsService;
@@ -8,6 +9,7 @@ import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -29,4 +31,15 @@ public class TpmParamsServiceImpl extends ServiceImpl<TpmParamsMapper, TpmParams
         return tpmParamsMapper.selectTpmParamsList(params);
     }
 
+    /**
+     * 通过设备id查询相关参数
+     * */
+    public Result<List<TpmParams>>  queryByEquipId(String equipmentid){
+        List<TpmParams> tpmParamsList = tpmParamsMapper.queryByEquipId(equipmentid);
+        if(tpmParamsList.size()==0) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.ok(tpmParamsList);
+    }
+
 }