提交修改
This commit is contained in:
parent
c969b218bc
commit
ceeb32332c
@ -7,13 +7,11 @@ import com.lz.modules.app.utils.t.Tuple;
|
||||
import com.lz.modules.flow.model.TaskDto;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.print.attribute.standard.MediaSize;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class TaskCommand {
|
||||
|
||||
public static final String add = "add";
|
||||
public static final String update = "update";
|
||||
public static final String list = "list";
|
||||
@ -24,7 +22,6 @@ public class TaskCommand {
|
||||
|
||||
public static List<String> optTargets = new ArrayList<String>(Arrays.asList(new String[]{"task", "record"}));
|
||||
|
||||
|
||||
public static Tuple parse(String command) {
|
||||
String[] tokens = getTokens(command);
|
||||
if (commandCommands.contains(tokens[0])) {
|
||||
@ -38,69 +35,14 @@ public class TaskCommand {
|
||||
return new Tuple(1);
|
||||
}
|
||||
if (tokens[0].equals(add)) {
|
||||
//task add 1 -nrm "内容" 30 "哈哈"
|
||||
//task add 1 "内容" 30 "哈哈"
|
||||
//task add 1 "内容" 30
|
||||
//task add 1 "内容"
|
||||
//task add 1 -n "内容"
|
||||
if(tokens.length < 4 ){
|
||||
return new Tuple(488, "task add 参数不对,如 task add 1 \"今天任务\"");
|
||||
}
|
||||
if(!NumberUtil.isNumeric(tokens[2])){
|
||||
return new Tuple(488, "命令的第三个参数必需是数字");
|
||||
}
|
||||
TaskDto taskDto = new TaskDto();
|
||||
taskDto.setId(NumberUtil.objToLong(tokens[2]));
|
||||
int i = 3;
|
||||
while (i < tokens.length) {
|
||||
String notKnow = tokens[i];
|
||||
if(notKnow.startsWith("-")){
|
||||
notKnow = notKnow.substring(1);
|
||||
if (StringUtil.isEmpty(notKnow)) {
|
||||
return new Tuple(488, "task add 的-参数后面必需是 n或r或m。");
|
||||
}
|
||||
char chars[] = notKnow.toCharArray();
|
||||
if (i + chars.length > tokens.length) {
|
||||
return new Tuple(488, "参数个数不对");
|
||||
}
|
||||
for (char c : chars) {
|
||||
i++;
|
||||
String know = tokens[i];
|
||||
if (c == 'n') {
|
||||
taskDto.setName(know);
|
||||
} else if (c == 'r') {
|
||||
if(!NumberUtil.isNumeric(know)){
|
||||
return new Tuple(488, "r 参数必需是一个正整数");
|
||||
}
|
||||
taskDto.setRate(NumberUtil.objToIntDefault(know,0));
|
||||
}else if ( c == 'm'){
|
||||
taskDto.setMark(know);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(StringUtil.isBlank(taskDto.getName())){
|
||||
taskDto.setName(notKnow);
|
||||
}else if(taskDto.getRate() !=null){
|
||||
if(!NumberUtil.isNumeric(notKnow)){
|
||||
return new Tuple(488, "进度必需是一个正整数");
|
||||
}
|
||||
taskDto.setRate(NumberUtil.objToIntDefault( notKnow,0));
|
||||
}else if(StringUtil.isEmpty(taskDto.getMark())){
|
||||
taskDto.setMark(notKnow);
|
||||
}
|
||||
}
|
||||
i ++;
|
||||
}
|
||||
return new Tuple(2,taskDto);
|
||||
return doParseTaskDto(2,tokens);
|
||||
} else if (tokens[0].equals(update)) { //task update
|
||||
|
||||
return new Tuple(3);
|
||||
return doParseTaskDto(3,tokens);
|
||||
}
|
||||
} else if (record.equals(tokens[1])) { //表示对 record 增删改查
|
||||
if (tokens[0].equals(list)) { //record list
|
||||
return new Tuple(4);
|
||||
}
|
||||
|
||||
if (tokens[0].equals(add)) { //record add
|
||||
return new Tuple(5);
|
||||
} else if (tokens[0].equals(update)) { //record update
|
||||
@ -120,6 +62,69 @@ public class TaskCommand {
|
||||
return tokenList.toArray(new String[tokenList.size()]);
|
||||
}
|
||||
|
||||
|
||||
public static Tuple doParseTaskDto(int flag ,String [] tokens){
|
||||
//task add 1 -nrm "内容" 30 "哈哈"
|
||||
//task add 1 "内容" 30 "哈哈"
|
||||
//task add 1 "内容" 30
|
||||
//task add 1 "内容"
|
||||
//task add 1 -n "内容"
|
||||
if (tokens.length < 4) {
|
||||
return new Tuple(488, "task add 参数不对,如 task add 1 \"今天任务\"");
|
||||
}
|
||||
if (!NumberUtil.isNumeric(tokens[2])) {
|
||||
return new Tuple(488, "命令的第三个参数必需是数字");
|
||||
}
|
||||
TaskDto taskDto = new TaskDto();
|
||||
taskDto.setId(NumberUtil.objToLong(tokens[2]));
|
||||
int i = 3;
|
||||
while (i < tokens.length) {
|
||||
String notKnow = tokens[i];
|
||||
if (notKnow.startsWith("-")) {
|
||||
notKnow = notKnow.substring(1);
|
||||
if (StringUtil.isEmpty(notKnow)) {
|
||||
return new Tuple(488, "task add 的-参数后面必需是 n或r或m。");
|
||||
}
|
||||
char chars[] = notKnow.toCharArray();
|
||||
if (i + chars.length > tokens.length) {
|
||||
return new Tuple(488, "参数个数不对");
|
||||
}
|
||||
for (char c : chars) {
|
||||
i++;
|
||||
String know = tokens[i];
|
||||
if (c == 'n') {
|
||||
taskDto.setName(know);
|
||||
} else if (c == 'r') {
|
||||
if (!NumberUtil.isNumeric(know)) {
|
||||
return new Tuple(488, "r 参数必需是一个正整数");
|
||||
}
|
||||
taskDto.setRate(NumberUtil.objToIntDefault(know, 0));
|
||||
} else if (c == 'm') {
|
||||
taskDto.setMark(know);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (StringUtil.isBlank(taskDto.getName())) {
|
||||
taskDto.setName(notKnow);
|
||||
} else if (taskDto.getRate() != null) {
|
||||
if (!NumberUtil.isNumeric(notKnow)) {
|
||||
return new Tuple(488, "进度必需是一个正整数");
|
||||
}
|
||||
taskDto.setRate(NumberUtil.objToIntDefault(notKnow, 0));
|
||||
} else if (StringUtil.isEmpty(taskDto.getMark())) {
|
||||
taskDto.setMark(notKnow);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(flag ==2 ){
|
||||
taskDto.setOption(add);
|
||||
}else if(flag == 3 ){
|
||||
taskDto.setOption(update);
|
||||
}
|
||||
return new Tuple(flag,taskDto);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test11() {
|
||||
String ln = " abcdef b csssss dddddd -c \"b ccc ' bb a , bb x b\" a ";
|
||||
@ -127,9 +132,11 @@ public class TaskCommand {
|
||||
for (int i = 0; i < tokens.size(); i++) {
|
||||
System.out.println(tokens.get(i).value());
|
||||
}
|
||||
System.out.println("======================");
|
||||
String dd = "-d";
|
||||
dd = dd.substring(1);
|
||||
System.out.println(dd);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void test2() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,15 +1,23 @@
|
||||
package com.lz.modules.app.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.lz.common.constant.CacheConstants;
|
||||
import com.lz.common.utils.Md5Utils;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.RedisCacheUtil;
|
||||
import com.lz.common.utils.RedisUtils;
|
||||
import com.lz.common.utils.TaskCommand;
|
||||
import com.lz.modules.app.dto.CommandDto;
|
||||
import com.lz.modules.app.dto.ResultDto;
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.app.utils.t.OneTuple;
|
||||
import com.lz.modules.app.utils.t.Tuple;
|
||||
import com.lz.modules.app.utils.t.TwoTuple;
|
||||
import com.lz.modules.flow.model.TaskDto;
|
||||
import com.lz.modules.performance.service.ResultTaskService;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import com.lz.modules.sys.service.SysUserService;
|
||||
import com.lz.modules.sys.service.app.ResultDetailService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.crypto.hash.Sha256Hash;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -35,33 +43,55 @@ public class ThirdTaskController {
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Autowired
|
||||
private ResultTaskService resultTaskService;
|
||||
|
||||
@Autowired
|
||||
private ResultDetailService resultDetailService;
|
||||
|
||||
@RequestMapping("/handler")
|
||||
public R handler(@RequestBody CommandDto command) {
|
||||
SysUserEntity user = checkLogin(command.getToken());
|
||||
public R handler(@RequestBody CommandDto commandDto) {
|
||||
SysUserEntity user = checkLogin(commandDto.getToken());
|
||||
if (user == null) {
|
||||
return R.error(499, "登陆己经过期");
|
||||
}
|
||||
|
||||
log.info("command:" + command);
|
||||
|
||||
|
||||
|
||||
List<List<String>> data = new ArrayList<>();
|
||||
for (int i = 0; i < 5; i++) {
|
||||
List<String> a = new ArrayList<>();
|
||||
for (int j = 0; j < 5; j++) {
|
||||
a.add(j + "");
|
||||
}
|
||||
data.add(a);
|
||||
log.info("commandDto:" + JSON.toJSONString(commandDto));
|
||||
Tuple tuple = TaskCommand.parse(commandDto.getCommand());
|
||||
OneTuple<Integer> parseData = tuple.getData();
|
||||
if (parseData.getFirst() == 488) { // 命令解析失败
|
||||
TwoTuple<Integer,String> twoTuple = tuple.getData();
|
||||
return R.error(twoTuple.getSecond());
|
||||
}
|
||||
TwoTuple<Integer, TaskDto> taskInfo = tuple.getData();
|
||||
switch (parseData.getFirst()) {
|
||||
case 1: //list task
|
||||
List<ResultDto> list = resultTaskService.listResultTask(user);
|
||||
break;
|
||||
case 2: //add task
|
||||
return resultTaskService.addOrUpdateTask(user, taskInfo.getSecond());
|
||||
case 3: //update task
|
||||
return resultTaskService.addOrUpdateTask(user, taskInfo.getSecond());
|
||||
case 4: //list record
|
||||
return resultDetailService.listRecord(user);
|
||||
case 5: //TODO add record
|
||||
break;
|
||||
case 6: //TODO update record
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
List<List<String>> data = new ArrayList<>();
|
||||
List<String> header = new ArrayList<>(Arrays.asList(new String[]{"用户名", "密码", "哈哈", "双", "你是"}));
|
||||
|
||||
|
||||
|
||||
|
||||
return R.ok().put("header", header).put("data", data);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public SysUserEntity checkLogin(String token) {
|
||||
Object object = redisCacheUtil.getObject(token);
|
||||
if (object != null) {
|
||||
|
||||
@ -4,7 +4,7 @@ import com.lz.common.annotation.TaskHeader;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RecordDto {
|
||||
public class ResultDto {
|
||||
@TaskHeader("索引")
|
||||
private int index;
|
||||
@TaskHeader("Id")
|
||||
@ -4,6 +4,7 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TaskDto {
|
||||
private String option;
|
||||
private Long id ;
|
||||
private String name;
|
||||
private Integer rate ;
|
||||
|
||||
@ -2,10 +2,13 @@ package com.lz.modules.performance.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.modules.app.dto.ResultDto;
|
||||
import com.lz.modules.flow.model.TaskDto;
|
||||
import com.lz.modules.performance.dto.ResultTaskDto;
|
||||
import com.lz.modules.performance.entity.ResultTask;
|
||||
import com.lz.modules.performance.req.ResultUpdateTaskReq;
|
||||
import com.lz.modules.performance.res.ResultTaskDetailRes;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -47,4 +50,8 @@ public interface ResultTaskService extends IService<ResultTask> {
|
||||
R deleteTask(Long taskId,Long userId);
|
||||
|
||||
List<ResultTaskDto> selectResultTaskDtosByDetailId(Long detailId);
|
||||
|
||||
List<ResultDto> listResultTask(SysUserEntity user);
|
||||
|
||||
R addOrUpdateTask(SysUserEntity user, TaskDto second);
|
||||
}
|
||||
@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lz.common.utils.BigDecimalUtil;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.dto.ResultDto;
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.flow.model.TaskDto;
|
||||
import com.lz.modules.performance.dao.ResultTaskMapper;
|
||||
import com.lz.modules.performance.dao.TaskProcessRecordMapper;
|
||||
import com.lz.modules.performance.dto.ResultTaskDto;
|
||||
@ -17,6 +19,7 @@ import com.lz.modules.performance.req.ResultUpdateTaskReq;
|
||||
import com.lz.modules.performance.res.ResultTaskDetailRes;
|
||||
import com.lz.modules.performance.service.ResultTaskService;
|
||||
import com.lz.modules.performance.service.TaskProcessRecordService;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import com.lz.modules.sys.entity.app.ResultDetail;
|
||||
import com.lz.modules.sys.service.app.ResultDetailService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -317,4 +320,14 @@ public class ResultTaskServiceImpl extends ServiceImpl<ResultTaskMapper, ResultT
|
||||
return resultTaskMapper.selectResultTaskDtosByDetailId(detailId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResultDto> listResultTask(SysUserEntity user) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R addOrUpdateTask(SysUserEntity user, TaskDto second) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,10 +2,12 @@ package com.lz.modules.sys.service.app;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.common.utils.BigDecimalUtil;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.modules.app.resp.ResultDetailResp;
|
||||
import com.lz.modules.app.resp.Step;
|
||||
import com.lz.modules.flow.model.Auth;
|
||||
import com.lz.modules.flow.model.ResultDetailDto;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import com.lz.modules.sys.entity.app.ResultDetail;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
|
||||
@ -76,4 +78,6 @@ public interface ResultDetailService extends IService<ResultDetail> {
|
||||
ResultDetail selectNotNoticeResultDetailByBackId(Long id);
|
||||
|
||||
List<ResultDetail> selectNotNoticeResultDetailByRecordId(Long recordId);
|
||||
|
||||
R listRecord(SysUserEntity user);
|
||||
}
|
||||
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lz.common.utils.BigDecimalUtil;
|
||||
import com.lz.common.utils.Constant;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.resp.ResultDetailResp;
|
||||
import com.lz.modules.app.resp.Step;
|
||||
@ -16,6 +17,7 @@ import com.lz.modules.flow.model.ResultDetailDto;
|
||||
import com.lz.modules.flow.model.StaffRoleDto;
|
||||
import com.lz.modules.flow.service.*;
|
||||
import com.lz.modules.sys.dao.app.ResultDetailMapper;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import com.lz.modules.sys.entity.app.ResultDetail;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import com.lz.modules.sys.service.app.ResultDetailService;
|
||||
@ -354,4 +356,9 @@ public class ResultDetailServiceImpl extends ServiceImpl<ResultDetailMapper, Res
|
||||
public List<ResultDetail> selectNotNoticeResultDetailByRecordId(Long recordId){
|
||||
return resultDetailMapper.selectNotNoticeResultDetailByRecordId(recordId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R listRecord(SysUserEntity user) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
33
src/main/java/com/lz/modules/third/dao/TaskRespMapper.java
Normal file
33
src/main/java/com/lz/modules/third/dao/TaskRespMapper.java
Normal file
@ -0,0 +1,33 @@
|
||||
package com.lz.modules.third.dao;
|
||||
/**
|
||||
* <p>
|
||||
* 用户执行命令的最后一个值表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2021-01-22
|
||||
*/
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.modules.third.entity.TaskResp;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@Mapper
|
||||
public interface TaskRespMapper extends BaseMapper<TaskResp> {
|
||||
|
||||
|
||||
TaskResp selectTaskRespById(@Param("id") Long id);
|
||||
|
||||
|
||||
Long insertTaskResp(TaskResp taskResp);
|
||||
|
||||
|
||||
int updateTaskRespById(TaskResp taskResp);
|
||||
|
||||
|
||||
int updateCoverTaskRespById(TaskResp taskResp);
|
||||
|
||||
|
||||
int deleteTaskRespById(@Param("id") Long id);
|
||||
|
||||
|
||||
}
|
||||
177
src/main/java/com/lz/modules/third/entity/TaskResp.java
Normal file
177
src/main/java/com/lz/modules/third/entity/TaskResp.java
Normal file
@ -0,0 +1,177 @@
|
||||
package com.lz.modules.third.entity;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
/**
|
||||
* <p>
|
||||
* </p>*用户执行命令的最后一个值表
|
||||
* @author quyixiao
|
||||
* @since 2021-01-22
|
||||
*/
|
||||
|
||||
@Data
|
||||
@TableName("lz_task_resp")
|
||||
@ApiModel(value = "用户执行命令的最后一个值表")
|
||||
public class TaskResp implements java.io.Serializable {
|
||||
//
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
//是否删除状态,1:删除,0:有效
|
||||
@ApiModelProperty(value = "是否删除状态,1:删除,0:有效", name = "isDelete")
|
||||
private Integer isDelete;
|
||||
//创建时间
|
||||
@ApiModelProperty(value = "创建时间", name = "gmtCreate")
|
||||
private Date gmtCreate;
|
||||
//最后修改时间
|
||||
@ApiModelProperty(value = "最后修改时间", name = "gmtModified")
|
||||
private Date gmtModified;
|
||||
//索引
|
||||
@ApiModelProperty(value = "索引 ", name = "index")
|
||||
private Integer index;
|
||||
//用户 id
|
||||
@ApiModelProperty(value = "用户 id", name = "userId")
|
||||
private Long userId;
|
||||
//返回值内容 id
|
||||
@ApiModelProperty(value = "返回值内容 id", name = "resultId")
|
||||
private Long resultId;
|
||||
//返回值内容
|
||||
@ApiModelProperty(value = "返回值内容", name = "content")
|
||||
private String content;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否删除状态,1:删除,0:有效
|
||||
* @return
|
||||
*/
|
||||
public Integer getIsDelete() {
|
||||
return isDelete;
|
||||
}
|
||||
/**
|
||||
* 是否删除状态,1:删除,0:有效
|
||||
* @param isDelete
|
||||
*/
|
||||
public void setIsDelete(Integer isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
* @return
|
||||
*/
|
||||
public Date getGmtCreate() {
|
||||
return gmtCreate;
|
||||
}
|
||||
/**
|
||||
* 创建时间
|
||||
* @param gmtCreate
|
||||
*/
|
||||
public void setGmtCreate(Date gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 最后修改时间
|
||||
* @return
|
||||
*/
|
||||
public Date getGmtModified() {
|
||||
return gmtModified;
|
||||
}
|
||||
/**
|
||||
* 最后修改时间
|
||||
* @param gmtModified
|
||||
*/
|
||||
public void setGmtModified(Date gmtModified) {
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* 索引
|
||||
* @return
|
||||
*/
|
||||
public Integer getIndex() {
|
||||
return index;
|
||||
}
|
||||
/**
|
||||
* 索引
|
||||
* @param index
|
||||
*/
|
||||
public void setIndex(Integer index) {
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户 id
|
||||
* @return
|
||||
*/
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
/**
|
||||
* 用户 id
|
||||
* @param userId
|
||||
*/
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回值内容 id
|
||||
* @return
|
||||
*/
|
||||
public Long getResultId() {
|
||||
return resultId;
|
||||
}
|
||||
/**
|
||||
* 返回值内容 id
|
||||
* @param resultId
|
||||
*/
|
||||
public void setResultId(Long resultId) {
|
||||
this.resultId = resultId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回值内容
|
||||
* @return
|
||||
*/
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
/**
|
||||
* 返回值内容
|
||||
* @param content
|
||||
*/
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaskResp{" +
|
||||
",id=" + id +
|
||||
",isDelete=" + isDelete +
|
||||
",gmtCreate=" + gmtCreate +
|
||||
",gmtModified=" + gmtModified +
|
||||
",index=" + index +
|
||||
",userId=" + userId +
|
||||
",resultId=" + resultId +
|
||||
",content=" + content +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.lz.modules.third.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.modules.third.entity.TaskResp;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户执行命令的最后一个值表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2021-01-22
|
||||
*/
|
||||
public interface TaskRespService extends IService<TaskResp> {
|
||||
|
||||
|
||||
|
||||
TaskResp selectTaskRespById(Long id);
|
||||
|
||||
|
||||
Long insertTaskResp(TaskResp taskResp);
|
||||
|
||||
|
||||
int updateTaskRespById(TaskResp taskResp);
|
||||
|
||||
|
||||
int updateCoverTaskRespById(TaskResp taskResp);
|
||||
|
||||
|
||||
int deleteTaskRespById(Long id);
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package com.lz.modules.third.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lz.modules.third.dao.TaskRespMapper;
|
||||
import com.lz.modules.third.entity.TaskResp;
|
||||
import com.lz.modules.third.service.TaskRespService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户执行命令的最后一个值表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2021-01-22
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class TaskRespServiceImpl extends ServiceImpl<TaskRespMapper, TaskResp> implements TaskRespService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private TaskRespMapper taskRespMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public TaskResp selectTaskRespById(Long id){
|
||||
return taskRespMapper.selectTaskRespById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Long insertTaskResp(TaskResp taskResp){
|
||||
return taskRespMapper.insertTaskResp(taskResp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int updateTaskRespById(TaskResp taskResp){
|
||||
return taskRespMapper.updateTaskRespById(taskResp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int updateCoverTaskRespById(TaskResp taskResp){
|
||||
return taskRespMapper.updateCoverTaskRespById(taskResp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int deleteTaskRespById(Long id){
|
||||
return taskRespMapper.deleteTaskRespById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
88
src/main/resources/mapper/third/TaskRespMapper.xml
Normal file
88
src/main/resources/mapper/third/TaskRespMapper.xml
Normal file
@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.lz.modules.third.dao.TaskRespMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.lz.modules.third.entity.TaskResp">
|
||||
<id column="id" property="id"/>
|
||||
<result column="is_delete" property="isDelete"/>
|
||||
<result column="gmt_create" property="gmtCreate"/>
|
||||
<result column="gmt_modified" property="gmtModified"/>
|
||||
<result column="index" property="index"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="result_id" property="resultId"/>
|
||||
<result column="content" property="content"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, index AS index, user_id AS userId, result_id AS resultId, content AS content
|
||||
</sql>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectTaskRespById" resultType="TaskResp" >
|
||||
select * from lz_task_resp where id=#{id} and is_delete = 0 limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertTaskResp" parameterType="TaskResp" useGeneratedKeys="true" keyProperty="id" >
|
||||
insert into lz_task_resp(
|
||||
<if test="index != null">index, </if>
|
||||
<if test="userId != null">user_id, </if>
|
||||
<if test="resultId != null">result_id, </if>
|
||||
<if test="content != null">content, </if>
|
||||
is_delete,
|
||||
gmt_create,
|
||||
gmt_modified
|
||||
)values(
|
||||
<if test="index != null">#{ index}, </if>
|
||||
<if test="userId != null">#{ userId}, </if>
|
||||
<if test="resultId != null">#{ resultId}, </if>
|
||||
<if test="content != null">#{ content}, </if>
|
||||
0,
|
||||
now(),
|
||||
now()
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="updateTaskRespById" parameterType="TaskResp" >
|
||||
update
|
||||
lz_task_resp
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
|
||||
<if test="index != null">index = #{index},</if>
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="resultId != null">result_id = #{resultId},</if>
|
||||
<if test="content != null">content = #{content}</if>
|
||||
</trim>
|
||||
,gmt_modified = now()
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updateCoverTaskRespById" parameterType="TaskResp" >
|
||||
update
|
||||
lz_task_resp
|
||||
set
|
||||
is_delete = #{isDelete},
|
||||
gmt_create = #{gmtCreate},
|
||||
index = #{index},
|
||||
user_id = #{userId},
|
||||
result_id = #{resultId},
|
||||
content = #{content}
|
||||
,gmt_modified = now()
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="deleteTaskRespById" parameterType="java.lang.Long">
|
||||
update lz_task_resp set is_delete = 1 where id=#{id} limit 1
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -85,8 +85,7 @@ public class MysqlMain {
|
||||
List<TablesBean> list = new ArrayList<TablesBean>();
|
||||
|
||||
|
||||
list.add(new TablesBean("lz_flow_chart_role"));
|
||||
list.add(new TablesBean("lz_flow_chart_role_group"));
|
||||
list.add(new TablesBean("lz_task_resp"));
|
||||
|
||||
|
||||
List<TablesBean> list2 = new ArrayList<TablesBean>();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user