diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java index c4a8118261..a867deafc2 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java @@ -43,13 +43,14 @@ import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper; import org.apache.dolphinscheduler.service.process.ProcessService; -import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Set; import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; @@ -148,8 +149,8 @@ public class DataAnalysisServiceImpl extends BaseServiceImpl implements DataAnal } } - Project project = projectMapper.selectById(projectId); - Long[] projectCodeArray = getProjectCodesArrays(loginUser, project.getCode()); + Long[] projectCodeArray = projectId == 0 ? getProjectCodesArrays(loginUser) + : new Long[] { projectMapper.selectById(projectId).getCode() }; List processInstanceStateCounts = instanceStateCounter.apply(start, end, projectCodeArray); @@ -172,9 +173,12 @@ public class DataAnalysisServiceImpl extends BaseServiceImpl implements DataAnal @Override public Map countDefinitionByUser(User loginUser, int projectId) { Map result = new HashMap<>(); - - Project project = projectMapper.selectById(projectId); - Long[] projectCodeArray = getProjectCodesArrays(loginUser, project.getCode()); + boolean checkProject = checkProject(loginUser, projectId, result); + if (!checkProject) { + return result; + } + Long[] projectCodeArray = projectId == 0 ? getProjectCodesArrays(loginUser) + : new Long[] { projectMapper.selectById(projectId).getCode() }; List defineGroupByUsers = processDefinitionMapper.countDefinitionGroupByUser( loginUser.getId(), projectCodeArray, isAdmin(loginUser)); @@ -203,8 +207,6 @@ public class DataAnalysisServiceImpl extends BaseServiceImpl implements DataAnal return result; } - Project project = projectMapper.selectById(projectId); - /** * find all the task lists in the project under the user * statistics based on task status execution, failure, completion, wait, total @@ -226,7 +228,8 @@ public class DataAnalysisServiceImpl extends BaseServiceImpl implements DataAnal } } - Long[] projectCodeArray = getProjectCodesArrays(loginUser, project.getCode()); + Long[] projectCodeArray = projectId == 0 ? getProjectCodesArrays(loginUser) + : new Long[] { projectMapper.selectById(projectId).getCode() }; // count normal command state Map normalCountCommandCounts = commandMapper.countCommandState(loginUser.getId(), start, end, projectCodeArray) .stream() @@ -249,15 +252,14 @@ public class DataAnalysisServiceImpl extends BaseServiceImpl implements DataAnal return result; } - private Long[] getProjectCodesArrays(User loginUser, Long projectCode) { - List projectCodes = new ArrayList<>(); - if (projectCode != 0) { - projectCodes.add(projectCode); - } else if (loginUser.getUserType() == UserType.GENERAL_USER) { - projectCodes = processService.getProjectIdListHavePerm(loginUser.getId()); - if (projectCodes.isEmpty()) { - projectCodes.add(0L); - } + private Long[] getProjectCodesArrays(User loginUser) { + List projectList = projectMapper.queryRelationProjectListByUserId( + loginUser.getUserType() == UserType.ADMIN_USER ? 0 : loginUser.getId()); + Set projectCodes = new HashSet<>(); + projectList.forEach(project -> projectCodes.add(project.getCode())); + if (loginUser.getUserType() == UserType.GENERAL_USER) { + List createProjects = projectMapper.queryProjectCreatedByUser(loginUser.getId()); + createProjects.forEach(project -> projectCodes.add(project.getCode())); } return projectCodes.toArray(new Long[0]); } diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java index 95e3f5c4a5..e2f4320cdc 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java @@ -259,9 +259,9 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce ProcessDefinition processDefinition = processDefineMapper.queryByDefineId(processDefineId); - IPage processInstanceList = - processInstanceMapper.queryProcessInstanceListPaging(page, - project.getCode(), processDefinition.getCode(), searchVal, executorId, statusArray, host, start, end); + IPage processInstanceList = processInstanceMapper.queryProcessInstanceListPaging(page, + project.getCode(), processDefinition == null ? 0L : processDefinition.getCode(), searchVal, + executorId, statusArray, host, start, end); List processInstances = processInstanceList.getRecords(); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java index a484e584fb..09d0a362f3 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java @@ -444,7 +444,7 @@ public class ProjectServiceImpl extends BaseServiceImpl implements ProjectServic return Constants.ALL_PERMISSIONS; } - ProjectUser projectUser = projectUserMapper.queryProjectRelation(project.getCode(), user.getId()); + ProjectUser projectUser = projectUserMapper.queryProjectRelation(project.getId(), user.getId()); if (projectUser == null) { return 0; diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java index c1da442a72..885a17a88f 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java @@ -271,25 +271,9 @@ public class TaskDefinitionServiceImpl extends BaseServiceImpl implements TaskDe return result; } TaskDefinitionLog taskDefinitionLog = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, version); - taskDefinition.setVersion(version); - taskDefinition.setCode(taskCode); - taskDefinition.setName(taskDefinitionLog.getName()); - taskDefinition.setDescription(taskDefinitionLog.getDescription()); - taskDefinition.setProjectCode(taskDefinitionLog.getProjectCode()); - taskDefinition.setUserId(loginUser.getId()); - taskDefinition.setTaskType(taskDefinitionLog.getTaskType()); - taskDefinition.setTaskParams(taskDefinitionLog.getTaskParams()); - taskDefinition.setFlag(taskDefinitionLog.getFlag()); - taskDefinition.setTaskPriority(taskDefinitionLog.getTaskPriority()); - taskDefinition.setWorkerGroup(taskDefinitionLog.getWorkerGroup()); - taskDefinition.setFailRetryTimes(taskDefinitionLog.getFailRetryTimes()); - taskDefinition.setFailRetryInterval(taskDefinitionLog.getFailRetryInterval()); - taskDefinition.setTimeoutFlag(taskDefinitionLog.getTimeoutFlag()); - taskDefinition.setTimeoutNotifyStrategy(taskDefinitionLog.getTimeoutNotifyStrategy()); - taskDefinition.setTimeout(taskDefinitionLog.getTimeout()); - taskDefinition.setUpdateTime(new Date()); - taskDefinition.setResourceIds(taskDefinitionLog.getResourceIds()); - taskDefinitionMapper.updateById(taskDefinition); + taskDefinitionLog.setUserId(loginUser.getId()); + taskDefinitionLog.setUpdateTime(new Date()); + taskDefinitionMapper.updateById(taskDefinitionLog); result.put(Constants.DATA_LIST, taskCode); putMsg(result, Status.SUCCESS); return result; diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java index 00cb72079f..869cfafe5c 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java @@ -525,10 +525,10 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService { putMsg(result, Status.USER_NOT_EXIST, userId); return result; } - //if the selected projectIds are empty, delete all items associated with the user - projectUserMapper.deleteProjectRelation(0L, userId); + //if the selected projectIds are empty, delete all items associated with the user if (check(result, StringUtils.isEmpty(projectIds), Status.SUCCESS)) { + projectUserMapper.deleteProjectRelation(0, userId); return result; } diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java index f227cc0559..857c52af79 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java @@ -116,7 +116,7 @@ public class ProjectServiceTest { @Test public void testCheckProjectAndAuth() { - Mockito.when(projectUserMapper.queryProjectRelation(1L, 1)).thenReturn(getProjectUser()); + Mockito.when(projectUserMapper.queryProjectRelation(1, 1)).thenReturn(getProjectUser()); User loginUser = getLoginUser(); Map result = projectService.checkProjectAndAuth(loginUser, null, projectName); diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java index bba368b32d..e8707fc01e 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java @@ -305,7 +305,7 @@ public class UsersServiceTest { logger.info(result.toString()); Assert.assertEquals(Status.USER_NOT_EXIST, result.get(Constants.STATUS)); //success - when(projectUserMapper.deleteProjectRelation(Mockito.anyLong(), Mockito.anyInt())).thenReturn(1); + when(projectUserMapper.deleteProjectRelation(Mockito.anyInt(), Mockito.anyInt())).thenReturn(1); result = usersService.grantProject(loginUser, 1, projectIds); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/model/TaskNode.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/model/TaskNode.java index 1e338d908d..60be33bf6c 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/model/TaskNode.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/model/TaskNode.java @@ -137,12 +137,6 @@ public class TaskNode { */ private String workerGroup; - /** - * worker group id - */ - private Integer workerGroupId; - - /** * task time out */ @@ -325,14 +319,6 @@ public class TaskNode { this.conditionResult = conditionResult; } - public Integer getWorkerGroupId() { - return workerGroupId; - } - - public void setWorkerGroupId(Integer workerGroupId) { - this.workerGroupId = workerGroupId; - } - public int getDelayTime() { return delayTime; } @@ -405,7 +391,6 @@ public class TaskNode { + ", conditionResult='" + conditionResult + '\'' + ", taskInstancePriority=" + taskInstancePriority + ", workerGroup='" + workerGroup + '\'' - + ", workerGroupId=" + workerGroupId + ", timeout='" + timeout + '\'' + ", delayTime=" + delayTime + '}'; diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProjectUser.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProjectUser.java index e541ac0cc0..37722f3c79 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProjectUser.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProjectUser.java @@ -34,12 +34,9 @@ public class ProjectUser { @TableField("user_id") private int userId; - @TableField(exist = false) + @TableField("project_id") private int projectId; - @TableField("project_code") - private long projectCode; - /** * project name */ @@ -63,14 +60,6 @@ public class ProjectUser { @TableField("update_time") private Date updateTime; - public long getProjectCode() { - return projectCode; - } - - public void setProjectCode(long projectCode) { - this.projectCode = projectCode; - } - public int getId() { return id; } @@ -141,7 +130,6 @@ public class ProjectUser { + "id=" + id + ", userId=" + userId + ", projectId=" + projectId - + ", projectCode=" + projectCode + ", projectName='" + projectName + '\'' + ", userName='" + userName + '\'' + ", perm=" + perm diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.java index ffc45a2eb3..ad4cdb99cc 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.java @@ -85,6 +85,13 @@ public interface ProjectMapper extends BaseMapper { */ List queryAuthedProjectListByUserId(@Param("userId") int userId); + /** + * query relation project list by userId + * @param userId userId + * @return project list + */ + List queryRelationProjectListByUserId(@Param("userId") int userId); + /** * query project except userId * @param userId userId diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProjectUserMapper.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProjectUserMapper.java index f842eb35e4..b6947210be 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProjectUserMapper.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProjectUserMapper.java @@ -17,9 +17,11 @@ package org.apache.dolphinscheduler.dao.mapper; import org.apache.dolphinscheduler.dao.entity.ProjectUser; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; + import org.apache.ibatis.annotations.Param; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + /** * project user mapper interface */ @@ -27,19 +29,21 @@ public interface ProjectUserMapper extends BaseMapper { /** * delte prject user relation - * @param projectCode projectCode + * + * @param projectId projectId * @param userId userId * @return delete result */ - int deleteProjectRelation(@Param("projectCode") Long projectCode, + int deleteProjectRelation(@Param("projectId") int projectId, @Param("userId") int userId); /** * query project relation - * @param projectCode projectCode + * + * @param projectId projectId * @param userId userId * @return project user relation */ - ProjectUser queryProjectRelation(@Param("projectCode") Long projectCode, + ProjectUser queryProjectRelation(@Param("projectId") int projectId, @Param("userId") int userId); } diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ErrorCommandMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ErrorCommandMapper.xml index 0865e964f4..5f93854a3d 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ErrorCommandMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ErrorCommandMapper.xml @@ -29,7 +29,7 @@ - and cmd.startTime = ]]> #{startTime} and cmd.update_time #{endTime} + and cmd.start_time = ]]> #{startTime} and cmd.update_time #{endTime} group by cmd.command_type diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.xml index 0469587c75..04db7ab238 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.xml @@ -19,7 +19,6 @@ - id, name, code, description, user_id, flag, create_time, update_time @@ -83,9 +82,9 @@ join t_ds_user u on u.id=p.user_id where 1=1 - and p.code in - (select project_code from t_ds_relation_project_user where user_id=#{userId} - union select id as project_code from t_ds_project where user_id=#{userId} + and p.id in + (select project_id from t_ds_relation_project_user where user_id=#{userId} + union select id as project_id from t_ds_project where user_id=#{userId} ) @@ -101,6 +100,18 @@ from t_ds_project p,t_ds_relation_project_user rel where p.id = rel.project_id and rel.user_id= #{userId} + select from t_ds_relation_project_user - where project_code = #{projectCode} + where project_id = #{projectId} and user_id = #{userId} limit 1 diff --git a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProjectUserMapperTest.java b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProjectUserMapperTest.java index a5910f7711..e8eff87830 100644 --- a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProjectUserMapperTest.java +++ b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProjectUserMapperTest.java @@ -52,7 +52,6 @@ public class ProjectUserMapperTest { private ProjectUser insertOne(){ //insertOne ProjectUser projectUser = new ProjectUser(); - projectUser.setProjectCode(1010L); projectUser.setProjectId(1010); projectUser.setUserId(111); projectUserMapper.insert(projectUser); @@ -101,7 +100,7 @@ public class ProjectUserMapperTest { ProjectUser projectUser = insertOne(); - int delete = projectUserMapper.deleteProjectRelation(projectUser.getProjectCode(), projectUser.getUserId()); + int delete = projectUserMapper.deleteProjectRelation(projectUser.getProjectId(), projectUser.getUserId()); assertThat(delete,greaterThanOrEqualTo(1)); } @@ -112,7 +111,7 @@ public class ProjectUserMapperTest { @Test public void testQueryProjectRelation() { ProjectUser projectUser = insertOne(); - ProjectUser projectUser1 = projectUserMapper.queryProjectRelation(projectUser.getProjectCode(), projectUser.getUserId()); + ProjectUser projectUser1 = projectUserMapper.queryProjectRelation(projectUser.getProjectId(), projectUser.getUserId()); Assert.assertNotEquals(projectUser1, null); } diff --git a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java index 5a12c6e13a..a1f5eca8b8 100644 --- a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java +++ b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java @@ -2222,7 +2222,6 @@ public class ProcessService { * update task definition */ public int updateTaskDefinition(User operator, Long projectCode, TaskNode taskNode, TaskDefinition taskDefinition) { - Integer version = taskDefinitionLogMapper.queryMaxVersionForDefinition(taskDefinition.getCode()); Date now = new Date(); taskDefinition.setProjectCode(projectCode); @@ -2243,7 +2242,7 @@ public class ProcessService { taskDefinition.setName(taskNode.getName()); taskDefinition.setDescription(taskNode.getDesc()); taskDefinition.setTaskType(TaskType.of(taskNode.getType())); - taskDefinition.setTaskParams(taskNode.getParams()); + taskDefinition.setTaskParams(TaskType.of(taskNode.getType()) == TaskType.DEPENDENT ? taskNode.getDependence() : taskNode.getParams()); taskDefinition.setFlag(taskNode.isForbidden() ? Flag.NO : Flag.YES); taskDefinition.setTaskPriority(taskNode.getTaskInstancePriority()); taskDefinition.setWorkerGroup(taskNode.getWorkerGroup()); @@ -2508,7 +2507,8 @@ public class ProcessService { v.setRunFlag(taskDefinitionLog.getFlag() == Flag.YES ? Constants.FLOWNODE_RUN_FLAG_NORMAL : Constants.FLOWNODE_RUN_FLAG_FORBIDDEN); v.setMaxRetryTimes(taskDefinitionLog.getFailRetryTimes()); v.setRetryInterval(taskDefinitionLog.getFailRetryInterval()); - v.setParams(taskDefinitionLog.getTaskParams()); + v.setParams(taskDefinitionLog.getTaskType() == TaskType.DEPENDENT ? "" : taskDefinitionLog.getTaskParams()); + v.setDependence(taskDefinitionLog.getTaskType() == TaskType.DEPENDENT ? taskDefinitionLog.getTaskParams() : ""); v.setTaskInstancePriority(taskDefinitionLog.getTaskPriority()); v.setWorkerGroup(taskDefinitionLog.getWorkerGroup()); v.setTimeout(JSONUtils.toJsonString(new TaskTimeoutParameter(taskDefinitionLog.getTimeoutFlag() == TimeoutFlag.OPEN, diff --git a/sql/dolphinscheduler_mysql.sql b/sql/dolphinscheduler_mysql.sql index 8158b54161..419e90b220 100644 --- a/sql/dolphinscheduler_mysql.sql +++ b/sql/dolphinscheduler_mysql.sql @@ -696,7 +696,7 @@ DROP TABLE IF EXISTS `t_ds_relation_project_user`; CREATE TABLE `t_ds_relation_project_user` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', `user_id` int(11) NOT NULL COMMENT 'user id', - `project_code` bigint(20) DEFAULT NULL COMMENT 'project code', + `project_id` int(11) DEFAULT NULL COMMENT 'project id', `perm` int(11) DEFAULT '1' COMMENT 'limits of authority', `create_time` datetime DEFAULT NULL COMMENT 'create time', `update_time` datetime DEFAULT NULL COMMENT 'update time',