|
@@ -0,0 +1,55 @@
|
|
|
+package com.huimv.env.common.service.impl;
|
|
|
+
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.core.util.RandomUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.huimv.common.utils.Result;
|
|
|
+import com.huimv.common.utils.ResultCode;
|
|
|
+import com.huimv.env.common.entity.BaseThreshold;
|
|
|
+import com.huimv.env.common.mapper.BaseThresholdMapper;
|
|
|
+import com.huimv.env.common.service.IBaseThresholdService;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author author
|
|
|
+ * @since 2022-11-01
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class BaseThresholdServiceImpl extends ServiceImpl<BaseThresholdMapper, BaseThreshold> implements IBaseThresholdService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private BaseThresholdMapper baseThresholdMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result listThreshold(Map<String,String> map) {
|
|
|
+ String farmCode = map.get("farmCode");
|
|
|
+ BaseThreshold baseThreshold = baseThresholdMapper.selectOne(new QueryWrapper<BaseThreshold>().eq("farm_code", farmCode));
|
|
|
+ if (ObjectUtil.isEmpty(baseThreshold)){
|
|
|
+ baseThreshold = new BaseThreshold();
|
|
|
+ baseThreshold.setFarmCode(Integer.parseInt(farmCode));
|
|
|
+ baseThreshold.setMaxHumi(new BigDecimal("40.0"));
|
|
|
+ baseThreshold.setMaxTemp(new BigDecimal("90.0"));
|
|
|
+ baseThreshold.setMinHumi(new BigDecimal("0.0"));
|
|
|
+ baseThreshold.setMinTemp(new BigDecimal("0.0"));
|
|
|
+ baseThreshold.setOther1("0");
|
|
|
+ baseThreshold.setOther2("0");
|
|
|
+ baseThreshold.setOther3("0");
|
|
|
+ baseThreshold.setOther4("0");
|
|
|
+ baseThreshold.setOther5("0");
|
|
|
+ baseThreshold.setOther6("0");
|
|
|
+ baseThresholdMapper.insert(baseThreshold);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return new Result(ResultCode.SUCCESS,baseThreshold);
|
|
|
+ }
|
|
|
+}
|