|
@@ -1,11 +1,15 @@
|
|
|
package com.gyee.table.controller;
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
+import com.gyee.table.entity.ComponentModificationRecord;
|
|
|
import com.gyee.table.entity.Configurationinfo;
|
|
|
import com.gyee.table.result.Result;
|
|
|
-import com.gyee.table.result.ResultCode;
|
|
|
+import com.gyee.table.service.IComponentModificationRecordService;
|
|
|
import com.gyee.table.service.IConfigurationinfoService;
|
|
|
import com.gyee.table.utils.SnowflakeIdUtils;
|
|
|
+import com.gyee.table.utils.TableDataInfo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
@@ -25,15 +29,19 @@ public class ComponentInformationController {
|
|
|
@Resource
|
|
|
private IConfigurationinfoService configurationinfoService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private IComponentModificationRecordService componentModificationRecordService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询组件信息列表
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/componentList")
|
|
|
- public JSONObject componentList() {
|
|
|
- List<Configurationinfo> list = configurationinfoService.list();
|
|
|
- return Result.successData(ResultCode.SUCCESS, list);
|
|
|
+ public TableDataInfo componentList(@RequestBody Configurationinfo configurationinfo) {
|
|
|
+ PageHelper.startPage(configurationinfo.getPageNum(), configurationinfo.getPageSize(), true);
|
|
|
+ List<Configurationinfo> list = configurationinfoService.selectConfigurationinfoList(configurationinfo);
|
|
|
+ return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -58,6 +66,11 @@ public class ComponentInformationController {
|
|
|
@PostMapping("/updateComponent")
|
|
|
public JSONObject updateComponent(@RequestBody Configurationinfo configurationinfo) {
|
|
|
configurationinfoService.updateById(configurationinfo);
|
|
|
+ ComponentModificationRecord componentModificationRecord = new ComponentModificationRecord();
|
|
|
+ componentModificationRecord.setId(configurationinfo.getId());
|
|
|
+ componentModificationRecord.setChangeUser(configurationinfo.getChangeUser());
|
|
|
+ componentModificationRecord.setUpdataDate(configurationinfo.getUpdataDate());
|
|
|
+ componentModificationRecordService.save(componentModificationRecord);
|
|
|
return Result.success();
|
|
|
}
|
|
|
|
|
@@ -67,9 +80,23 @@ public class ComponentInformationController {
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
- @PostMapping("/deleteComponent")
|
|
|
- public JSONObject deleteComponent(@RequestParam(value = "id") String id) {
|
|
|
+ @DeleteMapping("/deleteComponent/{id}")
|
|
|
+ public JSONObject deleteComponent(@PathVariable String id) {
|
|
|
configurationinfoService.removeById(id);
|
|
|
return Result.success();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 响应请求分页数据
|
|
|
+ */
|
|
|
+ @SuppressWarnings({ "rawtypes", "unchecked" })
|
|
|
+ protected TableDataInfo getDataTable(List<?> list)
|
|
|
+ {
|
|
|
+ TableDataInfo rspData = new TableDataInfo();
|
|
|
+ rspData.setCode(200);
|
|
|
+ rspData.setRows(list);
|
|
|
+ rspData.setTotal(new PageInfo(list).getTotal());
|
|
|
+ rspData.setMsg("成功");
|
|
|
+ return rspData;
|
|
|
+ }
|
|
|
}
|