监测平台系统监控单元管理自定义属性功能

breach-zhy
马雪伟 2 months ago
parent 500d6cea99
commit 7d590ed05d

@ -0,0 +1,107 @@
package com.ruoyi.business.controller;
import com.ruoyi.business.domain.HwMonitorUnitAttribute;
import com.ruoyi.business.service.HwMonitorUnitAttributeService;
import com.ruoyi.common.core.web.domain.AjaxResult;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* (HwMonitorUnitAttribute)
*
* @author makejava
* @since 2024-09-04 13:20:30
*/
@RestController
@RequestMapping("hwMonitorUnitAttribute")
public class HwMonitorUnitAttributeController {
/**
*
*/
@Resource
private HwMonitorUnitAttributeService hwMonitorUnitAttributeService;
/**
*
*
* @param hwMonitorUnitAttribute
* @param pageRequest
* @return
*/
@GetMapping
public ResponseEntity<Page<HwMonitorUnitAttribute>> queryByPage(HwMonitorUnitAttribute hwMonitorUnitAttribute, PageRequest pageRequest) {
return ResponseEntity.ok(this.hwMonitorUnitAttributeService.queryByPage(hwMonitorUnitAttribute, pageRequest));
}
/**
*
*
* @param id
* @return
*/
@GetMapping("{id}")
public ResponseEntity<HwMonitorUnitAttribute> queryById(@PathVariable("id") Long id) {
return ResponseEntity.ok(this.hwMonitorUnitAttributeService.queryById(id));
}
/**
*
*
* @param hwMonitorUnitAttribute
* @return
*/
@PostMapping
public ResponseEntity<HwMonitorUnitAttribute> add(HwMonitorUnitAttribute hwMonitorUnitAttribute) {
return ResponseEntity.ok(this.hwMonitorUnitAttributeService.insert(hwMonitorUnitAttribute));
}
/**
*
*
* @param hwMonitorUnitAttribute
* @return
*/
@PutMapping
public ResponseEntity<HwMonitorUnitAttribute> edit(HwMonitorUnitAttribute hwMonitorUnitAttribute) {
return ResponseEntity.ok(this.hwMonitorUnitAttributeService.update(hwMonitorUnitAttribute));
}
/**
*
*
* @param id
* @return
*/
@DeleteMapping
public ResponseEntity<Boolean> deleteById(Long id) {
return ResponseEntity.ok(this.hwMonitorUnitAttributeService.deleteById(id));
}
@PostMapping("/addUnitAttribute")
public AjaxResult addUnitAttribute(@RequestBody HwMonitorUnitAttribute hwMonitorUnitAttribute){
int rows = hwMonitorUnitAttributeService.addUnitAttribute(hwMonitorUnitAttribute);
return AjaxResult.success(rows);
}
@GetMapping("/selectAttributeByUnitId")
public AjaxResult selectAttributeByUnitId(Long monitorUnitId){
return AjaxResult.success(hwMonitorUnitAttributeService.selectAttributeByUnitId(monitorUnitId));
}
@PostMapping("/updateAttributeByUniitId")
public AjaxResult updateAttributeByUniitId(@RequestBody HwMonitorUnitAttribute hwMonitorUnitAttribute){
return AjaxResult.success(hwMonitorUnitAttributeService.updateAttributeByUniitId(hwMonitorUnitAttribute));
}
@DeleteMapping("/deleteAttributeByUniitId/{attributeId}")
public AjaxResult deleteAttributeByUniitId(@PathVariable Long attributeId){
return AjaxResult.success(hwMonitorUnitAttributeService.deleteAttributeByUniitId(attributeId));
}
}

