mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-12-02 12:17:43 +08:00
add ut for dao ... (#923)
* update english documents * refactor zk client * update documents * update zkclient * update zkclient * update documents * add architecture-design * change i18n * update i18n * update english documents * add architecture-design * update english documents * update en-US documents * add architecture-design * update demo site * add mybatis plus model * modify mybatisplus * modify mybatisplus * change interface by mybatisplus * add unit test * refactor dao interface. * add unit test for dao... * add unit test for dao...
This commit is contained in:
parent
bf39b31855
commit
e84c6adcac
@ -158,9 +158,19 @@ public class DataAnalysisService {
|
|||||||
putErrorRequestParamsMsg(result);
|
putErrorRequestParamsMsg(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Integer> projectIds = new ArrayList<>();
|
||||||
|
if(projectId !=0){
|
||||||
|
projectIds.add(projectId);
|
||||||
|
}else if(loginUser.getUserType() == UserType.GENERAL_USER){
|
||||||
|
projectIds = processDao.getProjectIdListHavePerm(loginUser.getId());
|
||||||
|
|
||||||
|
}
|
||||||
|
Integer[] projectIdArray = projectIds.toArray(new Integer[projectIds.size()]);
|
||||||
|
|
||||||
List<ExecuteStatusCount> processInstanceStateCounts =
|
List<ExecuteStatusCount> processInstanceStateCounts =
|
||||||
processInstanceMapper.countInstanceStateByUser(loginUser.getId(),
|
processInstanceMapper.countInstanceStateByUser(start, end,
|
||||||
loginUser.getUserType(), start, end, String.valueOf(projectId));
|
projectIdArray);
|
||||||
|
|
||||||
TaskCountDto taskCountResult = new TaskCountDto(processInstanceStateCounts);
|
TaskCountDto taskCountResult = new TaskCountDto(processInstanceStateCounts);
|
||||||
if (processInstanceStateCounts != null) {
|
if (processInstanceStateCounts != null) {
|
||||||
@ -259,12 +269,9 @@ public class DataAnalysisService {
|
|||||||
if(projectId !=0){
|
if(projectId !=0){
|
||||||
projectIds.add(projectId);
|
projectIds.add(projectId);
|
||||||
}else if(loginUser.getUserType() == UserType.GENERAL_USER){
|
}else if(loginUser.getUserType() == UserType.GENERAL_USER){
|
||||||
List<Project> projects = processDao.getProjectListHavePerm(loginUser.getId());
|
projectIds = processDao.getProjectIdListHavePerm(loginUser.getId());
|
||||||
for(Project project : projects){
|
|
||||||
projectIds.add(project.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
Integer[] projectIdArray = projectIds.toArray(new Integer[projectIds.size()]);
|
Integer[] projectIdArray = projectIds.toArray(new Integer[projectIds.size()]);
|
||||||
// count command state
|
// count command state
|
||||||
List<CommandCount> commandStateCounts =
|
List<CommandCount> commandStateCounts =
|
||||||
|
@ -502,7 +502,9 @@ public class ProcessDefinitionService extends BaseDAGService {
|
|||||||
case OFFLINE: {
|
case OFFLINE: {
|
||||||
processDefinition.setReleaseState(state);
|
processDefinition.setReleaseState(state);
|
||||||
processDefineMapper.updateById(processDefinition);
|
processDefineMapper.updateById(processDefinition);
|
||||||
List<Schedule> scheduleList = scheduleMapper.selectAllByProcessDefineArray(String.valueOf(id));
|
List<Schedule> scheduleList = scheduleMapper.selectAllByProcessDefineArray(
|
||||||
|
new int[]{processDefinition.getId()}
|
||||||
|
);
|
||||||
|
|
||||||
for(Schedule schedule:scheduleList){
|
for(Schedule schedule:scheduleList){
|
||||||
logger.info("set schedule offline, schedule id: {}, process definition id: {}", project.getId(), schedule.getId(), id);
|
logger.info("set schedule offline, schedule id: {}, process definition id: {}", project.getId(), schedule.getId(), id);
|
||||||
|
@ -191,7 +191,7 @@ public class ProcessInstanceService extends BaseDAGService {
|
|||||||
|
|
||||||
IPage<ProcessInstance> processInstanceList =
|
IPage<ProcessInstance> processInstanceList =
|
||||||
processInstanceMapper.queryProcessInstanceListPaging(page,
|
processInstanceMapper.queryProcessInstanceListPaging(page,
|
||||||
project.getId(), processDefineId, searchVal, statesStr, host, start, end);
|
project.getId(), processDefineId, searchVal, statusArray, host, start, end);
|
||||||
|
|
||||||
Set<String> exclusionSet = new HashSet<String>(){{
|
Set<String> exclusionSet = new HashSet<String>(){{
|
||||||
add(Constants.CLASS);
|
add(Constants.CLASS);
|
||||||
|
@ -243,7 +243,7 @@ public class QueueService extends BaseService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private boolean checkQueueExist(String queue) {
|
private boolean checkQueueExist(String queue) {
|
||||||
return queueMapper.queryByQueue(queue) == null ? false : true;
|
return queueMapper.queryAllQueueList(queue, null).size()>0 ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -253,7 +253,7 @@ public class QueueService extends BaseService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private boolean checkQueueNameExist(String queueName) {
|
private boolean checkQueueNameExist(String queueName) {
|
||||||
return queueMapper.queryByQueueName(queueName) == null ? false : true;
|
return queueMapper.queryAllQueueList(null ,queueName).size()>0 ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -168,8 +168,7 @@ public class TenantService extends BaseService{
|
|||||||
* if the tenant code is modified, the original resource needs to be copied to the new tenant.
|
* if the tenant code is modified, the original resource needs to be copied to the new tenant.
|
||||||
*/
|
*/
|
||||||
if (!tenant.getTenantCode().equals(tenantCode)){
|
if (!tenant.getTenantCode().equals(tenantCode)){
|
||||||
Tenant newTenant = tenantMapper.queryByTenantCode(tenantCode);
|
if (checkTenant(tenantCode)){
|
||||||
if (newTenant == null){
|
|
||||||
// if hdfs startup
|
// if hdfs startup
|
||||||
if (PropertyUtils.getResUploadStartupState()){
|
if (PropertyUtils.getResUploadStartupState()){
|
||||||
String resourcePath = HadoopUtils.getHdfsDataBasePath() + "/" + tenantCode + "/resources";
|
String resourcePath = HadoopUtils.getHdfsDataBasePath() + "/" + tenantCode + "/resources";
|
||||||
@ -279,8 +278,7 @@ public class TenantService extends BaseService{
|
|||||||
*/
|
*/
|
||||||
public Result verifyTenantCode(String tenantCode) {
|
public Result verifyTenantCode(String tenantCode) {
|
||||||
Result result=new Result();
|
Result result=new Result();
|
||||||
Tenant tenant= tenantMapper.queryByTenantCode(tenantCode);
|
if (checkTenant(tenantCode)) {
|
||||||
if (tenant != null) {
|
|
||||||
logger.error("tenant {} has exist, can't create again.", tenantCode);
|
logger.error("tenant {} has exist, can't create again.", tenantCode);
|
||||||
putMsg(result, Status.TENANT_NAME_EXIST);
|
putMsg(result, Status.TENANT_NAME_EXIST);
|
||||||
}else{
|
}else{
|
||||||
|
@ -396,6 +396,11 @@ public class UsersService extends BaseService {
|
|||||||
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM, Constants.STATUS)) {
|
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM, Constants.STATUS)) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
User user = userMapper.selectById(userId);
|
||||||
|
if(user == null){
|
||||||
|
putMsg(result, Status.USER_NOT_EXIST, userId);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
resourcesUserMapper.deleteResourceUser(userId, 0);
|
resourcesUserMapper.deleteResourceUser(userId, 0);
|
||||||
|
|
||||||
|
@ -278,18 +278,6 @@ public class ProcessDao extends AbstractBaseDao {
|
|||||||
return processInstanceMapper.selectById(processId);
|
return processInstanceMapper.selectById(processId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* find process instance by scheduler time.
|
|
||||||
* @param defineId
|
|
||||||
* @param scheduleTime
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public ProcessInstance findProcessInstanceByScheduleTime(int defineId, Date scheduleTime){
|
|
||||||
|
|
||||||
return processInstanceMapper.queryByScheduleTime(defineId,
|
|
||||||
DateUtils.dateToString(scheduleTime), 0, null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* find process define by id.
|
* find process define by id.
|
||||||
* @param processDefinitionId
|
* @param processDefinitionId
|
||||||
@ -315,7 +303,7 @@ public class ProcessDao extends AbstractBaseDao {
|
|||||||
*/
|
*/
|
||||||
public int deleteAllSubWorkProcessByParentId(int processInstanceId){
|
public int deleteAllSubWorkProcessByParentId(int processInstanceId){
|
||||||
|
|
||||||
List<Integer> subProcessIdList = processInstanceMapper.querySubIdListByParentId(processInstanceId);
|
List<Integer> subProcessIdList = processInstanceMapMapper.querySubIdListByParentId(processInstanceId);
|
||||||
|
|
||||||
for(Integer subId : subProcessIdList ){
|
for(Integer subId : subProcessIdList ){
|
||||||
deleteAllSubWorkProcessByParentId(subId);
|
deleteAllSubWorkProcessByParentId(subId);
|
||||||
@ -1465,8 +1453,7 @@ public class ProcessDao extends AbstractBaseDao {
|
|||||||
|
|
||||||
public List<ProcessInstance> queryNeedFailoverProcessInstances(String host){
|
public List<ProcessInstance> queryNeedFailoverProcessInstances(String host){
|
||||||
|
|
||||||
String states = StringUtils.join(stateArray, ",");
|
return processInstanceMapper.queryByHostAndStatus(host, stateArray);
|
||||||
return processInstanceMapper.queryByHostAndStatus(host, states);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1533,7 +1520,11 @@ public class ProcessDao extends AbstractBaseDao {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ProcessInstance findProcessInstanceByTaskId(int taskId){
|
public ProcessInstance findProcessInstanceByTaskId(int taskId){
|
||||||
return processInstanceMapper.queryByTaskId(taskId);
|
TaskInstance taskInstance = taskInstanceMapper.selectById(taskId);
|
||||||
|
if(taskInstance!= null){
|
||||||
|
return processInstanceMapper.selectById(taskInstance.getProcessInstanceId());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1562,7 +1553,7 @@ public class ProcessDao extends AbstractBaseDao {
|
|||||||
*/
|
*/
|
||||||
public List<Schedule> selectAllByProcessDefineId(int[] ids){
|
public List<Schedule> selectAllByProcessDefineId(int[] ids){
|
||||||
return scheduleMapper.selectAllByProcessDefineArray(
|
return scheduleMapper.selectAllByProcessDefineArray(
|
||||||
StringUtils.join(ids, ","));
|
ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1653,40 +1644,6 @@ public class ProcessDao extends AbstractBaseDao {
|
|||||||
return cycleDependencyList;
|
return cycleDependencyList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* find process instance by time interval
|
|
||||||
* @param defineId
|
|
||||||
* @param startTime
|
|
||||||
* @param endTime
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public ProcessInstance findProcessInstanceByTimeInterval(int defineId, Date startTime, Date endTime, int excludeId) {
|
|
||||||
|
|
||||||
return processInstanceMapper.queryByScheduleTime(defineId, null, excludeId,
|
|
||||||
DateUtils.dateToString(startTime), DateUtils.dateToString(endTime));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(value = "TransactionManager",rollbackFor = Exception.class)
|
|
||||||
public void selfFaultTolerant(ProcessInstance processInstance){
|
|
||||||
|
|
||||||
processInstance.setState(ExecutionStatus.FAILURE);
|
|
||||||
processInstanceMapper.updateById(processInstance);
|
|
||||||
// insert to command
|
|
||||||
|
|
||||||
Command command = new Command();
|
|
||||||
command.setCommandType(CommandType.START_FAILURE_TASK_PROCESS);
|
|
||||||
command.setProcessDefinitionId(processInstance.getProcessDefinitionId());
|
|
||||||
command.setCommandParam(String.format("{\"%s\":%d}",
|
|
||||||
CMDPARAM_RECOVER_PROCESS_ID_STRING, processInstance.getId()));
|
|
||||||
|
|
||||||
|
|
||||||
command.setExecutorId(processInstance.getExecutorId());
|
|
||||||
command.setProcessInstancePriority(processInstance.getProcessInstancePriority());
|
|
||||||
|
|
||||||
createCommand(command);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* find last scheduler process instance in the date interval
|
* find last scheduler process instance in the date interval
|
||||||
* @param definitionId
|
* @param definitionId
|
||||||
@ -1701,8 +1658,8 @@ public class ProcessDao extends AbstractBaseDao {
|
|||||||
|
|
||||||
public ProcessInstance findLastManualProcessInterval(int definitionId, DateInterval dateInterval) {
|
public ProcessInstance findLastManualProcessInterval(int definitionId, DateInterval dateInterval) {
|
||||||
return processInstanceMapper.queryLastManualProcess(definitionId,
|
return processInstanceMapper.queryLastManualProcess(definitionId,
|
||||||
DateUtils.dateToString(dateInterval.getStartTime()),
|
dateInterval.getStartTime(),
|
||||||
DateUtils.dateToString(dateInterval.getEndTime()));
|
dateInterval.getEndTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProcessInstance findLastRunningProcess(int definitionId, DateInterval dateInterval) {
|
public ProcessInstance findLastRunningProcess(int definitionId, DateInterval dateInterval) {
|
||||||
@ -1767,9 +1724,23 @@ public class ProcessDao extends AbstractBaseDao {
|
|||||||
List<Project> createProjects = projectMapper.queryProjectCreatedByUser(userId);
|
List<Project> createProjects = projectMapper.queryProjectCreatedByUser(userId);
|
||||||
List<Project> authedProjects = projectMapper.queryAuthedProjectListByUserId(userId);
|
List<Project> authedProjects = projectMapper.queryAuthedProjectListByUserId(userId);
|
||||||
|
|
||||||
createProjects.addAll(authedProjects);
|
if(createProjects == null){
|
||||||
return createProjects;
|
createProjects = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(authedProjects != null){
|
||||||
|
createProjects.addAll(authedProjects);
|
||||||
|
}
|
||||||
|
return createProjects;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getProjectIdListHavePerm(int userId){
|
||||||
|
|
||||||
|
List<Integer> projectIdList = new ArrayList<>();
|
||||||
|
for(Project project : getProjectListHavePerm(userId)){
|
||||||
|
projectIdList.add(project.getId());
|
||||||
|
}
|
||||||
|
return projectIdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ package cn.escheduler.dao.entity;
|
|||||||
|
|
||||||
import cn.escheduler.common.enums.*;
|
import cn.escheduler.common.enums.*;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
@ -77,6 +78,7 @@ public class ProcessInstance {
|
|||||||
/**
|
/**
|
||||||
* process definition structure
|
* process definition structure
|
||||||
*/
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
private ProcessDefinition processDefinition;
|
private ProcessDefinition processDefinition;
|
||||||
/**
|
/**
|
||||||
* process command type
|
* process command type
|
||||||
@ -141,11 +143,13 @@ public class ProcessInstance {
|
|||||||
/**
|
/**
|
||||||
* tenant code
|
* tenant code
|
||||||
*/
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
private String tenantCode;
|
private String tenantCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* queue
|
* queue
|
||||||
*/
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
private String queue;
|
private String queue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -177,6 +181,7 @@ public class ProcessInstance {
|
|||||||
* process duration
|
* process duration
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
private Long duration;
|
private Long duration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -202,16 +207,19 @@ public class ProcessInstance {
|
|||||||
/**
|
/**
|
||||||
* worker group name. for api.
|
* worker group name. for api.
|
||||||
*/
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
private String workerGroupName;
|
private String workerGroupName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* receivers for api
|
* receivers for api
|
||||||
*/
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
private String receivers;
|
private String receivers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* receivers cc for api
|
* receivers cc for api
|
||||||
*/
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
private String receiversCc;
|
private String receiversCc;
|
||||||
|
|
||||||
public ProcessInstance(){
|
public ProcessInstance(){
|
||||||
|
@ -18,6 +18,7 @@ package cn.escheduler.dao.entity;
|
|||||||
|
|
||||||
import cn.escheduler.common.enums.*;
|
import cn.escheduler.common.enums.*;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -42,17 +43,20 @@ public class Schedule {
|
|||||||
/**
|
/**
|
||||||
* process definition name
|
* process definition name
|
||||||
*/
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
private String processDefinitionName;
|
private String processDefinitionName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* project name
|
* project name
|
||||||
*/
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
private String projectName;
|
private String projectName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* schedule description
|
* schedule description
|
||||||
*/
|
*/
|
||||||
private String desc;
|
@TableField(exist = false)
|
||||||
|
private String definitionDescription;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* schedule start time
|
* schedule start time
|
||||||
@ -97,6 +101,7 @@ public class Schedule {
|
|||||||
/**
|
/**
|
||||||
* created user name
|
* created user name
|
||||||
*/
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -201,13 +206,7 @@ public class Schedule {
|
|||||||
this.releaseState = releaseState;
|
this.releaseState = releaseState;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDesc() {
|
|
||||||
return desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDesc(String desc) {
|
|
||||||
this.desc = desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getProcessDefinitionId() {
|
public int getProcessDefinitionId() {
|
||||||
return processDefinitionId;
|
return processDefinitionId;
|
||||||
@ -281,7 +280,7 @@ public class Schedule {
|
|||||||
", processDefinitionId=" + processDefinitionId +
|
", processDefinitionId=" + processDefinitionId +
|
||||||
", processDefinitionName='" + processDefinitionName + '\'' +
|
", processDefinitionName='" + processDefinitionName + '\'' +
|
||||||
", projectName='" + projectName + '\'' +
|
", projectName='" + projectName + '\'' +
|
||||||
", desc='" + desc + '\'' +
|
", description='" + definitionDescription + '\'' +
|
||||||
", startTime=" + startTime +
|
", startTime=" + startTime +
|
||||||
", endTime=" + endTime +
|
", endTime=" + endTime +
|
||||||
", crontab='" + crontab + '\'' +
|
", crontab='" + crontab + '\'' +
|
||||||
@ -298,4 +297,11 @@ public class Schedule {
|
|||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDefinitionDescription() {
|
||||||
|
return definitionDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefinitionDescription(String definitionDescription) {
|
||||||
|
this.definitionDescription = definitionDescription;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,8 @@ import cn.escheduler.dao.entity.ProcessInstanceMap;
|
|||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface ProcessInstanceMapMapper extends BaseMapper<ProcessInstanceMap> {
|
public interface ProcessInstanceMapMapper extends BaseMapper<ProcessInstanceMap> {
|
||||||
|
|
||||||
|
|
||||||
@ -31,4 +33,6 @@ public interface ProcessInstanceMapMapper extends BaseMapper<ProcessInstanceMap>
|
|||||||
|
|
||||||
int deleteByParentProcessId(@Param("parentProcessId") int parentProcessId);
|
int deleteByParentProcessId(@Param("parentProcessId") int parentProcessId);
|
||||||
|
|
||||||
|
List<Integer> querySubIdListByParentId(@Param("parentInstanceId") int parentInstanceId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,47 +31,33 @@ public interface ProcessInstanceMapper extends BaseMapper<ProcessInstance> {
|
|||||||
|
|
||||||
ProcessInstance queryDetailById(@Param("processId") int processId);
|
ProcessInstance queryDetailById(@Param("processId") int processId);
|
||||||
|
|
||||||
List<ProcessInstance> queryByHostAndStatus(@Param("host") String host, @Param("states") String stateArray);
|
List<ProcessInstance> queryByHostAndStatus(@Param("host") String host,
|
||||||
|
@Param("states") int[] stateArray);
|
||||||
|
|
||||||
IPage<ProcessInstance> queryProcessInstanceListPaging(Page<ProcessInstance> page,
|
IPage<ProcessInstance> queryProcessInstanceListPaging(Page<ProcessInstance> page,
|
||||||
@Param("projectId") int projectId,
|
@Param("projectId") int projectId,
|
||||||
@Param("processDefinitionId") Integer processDefinitionId,
|
@Param("processDefinitionId") Integer processDefinitionId,
|
||||||
@Param("searchVal") String searchVal,
|
@Param("searchVal") String searchVal,
|
||||||
@Param("states") String statusArray,
|
@Param("states") int[] statusArray,
|
||||||
@Param("host") String host,
|
@Param("host") String host,
|
||||||
@Param("startTime") Date startTime,
|
@Param("startTime") Date startTime,
|
||||||
@Param("endTime") Date endTime
|
@Param("endTime") Date endTime
|
||||||
);
|
);
|
||||||
|
|
||||||
int setFailoverByHostAndStateArray(@Param("host") String host,
|
int setFailoverByHostAndStateArray(@Param("host") String host,
|
||||||
@Param("states") String stateArray);
|
@Param("states") int[] stateArray);
|
||||||
|
|
||||||
int updateProcessInstanceByState(@Param("originState") ExecutionStatus originState,
|
int updateProcessInstanceByState(@Param("originState") ExecutionStatus originState,
|
||||||
@Param("destState") ExecutionStatus destState);
|
@Param("destState") ExecutionStatus destState);
|
||||||
|
|
||||||
|
|
||||||
ProcessInstance queryByTaskId(@Param("taskId") int taskId);
|
|
||||||
|
|
||||||
|
|
||||||
List<ExecuteStatusCount> countInstanceStateByUser(
|
List<ExecuteStatusCount> countInstanceStateByUser(
|
||||||
@Param("userId") int userId,
|
|
||||||
@Param("userType") UserType userType,
|
|
||||||
@Param("startTime") Date startTime,
|
@Param("startTime") Date startTime,
|
||||||
@Param("endTime") Date endTime,
|
@Param("endTime") Date endTime,
|
||||||
@Param("projectIds") String projectIds);
|
@Param("projectIds") Integer[] projectIds);
|
||||||
|
|
||||||
List<Integer> querySubIdListByParentId(@Param("parentInstanceId") int parentInstanceId);
|
|
||||||
|
|
||||||
|
|
||||||
List<ProcessInstance> queryByProcessDefineId(@Param("processDefinitionId") int processDefinitionId,
|
|
||||||
@Param("size") int size);
|
|
||||||
|
|
||||||
ProcessInstance queryByScheduleTime(@Param("processDefinitionId") int processDefinitionId,
|
|
||||||
@Param("scheduleTime") String scheduleTime,
|
|
||||||
@Param("excludeId") int excludeId,
|
|
||||||
@Param("startTime") String startTime,
|
|
||||||
@Param("endTime") String endTime);
|
|
||||||
|
|
||||||
|
List<ProcessInstance> queryByProcessDefineId(
|
||||||
|
@Param("processDefinitionId") int processDefinitionId,
|
||||||
|
@Param("size") int size);
|
||||||
|
|
||||||
ProcessInstance queryLastSchedulerProcess(@Param("processDefinitionId") int definitionId,
|
ProcessInstance queryLastSchedulerProcess(@Param("processDefinitionId") int definitionId,
|
||||||
@Param("startTime") String startTime,
|
@Param("startTime") String startTime,
|
||||||
@ -83,6 +69,6 @@ public interface ProcessInstanceMapper extends BaseMapper<ProcessInstance> {
|
|||||||
@Param("states") int[] stateArray);
|
@Param("states") int[] stateArray);
|
||||||
|
|
||||||
ProcessInstance queryLastManualProcess(@Param("processDefinitionId") int definitionId,
|
ProcessInstance queryLastManualProcess(@Param("processDefinitionId") int definitionId,
|
||||||
@Param("startTime") String startTime,
|
@Param("startTime") Date startTime,
|
||||||
@Param("endTime") String endTime);
|
@Param("endTime") Date endTime);
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -29,7 +31,7 @@ public interface QueueMapper extends BaseMapper<Queue> {
|
|||||||
IPage<Queue> queryQueuePaging(IPage<Queue> page,
|
IPage<Queue> queryQueuePaging(IPage<Queue> page,
|
||||||
@Param("searchVal") String searchVal);
|
@Param("searchVal") String searchVal);
|
||||||
|
|
||||||
Queue queryByQueue(@Param("queue") String queue);
|
List<Queue> queryAllQueueList(@Param("queue") String queue,
|
||||||
|
@Param("queueName") String queueName);
|
||||||
|
|
||||||
Queue queryByQueueName(@Param("queueName") String queueName);
|
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public interface ScheduleMapper extends BaseMapper<Schedule> {
|
|||||||
List<Schedule> querySchedulerListByProjectName(@Param("projectName") String projectName);
|
List<Schedule> querySchedulerListByProjectName(@Param("projectName") String projectName);
|
||||||
|
|
||||||
|
|
||||||
List<Schedule> selectAllByProcessDefineArray(@Param("processDefineIds") String processDefineIds);
|
List<Schedule> selectAllByProcessDefineArray(@Param("processDefineIds") int[] processDefineIds);
|
||||||
|
|
||||||
List<Schedule> queryByProcessDefinitionId(@Param("processDefinitionId") int processDefinitionId);
|
List<Schedule> queryByProcessDefinitionId(@Param("processDefinitionId") int processDefinitionId);
|
||||||
|
|
||||||
|
@ -21,11 +21,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface TenantMapper extends BaseMapper<Tenant> {
|
public interface TenantMapper extends BaseMapper<Tenant> {
|
||||||
|
|
||||||
Tenant queryById(@Param("tenantId") int tenantId);
|
Tenant queryById(@Param("tenantId") int tenantId);
|
||||||
|
|
||||||
Tenant queryByTenantCode(@Param("tenantCode") String tenantCode);
|
List<Tenant> queryByTenantCode(@Param("tenantCode") String tenantCode);
|
||||||
|
|
||||||
IPage<Tenant> queryTenantPaging(IPage<Tenant> page,
|
IPage<Tenant> queryTenantPaging(IPage<Tenant> page,
|
||||||
@Param("searchVal") String searchVal);
|
@Param("searchVal") String searchVal);
|
||||||
|
@ -25,12 +25,12 @@
|
|||||||
<if test="userId != 0">
|
<if test="userId != 0">
|
||||||
and id in
|
and id in
|
||||||
(select datasource_id
|
(select datasource_id
|
||||||
from t_escheduler_relation_datasource_user
|
from t_escheduler_relation_datasource_user
|
||||||
where user_id=#{userId}
|
where user_id=#{userId}
|
||||||
union select id as datasource_id
|
union select id as datasource_id
|
||||||
from t_escheduler_datasource
|
from t_escheduler_datasource
|
||||||
where user_id=#{userId}
|
where user_id=#{userId}
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="name != null and name != ''">
|
<if test="name != null and name != ''">
|
||||||
and name like concat ('%', #{name}, '%')
|
and name like concat ('%', #{name}, '%')
|
||||||
|
@ -18,4 +18,9 @@
|
|||||||
from t_escheduler_relation_process_instance
|
from t_escheduler_relation_process_instance
|
||||||
where process_instance_id = #{subProcessId}
|
where process_instance_id = #{subProcessId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="querySubIdListByParentId" resultType="java.lang.Integer">
|
||||||
|
select process_instance_id
|
||||||
|
from t_escheduler_process_instance_map
|
||||||
|
where parent_process_instance_id = #{parentInstanceId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -2,8 +2,8 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
<mapper namespace="cn.escheduler.dao.mapper.ProcessInstanceMapper">
|
<mapper namespace="cn.escheduler.dao.mapper.ProcessInstanceMapper">
|
||||||
<select id="queryDetailById" resultType="cn.escheduler.dao.entity.ProcessInstance">
|
<select id="queryDetailById" resultType="cn.escheduler.dao.entity.ProcessInstance">
|
||||||
select inst.*,UNIX_TIMESTAMP(inst.end_time)-UNIX_TIMESTAMP(inst.start_time) as duration
|
select inst.*
|
||||||
from t_escheduler_process_instance
|
from t_escheduler_process_instance inst
|
||||||
where inst.id = #{processId}
|
where inst.id = #{processId}
|
||||||
</select>
|
</select>
|
||||||
<select id="queryByHostAndStatus" resultType="cn.escheduler.dao.entity.ProcessInstance">
|
<select id="queryByHostAndStatus" resultType="cn.escheduler.dao.entity.ProcessInstance">
|
||||||
@ -13,15 +13,19 @@
|
|||||||
<if test="host != null and host != ''">
|
<if test="host != null and host != ''">
|
||||||
and host=#{host}
|
and host=#{host}
|
||||||
</if>
|
</if>
|
||||||
and state in (#{states})
|
and state in
|
||||||
|
<foreach collection="states" item="i" open="(" close=")" separator=",">
|
||||||
|
#{i}
|
||||||
|
</foreach>
|
||||||
order by id asc
|
order by id asc
|
||||||
</select>
|
</select>
|
||||||
<select id="queryProcessInstanceListPaging" resultType="cn.escheduler.dao.entity.ProcessInstance">
|
<select id="queryProcessInstanceListPaging" resultType="cn.escheduler.dao.entity.ProcessInstance">
|
||||||
select instance.*, (UNIX_TIMESTAMP(instance.end_time) - UNIX_TIMESTAMP(instance.start_time)) as duration
|
select instance.*
|
||||||
from t_escheduler_process_instance instance
|
from t_escheduler_process_instance instance
|
||||||
join t_escheduler_process_definition define ON instance.process_definition_id = define.id
|
join t_escheduler_process_definition define ON instance.process_definition_id = define.id
|
||||||
where 1=1
|
where 1=1
|
||||||
and instance.is_sub_process=0 and define.project_id = #{projectId}
|
and instance.is_sub_process=0
|
||||||
|
and define.project_id = #{projectId}
|
||||||
<if test="processDefinitionId != 0">
|
<if test="processDefinitionId != 0">
|
||||||
and instance.process_definition_id = #{processDefinitionId}
|
and instance.process_definition_id = #{processDefinitionId}
|
||||||
</if>
|
</if>
|
||||||
@ -32,7 +36,10 @@
|
|||||||
and instance.start_time > #{startTime} and instance.start_time <![CDATA[ <=]]> #{endTime}
|
and instance.start_time > #{startTime} and instance.start_time <![CDATA[ <=]]> #{endTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="states != null and states != ''">
|
<if test="states != null and states != ''">
|
||||||
and instance.state in ( #{states} )
|
and instance.state in
|
||||||
|
<foreach collection="states" index="index" item="i" open="(" separator="," close=")">
|
||||||
|
#{i}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="host != null and host != ''">
|
<if test="host != null and host != ''">
|
||||||
and instance.host like concat('%', #{host}, '%')
|
and instance.host like concat('%', #{host}, '%')
|
||||||
@ -42,60 +49,42 @@
|
|||||||
<update id="setFailoverByHostAndStateArray">
|
<update id="setFailoverByHostAndStateArray">
|
||||||
update t_escheduler_process_instance
|
update t_escheduler_process_instance
|
||||||
set host=null
|
set host=null
|
||||||
where host =#{host} and state in (#{states})
|
where host =#{host} and state in
|
||||||
|
<foreach collection="states" index="index" item="i" open="(" close=")" separator=",">
|
||||||
|
#{i}
|
||||||
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
<update id="updateProcessInstanceByState">
|
<update id="updateProcessInstanceByState">
|
||||||
update t_escheduler_process_instance
|
update t_escheduler_process_instance
|
||||||
set state = #{destState}
|
set state = #{destState}
|
||||||
where state = #{originState}
|
where state = #{originState}
|
||||||
</update>
|
</update>
|
||||||
<select id="queryByTaskId" resultType="cn.escheduler.dao.entity.ProcessInstance">
|
|
||||||
select process.*, UNIX_TIMESTAMP(process.end_time)-UNIX_TIMESTAMP(process.start_time) as duration
|
|
||||||
from t_escheduler_process_instance process
|
|
||||||
join t_escheduler_task_instance task on task.process_instance_id = process.id
|
|
||||||
where task.id = #{taskId}
|
|
||||||
</select>
|
|
||||||
<select id="countInstanceStateByUser" resultType="cn.escheduler.dao.entity.ExecuteStatusCount">
|
<select id="countInstanceStateByUser" resultType="cn.escheduler.dao.entity.ExecuteStatusCount">
|
||||||
select state, count(0) as count
|
select t.state, count(0) as count
|
||||||
from t_escheduler_process_instance t
|
from t_escheduler_process_instance t
|
||||||
join t_escheduler_process_definition d on d.id=t.process_definition_id
|
join t_escheduler_process_definition d on d.id=t.process_definition_id
|
||||||
join t_escheduler_project p on p.id=d.project_id
|
join t_escheduler_project p on p.id=d.project_id
|
||||||
where t.flag = 1
|
where 1 = 1
|
||||||
and t.is_sub_process = 0
|
and t.is_sub_process = 0
|
||||||
and t.start_time > #{startTime} and t.start_time <![CDATA[ <= ]]> #{endTime}
|
<if test="startTime != null and endTime != null">
|
||||||
|
and t.start_time >= #{startTime} and t.start_time <![CDATA[ <= ]]> #{endTime}
|
||||||
|
</if>
|
||||||
<if test="projectIds != null and projectIds != ''">
|
<if test="projectIds != null and projectIds != ''">
|
||||||
and p.id in (#projectIds)
|
and p.id in
|
||||||
|
<foreach collection="projectIds" index="index" item="i" open="(" close=")" separator=",">
|
||||||
|
#{i}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
group by t.state
|
group by t.state
|
||||||
</select>
|
</select>
|
||||||
<select id="querySubIdListByParentId" resultType="java.lang.Integer">
|
|
||||||
select process_instance_id
|
|
||||||
from t_escheduler_process_instance
|
|
||||||
where parent_process_instance_id = #{parentInstanceId}
|
|
||||||
</select>
|
|
||||||
<select id="queryByProcessDefineId" resultType="cn.escheduler.dao.entity.ProcessInstance">
|
<select id="queryByProcessDefineId" resultType="cn.escheduler.dao.entity.ProcessInstance">
|
||||||
select *,UNIX_TIMESTAMP(end_time)-UNIX_TIMESTAMP(start_time) as duration
|
select *
|
||||||
from t_escheduler_process_instance
|
from t_escheduler_process_instance
|
||||||
where process_definition_id=#{processDefinitionId}
|
where process_definition_id=#{processDefinitionId}
|
||||||
order by start_time desc limit #{size}
|
order by start_time desc limit #{size}
|
||||||
</select>
|
</select>
|
||||||
<select id="queryByScheduleTime" resultType="cn.escheduler.dao.entity.ProcessInstance">
|
|
||||||
select *,UNIX_TIMESTAMP(end_time)-UNIX_TIMESTAMP(start_time) as duration
|
|
||||||
from t_escheduler_process_instance
|
|
||||||
where process_definition_id=#{processDefinitionId}
|
|
||||||
<if test="scheduleTime != null" >
|
|
||||||
and schedule_time=#{scheduleTime}
|
|
||||||
</if>
|
|
||||||
<if test="startTime!=null and endTime != null ">
|
|
||||||
and command_start_time between #{startTime} and #{endTime}
|
|
||||||
</if>
|
|
||||||
<if test="excludeId != 0">
|
|
||||||
where id not in (#{excludeId})
|
|
||||||
</if>
|
|
||||||
order by startTime desc limit 1
|
|
||||||
</select>
|
|
||||||
<select id="queryLastSchedulerProcess" resultType="cn.escheduler.dao.entity.ProcessInstance">
|
<select id="queryLastSchedulerProcess" resultType="cn.escheduler.dao.entity.ProcessInstance">
|
||||||
select *,UNIX_TIMESTAMP(end_time)-UNIX_TIMESTAMP(start_time) as duration
|
select *
|
||||||
from t_escheduler_process_instance
|
from t_escheduler_process_instance
|
||||||
where process_definition_id=#{processDefinitionId}
|
where process_definition_id=#{processDefinitionId}
|
||||||
<if test="startTime!=null and endTime != null ">
|
<if test="startTime!=null and endTime != null ">
|
||||||
@ -104,16 +93,23 @@
|
|||||||
order by end_time desc limit 1
|
order by end_time desc limit 1
|
||||||
</select>
|
</select>
|
||||||
<select id="queryLastRunningProcess" resultType="cn.escheduler.dao.entity.ProcessInstance">
|
<select id="queryLastRunningProcess" resultType="cn.escheduler.dao.entity.ProcessInstance">
|
||||||
select *,UNIX_TIMESTAMP(end_time)-UNIX_TIMESTAMP(start_time) as duration
|
select *
|
||||||
from t_escheduler_process_instance
|
from t_escheduler_process_instance
|
||||||
where state in (#{states})
|
where 1=1
|
||||||
|
<if test="states !=null and states.length != 0">
|
||||||
|
and state in
|
||||||
|
<foreach collection="states" item="i" index="index" open="(" separator="," close=")">
|
||||||
|
#{i}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="startTime!=null and endTime != null ">
|
<if test="startTime!=null and endTime != null ">
|
||||||
and process_definition_id=#{processDefinitionId}
|
and process_definition_id=#{processDefinitionId}
|
||||||
and (schedule_time between #{startTime} and #{endTime} or start_time between #{startTime} and #{endTime})
|
and (schedule_time between #{startTime} and #{endTime} or start_time between #{startTime} and #{endTime})
|
||||||
</if>
|
</if>
|
||||||
|
order by start_time desc limit 1
|
||||||
</select>
|
</select>
|
||||||
<select id="queryLastManualProcess" resultType="cn.escheduler.dao.entity.ProcessInstance">
|
<select id="queryLastManualProcess" resultType="cn.escheduler.dao.entity.ProcessInstance">
|
||||||
select *,UNIX_TIMESTAMP(end_time)-UNIX_TIMESTAMP(start_time) as duration
|
select *
|
||||||
from t_escheduler_process_instance
|
from t_escheduler_process_instance
|
||||||
where process_definition_id=#{processDefinitionId}
|
where process_definition_id=#{processDefinitionId}
|
||||||
and schedule_time is null
|
and schedule_time is null
|
||||||
|
@ -3,17 +3,17 @@
|
|||||||
<mapper namespace="cn.escheduler.dao.mapper.ProjectUserMapper">
|
<mapper namespace="cn.escheduler.dao.mapper.ProjectUserMapper">
|
||||||
<delete id="deleteProjectRelation">
|
<delete id="deleteProjectRelation">
|
||||||
delete from t_escheduler_relation_project_user
|
delete from t_escheduler_relation_project_user
|
||||||
where user_id = #{userId}
|
where 1=1
|
||||||
|
and user_id = #{userId}
|
||||||
<if test="projectId != 0 ">
|
<if test="projectId != 0 ">
|
||||||
and project_id = #{projectId}
|
and project_id = #{projectId}
|
||||||
</if>
|
</if>
|
||||||
</delete>
|
</delete>
|
||||||
<select id="queryProjectRelation" resultType="cn.escheduler.dao.entity.ProjectUser">
|
<select id="queryProjectRelation" resultType="cn.escheduler.dao.entity.ProjectUser">
|
||||||
select p_u.*, u.user_name as user_name, p.name as proect_name
|
select *
|
||||||
from t_escheduler_relation_project_user p_u
|
from t_escheduler_relation_project_user
|
||||||
join t_escheduler_user u on u.id = p_u.user_id
|
where project_id = #{projectId}
|
||||||
join t_escheduler_project p on p.id = p_u.project_id
|
and user_id = #{userId}
|
||||||
where p_u.project_id = #{projectId}
|
limit 1
|
||||||
and p_u.user_id = #{userId}
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -4,19 +4,22 @@
|
|||||||
<select id="queryQueuePaging" resultType="cn.escheduler.dao.entity.Queue">
|
<select id="queryQueuePaging" resultType="cn.escheduler.dao.entity.Queue">
|
||||||
select *
|
select *
|
||||||
from t_escheduler_queue
|
from t_escheduler_queue
|
||||||
where queue_name like concat('%', #{searchVal}, '%')
|
where 1= 1
|
||||||
|
<if test="searchVal != null and searchVal != ''">
|
||||||
|
and queue_name like concat('%', #{searchVal}, '%')
|
||||||
|
</if>
|
||||||
order by update_time desc
|
order by update_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="queryByQueue" resultType="cn.escheduler.dao.entity.Queue">
|
<select id="queryAllQueueList" resultType="cn.escheduler.dao.entity.Queue">
|
||||||
select *
|
|
||||||
from t_escheduler_queue
|
|
||||||
where queue=#{queue}
|
|
||||||
order by update_time desc
|
|
||||||
</select>
|
|
||||||
<select id="queryByQueueName" resultType="cn.escheduler.dao.entity.Queue">
|
|
||||||
select *
|
select *
|
||||||
from t_escheduler_queue
|
from t_escheduler_queue
|
||||||
where queue_name =#{queueName}
|
where 1=1
|
||||||
|
<if test="queue != null and queue != ''">
|
||||||
|
and queue = #{queue}
|
||||||
|
</if>
|
||||||
|
<if test="queueName != null and queueName != ''">
|
||||||
|
and queue_name =#{queueName}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -9,7 +9,7 @@
|
|||||||
and user_id = #{userId}
|
and user_id = #{userId}
|
||||||
</if>
|
</if>
|
||||||
<if test="resourceId != 0">
|
<if test="resourceId != 0">
|
||||||
and resource_id = #{resourceId}
|
and resources_id = #{resourceId}
|
||||||
</if>
|
</if>
|
||||||
</delete>
|
</delete>
|
||||||
</mapper>
|
</mapper>
|
@ -14,7 +14,7 @@
|
|||||||
order by s.update_time desc
|
order by s.update_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="querySchedulerListByProjectName" resultType="cn.escheduler.dao.entity.Schedule">
|
<select id="querySchedulerListByProjectName" resultType="cn.escheduler.dao.entity.Schedule">
|
||||||
select p_f.name as process_definition_name, p_f.desc as `desc`, p.name as project_name,u.user_name,s.*
|
select p_f.name as process_definition_name, p_f.description as definition_description, p.name as project_name,u.user_name,s.*
|
||||||
from t_escheduler_schedules s
|
from t_escheduler_schedules s
|
||||||
join t_escheduler_process_definition p_f on s.process_definition_id = p_f.id
|
join t_escheduler_process_definition p_f on s.process_definition_id = p_f.id
|
||||||
join t_escheduler_project as p on p_f.project_id = p.id
|
join t_escheduler_project as p on p_f.project_id = p.id
|
||||||
@ -24,7 +24,13 @@
|
|||||||
<select id="selectAllByProcessDefineArray" resultType="cn.escheduler.dao.entity.Schedule">
|
<select id="selectAllByProcessDefineArray" resultType="cn.escheduler.dao.entity.Schedule">
|
||||||
select *
|
select *
|
||||||
from t_escheduler_schedules
|
from t_escheduler_schedules
|
||||||
where process_definition_id in (#{processDefineIds})
|
where 1= 1
|
||||||
|
<if test="processDefineIds != null and processDefineIds.length != 0 ">
|
||||||
|
and process_definition_id in
|
||||||
|
<foreach collection="processDefineIds" index="index" item="i" open="(" separator="," close=")">
|
||||||
|
#{i}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
and release_state = 1
|
and release_state = 1
|
||||||
</select>
|
</select>
|
||||||
<select id="queryByProcessDefinitionId" resultType="cn.escheduler.dao.entity.Schedule">
|
<select id="queryByProcessDefinitionId" resultType="cn.escheduler.dao.entity.Schedule">
|
||||||
|
@ -10,11 +10,11 @@
|
|||||||
<select id="queryByTenantCode" resultType="cn.escheduler.dao.entity.Tenant">
|
<select id="queryByTenantCode" resultType="cn.escheduler.dao.entity.Tenant">
|
||||||
select *
|
select *
|
||||||
from t_escheduler_tenant
|
from t_escheduler_tenant
|
||||||
where `tenant_code` = #{tenantCode}
|
where tenant_code = #{tenantCode}
|
||||||
</select>
|
</select>
|
||||||
<select id="queryTenantPaging" resultType="cn.escheduler.dao.entity.Tenant">
|
<select id="queryTenantPaging" resultType="cn.escheduler.dao.entity.Tenant">
|
||||||
SELECT t.*,q.queue_name
|
SELECT t.*,q.queue_name
|
||||||
FROM t_escheduler_tenantt,t_escheduler_queue q
|
FROM t_escheduler_tenant t,t_escheduler_queue q
|
||||||
WHERE t.queue_id = q.id
|
WHERE t.queue_id = q.id
|
||||||
<if test="searchVal != null and searchVal != ''">
|
<if test="searchVal != null and searchVal != ''">
|
||||||
and t.tenant_name like concat('%', #{searchVal}, '%')
|
and t.tenant_name like concat('%', #{searchVal}, '%')
|
||||||
|
@ -114,4 +114,20 @@ public class ProcessInstanceMapMapperTest {
|
|||||||
);
|
);
|
||||||
Assert.assertEquals(delete, 1);
|
Assert.assertEquals(delete, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void querySubIdListByParentId() {
|
||||||
|
ProcessInstanceMap processInstanceMap = insertOne();
|
||||||
|
processInstanceMap.setProcessInstanceId(1);
|
||||||
|
processInstanceMap.setParentProcessInstanceId(1010);
|
||||||
|
|
||||||
|
processInstanceMapMapper.updateById(processInstanceMap);
|
||||||
|
|
||||||
|
List<Integer> subIds = processInstanceMapMapper.querySubIdListByParentId(processInstanceMap.getParentProcessInstanceId());
|
||||||
|
|
||||||
|
Assert.assertNotEquals(subIds.size(), 0);
|
||||||
|
|
||||||
|
processInstanceMapMapper.deleteById(processInstanceMap.getId());
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
@ -17,15 +17,21 @@
|
|||||||
package cn.escheduler.dao.mapper;
|
package cn.escheduler.dao.mapper;
|
||||||
|
|
||||||
|
|
||||||
import cn.escheduler.dao.entity.ProcessInstance;
|
import cn.escheduler.common.enums.ExecutionStatus;
|
||||||
import cn.escheduler.dao.entity.ProcessInstanceMap;
|
import cn.escheduler.common.enums.Flag;
|
||||||
|
import cn.escheduler.common.enums.ReleaseState;
|
||||||
|
import cn.escheduler.dao.entity.*;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mortbay.jetty.servlet.AbstractSessionIdManager;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@ -36,12 +42,24 @@ public class ProcessInstanceMapperTest {
|
|||||||
@Autowired
|
@Autowired
|
||||||
ProcessInstanceMapper processInstanceMapper;
|
ProcessInstanceMapper processInstanceMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ProcessDefinitionMapper processDefinitionMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ProjectMapper projectMapper;
|
||||||
|
|
||||||
|
|
||||||
private ProcessInstance insertOne(){
|
private ProcessInstance insertOne(){
|
||||||
//insertOne
|
//insertOne
|
||||||
ProcessInstance processInstanceMap = new ProcessInstance();
|
ProcessInstance processInstance = new ProcessInstance();
|
||||||
processInstanceMapper.insert(processInstanceMap);
|
Date start = new Date(2019-1900, 1-1, 1, 0, 10,0);
|
||||||
return processInstanceMap;
|
Date end = new Date(2019-1900, 1-1, 1, 1, 0,0);
|
||||||
|
processInstance.setStartTime(start);
|
||||||
|
processInstance.setEndTime(end);
|
||||||
|
processInstance.setState(ExecutionStatus.SUBMITTED_SUCCESS);
|
||||||
|
|
||||||
|
processInstanceMapper.insert(processInstance);
|
||||||
|
return processInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -63,62 +81,207 @@ public class ProcessInstanceMapperTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQuery() {
|
public void testQuery() {
|
||||||
ProcessInstance processInstanceMap = insertOne();
|
ProcessInstance processInstance = insertOne();
|
||||||
//query
|
//query
|
||||||
List<ProcessInstance> dataSources = processInstanceMapper.selectList(null);
|
List<ProcessInstance> dataSources = processInstanceMapper.selectList(null);
|
||||||
Assert.assertNotEquals(dataSources.size(), 0);
|
Assert.assertNotEquals(dataSources.size(), 0);
|
||||||
processInstanceMapper.deleteById(processInstanceMap.getId());
|
processInstanceMapper.deleteById(processInstance.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryDetailById() {
|
public void testQueryDetailById() {
|
||||||
|
ProcessInstance processInstance = insertOne();
|
||||||
|
processInstanceMapper.updateById(processInstance);
|
||||||
|
|
||||||
|
ProcessInstance processInstance1 = processInstanceMapper.queryDetailById(processInstance.getId());
|
||||||
|
Assert.assertNotEquals(processInstance1, 50);
|
||||||
|
processInstanceMapper.deleteById(processInstance.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryByHostAndStatus() {
|
public void testQueryByHostAndStatus() {
|
||||||
|
ProcessInstance processInstance = insertOne();
|
||||||
|
processInstance.setHost("192.168.2.155");
|
||||||
|
processInstance.setState(ExecutionStatus.RUNNING_EXEUTION);
|
||||||
|
processInstanceMapper.updateById(processInstance);
|
||||||
|
|
||||||
|
int[] stateArray = new int[]{
|
||||||
|
ExecutionStatus.RUNNING_EXEUTION.ordinal(),
|
||||||
|
ExecutionStatus.SUCCESS.ordinal()};
|
||||||
|
|
||||||
|
processInstanceMapper.queryByHostAndStatus(processInstance.getHost(), stateArray);
|
||||||
|
|
||||||
|
processInstanceMapper.deleteById(processInstance.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryProcessInstanceListPaging() {
|
public void testQueryProcessInstanceListPaging() {
|
||||||
|
|
||||||
|
|
||||||
|
int[] stateArray = new int[]{
|
||||||
|
ExecutionStatus.RUNNING_EXEUTION.ordinal(),
|
||||||
|
ExecutionStatus.SUCCESS.ordinal()};
|
||||||
|
|
||||||
|
ProcessDefinition processDefinition = new ProcessDefinition();
|
||||||
|
processDefinition.setProjectId(1010);
|
||||||
|
processDefinition.setReleaseState(ReleaseState.ONLINE);
|
||||||
|
processDefinitionMapper.insert(processDefinition);
|
||||||
|
|
||||||
|
ProcessInstance processInstance = insertOne();
|
||||||
|
processInstance.setProcessDefinitionId(processDefinition.getId());
|
||||||
|
processInstance.setState(ExecutionStatus.RUNNING_EXEUTION);
|
||||||
|
processInstance.setIsSubProcess(Flag.NO);
|
||||||
|
processInstance.setStartTime(new Date());
|
||||||
|
|
||||||
|
processInstanceMapper.updateById(processInstance);
|
||||||
|
|
||||||
|
|
||||||
|
Page<ProcessInstance> page = new Page(1, 3);
|
||||||
|
|
||||||
|
IPage<ProcessInstance> processInstanceIPage = processInstanceMapper.queryProcessInstanceListPaging(
|
||||||
|
page,
|
||||||
|
processDefinition.getProjectId(),
|
||||||
|
processInstance.getProcessDefinitionId(),
|
||||||
|
processInstance.getName(),
|
||||||
|
stateArray,
|
||||||
|
processInstance.getHost(),
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
Assert.assertNotEquals(processInstanceIPage.getTotal(), 0);
|
||||||
|
|
||||||
|
processDefinitionMapper.deleteById(processDefinition.getId());
|
||||||
|
processInstanceMapper.deleteById(processInstance.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSetFailoverByHostAndStateArray() {
|
public void testSetFailoverByHostAndStateArray() {
|
||||||
|
|
||||||
|
int[] stateArray = new int[]{
|
||||||
|
ExecutionStatus.RUNNING_EXEUTION.ordinal(),
|
||||||
|
ExecutionStatus.SUCCESS.ordinal()};
|
||||||
|
|
||||||
|
ProcessInstance processInstance = insertOne();
|
||||||
|
|
||||||
|
processInstance.setState(ExecutionStatus.RUNNING_EXEUTION);
|
||||||
|
processInstance.setHost("192.168.2.220");
|
||||||
|
processInstanceMapper.updateById(processInstance);
|
||||||
|
String host = processInstance.getHost();
|
||||||
|
int update = processInstanceMapper.setFailoverByHostAndStateArray(host, stateArray);
|
||||||
|
Assert.assertNotEquals(update, 0);
|
||||||
|
|
||||||
|
processInstance = processInstanceMapper.selectById(processInstance.getId());
|
||||||
|
Assert.assertEquals(processInstance.getHost(), null);
|
||||||
|
processInstanceMapper.deleteById(processInstance.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateProcessInstanceByState() {
|
public void testUpdateProcessInstanceByState() {
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testQueryByTaskId() {
|
ProcessInstance processInstance = insertOne();
|
||||||
|
|
||||||
|
processInstance.setState(ExecutionStatus.RUNNING_EXEUTION);
|
||||||
|
processInstanceMapper.updateById(processInstance);
|
||||||
|
processInstanceMapper.updateProcessInstanceByState(ExecutionStatus.RUNNING_EXEUTION, ExecutionStatus.SUCCESS);
|
||||||
|
|
||||||
|
ProcessInstance processInstance1 = processInstanceMapper.selectById(processInstance.getId());
|
||||||
|
|
||||||
|
processInstanceMapper.deleteById(processInstance.getId());
|
||||||
|
Assert.assertEquals(processInstance1.getState(), ExecutionStatus.SUCCESS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCountInstanceStateByUser() {
|
public void testCountInstanceStateByUser() {
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
processDefinitionMapper.delete(null);
|
||||||
public void testQuerySubIdListByParentId() {
|
processInstanceMapper.delete(null);
|
||||||
|
|
||||||
|
Project project = new Project();
|
||||||
|
project.setName("testProject");
|
||||||
|
projectMapper.insert(project);
|
||||||
|
|
||||||
|
ProcessDefinition processDefinition = new ProcessDefinition();
|
||||||
|
processDefinition.setProjectId(project.getId());
|
||||||
|
|
||||||
|
processDefinitionMapper.insert(processDefinition);
|
||||||
|
ProcessInstance processInstance = insertOne();
|
||||||
|
processInstance.setProcessDefinitionId(processDefinition.getId());
|
||||||
|
int update = processInstanceMapper.updateById(processInstance);
|
||||||
|
|
||||||
|
Integer[] projectIds = new Integer[]{processDefinition.getProjectId()};
|
||||||
|
|
||||||
|
List<ExecuteStatusCount> executeStatusCounts = processInstanceMapper.countInstanceStateByUser(null, null, projectIds);
|
||||||
|
|
||||||
|
|
||||||
|
Assert.assertNotEquals(executeStatusCounts.size(), 0);
|
||||||
|
|
||||||
|
projectMapper.deleteById(project.getId());
|
||||||
|
processDefinitionMapper.deleteById(processDefinition.getId());
|
||||||
|
processInstanceMapper.deleteById(processInstance.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryByProcessDefineId() {
|
public void testQueryByProcessDefineId() {
|
||||||
}
|
ProcessInstance processInstance = insertOne();
|
||||||
|
ProcessInstance processInstance1 = insertOne();
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testQueryByScheduleTime() {
|
List<ProcessInstance> processInstances = processInstanceMapper.queryByProcessDefineId(processInstance.getProcessDefinitionId(), 1);
|
||||||
|
Assert.assertEquals(processInstances.size(), 1);
|
||||||
|
|
||||||
|
processInstances = processInstanceMapper.queryByProcessDefineId(processInstance.getProcessDefinitionId(), 2);
|
||||||
|
Assert.assertEquals(processInstances.size(), 2);
|
||||||
|
|
||||||
|
processInstanceMapper.deleteById(processInstance.getId());
|
||||||
|
processInstanceMapper.deleteById(processInstance1.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryLastSchedulerProcess() {
|
public void testQueryLastSchedulerProcess() {
|
||||||
|
ProcessInstance processInstance = insertOne();
|
||||||
|
processInstance.setScheduleTime(new Date());
|
||||||
|
processInstanceMapper.updateById(processInstance);
|
||||||
|
|
||||||
|
ProcessInstance processInstance1 = processInstanceMapper.queryLastSchedulerProcess(processInstance.getProcessDefinitionId(), null, null );
|
||||||
|
Assert.assertNotEquals(processInstance1, null);
|
||||||
|
processInstanceMapper.deleteById(processInstance.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryLastRunningProcess() {
|
public void testQueryLastRunningProcess() {
|
||||||
|
ProcessInstance processInstance = insertOne();
|
||||||
|
processInstance.setState(ExecutionStatus.RUNNING_EXEUTION);
|
||||||
|
processInstanceMapper.updateById(processInstance);
|
||||||
|
|
||||||
|
int[] stateArray = new int[]{
|
||||||
|
ExecutionStatus.RUNNING_EXEUTION.ordinal(),
|
||||||
|
ExecutionStatus.SUBMITTED_SUCCESS.ordinal()};
|
||||||
|
|
||||||
|
ProcessInstance processInstance1 = processInstanceMapper.queryLastRunningProcess(processInstance.getProcessDefinitionId(), null, null , stateArray);
|
||||||
|
|
||||||
|
Assert.assertNotEquals(processInstance1, null);
|
||||||
|
processInstanceMapper.deleteById(processInstance.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryLastManualProcess() {
|
public void testQueryLastManualProcess() {
|
||||||
|
ProcessInstance processInstance = insertOne();
|
||||||
|
processInstanceMapper.updateById(processInstance);
|
||||||
|
|
||||||
|
Date start = new Date(2019-1900, 1-1, 01, 0, 0, 0);
|
||||||
|
Date end = new Date(2019-1900, 1-1, 01, 5, 0, 0);
|
||||||
|
ProcessInstance processInstance1 = processInstanceMapper.queryLastManualProcess(processInstance.getProcessDefinitionId(),start, end
|
||||||
|
);
|
||||||
|
Assert.assertEquals(processInstance1.getId(), processInstance.getId());
|
||||||
|
|
||||||
|
start = new Date(2019-1900, 1-1, 01, 1, 0, 0);
|
||||||
|
processInstance1 = processInstanceMapper.queryLastManualProcess(processInstance.getProcessDefinitionId(),start, end
|
||||||
|
);
|
||||||
|
Assert.assertEquals(processInstance1, null);
|
||||||
|
|
||||||
|
processInstanceMapper.deleteById(processInstance.getId());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,20 +17,79 @@
|
|||||||
package cn.escheduler.dao.mapper;
|
package cn.escheduler.dao.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.escheduler.common.enums.ExecutionStatus;
|
||||||
|
import cn.escheduler.dao.entity.ProjectUser;
|
||||||
|
import cn.escheduler.dao.entity.ProjectUser;
|
||||||
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
public class ProjectUserMapperTest {
|
public class ProjectUserMapperTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ProjectUserMapper projectUserMapper;
|
||||||
|
|
||||||
|
private ProjectUser insertOne(){
|
||||||
|
//insertOne
|
||||||
|
ProjectUser projectUser = new ProjectUser();
|
||||||
|
projectUser.setProjectId(1010);
|
||||||
|
projectUser.setUserId(111);
|
||||||
|
projectUserMapper.insert(projectUser);
|
||||||
|
return projectUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdate(){
|
||||||
|
//insertOne
|
||||||
|
ProjectUser projectUser = insertOne();
|
||||||
|
projectUser.setCreateTime(new Date());
|
||||||
|
//update
|
||||||
|
int update = projectUserMapper.updateById(projectUser);
|
||||||
|
Assert.assertEquals(update, 1);
|
||||||
|
projectUserMapper.deleteById(projectUser.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDelete(){
|
||||||
|
ProjectUser projectUserMap = insertOne();
|
||||||
|
int delete = projectUserMapper.deleteById(projectUserMap.getId());
|
||||||
|
Assert.assertEquals(delete, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testQuery() {
|
||||||
|
ProjectUser projectUser = insertOne();
|
||||||
|
//query
|
||||||
|
List<ProjectUser> projectUsers = projectUserMapper.selectList(null);
|
||||||
|
Assert.assertNotEquals(projectUsers.size(), 0);
|
||||||
|
projectUserMapper.deleteById(projectUser.getId());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteProjectRelation() {
|
public void testDeleteProjectRelation() {
|
||||||
|
|
||||||
|
|
||||||
|
ProjectUser projectUser = insertOne();
|
||||||
|
int delete = projectUserMapper.deleteProjectRelation(projectUser.getProjectId(), projectUser.getUserId());
|
||||||
|
Assert.assertEquals(delete, 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryProjectRelation() {
|
public void testQueryProjectRelation() {
|
||||||
|
ProjectUser projectUser = insertOne();
|
||||||
|
ProjectUser projectUser1 = projectUserMapper.queryProjectRelation(projectUser.getProjectId(), projectUser.getUserId());
|
||||||
|
Assert.assertNotEquals(projectUser1, null);
|
||||||
|
|
||||||
|
projectUserMapper.deleteById(projectUser.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,24 +17,92 @@
|
|||||||
package cn.escheduler.dao.mapper;
|
package cn.escheduler.dao.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.escheduler.dao.entity.Queue;
|
||||||
|
import cn.escheduler.dao.entity.Queue;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
public class QueueMapperTest {
|
public class QueueMapperTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
QueueMapper queueMapper;
|
||||||
|
|
||||||
|
|
||||||
|
private Queue insertOne(){
|
||||||
|
//insertOne
|
||||||
|
Queue queue = new Queue();
|
||||||
|
queue.setQueueName("queue");
|
||||||
|
queue.setQueue("queue");
|
||||||
|
queue.setCreateTime(new Date());
|
||||||
|
queue.setUpdateTime(new Date());
|
||||||
|
queueMapper.insert(queue);
|
||||||
|
return queue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdate(){
|
||||||
|
//insertOne
|
||||||
|
Queue queue = insertOne();
|
||||||
|
queue.setCreateTime(new Date());
|
||||||
|
//update
|
||||||
|
int update = queueMapper.updateById(queue);
|
||||||
|
Assert.assertEquals(update, 1);
|
||||||
|
queueMapper.deleteById(queue.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDelete(){
|
||||||
|
Queue queue = insertOne();
|
||||||
|
int delete = queueMapper.deleteById(queue.getId());
|
||||||
|
Assert.assertEquals(delete, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testQuery() {
|
||||||
|
Queue queue = insertOne();
|
||||||
|
//query
|
||||||
|
List<Queue> queues = queueMapper.selectList(null);
|
||||||
|
Assert.assertNotEquals(queues.size(), 0);
|
||||||
|
queueMapper.deleteById(queue.getId());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryQueuePaging() {
|
public void testQueryQueuePaging() {
|
||||||
|
|
||||||
|
Queue queue = insertOne();
|
||||||
|
Page<Queue> page = new Page(1,3);
|
||||||
|
|
||||||
|
IPage<Queue> queueIPage= queueMapper.queryQueuePaging(page,
|
||||||
|
null);
|
||||||
|
Assert.assertNotEquals(queueIPage.getTotal(), 0);
|
||||||
|
|
||||||
|
queueIPage= queueMapper.queryQueuePaging(page,
|
||||||
|
queue.getQueueName());
|
||||||
|
Assert.assertNotEquals(queueIPage.getTotal(), 0);
|
||||||
|
queueMapper.deleteById(queue.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryByQueue() {
|
public void queryAllQueueList() {
|
||||||
}
|
Queue queue = insertOne();
|
||||||
|
|
||||||
@Test
|
List<Queue> queues = queueMapper.queryAllQueueList(queue.getQueue(), null);
|
||||||
public void testQueryByQueueName() {
|
Assert.assertNotEquals(queues.size(), 0);
|
||||||
|
|
||||||
|
queues = queueMapper.queryAllQueueList(null, queue.getQueueName());
|
||||||
|
Assert.assertNotEquals(queues.size(), 0);
|
||||||
|
queueMapper.deleteById(queue.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,16 +17,71 @@
|
|||||||
package cn.escheduler.dao.mapper;
|
package cn.escheduler.dao.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.escheduler.dao.entity.ResourcesUser;
|
||||||
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
public class ResourceUserMapperTest {
|
public class ResourceUserMapperTest {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ResourceUserMapper resourceUserMapper;
|
||||||
|
|
||||||
|
private ResourcesUser insertOne(){
|
||||||
|
//insertOne
|
||||||
|
ResourcesUser queue = new ResourcesUser();
|
||||||
|
queue.setCreateTime(new Date());
|
||||||
|
queue.setUpdateTime(new Date());
|
||||||
|
queue.setUserId(11111);
|
||||||
|
queue.setResourcesId(1110);
|
||||||
|
resourceUserMapper.insert(queue);
|
||||||
|
return queue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdate(){
|
||||||
|
//insertOne
|
||||||
|
ResourcesUser queue = insertOne();
|
||||||
|
queue.setCreateTime(new Date());
|
||||||
|
//update
|
||||||
|
int update = resourceUserMapper.updateById(queue);
|
||||||
|
Assert.assertEquals(update, 1);
|
||||||
|
resourceUserMapper.deleteById(queue.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDelete(){
|
||||||
|
ResourcesUser queue = insertOne();
|
||||||
|
int delete = resourceUserMapper.deleteById(queue.getId());
|
||||||
|
Assert.assertEquals(delete, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testQuery() {
|
||||||
|
ResourcesUser queue = insertOne();
|
||||||
|
//query
|
||||||
|
List<ResourcesUser> queues = resourceUserMapper.selectList(null);
|
||||||
|
Assert.assertNotEquals(queues.size(), 0);
|
||||||
|
resourceUserMapper.deleteById(queue.getId());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteResourceUser() {
|
public void testDeleteResourceUser() {
|
||||||
|
|
||||||
|
ResourcesUser queue = insertOne();
|
||||||
|
int delete = resourceUserMapper.deleteResourceUser(
|
||||||
|
queue.getUserId(),
|
||||||
|
queue.getResourcesId());
|
||||||
|
Assert.assertNotEquals(delete, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,28 +17,177 @@
|
|||||||
package cn.escheduler.dao.mapper;
|
package cn.escheduler.dao.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.escheduler.common.enums.FailureStrategy;
|
||||||
|
import cn.escheduler.common.enums.ReleaseState;
|
||||||
|
import cn.escheduler.common.enums.WarningType;
|
||||||
|
import cn.escheduler.dao.entity.ProcessDefinition;
|
||||||
|
import cn.escheduler.dao.entity.Project;
|
||||||
|
import cn.escheduler.dao.entity.Schedule;
|
||||||
|
import cn.escheduler.dao.entity.User;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
public class ScheduleMapperTest {
|
public class ScheduleMapperTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ScheduleMapper scheduleMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
UserMapper userMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ProjectMapper projectMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ProcessDefinitionMapper processDefinitionMapper;
|
||||||
|
|
||||||
|
private Schedule insertOne(){
|
||||||
|
//insertOne
|
||||||
|
Schedule schedule = new Schedule();
|
||||||
|
schedule.setStartTime(new Date());
|
||||||
|
schedule.setEndTime(new Date());
|
||||||
|
schedule.setCrontab("");
|
||||||
|
schedule.setFailureStrategy(FailureStrategy.CONTINUE);
|
||||||
|
schedule.setReleaseState(ReleaseState.OFFLINE);
|
||||||
|
schedule.setWarningType(WarningType.NONE);
|
||||||
|
schedule.setCreateTime(new Date());
|
||||||
|
schedule.setUpdateTime(new Date());
|
||||||
|
scheduleMapper.insert(schedule);
|
||||||
|
return schedule;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdate(){
|
||||||
|
//insertOne
|
||||||
|
Schedule schedule = insertOne();
|
||||||
|
schedule.setCreateTime(new Date());
|
||||||
|
//update
|
||||||
|
int update = scheduleMapper.updateById(schedule);
|
||||||
|
Assert.assertEquals(update, 1);
|
||||||
|
scheduleMapper.deleteById(schedule.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDelete(){
|
||||||
|
Schedule schedule = insertOne();
|
||||||
|
int delete = scheduleMapper.deleteById(schedule.getId());
|
||||||
|
Assert.assertEquals(delete, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testQuery() {
|
||||||
|
Schedule schedule = insertOne();
|
||||||
|
//query
|
||||||
|
List<Schedule> schedules = scheduleMapper.selectList(null);
|
||||||
|
Assert.assertNotEquals(schedules.size(), 0);
|
||||||
|
scheduleMapper.deleteById(schedule.getId());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryByProcessDefineIdPaging() {
|
public void testQueryByProcessDefineIdPaging() {
|
||||||
|
|
||||||
|
User user = new User();
|
||||||
|
user.setUserName("ut name");
|
||||||
|
userMapper.insert(user);
|
||||||
|
|
||||||
|
Project project = new Project();
|
||||||
|
project.setName("ut project");
|
||||||
|
project.setUserId(user.getId());
|
||||||
|
projectMapper.insert(project);
|
||||||
|
|
||||||
|
ProcessDefinition processDefinition = new ProcessDefinition();
|
||||||
|
processDefinition.setProjectId(project.getId());
|
||||||
|
processDefinition.setUserId(user.getId());
|
||||||
|
processDefinition.setLocations("");
|
||||||
|
processDefinitionMapper.insert(processDefinition);
|
||||||
|
|
||||||
|
Schedule schedule= insertOne();
|
||||||
|
schedule.setUserId(user.getId());
|
||||||
|
schedule.setProcessDefinitionId(processDefinition.getId());
|
||||||
|
scheduleMapper.insert(schedule);
|
||||||
|
|
||||||
|
Page<Schedule> page = new Page(1,3);
|
||||||
|
IPage<Schedule> scheduleIPage = scheduleMapper.queryByProcessDefineIdPaging(page,
|
||||||
|
processDefinition.getId(), ""
|
||||||
|
);
|
||||||
|
Assert.assertNotEquals(scheduleIPage.getSize(), 0);
|
||||||
|
|
||||||
|
|
||||||
|
projectMapper.deleteById(project.getId());
|
||||||
|
processDefinitionMapper.deleteById(processDefinition.getId());
|
||||||
|
userMapper.deleteById(user.getId());
|
||||||
|
scheduleMapper.deleteById(schedule.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQuerySchedulerListByProjectName() {
|
public void testQuerySchedulerListByProjectName() {
|
||||||
|
|
||||||
|
|
||||||
|
User user = new User();
|
||||||
|
user.setUserName("ut name");
|
||||||
|
userMapper.insert(user);
|
||||||
|
|
||||||
|
Project project = new Project();
|
||||||
|
project.setName("ut project");
|
||||||
|
project.setUserId(user.getId());
|
||||||
|
projectMapper.insert(project);
|
||||||
|
|
||||||
|
ProcessDefinition processDefinition = new ProcessDefinition();
|
||||||
|
processDefinition.setProjectId(project.getId());
|
||||||
|
processDefinition.setUserId(user.getId());
|
||||||
|
processDefinition.setLocations("");
|
||||||
|
processDefinitionMapper.insert(processDefinition);
|
||||||
|
|
||||||
|
Schedule schedule= insertOne();
|
||||||
|
schedule.setUserId(user.getId());
|
||||||
|
schedule.setProcessDefinitionId(processDefinition.getId());
|
||||||
|
scheduleMapper.insert(schedule);
|
||||||
|
|
||||||
|
Page<Schedule> page = new Page(1,3);
|
||||||
|
List<Schedule> schedules = scheduleMapper.querySchedulerListByProjectName(
|
||||||
|
project.getName()
|
||||||
|
);
|
||||||
|
projectMapper.deleteById(project.getId());
|
||||||
|
processDefinitionMapper.deleteById(processDefinition.getId());
|
||||||
|
userMapper.deleteById(user.getId());
|
||||||
|
scheduleMapper.deleteById(schedule.getId());
|
||||||
|
|
||||||
|
Assert.assertNotEquals(schedules.size(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSelectAllByProcessDefineArray() {
|
public void testSelectAllByProcessDefineArray() {
|
||||||
|
|
||||||
|
Schedule schedule = insertOne();
|
||||||
|
schedule.setProcessDefinitionId(12345);
|
||||||
|
schedule.setReleaseState(ReleaseState.ONLINE);
|
||||||
|
scheduleMapper.updateById(schedule);
|
||||||
|
|
||||||
|
List<Schedule> schedules= scheduleMapper.selectAllByProcessDefineArray(new int[] {schedule.getProcessDefinitionId()});
|
||||||
|
scheduleMapper.deleteById(schedule.getId());
|
||||||
|
Assert.assertNotEquals(schedules.size(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryByProcessDefinitionId() {
|
public void queryByProcessDefinitionId() {
|
||||||
|
Schedule schedule = insertOne();
|
||||||
|
schedule.setProcessDefinitionId(12345);
|
||||||
|
scheduleMapper.updateById(schedule);
|
||||||
|
|
||||||
|
List<Schedule> schedules= scheduleMapper.queryByProcessDefinitionId(schedule.getProcessDefinitionId());
|
||||||
|
scheduleMapper.deleteById(schedule.getId());
|
||||||
|
Assert.assertNotEquals(schedules.size(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,16 +17,66 @@
|
|||||||
package cn.escheduler.dao.mapper;
|
package cn.escheduler.dao.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.escheduler.dao.entity.Session;
|
||||||
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
public class SessionMapperTest {
|
public class SessionMapperTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
SessionMapper sessionMapper;
|
||||||
|
|
||||||
|
private Session insertOne(){
|
||||||
|
//insertOne
|
||||||
|
Session session = new Session();
|
||||||
|
session.setLastLoginTime(new Date());
|
||||||
|
session.setUserId(11111);
|
||||||
|
sessionMapper.insert(session);
|
||||||
|
return session;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdate(){
|
||||||
|
//insertOne
|
||||||
|
Session session = insertOne();
|
||||||
|
session.setLastLoginTime(new Date());
|
||||||
|
//update
|
||||||
|
int update = sessionMapper.updateById(session);
|
||||||
|
Assert.assertEquals(update, 1);
|
||||||
|
sessionMapper.deleteById(session.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDelete(){
|
||||||
|
Session session = insertOne();
|
||||||
|
int delete = sessionMapper.deleteById(session.getId());
|
||||||
|
Assert.assertEquals(delete, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testQuery() {
|
||||||
|
Session session = insertOne();
|
||||||
|
//query
|
||||||
|
List<Session> sessions = sessionMapper.selectList(null);
|
||||||
|
Assert.assertNotEquals(sessions.size(), 0);
|
||||||
|
sessionMapper.deleteById(session.getId());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryByUserId() {
|
public void testQueryByUserId() {
|
||||||
|
Session session = insertOne();
|
||||||
|
List<Session> sessions = sessionMapper.queryByUserId(session.getUserId());
|
||||||
|
Assert.assertNotEquals(sessions.size(), 0);
|
||||||
|
|
||||||
|
sessionMapper.deleteById(session.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,24 +17,109 @@
|
|||||||
package cn.escheduler.dao.mapper;
|
package cn.escheduler.dao.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.escheduler.dao.entity.Queue;
|
||||||
|
import cn.escheduler.dao.entity.Tenant;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
public class TenantMapperTest {
|
public class TenantMapperTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
TenantMapper tenantMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
QueueMapper queueMapper;
|
||||||
|
|
||||||
|
private Tenant insertOne(){
|
||||||
|
//insertOne
|
||||||
|
Tenant tenant = new Tenant();
|
||||||
|
tenant.setCreateTime(new Date());
|
||||||
|
tenant.setUpdateTime(new Date());
|
||||||
|
tenantMapper.insert(tenant);
|
||||||
|
return tenant;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdate(){
|
||||||
|
//insertOne
|
||||||
|
Tenant tenant = insertOne();
|
||||||
|
tenant.setUpdateTime(new Date());
|
||||||
|
//update
|
||||||
|
int update = tenantMapper.updateById(tenant);
|
||||||
|
Assert.assertEquals(update, 1);
|
||||||
|
tenantMapper.deleteById(tenant.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDelete(){
|
||||||
|
Tenant tenant = insertOne();
|
||||||
|
int delete = tenantMapper.deleteById(tenant.getId());
|
||||||
|
Assert.assertEquals(delete, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testQuery() {
|
||||||
|
Tenant tenant = insertOne();
|
||||||
|
//query
|
||||||
|
List<Tenant> tenants = tenantMapper.selectList(null);
|
||||||
|
Assert.assertNotEquals(tenants.size(), 0);
|
||||||
|
tenantMapper.deleteById(tenant.getId());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryById() {
|
public void testQueryById() {
|
||||||
|
|
||||||
|
Queue queue = new Queue();
|
||||||
|
queue.setQueueName("ut queue name");
|
||||||
|
queue.setQueue("ut queue");
|
||||||
|
queueMapper.insert(queue);
|
||||||
|
|
||||||
|
|
||||||
|
Tenant tenant = insertOne();
|
||||||
|
tenant.setQueueId(queue.getId());
|
||||||
|
tenantMapper.updateById(tenant);
|
||||||
|
|
||||||
|
Tenant tenant1 = tenantMapper.queryById(tenant.getId());
|
||||||
|
|
||||||
|
tenantMapper.deleteById(tenant.getId());
|
||||||
|
Assert.assertNotEquals(tenant1, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryByTenantCode() {
|
public void testQueryByTenantCode() {
|
||||||
|
|
||||||
|
Tenant tenant = insertOne();
|
||||||
|
tenant.setTenantCode("ut code");
|
||||||
|
tenantMapper.updateById(tenant);
|
||||||
|
|
||||||
|
List<Tenant> tenant1 = tenantMapper.queryByTenantCode(tenant.getTenantCode());
|
||||||
|
|
||||||
|
tenantMapper.deleteById(tenant.getId());
|
||||||
|
Assert.assertNotEquals(tenant1.size(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryTenantPaging() {
|
public void testQueryTenantPaging() {
|
||||||
|
Tenant tenant = insertOne();
|
||||||
|
tenant.setTenantCode("ut code");
|
||||||
|
tenant.setTenantName("ut name");
|
||||||
|
tenantMapper.updateById(tenant);
|
||||||
|
Page<Tenant> page = new Page(1,3);
|
||||||
|
|
||||||
|
IPage<Tenant> tenantIPage = tenantMapper.queryTenantPaging(page, tenant.getTenantName());
|
||||||
|
|
||||||
|
tenantMapper.deleteById(tenant.getId());
|
||||||
|
Assert.assertNotEquals(tenantIPage.getTotal(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -33,7 +33,6 @@ public abstract class AbstractYarnTask extends AbstractTask {
|
|||||||
/**
|
/**
|
||||||
* process instance
|
* process instance
|
||||||
*/
|
*/
|
||||||
protected ProcessInstance processInstance;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* process task
|
* process task
|
||||||
@ -53,7 +52,6 @@ public abstract class AbstractYarnTask extends AbstractTask {
|
|||||||
public AbstractYarnTask(TaskProps taskProps, Logger logger) {
|
public AbstractYarnTask(TaskProps taskProps, Logger logger) {
|
||||||
super(taskProps, logger);
|
super(taskProps, logger);
|
||||||
this.processDao = DaoFactory.getDaoInstance(ProcessDao.class);
|
this.processDao = DaoFactory.getDaoInstance(ProcessDao.class);
|
||||||
this.processInstance = processDao.findProcessInstanceByTaskId(taskProps.getTaskInstId());
|
|
||||||
this.shellCommandExecutor = new ShellCommandExecutor(this::logHandle,
|
this.shellCommandExecutor = new ShellCommandExecutor(this::logHandle,
|
||||||
taskProps.getTaskDir(),
|
taskProps.getTaskDir(),
|
||||||
taskProps.getTaskAppId(),
|
taskProps.getTaskAppId(),
|
||||||
|
Loading…
Reference in New Issue
Block a user