解决新模块缺少Controller以及部分不兼容问题
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
package com.klp.mes.dv.controller;
|
||||
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.constant.UserConstants;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.AjaxResult;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.excel.ExcelUtil;
|
||||
import com.klp.mes.dv.domain.DvSubject;
|
||||
import com.klp.mes.dv.service.IDvSubjectService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备点检保养项目Controller
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2022-06-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/mes/dv/dvsubject")
|
||||
public class DvSubjectController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IDvSubjectService dvSubjectService;
|
||||
|
||||
/**
|
||||
* 查询设备点检保养项目列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(DvSubject dvSubject)
|
||||
{
|
||||
startPage();
|
||||
List<DvSubject> list = dvSubjectService.selectDvSubjectList(dvSubject);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备点检保养项目列表
|
||||
*/
|
||||
|
||||
@Log(title = "设备点检保养项目", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, DvSubject dvSubject)
|
||||
{
|
||||
List<DvSubject> list = dvSubjectService.selectDvSubjectList(dvSubject);
|
||||
ExcelUtil<DvSubject> util = new ExcelUtil<DvSubject>(DvSubject.class);
|
||||
util.exportExcel(response, list, "设备点检保养项目数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备点检保养项目详细信息
|
||||
*/
|
||||
|
||||
@GetMapping(value = "/{subjectId}")
|
||||
public AjaxResult getInfo(@PathVariable("subjectId") Long subjectId)
|
||||
{
|
||||
return AjaxResult.success(dvSubjectService.selectDvSubjectBySubjectId(subjectId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备点检保养项目
|
||||
*/
|
||||
|
||||
@Log(title = "设备点检保养项目", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@RequestBody DvSubject dvSubject)
|
||||
{
|
||||
if(UserConstants.NOT_UNIQUE.equals(dvSubjectService.checkSubjectCodeUnique(dvSubject))){
|
||||
return R.fail("项目编码已存在!");
|
||||
}
|
||||
return toAjax(dvSubjectService.insertDvSubject(dvSubject));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备点检保养项目
|
||||
*/
|
||||
|
||||
@Log(title = "设备点检保养项目", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@RequestBody DvSubject dvSubject)
|
||||
{
|
||||
if(UserConstants.NOT_UNIQUE.equals(dvSubjectService.checkSubjectCodeUnique(dvSubject))){
|
||||
return R.fail("项目编码已存在!");
|
||||
}
|
||||
return toAjax(dvSubjectService.updateDvSubject(dvSubject));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备点检保养项目
|
||||
*/
|
||||
|
||||
@Log(title = "设备点检保养项目", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{subjectIds}")
|
||||
public R<Void> remove(@PathVariable Long[] subjectIds)
|
||||
{
|
||||
return toAjax(dvSubjectService.deleteDvSubjectBySubjectIds(subjectIds));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user