feat(pocket): 新增工厂状态数据的CURD功能
- 为Klptcm1ProPlantStateCurrent实体增加完整的增删改查接口 - 实现按复合键(INSDATE+TYPE)查询、插入、更新和删除逻辑 - 在Mapper层添加对应的XML SQL映射支持 - 为Klptcm1ProPlantStateDefine增加ID查询、批量删除等功能 - 添加PlantStateWithValueVo视图对象及相关联查逻辑 - 提供根据名称获取带值的状态定义列表方法 - 控制器层新增RESTful API endpoints支持完整操作- 完善服务层实现并暴露统一的服务接口供调用
This commit is contained in:
@@ -9,6 +9,9 @@ import com.klp.pocket.service.IKlptcm1ProPlantStateCurrentService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/pocket/proPlantStateCurrent")
|
||||
@@ -26,4 +29,40 @@ public class Klptcm1ProPlantStateCurrentController extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单条(按 INSDATE + TYPE)
|
||||
*/
|
||||
@GetMapping("/one")
|
||||
public R<Klptcm1ProPlantStateCurrent> getOne(
|
||||
@RequestParam("type") BigDecimal type,
|
||||
@RequestParam("insdate") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date insdate) {
|
||||
return R.ok(klptcm1ProPlantStateCurrentService.selectOne(insdate, type));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增一条 current 记录
|
||||
*/
|
||||
@PostMapping
|
||||
public R<Void> add(@RequestBody Klptcm1ProPlantStateCurrent entity) {
|
||||
return toAjax(klptcm1ProPlantStateCurrentService.insert(entity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改一条 current 记录(依据 INSDATE + TYPE)
|
||||
*/
|
||||
@PutMapping
|
||||
public R<Void> edit(@RequestBody Klptcm1ProPlantStateCurrent entity) {
|
||||
return toAjax(klptcm1ProPlantStateCurrentService.updateByKey(entity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除一条 current 记录(按 INSDATE + TYPE)
|
||||
*/
|
||||
@DeleteMapping
|
||||
public R<Void> remove(
|
||||
@RequestParam("type") BigDecimal type,
|
||||
@RequestParam("insdate") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date insdate) {
|
||||
return toAjax(klptcm1ProPlantStateCurrentService.deleteByKey(insdate, type));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,11 +4,13 @@ import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.pocket.domain.Klptcm1ProPlantStateDefine;
|
||||
import com.klp.pocket.domain.vo.PlantStateWithValueVo;
|
||||
import com.klp.pocket.service.IKlptcm1ProPlantStateDefineService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import com.klp.common.core.domain.R;
|
||||
|
||||
/**
|
||||
* 工厂状态定义表Controller
|
||||
@@ -21,6 +23,10 @@ public class Klptcm1ProPlantStateDefineController extends BaseController {
|
||||
@Resource
|
||||
private IKlptcm1ProPlantStateDefineService defineService;
|
||||
|
||||
@GetMapping("/plant/state")
|
||||
public List<PlantStateWithValueVo> getTopByValue(@RequestParam String name) {
|
||||
return defineService.selectByValue(name);
|
||||
}
|
||||
/**
|
||||
* 分页查询状态定义列表
|
||||
* @param pageQuery 分页参数(请求参数,如?pageNum=1&pageSize=10)
|
||||
@@ -31,4 +37,25 @@ public class Klptcm1ProPlantStateDefineController extends BaseController {
|
||||
return defineService.getDefinePage(pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public R<Klptcm1ProPlantStateDefine> getInfo(@PathVariable BigDecimal id) {
|
||||
return R.ok(defineService.selectById(id));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public R<Void> add(@RequestBody Klptcm1ProPlantStateDefine entity) {
|
||||
return toAjax(defineService.insert(entity));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public R<Void> edit(@RequestBody Klptcm1ProPlantStateDefine entity) {
|
||||
return toAjax(defineService.updateById(entity));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@PathVariable List<BigDecimal> ids) {
|
||||
return toAjax(defineService.deleteByIds(ids));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user