|
@@ -0,0 +1,56 @@
|
|
|
+package com.bizmatics.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.bizmatics.model.PowerQualityConfig;
|
|
|
+import com.bizmatics.model.system.SysUser;
|
|
|
+import com.bizmatics.persistence.mapper.PowerQualityConfigMapper;
|
|
|
+import com.bizmatics.service.PowerQualityConfigService;
|
|
|
+import com.bizmatics.common.mvc.base.AbstractCrudService;
|
|
|
+import com.bizmatics.service.util.SecurityUtils;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author ya
|
|
|
+ * @since 2021-10-09
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class PowerQualityConfigServiceImpl extends AbstractCrudService<PowerQualityConfigMapper, PowerQualityConfig> implements PowerQualityConfigService {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void powerQualityAdd(PowerQualityConfig powerQualityConfig){
|
|
|
+ SysUser user = SecurityUtils.getLoginUser().getUser();
|
|
|
+ powerQualityConfig.setEnable(1);
|
|
|
+ powerQualityConfig.setCreator(user.getUserName());
|
|
|
+ powerQualityConfig.setCreateTime(LocalDateTime.now());
|
|
|
+ this.save(powerQualityConfig);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void powerQualityUpdate(PowerQualityConfig powerQualityConfig){
|
|
|
+ this.updateById(powerQualityConfig);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<PowerQualityConfig> powerQualityList(int siteId) {
|
|
|
+ LambdaQueryWrapper<PowerQualityConfig> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(PowerQualityConfig::getEnable, 1).eq(PowerQualityConfig::getSiteId, siteId);
|
|
|
+ List<PowerQualityConfig> powerQualityList = this.list(queryWrapper);
|
|
|
+ return powerQualityList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void powerQualityDel(int id){
|
|
|
+ PowerQualityConfig powerQualityConfig = new PowerQualityConfig();
|
|
|
+ powerQualityConfig.setId(id);
|
|
|
+ powerQualityConfig.setEnable(0);
|
|
|
+ this.updateById(powerQualityConfig);
|
|
|
+ }
|
|
|
+}
|