@ -0,0 +1,114 @@
package com.ruoyi.business.domain;
import java.io.Serializable;
import java.util.Date;
/**
* (HwMonitorUnitAttribute)
*
* @author makejava
* @since 2024-09-04 13:20:33
*/
public class HwMonitorUnitAttribute implements Serializable {
private static final long serialVersionUID = -41167481835416588L;
/**
* ID
*/
private Long attributeId;
/**
* ID
*/
private Long monitorUnitId;
/**
*
*/
private String attributeName;
/**
*
*/
private String attributeValue;
/**
*
*/
private String createBy;
/**
*
*/
private Date createTime;
/**
*
*/
private String updateBy;
/**
*
*/
private Date updateTime;
public Long getAttributeId() {
return attributeId;
}
public void setAttributeId(Long attributeId) {
this.attributeId = attributeId;
}
public Long getMonitorUnitId() {
return monitorUnitId;
}
public void setMonitorUnitId(Long monitorUnitId) {
this.monitorUnitId = monitorUnitId;
}
public String getAttributeName() {
return attributeName;
}
public void setAttributeName(String attributeName) {
this.attributeName = attributeName;
}
public String getAttributeValue() {
return attributeValue;
}
public void setAttributeValue(String attributeValue) {
this.attributeValue = attributeValue;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

@ -0,0 +1,92 @@
package com.ruoyi.business.mapper;
import com.ruoyi.business.domain.HwMonitorUnitAttribute;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* (HwMonitorUnitAttribute)访
*
* @author makejava
* @since 2024-09-04 13:20:30
*/
public interface HwMonitorUnitAttributeDao {
/**
* ID
*
* @param attributeId
* @return
*/
HwMonitorUnitAttribute queryById(Long attributeId);
/**
*
*
* @param hwMonitorUnitAttribute
* @param pageable
* @return
*/
List<HwMonitorUnitAttribute> queryAllByLimit(HwMonitorUnitAttribute hwMonitorUnitAttribute, @Param("pageable") Pageable pageable);
/**
*
*
* @param hwMonitorUnitAttribute
* @return
*/
long count(HwMonitorUnitAttribute hwMonitorUnitAttribute);
/**
*
*
* @param hwMonitorUnitAttribute
* @return
*/
int insert(HwMonitorUnitAttribute hwMonitorUnitAttribute);
/**
* MyBatisforeach
*
* @param entities List<HwMonitorUnitAttribute>
* @return
*/
int insertBatch(@Param("entities") List<HwMonitorUnitAttribute> entities);
/**
* MyBatisforeach
*
* @param entities List<HwMonitorUnitAttribute>
* @return
* @throws org.springframework.jdbc.BadSqlGrammarException ListSQL
*/
int insertOrUpdateBatch(@Param("entities") List<HwMonitorUnitAttribute> entities);
/**
*
*
* @param hwMonitorUnitAttribute
* @return
*/
int update(HwMonitorUnitAttribute hwMonitorUnitAttribute);
/**
*
*
* @param attributeId
* @return
*/
int deleteById(Long attributeId);
List<HwMonitorUnitAttribute> selectAttributeByUnitId(Long monitorUnitId);
int updateAttributeByUniitId(HwMonitorUnitAttribute hwMonitorUnitAttribute);
int deleteAttributeByUniitId(Long attributeId);
List<HwMonitorUnitAttribute> selectAttributes(Long unitId);
}

@ -0,0 +1,68 @@
package com.ruoyi.business.service;
import com.ruoyi.business.domain.HwMonitorUnitAttribute;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import java.util.List;
/**
* (HwMonitorUnitAttribute)
*
* @author makejava
* @since 2024-09-04 13:20:34
*/
public interface HwMonitorUnitAttributeService {
/**
* ID
*
* @param attributeId
* @return
*/
HwMonitorUnitAttribute queryById(Long attributeId);
/**
*
*
* @param hwMonitorUnitAttribute
* @param pageRequest
* @return
*/
Page<HwMonitorUnitAttribute> queryByPage(HwMonitorUnitAttribute hwMonitorUnitAttribute, PageRequest pageRequest);
/**
*
*
* @param hwMonitorUnitAttribute
* @return
*/
HwMonitorUnitAttribute insert(HwMonitorUnitAttribute hwMonitorUnitAttribute);
/**
*
*
* @param hwMonitorUnitAttribute
* @return
*/
HwMonitorUnitAttribute update(HwMonitorUnitAttribute hwMonitorUnitAttribute);
/**
*
*
* @param attributeId
* @return
*/
boolean deleteById(Long attributeId);
int addUnitAttribute(HwMonitorUnitAttribute hwMonitorUnitAttribute);
List<HwMonitorUnitAttribute> selectAttributeByUnitId(Long monitorUnitId);
int updateAttributeByUniitId(HwMonitorUnitAttribute hwMonitorUnitAttribute);
int deleteAttributeByUniitId(Long attributeId);
List<HwMonitorUnitAttribute> selectAttributes(Long unitId);
}

@ -0,0 +1,116 @@
package com.ruoyi.business.service.impl;
import com.ruoyi.business.domain.HwMonitorUnitAttribute;
import com.ruoyi.business.mapper.HwMonitorUnitAttributeDao;
import com.ruoyi.business.service.HwMonitorUnitAttributeService;
import com.ruoyi.common.security.utils.SecurityUtils;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* (HwMonitorUnitAttribute)
*
* @author makejava
* @since 2024-09-04 13:20:34
*/
@Service("hwMonitorUnitAttributeService")
public class HwMonitorUnitAttributeServiceImpl implements HwMonitorUnitAttributeService {
@Resource
private HwMonitorUnitAttributeDao hwMonitorUnitAttributeDao;
/**
* ID
*
* @param attributeId
* @return
*/
@Override
public HwMonitorUnitAttribute queryById(Long attributeId) {
return this.hwMonitorUnitAttributeDao.queryById(attributeId);
}
/**
*
*
* @param hwMonitorUnitAttribute
* @param pageRequest
* @return
*/
@Override
public Page<HwMonitorUnitAttribute> queryByPage(HwMonitorUnitAttribute hwMonitorUnitAttribute, PageRequest pageRequest) {
long total = this.hwMonitorUnitAttributeDao.count(hwMonitorUnitAttribute);
return new PageImpl<>(this.hwMonitorUnitAttributeDao.queryAllByLimit(hwMonitorUnitAttribute, pageRequest), pageRequest, total);
}
/**
*
*
* @param hwMonitorUnitAttribute
* @return
*/
@Override
public HwMonitorUnitAttribute insert(HwMonitorUnitAttribute hwMonitorUnitAttribute) {
this.hwMonitorUnitAttributeDao.insert(hwMonitorUnitAttribute);
return hwMonitorUnitAttribute;
}
/**
*
*
* @param hwMonitorUnitAttribute
* @return
*/
@Override
public HwMonitorUnitAttribute update(HwMonitorUnitAttribute hwMonitorUnitAttribute) {
this.hwMonitorUnitAttributeDao.update(hwMonitorUnitAttribute);
return this.queryById(hwMonitorUnitAttribute.getAttributeId());
}
/**
*
*
* @param attributeId
* @return
*/
@Override
public boolean deleteById(Long attributeId) {
return this.hwMonitorUnitAttributeDao.deleteById(attributeId) > 0;
}
@Override
public int addUnitAttribute(HwMonitorUnitAttribute hwMonitorUnitAttribute) {
hwMonitorUnitAttribute.setCreateBy(SecurityUtils.getUsername());
hwMonitorUnitAttribute.setCreateTime(new Date());
return hwMonitorUnitAttributeDao.insert(hwMonitorUnitAttribute);
}
@Override
public List<HwMonitorUnitAttribute> selectAttributeByUnitId(Long monitorUnitId) {
return hwMonitorUnitAttributeDao.selectAttributeByUnitId(monitorUnitId);
}
@Override
public int updateAttributeByUniitId(HwMonitorUnitAttribute hwMonitorUnitAttribute) {
return hwMonitorUnitAttributeDao.updateAttributeByUniitId(hwMonitorUnitAttribute);
}
@Override
public List<HwMonitorUnitAttribute> selectAttributes(Long aLong) {
return hwMonitorUnitAttributeDao.selectAttributes(aLong);
}
@Override
public int deleteAttributeByUniitId(Long unitId) {
return hwMonitorUnitAttributeDao.deleteAttributeByUniitId(unitId);
}
}
Loading…
Cancel
Save