package org.dromara.demo.controller;
|
|
import java.util.List;
|
|
import lombok.RequiredArgsConstructor;
|
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.validation.constraints.*;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import org.dromara.demo.domain.bo.JdCruxIndexDataBo;
|
import org.dromara.demo.domain.vo.JdCruxIndexDataVo;
|
import org.dromara.demo.service.IJdCruxIndexDataService;
|
import org.springframework.web.bind.annotation.*;
|
import org.springframework.validation.annotation.Validated;
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.validate.AddGroup;
|
import org.dromara.common.core.validate.EditGroup;
|
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.excel.utils.ExcelUtil;
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
/**
|
* 关键指标数据(卡片)
|
*
|
* @author Lion Li
|
* @date 2024-02-22
|
*/
|
@Validated
|
@RequiredArgsConstructor
|
@RestController
|
@RequestMapping("/jd/cid")
|
public class JdCruxIndexDataController extends BaseController {
|
|
private final IJdCruxIndexDataService jdCruxIndexDataService;
|
|
/**
|
* 查询关键指标数据(卡片)列表
|
*/
|
@SaCheckPermission("jd:cruxIndexData:list")
|
@GetMapping("/list")
|
public TableDataInfo<JdCruxIndexDataVo> list(JdCruxIndexDataBo bo, PageQuery pageQuery) {
|
return jdCruxIndexDataService.queryPageList(bo, pageQuery);
|
}
|
|
/**
|
* 导出关键指标数据(卡片)列表
|
*/
|
@SaCheckPermission("jd:cruxIndexData:export")
|
@Log(title = "关键指标数据(卡片)", businessType = BusinessType.EXPORT)
|
@PostMapping("/export")
|
public void export(JdCruxIndexDataBo bo, HttpServletResponse response) {
|
List<JdCruxIndexDataVo> list = jdCruxIndexDataService.queryList(bo);
|
ExcelUtil.exportExcel(list, "关键指标数据(卡片)", JdCruxIndexDataVo.class, response);
|
}
|
|
/**
|
* 获取关键指标数据(卡片)详细信息
|
*
|
* @param id 主键
|
*/
|
@SaCheckPermission("jd:cruxIndexData:query")
|
@GetMapping("/{id}")
|
public R<JdCruxIndexDataVo> getInfo(@NotNull(message = "主键不能为空")
|
@PathVariable Long id) {
|
return R.ok(jdCruxIndexDataService.queryById(id));
|
}
|
|
/**
|
* 新增关键指标数据(卡片)
|
*/
|
@SaCheckPermission("jd:cruxIndexData:add")
|
@Log(title = "关键指标数据(卡片)", businessType = BusinessType.INSERT)
|
@RepeatSubmit()
|
@PostMapping()
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody JdCruxIndexDataBo bo) {
|
return toAjax(jdCruxIndexDataService.insertByBo(bo));
|
}
|
|
/**
|
* 修改关键指标数据(卡片)
|
*/
|
@SaCheckPermission("jd:cruxIndexData:edit")
|
@Log(title = "关键指标数据(卡片)", businessType = BusinessType.UPDATE)
|
@RepeatSubmit()
|
@PutMapping()
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody JdCruxIndexDataBo bo) {
|
return toAjax(jdCruxIndexDataService.updateByBo(bo));
|
}
|
|
/**
|
* 删除关键指标数据(卡片)
|
*
|
* @param ids 主键串
|
*/
|
@SaCheckPermission("jd:cruxIndexData:remove")
|
@Log(title = "关键指标数据(卡片)", businessType = BusinessType.DELETE)
|
@DeleteMapping("/{ids}")
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
@PathVariable Long[] ids) {
|
return toAjax(jdCruxIndexDataService.deleteWithValidByIds(List.of(ids), true));
|
}
|
}
|