添加实体类
parent
4db14d49a4
commit
43135beb53
|
@ -65,7 +65,7 @@ public class TaskInputInfo extends BaseEntity {
|
|||
/**
|
||||
* 表字段别名
|
||||
*/
|
||||
private String ableAsField;
|
||||
private String tableAsField;
|
||||
|
||||
/**
|
||||
* 字段规则
|
||||
|
|
|
@ -20,12 +20,6 @@ import lombok.NoArgsConstructor;
|
|||
@Builder
|
||||
public class TaskInfoReq {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 任务名称
|
||||
*/
|
||||
|
|
|
@ -50,7 +50,7 @@ public class TaskController {
|
|||
public Result<String> addTask(
|
||||
@Validated @RequestBody TaskInfo taskInfo) {
|
||||
|
||||
return Result.success(taskService.addTask(taskInfo),"添加成功");
|
||||
return Result.success(null,taskService.addTask(taskInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package com.muyu.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.domain.TaskInputInfo;
|
||||
import com.muyu.service.TaskInputService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* @PackageName:com.muyu.controller
|
||||
* @ClassName:TaskInputInfoController
|
||||
* @Description:
|
||||
* @author: ¥陈思豪¥
|
||||
* @date: 2024/8/27 21:35
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/taskInput")
|
||||
public class TaskInputInfoController {
|
||||
|
||||
@Autowired
|
||||
private TaskInputService taskInputService;
|
||||
|
||||
@PostMapping(value = "addTaskInput")
|
||||
public Result<String> addTaskInput(@RequestBody TaskInputInfo taskInputInfo){
|
||||
return Result.success(null,taskInputService.addTaskInput(taskInputInfo));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.muyu.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.TaskInputInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface TaskInputInfoMapper extends BaseMapper<TaskInputInfo> {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.muyu.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.TaskInputInfo;
|
||||
|
||||
public interface TaskInputService extends IService<TaskInputInfo> {
|
||||
String addTaskInput(TaskInputInfo taskInputInfo);
|
||||
}
|
|
@ -48,6 +48,16 @@ public class TableInfoServiceImpl extends ServiceImpl<TableInfoMapper, TableInfo
|
|||
tableInfoCasRespDad.setChildren(tableInfoCasRespSon);
|
||||
tableInfo.setTableInfoList(list1);
|
||||
tableInfoCasResp.add(tableInfoCasRespDad);
|
||||
// LambdaQueryWrapper<TableInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// queryWrapper.eq(TableInfo::getParentId,0);
|
||||
// List<TableInfo> list = this.list(queryWrapper);
|
||||
// list.forEach(tableInfo -> {
|
||||
// LambdaQueryWrapper<TableInfo> queryWrapperC = new LambdaQueryWrapper<>();
|
||||
// queryWrapperC.eq(TableInfo::getParentId,tableInfo.getId());
|
||||
// List<TableInfo> list1 = this.list(queryWrapperC);
|
||||
// tableInfo.setTableInfoList(list1);
|
||||
// });
|
||||
|
||||
});
|
||||
return tableInfoCasResp;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package com.muyu.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.domain.TaskInputInfo;
|
||||
import com.muyu.mapper.TaskInputInfoMapper;
|
||||
import com.muyu.service.TaskInputService;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @PackageName:com.muyu.service.impl
|
||||
* @ClassName:TaskInputServOceanServiceImpl
|
||||
* @Description:
|
||||
* @author: ¥陈思豪¥
|
||||
* @date: 2024/8/27 21:37
|
||||
*/
|
||||
@Service
|
||||
public class TaskInputInfoServiceImpl extends ServiceImpl<TaskInputInfoMapper, TaskInputInfo> implements TaskInputService {
|
||||
|
||||
@Autowired
|
||||
private TaskInputInfoMapper taskInputInfoMapper;
|
||||
|
||||
@Override
|
||||
public String addTaskInput(TaskInputInfo taskInputInfo) {
|
||||
int i = taskInputInfoMapper.insert(taskInputInfo);
|
||||
if(i<=0){
|
||||
throw new RuntimeException("添加失败");
|
||||
}
|
||||
return "添加成功";
|
||||
}
|
||||
}
|
|
@ -46,7 +46,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, TaskInfo> implement
|
|||
|
||||
@Override
|
||||
public String addTask(TaskInfo taskInfo) {
|
||||
this.save(taskInfo);
|
||||
boolean save = this.save(taskInfo);
|
||||
if(save == false){
|
||||
throw new RuntimeException("err");
|
||||
}
|
||||
return "success";
|
||||
}
|
||||
|
||||
|
@ -60,7 +63,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, TaskInfo> implement
|
|||
@Override
|
||||
public String deleteById(Integer id) {
|
||||
TaskMapper taskMapper = this.baseMapper;
|
||||
taskMapper.deleteById(id);
|
||||
int i = taskMapper.deleteById(id);
|
||||
if(i<=0){
|
||||
throw new RuntimeException("err");
|
||||
}
|
||||
return "success";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue