package com.iailab.module.data.indexdata.controller.admin;
|
|
import com.iailab.module.data.common.utils.PageUtils;
|
import com.iailab.module.data.common.utils.R;
|
import com.iailab.framework.security.core.util.SecurityFrameworkUtils;
|
import com.iailab.module.data.indexdata.entity.IndexDataClockEntity;
|
import com.iailab.module.data.indexdata.service.IndexDataClockService;
|
import javax.annotation.Resource;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.Date;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* @author PanZhibao
|
* @Description
|
* @createTime 2022年09月08日 21:52:00
|
*/
|
@RestController
|
@RequestMapping("/data/index-data/clock")
|
@Tag(name = "数据采集-index-data-clock")
|
public class IndexDataClockController {
|
|
@Resource
|
private IndexDataClockService indexDataClockService;
|
|
/**
|
* 所有时钟配置列表
|
*/
|
@GetMapping("/list")
|
@Operation(summary = "查询列表")
|
public R list(@RequestParam Map<String, Object> params){
|
PageUtils page = indexDataClockService.queryPage(params);
|
return R.ok().put("page", page);
|
}
|
|
/**
|
* 采集点列表(全部)
|
*/
|
@GetMapping("/list/all")
|
public R queryAll(@RequestParam Map<String, Object> params){
|
List<IndexDataClockEntity> data = indexDataClockService.queryList(params);
|
return R.ok().put("data", data);
|
}
|
|
/**
|
* 新增时钟配置
|
*
|
* @param indexDataClockEntity
|
* @return
|
*/
|
@PostMapping("/add")
|
public R add(@RequestBody IndexDataClockEntity indexDataClockEntity) {
|
int count = indexDataClockService.cheack(indexDataClockEntity);
|
if (count > 0) {
|
return R.error("名称或编号重复");
|
}
|
indexDataClockEntity.setCreateBy(SecurityFrameworkUtils.getLoginUserId().toString());
|
indexDataClockEntity.setCreateTime(new Date());
|
indexDataClockService.add(indexDataClockEntity);
|
return R.ok();
|
}
|
|
/**
|
* 更新时钟配置
|
*
|
* @param indexDataClockEntity
|
* @return
|
*/
|
@PostMapping("/update")
|
public R update(@RequestBody IndexDataClockEntity indexDataClockEntity) {
|
int count = indexDataClockService.cheack(indexDataClockEntity);
|
if (count > 0) {
|
return R.error("名称或编号重复");
|
}
|
indexDataClockEntity.setUpdateBy(SecurityFrameworkUtils.getLoginUserId().toString());
|
indexDataClockService.update(indexDataClockEntity);
|
return R.ok();
|
}
|
|
/**
|
* 删除时钟配置
|
*
|
* @param params
|
* @return
|
*/
|
@PostMapping("/delete")
|
public R delete(@RequestParam Map<String, Object> params) {
|
String id = (String)params.get("id");
|
indexDataClockService.deleteById(id);
|
return R.ok();
|
}
|
|
/**
|
* 时钟配置详情
|
*
|
* @param id
|
* @return
|
*/
|
@RequestMapping("/info/{id}")
|
public R info(@PathVariable("id") String id){
|
IndexDataClockEntity indexDataClockEntity = indexDataClockService.getInfoById(id);
|
return R.ok().put("data", indexDataClockEntity);
|
}
|
}
|