feat: 功能持续更新.

pull/161/head
chen.ma 3 years ago
parent 8ab9ecd064
commit e20f0fd92a

@ -16,17 +16,17 @@ public enum QueueTypeEnum {
/**
* {@link java.util.concurrent.LinkedBlockingQueue}
*/
Linked_Blocking_QUEUE(2),
LINKED_BLOCKING_QUEUE(2),
/**
* {@link java.util.concurrent.LinkedBlockingDeque}
*/
Linked_Blocking_Deque(3),
LINKED_BLOCKING_DEQUE(3),
/**
* {@link java.util.concurrent.SynchronousQueue}
*/
SynchronousQueue(4),
SYNCHRONOUS_QUEUE(4),
/**
* {@link java.util.concurrent.LinkedTransferQueue}
@ -36,12 +36,12 @@ public enum QueueTypeEnum {
/**
* {@link java.util.concurrent.PriorityBlockingQueue}
*/
PriorityBlockingQueue(6),
PRIORITY_BLOCKING_QUEUE(6),
/**
* {@link "io.dynamic.threadpool.starter.core.ResizableCapacityLinkedBlockIngQueue"}
*/
Resizable_LINKED_Blocking_QUEUE(9);
RESIZABLE_LINKED_BLOCKING_QUEUE(9);
public Integer type;

@ -18,18 +18,20 @@ public class BlockingQueueUtil {
BlockingQueue blockingQueue = null;
if (Objects.equals(type, QueueTypeEnum.ARRAY_BLOCKING_QUEUE.type)) {
blockingQueue = new ArrayBlockingQueue(capacity);
} else if (Objects.equals(type, QueueTypeEnum.Linked_Blocking_QUEUE.type)) {
} else if (Objects.equals(type, QueueTypeEnum.LINKED_BLOCKING_QUEUE.type)) {
blockingQueue = new LinkedBlockingQueue(capacity);
} else if (Objects.equals(type, QueueTypeEnum.Linked_Blocking_Deque.type)) {
} else if (Objects.equals(type, QueueTypeEnum.LINKED_BLOCKING_DEQUE.type)) {
blockingQueue = new LinkedBlockingDeque(capacity);
} else if (Objects.equals(type, QueueTypeEnum.SynchronousQueue.type)) {
} else if (Objects.equals(type, QueueTypeEnum.SYNCHRONOUS_QUEUE.type)) {
blockingQueue = new SynchronousQueue();
} else if (Objects.equals(type, QueueTypeEnum.LINKED_TRANSFER_QUEUE.type)) {
blockingQueue = new LinkedTransferQueue();
} else if (Objects.equals(type, QueueTypeEnum.PriorityBlockingQueue.type)) {
} else if (Objects.equals(type, QueueTypeEnum.PRIORITY_BLOCKING_QUEUE.type)) {
blockingQueue = new PriorityBlockingQueue(capacity);
} else if (Objects.equals(type, QueueTypeEnum.Resizable_LINKED_Blocking_QUEUE.type)) {
} else if (Objects.equals(type, QueueTypeEnum.RESIZABLE_LINKED_BLOCKING_QUEUE.type)) {
blockingQueue = new ResizableCapacityLinkedBlockIngQueue(capacity);
} else {
throw new IllegalArgumentException("未找到类型匹配的阻塞队列.");
}
return blockingQueue;
}

@ -0,0 +1,32 @@
package io.dynamic.threadpool.server.config;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import io.dynamic.threadpool.server.enums.DelEnum;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;
import java.util.Date;
/**
* Meta Object Handler.
*
* @author chen.ma
* @date 2021/7/1 22:43
*/
@Slf4j
@Component
public class MyMetaObjectHandler implements MetaObjectHandler {
@Override
public void insertFill(MetaObject metaObject) {
this.strictInsertFill(metaObject, "gmtCreate", Date.class, new Date());
this.strictInsertFill(metaObject, "gmtModified", Date.class, new Date());
this.strictInsertFill(metaObject, "delFlag", Integer.class, DelEnum.NORMAL.getIntCode());
}
@Override
public void updateFill(MetaObject metaObject) {
this.strictInsertFill(metaObject, "gmtModified", Date.class, new Date());
}
}

@ -47,7 +47,7 @@ public class TenantController {
return Results.success();
}
@DeleteMapping("/item/delete/{namespaceId}")
@DeleteMapping("/namespace/delete/{namespaceId}")
public Result deleteNameSpace(@PathVariable("namespaceId") String namespaceId) {
tenantService.deleteNameSpaceById(namespaceId);
return Results.success();

@ -3,6 +3,7 @@ package io.dynamic.threadpool.server.model;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import io.dynamic.threadpool.common.model.PoolParameter;
import lombok.Data;
@ -21,13 +22,33 @@ public class ConfigAllInfo extends ConfigInfo implements PoolParameter {
private static final long serialVersionUID = -2417394244017463665L;
/**
*
*/
@JSONField(serialize = false)
@TableField(exist = false, fill = FieldFill.UPDATE)
private String desc;
/**
*
*/
@JSONField(serialize = false)
@TableField(fill = FieldFill.INSERT)
private Date gmtCreate;
/**
*
*/
@JSONField(serialize = false)
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date gmtModified;
/**
*
*/
@TableLogic
@JSONField(serialize = false)
@TableField(fill = FieldFill.INSERT)
private Integer delFlag;
}

@ -1,7 +1,9 @@
package io.dynamic.threadpool.server.model;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.io.Serializable;
@ -20,6 +22,7 @@ public class ConfigInfoBase implements Serializable {
/**
* ID
*/
@TableId(type = IdType.AUTO)
private Integer id;
/**

@ -1,6 +1,6 @@
package io.dynamic.threadpool.server.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
@ -15,19 +15,54 @@ import java.util.Date;
@TableName("item_info")
public class ItemInfo {
/**
* ID
*/
@TableId(type = IdType.AUTO)
private Integer id;
/**
* ID
*/
private String tenantId;
/**
* ID
*/
private String itemId;
/**
*
*/
private String itemName;
/**
*
*/
private String itemDesc;
/**
*
*/
private String owner;
/**
*
*/
@TableField(fill = FieldFill.INSERT)
private Date gmtCreate;
/**
*
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date gmtModified;
/**
*
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
private Integer delFlag;
}

@ -1,7 +1,6 @@
package io.dynamic.threadpool.server.model;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
@ -19,6 +18,7 @@ public class TenantInfo {
/**
* ID
*/
@TableId(type = IdType.AUTO)
private Integer id;
/**
@ -44,17 +44,19 @@ public class TenantInfo {
/**
*
*/
@TableField(fill = FieldFill.INSERT)
private Date gmtCreate;
/**
*
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date gmtModified;
/**
*
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
private Integer delFlag;
}

@ -15,8 +15,6 @@ import io.dynamic.threadpool.server.model.biz.tenant.TenantQueryReqDTO;
import io.dynamic.threadpool.server.model.biz.tenant.TenantRespDTO;
import io.dynamic.threadpool.server.model.biz.tenant.TenantSaveReqDTO;
import io.dynamic.threadpool.server.model.biz.tenant.TenantUpdateReqDTO;
import io.dynamic.threadpool.server.service.biz.ItemService;
import io.dynamic.threadpool.server.service.biz.TenantService;
import io.dynamic.threadpool.server.toolkit.BeanUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -85,17 +83,17 @@ public class TenantServiceImpl implements TenantService {
@Override
public void deleteNameSpaceById(String namespaceId) {
TenantInfo tenantInfo = new TenantInfo();
tenantInfo.setDelFlag(DelEnum.DELETE.getIntCode());
ItemQueryReqDTO reqDTO = new ItemQueryReqDTO();
reqDTO.setTenantId(namespaceId);
List<ItemRespDTO> itemList = itemService.queryItem(reqDTO);
if (CollectionUtils.isNotEmpty(itemList)) {
throw new RuntimeException("业务线包含项目引用, 删除失败.");
}
int updateResult = tenantInfoMapper.update(tenantInfo,
Wrappers.lambdaUpdate(TenantInfo.class).eq(TenantInfo::getTenantId, namespaceId));
int updateResult = tenantInfoMapper.update(new TenantInfo(),
Wrappers.lambdaUpdate(TenantInfo.class)
.eq(TenantInfo::getTenantId, namespaceId)
.set(TenantInfo::getDelFlag, DelEnum.DELETE.getIntCode()));
boolean retBool = SqlHelper.retBool(updateResult);
if (!retBool) {
throw new RuntimeException("删除失败.");

@ -4,12 +4,17 @@ server:
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/dynamic-thread-pool
url: jdbc:mysql://47.94.158.71:3306/dynamic-threadpool
username: root
password: root
logging:
level:
com.baomidou.example.mapper: debug
mybatis-plus:
global-config:
db-config:
logic-delete-field: delFlag
logic-delete-value: 1
logic-not-delete-value: 0
Loading…
Cancel
Save