feat(ems): 添加告警、能耗记录和能源费率模块- 新增告警实体类 EmsAlert 及相关业务对象、控制器、映射器和服务实现
- 新增能耗记录实体类 EmsEnergyConsumption 及相关业务对象、控制器、映射器和服务实现 - 新增能源费率实体类 EmsEnergyRate 及相关业务对象、控制器、映射器和服务实现 - 实现各模块的基础 CRUD 功能,包括分页查询、导出 Excel 等操作 - 配置 MyBatis 映射文件及逻辑删除支持
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
package com.klp.ems.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.ems.domain.vo.EmsLocationVo;
|
||||
import com.klp.ems.domain.bo.EmsLocationBo;
|
||||
import com.klp.ems.service.IEmsLocationService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 位置
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/mes/location")
|
||||
public class EmsLocationController extends BaseController {
|
||||
|
||||
private final IEmsLocationService iEmsLocationService;
|
||||
|
||||
/**
|
||||
* 查询位置列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<EmsLocationVo> list(EmsLocationBo bo, PageQuery pageQuery) {
|
||||
return iEmsLocationService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出位置列表
|
||||
*/
|
||||
@Log(title = "位置", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(EmsLocationBo bo, HttpServletResponse response) {
|
||||
List<EmsLocationVo> list = iEmsLocationService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "位置", EmsLocationVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取位置详细信息
|
||||
*
|
||||
* @param locationId 主键
|
||||
*/
|
||||
@GetMapping("/{locationId}")
|
||||
public R<EmsLocationVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long locationId) {
|
||||
return R.ok(iEmsLocationService.queryById(locationId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增位置
|
||||
*/
|
||||
@Log(title = "位置", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody EmsLocationBo bo) {
|
||||
return toAjax(iEmsLocationService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改位置
|
||||
*/
|
||||
@Log(title = "位置", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody EmsLocationBo bo) {
|
||||
return toAjax(iEmsLocationService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除位置
|
||||
*
|
||||
* @param locationIds 主键串
|
||||
*/
|
||||
@Log(title = "位置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{locationIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] locationIds) {
|
||||
return toAjax(iEmsLocationService.deleteWithValidByIds(Arrays.asList(locationIds), true));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user