refactor(service): 简化当前状态服务接口
- 移除冗余的查询、分页和删除方法 -保留核心方法 selectAll用于获取全部数据 - 清理导入包和注释,优化代码结构
This commit is contained in:
@@ -1,102 +1,26 @@
|
||||
package com.klp.pocket.controller;
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
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.pocket.domain.vo.Klptcm1ProPlantStateCurrentVo;
|
||||
import com.klp.pocket.domain.bo.Klptcm1ProPlantStateCurrentBo;
|
||||
import com.klp.pocket.domain.Klptcm1ProPlantStateCurrent;
|
||||
import com.klp.pocket.service.IKlptcm1ProPlantStateCurrentService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 当前
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-10-27
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/pocket/proPlantStateCurrent")
|
||||
public class Klptcm1ProPlantStateCurrentController extends BaseController {
|
||||
@RequestMapping("/api/klptcm1ProPlantStateCurrent")
|
||||
public class Klptcm1ProPlantStateCurrentController {
|
||||
|
||||
private final IKlptcm1ProPlantStateCurrentService iKlptcm1ProPlantStateCurrentService;
|
||||
@Resource
|
||||
private IKlptcm1ProPlantStateCurrentService klptcm1ProPlantStateCurrentService;
|
||||
|
||||
/**
|
||||
* 查询当前列表
|
||||
* 查询所有数据
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<Klptcm1ProPlantStateCurrentVo> list(Klptcm1ProPlantStateCurrentBo bo, PageQuery pageQuery) {
|
||||
return iKlptcm1ProPlantStateCurrentService.queryPageList(bo, pageQuery);
|
||||
@GetMapping("/selectAll")
|
||||
public R<List<Klptcm1ProPlantStateCurrent>> selectAll() {
|
||||
List<Klptcm1ProPlantStateCurrent> result = klptcm1ProPlantStateCurrentService.selectAll();
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出当前列表
|
||||
*/
|
||||
@Log(title = "当前", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(Klptcm1ProPlantStateCurrentBo bo, HttpServletResponse response) {
|
||||
List<Klptcm1ProPlantStateCurrentVo> list = iKlptcm1ProPlantStateCurrentService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "当前", Klptcm1ProPlantStateCurrentVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前详细信息
|
||||
*
|
||||
* @param INSDATE 主键
|
||||
*/
|
||||
@GetMapping("/{INSDATE}")
|
||||
public R<Klptcm1ProPlantStateCurrentVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Date INSDATE) {
|
||||
return R.ok(iKlptcm1ProPlantStateCurrentService.queryById(INSDATE));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增当前
|
||||
*/
|
||||
@Log(title = "当前", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody Klptcm1ProPlantStateCurrentBo bo) {
|
||||
return toAjax(iKlptcm1ProPlantStateCurrentService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改当前
|
||||
*/
|
||||
@Log(title = "当前", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody Klptcm1ProPlantStateCurrentBo bo) {
|
||||
return toAjax(iKlptcm1ProPlantStateCurrentService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除当前
|
||||
*
|
||||
* @param INSDATEs 主键串
|
||||
*/
|
||||
@Log(title = "当前", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{INSDATEs}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Date[] INSDATEs) {
|
||||
return toAjax(iKlptcm1ProPlantStateCurrentService.deleteWithValidByIds(Arrays.asList(INSDATEs), true));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user