parent
fa4be5d125
commit
99688c474f
@ -0,0 +1,108 @@
|
||||
package xyz.wbsite.action.ajax.admin;
|
||||
|
||||
import com.alibaba.excel.support.ExcelTypeEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import xyz.wbsite.frame.base.Error;
|
||||
import xyz.wbsite.frame.excel.WExcel;
|
||||
import xyz.wbsite.frame.utils.LogUtil;
|
||||
import xyz.wbsite.frame.base.LocalData;
|
||||
import xyz.wbsite.frame.base.ErrorType;
|
||||
import xyz.wbsite.frame.utils.MapperUtil;
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
import xyz.wbsite.frame.utils.ResponseUtil;
|
||||
import xyz.wbsite.frame.utils.ValidationUtil;
|
||||
import xyz.wbsite.frame.excel.exception.TemplateNotMatchException;
|
||||
import xyz.wbsite.module.admin.ent.Services;
|
||||
import xyz.wbsite.module.admin.mgr.ServicesManager;
|
||||
import xyz.wbsite.module.admin.req.ServicesCreateRequest;
|
||||
import xyz.wbsite.module.admin.req.ServicesDeleteRequest;
|
||||
import xyz.wbsite.module.admin.req.ServicesFindRequest;
|
||||
import xyz.wbsite.module.admin.req.ServicesUpdateRequest;
|
||||
import xyz.wbsite.module.admin.rsp.ServicesCreateResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ServicesDeleteResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ServicesFindResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ServicesUpdateResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class ServicesAjax{
|
||||
|
||||
@Autowired
|
||||
private ServicesManager servicesManager;
|
||||
|
||||
public ServicesCreateResponse create(ServicesCreateRequest request) {
|
||||
return servicesManager.create(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public ServicesDeleteResponse delete(ServicesDeleteRequest request) {
|
||||
return servicesManager.delete(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public ServicesUpdateResponse update(ServicesUpdateRequest request) {
|
||||
return servicesManager.update(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public ServicesFindResponse find(ServicesFindRequest request) {
|
||||
return servicesManager.find(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public Object template(){
|
||||
return ResponseUtil.apply(new WExcel<>(Services.class));
|
||||
}
|
||||
|
||||
public Object exports(ServicesFindRequest request) {
|
||||
ServicesFindResponse response = servicesManager.find(request, LocalData.getToken());
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
} else if (response.getTotalCount() == 0) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, "导出数据为空");
|
||||
return response;
|
||||
}
|
||||
return ResponseUtil.apply(new WExcel<>(Services.class).addDatas(response.getResult()));
|
||||
}
|
||||
|
||||
public Object imports(MultipartFile file) {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
try {
|
||||
// 检查文件格式
|
||||
String originalFilename = file.getOriginalFilename() != null ? file.getOriginalFilename() : "";
|
||||
if (!originalFilename.matches(".+(.xlsx?|.XLSX?)$")) {
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, "上传文件格式错误!");
|
||||
return baseResponse;
|
||||
}
|
||||
// 兼容2003以前老版本.xls
|
||||
ExcelTypeEnum excelTypeEnum = originalFilename.matches(".+(.xlsx|.XLSX)$") ? ExcelTypeEnum.XLSX : ExcelTypeEnum.XLS;
|
||||
WExcel sheet = new WExcel<>(Services.class).read(file.getBytes(), excelTypeEnum, new WExcel.Processor<Services>() {
|
||||
@Override
|
||||
public List<String> exec(Services o, int index) {
|
||||
ServicesCreateRequest request = MapperUtil.map(o, ServicesCreateRequest.class);
|
||||
List<String> validate = ValidationUtil.validate(request);
|
||||
if (validate == null || validate.size() == 0) {
|
||||
ServicesCreateResponse servicesCreateResponse = servicesManager.create(request, LocalData.getToken());
|
||||
if (servicesCreateResponse.hasError()) {
|
||||
for (Error error : servicesCreateResponse.getErrors()) {
|
||||
validate.add(error.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return validate;
|
||||
}
|
||||
});
|
||||
// 当导入出现错误时可以将存在标注错误的Excel返回给用户改正
|
||||
if (sheet.hasError()) {
|
||||
return ResponseUtil.apply(sheet.getBytes(), sheet.getName() + "-检查.xlsx");
|
||||
} else {
|
||||
return baseResponse;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.dumpException(e);
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, "上传文件出错");
|
||||
} catch (TemplateNotMatchException e) {
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, e.getMessage());
|
||||
}
|
||||
return baseResponse;
|
||||
}
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
package xyz.wbsite.action.ajax.wframe;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import xyz.wbsite.config.CacheConfig;
|
||||
import xyz.wbsite.frame.base.ErrorType;
|
||||
import xyz.wbsite.frame.base.LocalData;
|
||||
import xyz.wbsite.frame.base.LoginRequest;
|
||||
import xyz.wbsite.frame.base.LoginResponse;
|
||||
import xyz.wbsite.frame.base.LogoutRequest;
|
||||
import xyz.wbsite.frame.base.LogoutResponse;
|
||||
import xyz.wbsite.frame.base.Token;
|
||||
import xyz.wbsite.frame.base.UserEntity;
|
||||
import xyz.wbsite.frame.base.VerifyCodeRequest;
|
||||
import xyz.wbsite.frame.base.VerifyCodeResponse;
|
||||
import xyz.wbsite.frame.provider.FrameProvider;
|
||||
import xyz.wbsite.frame.provider.TokenProvider;
|
||||
import xyz.wbsite.frame.provider.UserProvider;
|
||||
import xyz.wbsite.frame.utils.CookieUtil;
|
||||
import xyz.wbsite.frame.utils.IDgenerator;
|
||||
import xyz.wbsite.frame.utils.MD5Util;
|
||||
import xyz.wbsite.frame.utils.ValidationUtil;
|
||||
import xyz.wbsite.frame.utils.VerifyCodeUtil;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class AuthAjax {
|
||||
|
||||
@Autowired
|
||||
private CacheConfig cacheConfig;
|
||||
|
||||
public VerifyCodeResponse verifyCode(VerifyCodeRequest request) {
|
||||
VerifyCodeResponse response = new VerifyCodeResponse();
|
||||
VerifyCodeUtil.Builder builder = new VerifyCodeUtil.Builder().build();
|
||||
response.setVerifyCodeId(IDgenerator.nextId());
|
||||
response.setVerifyCodeBase64(builder.toBase64());
|
||||
cacheConfig.put(response.getVerifyCodeId(), builder.toCode(), 3 * 60 * 1000);
|
||||
return response;
|
||||
}
|
||||
|
||||
public LoginResponse login(LoginRequest request, HttpServletResponse httpServletResponse) {
|
||||
LoginResponse response = new LoginResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
// 获取验证码
|
||||
String o = cacheConfig.remove(request.getVerifyCodeId(), String.class);
|
||||
if (o == null) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, "验证码已过期!");
|
||||
return response;
|
||||
}
|
||||
|
||||
// 验证验证码
|
||||
if (!request.getVerifyCodeCode().toLowerCase().equals(o.toLowerCase())) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, "验证码错误!");
|
||||
cacheConfig.remove(request.getVerifyCodeId());
|
||||
return response;
|
||||
}
|
||||
|
||||
// 获取用户提供者
|
||||
UserProvider userProvider = FrameProvider.getInstance().getUserProvider();
|
||||
if (userProvider == null) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, "用户提供者未实现!");
|
||||
return response;
|
||||
}
|
||||
|
||||
// 获取用户信息
|
||||
UserEntity userEntity = userProvider.getUser(request.getUsername());
|
||||
if (userEntity == null) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, "用户名或密码错误!");
|
||||
return response;
|
||||
}
|
||||
|
||||
// 验证密码
|
||||
String generatePwd = MD5Util.generatePwd(request.getPassword());
|
||||
if (!generatePwd.equals(userEntity.getPassword())) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, "用户名或密码错误!");
|
||||
return response;
|
||||
}
|
||||
|
||||
// 获取通行证提供者
|
||||
TokenProvider tokenProvider = FrameProvider.getInstance().getTokenProvider();
|
||||
if (tokenProvider == null) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, "通行证提供者未实现!");
|
||||
return response;
|
||||
}
|
||||
|
||||
// 构建通行证
|
||||
Token token = tokenProvider.build(userEntity);
|
||||
if (token == null) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, "通行证构建失败!");
|
||||
return response;
|
||||
}
|
||||
response.setToken(token.getToken());
|
||||
Cookie cookie = CookieUtil.newCookie("token", response.getToken());
|
||||
httpServletResponse.addCookie(cookie);
|
||||
return response;
|
||||
}
|
||||
|
||||
public LogoutResponse logout(LogoutRequest request) {
|
||||
LogoutResponse response = new LogoutResponse();
|
||||
|
||||
Token token = LocalData.getToken();
|
||||
if (token != null) {
|
||||
cacheConfig.clear(token.getToken());
|
||||
}
|
||||
CookieUtil.clearCookie("token");
|
||||
return response;
|
||||
}
|
||||
|
||||
public LogoutResponse changePwd(LogoutRequest request) {
|
||||
LogoutResponse response = new LogoutResponse();
|
||||
|
||||
Token token = LocalData.getToken();
|
||||
if (token != null) {
|
||||
cacheConfig.clear(token.getToken());
|
||||
}
|
||||
CookieUtil.clearCookie("token");
|
||||
return response;
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package xyz.wbsite.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.BeanNameGenerator;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.type.filter.AssignableTypeFilter;
|
||||
import xyz.wbsite.frame.schedule.RunTask;
|
||||
import xyz.wbsite.frame.schedule.Scheduler;
|
||||
import xyz.wbsite.frame.utils.LogUtil;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Configuration
|
||||
public class TaskConfig {
|
||||
|
||||
@Autowired
|
||||
private Scheduler scheduler;
|
||||
|
||||
@Bean
|
||||
public Scheduler registerScheduler() {
|
||||
return new Scheduler();
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void registryTask() {
|
||||
{// 扫描类任务
|
||||
String aPackage = this.getClass().getPackage().getName();
|
||||
Pattern compile = Pattern.compile("(.*)\\.config");
|
||||
Matcher matcher = compile.matcher(aPackage);
|
||||
if (matcher.find()) {
|
||||
DefaultListableBeanFactory simpleBeanDefinitionRegistry = new DefaultListableBeanFactory();
|
||||
ClassPathBeanDefinitionScanner classPathBeanDefinitionScanner = new ClassPathBeanDefinitionScanner(simpleBeanDefinitionRegistry);
|
||||
classPathBeanDefinitionScanner.resetFilters(false);
|
||||
classPathBeanDefinitionScanner.addIncludeFilter(new AssignableTypeFilter(RunTask.class));
|
||||
classPathBeanDefinitionScanner.setBeanNameGenerator(new BeanNameGenerator() {
|
||||
@Override
|
||||
public String generateBeanName(BeanDefinition beanDefinition, BeanDefinitionRegistry beanDefinitionRegistry) {
|
||||
String beanClassName = beanDefinition.getBeanClassName();
|
||||
try {
|
||||
Class<?> aClass = Class.forName(beanClassName);
|
||||
Object instance = aClass.newInstance();
|
||||
RunTask task = (RunTask) instance;
|
||||
scheduler.createOrRepeat(task);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
LogUtil.i("registry task " + beanClassName);
|
||||
return beanClassName;
|
||||
}
|
||||
});
|
||||
classPathBeanDefinitionScanner.scan(matcher.group(1));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
public class DictLoadRequest extends BaseRequest{
|
||||
|
||||
@NotEmpty(message = "字典名称不能为空")
|
||||
private String dictName;
|
||||
|
||||
public String getDictName() {
|
||||
return dictName;
|
||||
}
|
||||
|
||||
public void setDictName(String dictName) {
|
||||
this.dictName = dictName;
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseRequest;
|
||||
|
||||
/**
|
||||
* LogoutRequest - 用户登出
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2017-01-01
|
||||
*/
|
||||
public class LogoutRequest extends BaseRequest {
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class UserEntity extends BaseEntity {
|
||||
|
||||
private String userName;
|
||||
|
||||
private String userAlias;
|
||||
|
||||
private String password;
|
||||
|
||||
private Set<String> resSet = new HashSet<>();
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserAlias() {
|
||||
return userAlias;
|
||||
}
|
||||
|
||||
public void setUserAlias(String userAlias) {
|
||||
this.userAlias = userAlias;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Set<String> getResSet() {
|
||||
return resSet;
|
||||
}
|
||||
|
||||
public void setResSet(Set<String> resSet) {
|
||||
this.resSet = resSet;
|
||||
}
|
||||
|
||||
public void putRes(String resource) {
|
||||
resSet.add(resource);
|
||||
}
|
||||
|
||||
public void putRes(Set<String> resourceSet) {
|
||||
this.resSet.addAll(resourceSet);
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* VerifyCodeResponse - 请求验证码
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-12-24
|
||||
*/
|
||||
public class VerifyCodeResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 验证码ID
|
||||
*/
|
||||
private Long verifyCodeId;
|
||||
|
||||
/**
|
||||
* 验证码base64
|
||||
*/
|
||||
private String verifyCodeBase64;
|
||||
|
||||
public Long getVerifyCodeId() {
|
||||
return verifyCodeId;
|
||||
}
|
||||
|
||||
public void setVerifyCodeId(Long verifyCodeId) {
|
||||
this.verifyCodeId = verifyCodeId;
|
||||
}
|
||||
|
||||
public String getVerifyCodeBase64() {
|
||||
return verifyCodeBase64;
|
||||
}
|
||||
|
||||
public void setVerifyCodeBase64(String verifyCodeBase64) {
|
||||
this.verifyCodeBase64 = verifyCodeBase64;
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class VisitorEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* APP_NAME - 应用名称
|
||||
*/
|
||||
private String appName;
|
||||
/**
|
||||
* APP_NOTE - 应用简介
|
||||
*/
|
||||
private String appNote;
|
||||
/**
|
||||
* APP_KEY - 应用码
|
||||
*/
|
||||
private String appKey;
|
||||
/**
|
||||
* APP_SECRET - 安全码
|
||||
*/
|
||||
private String appSecret;
|
||||
|
||||
public String getAppName() {
|
||||
return appName;
|
||||
}
|
||||
|
||||
public void setAppName(String appName) {
|
||||
this.appName = appName;
|
||||
}
|
||||
|
||||
public String getAppNote() {
|
||||
return appNote;
|
||||
}
|
||||
|
||||
public void setAppNote(String appNote) {
|
||||
this.appNote = appNote;
|
||||
}
|
||||
|
||||
public String getAppKey() {
|
||||
return appKey;
|
||||
}
|
||||
|
||||
public void setAppKey(String appKey) {
|
||||
this.appKey = appKey;
|
||||
}
|
||||
|
||||
public String getAppSecret() {
|
||||
return appSecret;
|
||||
}
|
||||
|
||||
public void setAppSecret(String appSecret) {
|
||||
this.appSecret = appSecret;
|
||||
}
|
||||
|
||||
private Set<String> resSet = new HashSet<>();
|
||||
|
||||
public Set<String> getResSet() {
|
||||
return resSet;
|
||||
}
|
||||
|
||||
public void setResSet(Set<String> resSet) {
|
||||
this.resSet = resSet;
|
||||
}
|
||||
|
||||
public void putRes(String resource) {
|
||||
resSet.add(resource);
|
||||
}
|
||||
|
||||
public void putRes(Set<String> resourceSet) {
|
||||
this.resSet.addAll(resourceSet);
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package xyz.wbsite.frame.excel.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Converter - Excel列转化器注解
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2017-01-01
|
||||
*/
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface Convert {
|
||||
Class target();
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
package xyz.wbsite.frame.excel.handler;
|
||||
|
||||
import com.alibaba.excel.metadata.Head;
|
||||
import com.alibaba.excel.write.handler.RowWriteHandler;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Comment;
|
||||
import org.apache.poi.ss.usermodel.Drawing;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
|
||||
import xyz.wbsite.frame.excel.WHead;
|
||||
import xyz.wbsite.frame.utils.StringUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class WRowWriteHandler implements RowWriteHandler {
|
||||
private List<WHead> wHeads;
|
||||
private Map<Integer, List<String>> errMap;
|
||||
|
||||
public WRowWriteHandler(List<WHead> wHeads, Map<Integer, List<String>> errMap) {
|
||||
this.wHeads = wHeads;
|
||||
this.errMap = errMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeRowCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Integer integer, Integer integer1, Boolean isHead) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterRowCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Integer integer, Boolean isHead) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterRowDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Integer rowIndex, Boolean isHead) {
|
||||
if (isHead && getHeadMaxRow() == rowIndex) {
|
||||
for (int i = 0; i < wHeads.size(); i++) {
|
||||
WHead wHead = wHeads.get(i);
|
||||
if (StringUtil.isNotEmpty(wHead.getNote())) {
|
||||
Drawing<?> drawingPatriarch = writeSheetHolder.getSheet().createDrawingPatriarch();
|
||||
// 创建一个批注
|
||||
int headRow = getHeadRow(wHead.getHead());
|
||||
Comment comment = drawingPatriarch.createCellComment(new XSSFClientAnchor(0, 0, 0, 0, (short) i, headRow, (short) i + 1, headRow + 3));
|
||||
// 输入批注信息
|
||||
comment.setString(new XSSFRichTextString(wHead.getNote()));
|
||||
// 将批注添加到标题对象中
|
||||
writeSheetHolder.getSheet().getRow(headRow).getCell(i).setCellComment(comment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isHead && errMap.get(rowIndex) != null) {
|
||||
Cell cell = row.createCell(wHeads.size());
|
||||
cell.getCellStyle().setWrapText(true);
|
||||
List<String> errs = errMap.get(rowIndex);
|
||||
cell.setCellValue(String.join("\r\n", errs));
|
||||
}
|
||||
}
|
||||
|
||||
public int getHeadMaxRow() {
|
||||
int r = 0;
|
||||
for (WHead wHead : wHeads) {
|
||||
if (wHead.getHead().getHeadNameList().size() - 1 > r) r = wHead.getHead().getHeadNameList().size() - 1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
public int getHeadRow(Head head) {
|
||||
List<String> nameList = head.getHeadNameList();
|
||||
if (nameList.size() == 1) {
|
||||
return 0;
|
||||
}
|
||||
int r = nameList.size() - 1;
|
||||
String last = nameList.get(r);
|
||||
for (int i = nameList.size() - 2; i >= 0; i--) {
|
||||
String s = nameList.get(i);
|
||||
if (s.equals(last)) {
|
||||
r--;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package xyz.wbsite.frame.excel.handler;
|
||||
|
||||
|
||||
import com.alibaba.excel.write.handler.SheetWriteHandler;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
|
||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
import org.apache.poi.ss.usermodel.DataValidation;
|
||||
import org.apache.poi.ss.usermodel.DataValidationConstraint;
|
||||
import org.apache.poi.ss.usermodel.DataValidationHelper;
|
||||
import org.apache.poi.ss.usermodel.FillPatternType;
|
||||
import org.apache.poi.ss.usermodel.Font;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.util.CellRangeAddressList;
|
||||
import xyz.wbsite.frame.excel.WHead;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class WSheetWriteHandler implements SheetWriteHandler {
|
||||
private List<WHead> wHeads;
|
||||
private CellStyle[] styles;
|
||||
|
||||
public WSheetWriteHandler(List<WHead> wHeads, CellStyle[] styles) {
|
||||
this.wHeads = wHeads;
|
||||
this.styles = styles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
|
||||
{
|
||||
styles[1] = writeWorkbookHolder.getWorkbook().createCellStyle();
|
||||
styles[1].setFillForegroundColor(IndexedColors.RED.getIndex());
|
||||
styles[1].setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
}
|
||||
|
||||
{
|
||||
styles[0] = writeWorkbookHolder.getWorkbook().createCellStyle();
|
||||
styles[0].setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
|
||||
styles[0].setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
styles[0].setBorderBottom(BorderStyle.THIN);
|
||||
styles[0].setBorderLeft(BorderStyle.THIN);
|
||||
styles[0].setBorderRight(BorderStyle.THIN);
|
||||
styles[0].setBorderTop(BorderStyle.THIN);
|
||||
styles[0].setAlignment(HorizontalAlignment.CENTER);
|
||||
Font font = writeWorkbookHolder.getWorkbook().createFont();
|
||||
font.setColor(IndexedColors.BLACK.getIndex());
|
||||
font.setFontHeightInPoints((short) 12);
|
||||
font.setBold(true);
|
||||
styles[0].setFont(font);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
|
||||
for (int i = 0; i < wHeads.size(); i++) {
|
||||
WHead col = wHeads.get(i);
|
||||
if (col.getSelectList() != null && col.getSelectList().length > 0) {
|
||||
CellRangeAddressList cellRangeAddressList = new CellRangeAddressList(0, 500, i, i);
|
||||
DataValidationHelper helper = writeSheetHolder.getSheet().getDataValidationHelper();
|
||||
DataValidationConstraint constraint = helper.createExplicitListConstraint(col.getSelectList());
|
||||
DataValidation dataValidation = helper.createValidation(constraint, cellRangeAddressList);
|
||||
writeSheetHolder.getSheet().addValidationData(dataValidation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package xyz.wbsite.frame.excel.listener;
|
||||
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import xyz.wbsite.frame.excel.WHead;
|
||||
import xyz.wbsite.frame.excel.exception.TemplateNotMatchException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public abstract class WReadListener<T> extends AnalysisEventListener<T> {
|
||||
private List<WHead> wHeads;
|
||||
private TemplateNotMatchException[] es;
|
||||
private boolean isHead;
|
||||
|
||||
public WReadListener(List<WHead> wHeads, TemplateNotMatchException[] es) {
|
||||
this.wHeads = wHeads;
|
||||
this.es = es;
|
||||
this.isHead = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invokeHeadMap(Map headMap, AnalysisContext context) {
|
||||
if (wHeads.size() != headMap.size()) {
|
||||
es[0] = new TemplateNotMatchException("文件列数量与模板不一致!");
|
||||
return;
|
||||
}
|
||||
es[0] = null;
|
||||
for (int i = 0; i < wHeads.size(); i++) {
|
||||
WHead wCol = wHeads.get(i);
|
||||
String cellValue = headMap.get(i).toString();
|
||||
if (!wCol.getName().equals(cellValue)) {
|
||||
es[0] = new TemplateNotMatchException(String.format("第 %d 列应为[ %s ]", i + 1, wCol.getName()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(T o, AnalysisContext analysisContext) {
|
||||
isHead = false;
|
||||
invoke(o);
|
||||
}
|
||||
|
||||
public abstract void invoke(T o);
|
||||
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext(AnalysisContext context) {
|
||||
// 请求head
|
||||
if (isHead) {//多级表头,头部未结束
|
||||
return true;
|
||||
}
|
||||
if (!isHead && es[0] == null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package xyz.wbsite.frame.excel.style;
|
||||
|
||||
import org.apache.poi.hssf.util.HSSFColor;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
|
||||
public class DataCellStyle extends BaseCellStyle {
|
||||
|
||||
public DataCellStyle(Workbook workbook, short align, boolean error) {
|
||||
super(workbook);
|
||||
style.setAlignment(align);
|
||||
if (error) {
|
||||
style.setFillForegroundColor(HSSFColor.RED.index); //背景颜色红色
|
||||
style.setFillPattern(CellStyle.SOLID_FOREGROUND); //设置单元格填充样式
|
||||
}
|
||||
}
|
||||
|
||||
public DataCellStyle(Workbook workbook, short align) {
|
||||
this(workbook, align, false);
|
||||
}
|
||||
|
||||
public DataCellStyle(Workbook workbook, boolean error) {
|
||||
this(workbook, CellStyle.ALIGN_LEFT, error);
|
||||
}
|
||||
|
||||
public DataCellStyle(Workbook workbook) {
|
||||
this(workbook, CellStyle.ALIGN_LEFT, false);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package xyz.wbsite.frame.excel.style;
|
||||
|
||||
import org.apache.poi.hssf.util.HSSFColor;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
|
||||
public class ErrorCellStyle extends BaseCellStyle {
|
||||
|
||||
public ErrorCellStyle(Workbook workbook) {
|
||||
super(workbook);
|
||||
style.setFillForegroundColor(HSSFColor.RED.index); //背景颜色红色
|
||||
style.setFillPattern(CellStyle.SOLID_FOREGROUND); //设置单元格填充样式
|
||||
}
|
||||
|
||||
public CellStyle getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
public void setStyle(CellStyle style) {
|
||||
this.style = style;
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package xyz.wbsite.frame.excel.style;
|
||||
|
||||
import org.apache.poi.hssf.util.HSSFColor;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
|
||||
public class HeadCellStyle extends BaseCellStyle {
|
||||
public HeadCellStyle(Workbook workbook) {
|
||||
super(workbook);
|
||||
style.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index); //背景颜色-灰色
|
||||
style.setFillPattern(CellStyle.SOLID_FOREGROUND); // 设置单元格填充样式
|
||||
style.setAlignment(CellStyle.ALIGN_CENTER); // 居中
|
||||
style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);//上下居中
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package xyz.wbsite.frame.excel.style;
|
||||
|
||||
import org.apache.poi.hssf.util.HSSFColor;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
|
||||
/**
|
||||
* 普通字体.颜色黑
|
||||
* Created on 2015/1/29.
|
||||
*
|
||||
* @author
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class RedFont extends BaseFont {
|
||||
public RedFont(Workbook workbook) {
|
||||
super(workbook);
|
||||
font.setColor(HSSFColor.RED.index); //字体颜色-黑色
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package xyz.wbsite.frame.listener;
|
||||
|
||||
/**
|
||||
* 资源收集监听器
|
||||
*/
|
||||
public interface IResListener {
|
||||
|
||||
void onRes(String res);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package xyz.wbsite.frame.listener;
|
||||
|
||||
/**
|
||||
* 任务错误监听器
|
||||
*/
|
||||
public interface ITaskErrorListener {
|
||||
|
||||
void error(Throwable error);
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package xyz.wbsite.frame.provider;
|
||||
|
||||
public interface ProfileProvider {
|
||||
|
||||
/**
|
||||
* 获得当前环境配置
|
||||
*
|
||||
* @param key 配置项名
|
||||
* @param defaultValue 默认值
|
||||
* @return
|
||||
*/
|
||||
String getString(String key, String defaultValue);
|
||||
|
||||
/**
|
||||
* 获得当前环境配置
|
||||
*
|
||||
* @param key 配置项名
|
||||
* @param defaultValue 默认值
|
||||
* @return
|
||||
*/
|
||||
int getInt(String key, int defaultValue);
|
||||
|
||||
/**
|
||||
* 获得当前环境配置
|
||||
*
|
||||
* @param key 配置项名
|
||||
* @param defaultValue 默认值
|
||||
* @return
|
||||
*/
|
||||
long getLong(String key, long defaultValue);
|
||||
|
||||
/**
|
||||
* 获得当前环境配置
|
||||
*
|
||||
* @param key 配置项名
|
||||
* @param defaultValue 默认值
|
||||
* @return
|
||||
*/
|
||||
boolean getBoolean(String key, boolean defaultValue);
|
||||
}
|
@ -0,0 +1,146 @@
|
||||
package xyz.wbsite.frame.schedule;
|
||||
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import org.springframework.util.ErrorHandler;
|
||||
import xyz.wbsite.frame.listener.FrameListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
/**
|
||||
* 调度器
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-01-01
|
||||
*/
|
||||
public class Scheduler extends ThreadPoolTaskScheduler implements ErrorHandler {
|
||||
|
||||
private Map<String, TaskWrapper> taskMap = new HashMap<>();
|
||||
|
||||
public Scheduler() {
|
||||
setErrorHandler(this);
|
||||
setPoolSize(4);
|
||||
initialize();
|
||||
}
|
||||
|
||||
public boolean createOrRepeat(RunTask task) {
|
||||
if (taskMap.containsKey(task.taskId())) {
|
||||
ScheduledFuture<?> scheduledFuture = taskMap.get(task.taskId()).future;
|
||||
scheduledFuture.cancel(false);
|
||||
}
|
||||
taskMap.put(task.taskId(), new TaskWrapper(task));
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean remove(String taskId) {
|
||||
if (taskMap.containsKey(taskId)) {
|
||||
ScheduledFuture<?> scheduledFuture = taskMap.get(taskId).future;
|
||||
scheduledFuture.cancel(false);
|
||||
taskMap.remove(taskId);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean start(String taskId) {
|
||||
if (taskMap.containsKey(taskId)) {
|
||||
taskMap.get(taskId).run = true;
|
||||
taskMap.get(taskId).future = taskMap.get(taskId).target.schedule(this);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean stop(String taskId) {
|
||||
if (taskMap.containsKey(taskId)) {
|
||||
taskMap.get(taskId).run = false;
|
||||
ScheduledFuture<?> scheduledFuture = taskMap.get(taskId).future;
|
||||
scheduledFuture.cancel(false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<Schedule> taskList() {
|
||||
List<Schedule> result = new ArrayList<>();
|
||||
for (TaskWrapper taskWrapper : taskMap.values()) {
|
||||
Schedule schedule = new Schedule();
|
||||
schedule.setId(taskWrapper.taskId);
|
||||
schedule.setName(taskWrapper.taskName);
|
||||
schedule.setNote(taskWrapper.taskNote);
|
||||
schedule.setRun(taskWrapper.run);
|
||||
result.add(schedule);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 【此方法为异常最终处理】通常是线程执行任务时未捕捉的的异常。
|
||||
* @param throwable
|
||||
*/
|
||||
@Override
|
||||
public void handleError(Throwable throwable) {
|
||||
FrameListener instance = FrameListener.getInstance();
|
||||
instance.onTaskError(throwable);
|
||||
}
|
||||
|
||||
class TaskWrapper {
|
||||
RunTask target;
|
||||
String taskId;
|
||||
String taskName;
|
||||
String taskNote;
|
||||
boolean run;
|
||||
ScheduledFuture<?> future;
|
||||
|
||||
public TaskWrapper(RunTask runTask) {
|
||||
this.target = runTask;
|
||||
this.taskId = runTask.taskId();
|
||||
this.taskName = runTask.taskName();
|
||||
this.taskNote = runTask.taskNote();
|
||||
this.future = runTask.schedule(Scheduler.this);
|
||||
this.run = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Schedule {
|
||||
private String id;
|
||||
private String name;
|
||||
private String note;
|
||||
private boolean run;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
public boolean isRun() {
|
||||
return run;
|
||||
}
|
||||
|
||||
public void setRun(boolean run) {
|
||||
this.run = run;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package xyz.wbsite.frame.utils;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
|
||||
/**
|
||||
* ArrayUtil - 数组操作工具
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2017-01-01
|
||||
*/
|
||||
public class ArrayUtil {
|
||||
|
||||
/**
|
||||
* 数组克隆
|
||||
*
|
||||
* @param array 待克隆数组
|
||||
* @param <T> 泛型
|
||||
* @return 数组
|
||||
*/
|
||||
public static <T> T[] clone(T[] array) {
|
||||
return array == null ? null : array.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数组合并
|
||||
*
|
||||
* @param array1 待合并数组1
|
||||
* @param array2 待合并数组2
|
||||
* @param <T> 泛型
|
||||
* @return 数组
|
||||
*/
|
||||
public static <T> T[] merge(T[] array1, T... array2) {
|
||||
if (array1 == null) {
|
||||
return clone(array2);
|
||||
} else if (array2 == null) {
|
||||
return clone(array1);
|
||||
} else {
|
||||
Class<?> type1 = array1.getClass().getComponentType();
|
||||
T[] joinedArray = (T[]) Array.newInstance(type1, array1.length + array2.length);
|
||||
System.arraycopy(array1, 0, joinedArray, 0, array1.length);
|
||||
|
||||
try {
|
||||
System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);
|
||||
return joinedArray;
|
||||
} catch (ArrayStoreException var6) {
|
||||
Class<?> type2 = array2.getClass().getComponentType();
|
||||
if (!type1.isAssignableFrom(type2)) {
|
||||
throw new IllegalArgumentException("Cannot store " + type2.getName() + " in an array of " + type1.getName(), var6);
|
||||
} else {
|
||||
throw var6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package xyz.wbsite.frame.utils;
|
||||
|
||||
/**
|
||||
* BytesUtil - 字节数组工具类
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2017-01-01
|
||||
*/
|
||||
public class BytesUtil {
|
||||
|
||||
private static final char[] HEXES = {
|
||||
'0', '1', '2', '3',
|
||||
'4', '5', '6', '7',
|
||||
'8', '9', 'a', 'b',
|
||||
'c', 'd', 'e', 'f'
|
||||
};
|
||||
|
||||
/**
|
||||
* byte数组转16进制字符串
|
||||
*/
|
||||
public static String bytes2Hex(byte[] bytes) {
|
||||
if (bytes == null || bytes.length == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuilder hex = new StringBuilder();
|
||||
|
||||
for (byte b : bytes) {
|
||||
hex.append(HEXES[(b >> 4) & 0x0F]);
|
||||
hex.append(HEXES[b & 0x0F]);
|
||||
}
|
||||
|
||||
return hex.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 16进制字符串转byte数组
|
||||
*/
|
||||
public static byte[] hex2Bytes(String hex) {
|
||||
if (hex == null || hex.length() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
char[] hexChars = hex.toCharArray();
|
||||
byte[] bytes = new byte[hexChars.length / 2];
|
||||
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
bytes[i] = (byte) Integer.parseInt("" + hexChars[i * 2] + hexChars[i * 2 + 1], 16);
|
||||
}
|
||||
|
||||
return bytes;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package xyz.wbsite.frame.validation;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Constraint(validatedBy = DictValidator.class)
|
||||
@Inherited
|
||||
public @interface Dict {
|
||||
String message() default "字典验证错误";
|
||||
|
||||
String name() default "";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package xyz.wbsite.frame.validation;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Constraint(validatedBy = NumberValidator.class)
|
||||
@Inherited
|
||||
public @interface Number {
|
||||
String message() default "字段长度不符合";
|
||||
|
||||
int min() default 0;
|
||||
|
||||
int max() default 2147483647;
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package xyz.wbsite.frame.validation;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Constraint(validatedBy = SelectValidator.class)
|
||||
@Inherited
|
||||
public @interface Select {
|
||||
String message() default "选项验证错误";
|
||||
|
||||
String[] value() default {};
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package xyz.wbsite.module.admin.ent;
|
||||
|
||||
import xyz.wbsite.frame.excel.annotation.ExcelNote;
|
||||
import xyz.wbsite.frame.excel.annotation.ExcelSelect;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import xyz.wbsite.frame.excel.annotation.ExcelSheet;
|
||||
import xyz.wbsite.frame.base.BaseEntity;
|
||||
|
||||
/**
|
||||
* CONFIG - 配置预设
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
@ExcelSheet("配置预设")
|
||||
public class Config extends BaseEntity {
|
||||
|
||||
/**
|
||||
* CONF_NAME - 配置名称
|
||||
*/
|
||||
@ExcelProperty("配置名称")
|
||||
@ExcelNote("")
|
||||
private String confName;
|
||||
/**
|
||||
* CONF_TYPE - 配置类型
|
||||
*/
|
||||
@ExcelProperty("配置类型")
|
||||
@ExcelNote("")
|
||||
private String confType;
|
||||
/**
|
||||
* CONF_VALUE - 配置属值
|
||||
*/
|
||||
@ExcelProperty("配置属值")
|
||||
@ExcelNote("")
|
||||
private String confValue;
|
||||
/**
|
||||
* CONF_NOTE - 配置备注
|
||||
*/
|
||||
@ExcelProperty("配置备注")
|
||||
@ExcelNote("")
|
||||
private String confNote;
|
||||
|
||||
public String getConfName() {
|
||||
return this.confName;
|
||||
}
|
||||
|
||||
public void setConfName(String confName) {
|
||||
this.confName = confName;
|
||||
}
|
||||
|
||||
public String getConfType() {
|
||||
return this.confType;
|
||||
}
|
||||
|
||||
public void setConfType(String confType) {
|
||||
this.confType = confType;
|
||||
}
|
||||
|
||||
public String getConfValue() {
|
||||
return this.confValue;
|
||||
}
|
||||
|
||||
public void setConfValue(String confValue) {
|
||||
this.confValue = confValue;
|
||||
}
|
||||
|
||||
public String getConfNote() {
|
||||
return this.confNote;
|
||||
}
|
||||
|
||||
public void setConfNote(String confNote) {
|
||||
this.confNote = confNote;
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package xyz.wbsite.module.admin.ent;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseEntity;
|
||||
|
||||
/**
|
||||
* CONFIG_DATA - 配置数据
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ConfigData extends BaseEntity {
|
||||
|
||||
/**
|
||||
* TARGET_ID - 目标主键
|
||||
*/
|
||||
private Long targetId;
|
||||
/**
|
||||
* CONF_NAME - 配置名称
|
||||
*/
|
||||
private String confName;
|
||||
/**
|
||||
* CONF_TYPE - 配置类型
|
||||
*/
|
||||
private String confType;
|
||||
/**
|
||||
* CONF_VALUE - 配置属值
|
||||
*/
|
||||
private String confValue;
|
||||
/**
|
||||
* CONF_NOTE - 配置备注
|
||||
*/
|
||||
private String confNote;
|
||||
|
||||
public Long getTargetId() {
|
||||
return this.targetId;
|
||||
}
|
||||
|
||||
public void setTargetId(Long targetId) {
|
||||
this.targetId = targetId;
|
||||
}
|
||||
|
||||
public String getConfName() {
|
||||
return this.confName;
|
||||
}
|
||||
|
||||
public void setConfName(String confName) {
|
||||
this.confName = confName;
|
||||
}
|
||||
|
||||
public String getConfType() {
|
||||
return this.confType;
|
||||
}
|
||||
|
||||
public void setConfType(String confType) {
|
||||
this.confType = confType;
|
||||
}
|
||||
|
||||
public String getConfValue() {
|
||||
return this.confValue;
|
||||
}
|
||||
|
||||
public void setConfValue(String confValue) {
|
||||
this.confValue = confValue;
|
||||
}
|
||||
|
||||
public String getConfNote() {
|
||||
return this.confNote;
|
||||
}
|
||||
|
||||
public void setConfNote(String confNote) {
|
||||
this.confNote = confNote;
|
||||
}
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
package xyz.wbsite.module.admin.ent;
|
||||
|
||||
import xyz.wbsite.frame.excel.annotation.ExcelNote;
|
||||
import xyz.wbsite.frame.excel.annotation.ExcelSelect;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import xyz.wbsite.frame.excel.annotation.ExcelSheet;
|
||||
import xyz.wbsite.frame.base.BaseEntity;
|
||||
|
||||
/**
|
||||
* LOCATIONS - 路径配置
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
@ExcelSheet("路径配置")
|
||||
public class Locations extends BaseEntity {
|
||||
|
||||
/**
|
||||
* SERVICE_ID - 服务主键
|
||||
*/
|
||||
@ExcelProperty("服务主键")
|
||||
@ExcelNote("")
|
||||
private Long serviceId;
|
||||
/**
|
||||
* LOCAL_TITLE - 配置标题
|
||||
*/
|
||||
@ExcelProperty("配置标题")
|
||||
@ExcelNote("")
|
||||
private String localTitle;
|
||||
/**
|
||||
* LOCAL_NOTE - 配置备注
|
||||
*/
|
||||
@ExcelProperty("配置备注")
|
||||
@ExcelNote("")
|
||||
private String localNote;
|
||||
/**
|
||||
* LOCAL_PATH - 配置路径
|
||||
*/
|
||||
@ExcelProperty("配置路径")
|
||||
@ExcelNote("")
|
||||
private String localPath;
|
||||
/**
|
||||
* LOCAL_VALID - 是否启用
|
||||
*/
|
||||
@ExcelProperty("是否启用")
|
||||
@ExcelNote("")
|
||||
@ExcelSelect({"是","否"})
|
||||
private Boolean localValid;
|
||||
/**
|
||||
* FILTER - 启用过滤
|
||||
*/
|
||||
@ExcelProperty("启用过滤")
|
||||
@ExcelNote("")
|
||||
@ExcelSelect({"是","否"})
|
||||
private Boolean filter;
|
||||
/**
|
||||
* FILTER_CONF - 过滤配置
|
||||
*/
|
||||
@ExcelProperty("过滤配置")
|
||||
@ExcelNote("")
|
||||
private String filterConf;
|
||||
|
||||
public Long getServiceId() {
|
||||
return this.serviceId;
|
||||
}
|
||||
|
||||
public void setServiceId(Long serviceId) {
|
||||
this.serviceId = serviceId;
|
||||
}
|
||||
|
||||
public String getLocalTitle() {
|
||||
return this.localTitle;
|
||||
}
|
||||
|
||||
public void setLocalTitle(String localTitle) {
|
||||
this.localTitle = localTitle;
|
||||
}
|
||||
|
||||
public String getLocalNote() {
|
||||
return this.localNote;
|
||||
}
|
||||
|
||||
public void setLocalNote(String localNote) {
|
||||
this.localNote = localNote;
|
||||
}
|
||||
|
||||
public String getLocalPath() {
|
||||
return this.localPath;
|
||||
}
|
||||
|
||||
public void setLocalPath(String localPath) {
|
||||
this.localPath = localPath;
|
||||
}
|
||||
|
||||
public Boolean getLocalValid() {
|
||||
return this.localValid;
|
||||
}
|
||||
|
||||
public void setLocalValid(Boolean localValid) {
|
||||
this.localValid = localValid;
|
||||
}
|
||||
|
||||
public Boolean getFilter() {
|
||||
return this.filter;
|
||||
}
|
||||
|
||||
public void setFilter(Boolean filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public String getFilterConf() {
|
||||
return this.filterConf;
|
||||
}
|
||||
|
||||
public void setFilterConf(String filterConf) {
|
||||
this.filterConf = filterConf;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package xyz.wbsite.module.admin.mgr;
|
||||
|
||||
import xyz.wbsite.module.admin.req.ConfigDataCreateRequest;
|
||||
import xyz.wbsite.module.admin.req.ConfigDataDeleteRequest;
|
||||
import xyz.wbsite.module.admin.req.ConfigDataFindRequest;
|
||||
import xyz.wbsite.module.admin.req.ConfigDataUpdateRequest;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigDataCreateResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigDataDeleteResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigDataFindResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigDataUpdateResponse;
|
||||
import xyz.wbsite.frame.base.Token;
|
||||
|
||||
/**
|
||||
* 配置数据
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public interface ConfigDataManager {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
ConfigDataCreateResponse create(ConfigDataCreateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
ConfigDataDeleteResponse delete(ConfigDataDeleteRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
ConfigDataUpdateResponse update(ConfigDataUpdateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
ConfigDataFindResponse find(ConfigDataFindRequest request, Token token);
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package xyz.wbsite.module.admin.mgr;
|
||||
|
||||
import xyz.wbsite.module.admin.req.ServicesCreateRequest;
|
||||
import xyz.wbsite.module.admin.req.ServicesDeleteRequest;
|
||||
import xyz.wbsite.module.admin.req.ServicesFindRequest;
|
||||
import xyz.wbsite.module.admin.req.ServicesUpdateRequest;
|
||||
import xyz.wbsite.module.admin.rsp.ServicesCreateResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ServicesDeleteResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ServicesFindResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ServicesUpdateResponse;
|
||||
import xyz.wbsite.frame.base.Token;
|
||||
|
||||
/**
|
||||
* 虚拟主机
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public interface ServicesManager {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
ServicesCreateResponse create(ServicesCreateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
ServicesDeleteResponse delete(ServicesDeleteRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
ServicesUpdateResponse update(ServicesUpdateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
ServicesFindResponse find(ServicesFindRequest request, Token token);
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
package xyz.wbsite.module.admin.mpr;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import xyz.wbsite.frame.base.Token;
|
||||
import xyz.wbsite.module.admin.ent.ConfigData;
|
||||
import xyz.wbsite.module.admin.req.ConfigDataFindRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* CONFIG_DATA - 配置数据
|
||||
*
|
||||
* @author wangbing
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
@Mapper
|
||||
public interface ConfigDataMapper {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insert(@Param("request") ConfigData request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 批量插入
|
||||
*
|
||||
* @param list 对象集合
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insertBatch(@Param("list") List<ConfigData> list, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param id 主键
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long delete(@Param("id") Long id, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 批量逻辑删除
|
||||
*
|
||||
* @param list 主键集合
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long deleteBatch(@Param("list") List<Long> list, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long update(@Param("request") ConfigData request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 普通查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
List<ConfigData> select(@Param("request") ConfigData request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 高级查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
List<ConfigData> find(@Param("request") ConfigDataFindRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param id 主键
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
ConfigData getById(@Param("id") Long id, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param ids 主键集合
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
List<ConfigData> getByIds(@Param("ids") Long[] ids, @Param("token") Token token);
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
package xyz.wbsite.module.admin.mpr;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import xyz.wbsite.frame.base.Token;
|
||||
import xyz.wbsite.module.admin.ent.Config;
|
||||
import xyz.wbsite.module.admin.req.ConfigFindRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* CONFIG - 配置预设
|
||||
*
|
||||
* @author wangbing
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
@Mapper
|
||||
public interface ConfigMapper {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insert(@Param("request") Config request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 批量插入
|
||||
*
|
||||
* @param list 对象集合
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insertBatch(@Param("list") List<Config> list, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param id 主键
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long delete(@Param("id") Long id, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 批量逻辑删除
|
||||
*
|
||||
* @param list 主键集合
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long deleteBatch(@Param("list") List<Long> list, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long update(@Param("request") Config request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 普通查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
List<Config> select(@Param("request") Config request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 高级查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
List<Config> find(@Param("request") ConfigFindRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param id 主键
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
Config getById(@Param("id") Long id, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param ids 主键集合
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
List<Config> getByIds(@Param("ids") Long[] ids, @Param("token") Token token);
|
||||
}
|
@ -0,0 +1,207 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="xyz.wbsite.module.admin.mpr.LocationsMapper">
|
||||
|
||||
<sql id="table">"NA_LOCATIONS"</sql>
|
||||
|
||||
<sql id="entityColumnList">
|
||||
"ID","SERVICE_ID","LOCAL_TITLE","LOCAL_NOTE","LOCAL_PATH","LOCAL_VALID","FILTER","FILTER_CONF","ROW_VERSION","IS_DELETED","CREATE_BY","CREATE_TIME","LAST_UPDATE_BY","LAST_UPDATE_TIME"
|
||||
</sql>
|
||||
|
||||
<resultMap id="locations" type="xyz.wbsite.module.admin.ent.Locations">
|
||||
<result column="ID" jdbcType="BIGINT" property="id"/>
|
||||
<result column="SERVICE_ID" jdbcType="BIGINT" property="serviceId"/>
|
||||
<result column="LOCAL_TITLE" jdbcType="VARCHAR" property="localTitle"/>
|
||||
<result column="LOCAL_NOTE" jdbcType="VARCHAR" property="localNote"/>
|
||||
<result column="LOCAL_PATH" jdbcType="VARCHAR" property="localPath"/>
|
||||
<result column="LOCAL_VALID" jdbcType="BIT" property="localValid"/>
|
||||
<result column="FILTER" jdbcType="BIT" property="filter"/>
|
||||
<result column="FILTER_CONF" jdbcType="VARCHAR" property="filterConf"/>
|
||||
<result column="ROW_VERSION" jdbcType="BIGINT" property="rowVersion"/>
|
||||
<result column="IS_DELETED" jdbcType="BIT" property="isDeleted"/>
|
||||
<result column="CREATE_BY" jdbcType="BIGINT" property="createBy"/>
|
||||
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="LAST_UPDATE_BY" jdbcType="BIGINT" property="lastUpdateBy"/>
|
||||
<result column="LAST_UPDATE_TIME" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
#{request.id},
|
||||
#{request.serviceId,jdbcType=BIGINT},
|
||||
#{request.localTitle,jdbcType=VARCHAR},
|
||||
#{request.localNote,jdbcType=VARCHAR},
|
||||
#{request.localPath,jdbcType=VARCHAR},
|
||||
#{request.localValid,jdbcType=BIT},
|
||||
#{request.filter,jdbcType=BIT},
|
||||
#{request.filterConf,jdbcType=VARCHAR},
|
||||
0,
|
||||
0,
|
||||
#{token.userId,jdbcType=NUMERIC},
|
||||
datetime('now','localtime'),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item.id},
|
||||
#{item.serviceId,jdbcType=BIGINT},
|
||||
#{item.localTitle,jdbcType=VARCHAR},
|
||||
#{item.localNote,jdbcType=VARCHAR},
|
||||
#{item.localPath,jdbcType=VARCHAR},
|
||||
#{item.localValid,jdbcType=BIT},
|
||||
#{item.filter,jdbcType=BIT},
|
||||
#{item.filterConf,jdbcType=VARCHAR},
|
||||
0,
|
||||
0,
|
||||
#{token.userId,jdbcType=NUMERIC},
|
||||
datetime('now','localtime'),
|
||||
NULL,
|
||||
NULL
|
||||
</foreach >
|
||||
</insert>
|
||||
|
||||
<update id="delete">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET "IS_DELETED" = 1
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteBatch">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET "IS_DELETED" = 1
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" IN
|
||||
<foreach collection="list" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="update">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET
|
||||
SERVICE_ID = #{request.serviceId,jdbcType=BIGINT},
|
||||
LOCAL_TITLE = #{request.localTitle,jdbcType=VARCHAR},
|
||||
LOCAL_NOTE = #{request.localNote,jdbcType=VARCHAR},
|
||||
LOCAL_PATH = #{request.localPath,jdbcType=VARCHAR},
|
||||
LOCAL_VALID = #{request.localValid,jdbcType=BIT},
|
||||
FILTER = #{request.filter,jdbcType=BIT},
|
||||
FILTER_CONF = #{request.filterConf,jdbcType=VARCHAR},
|
||||
"ROW_VERSION" = "ROW_VERSION" + 1,
|
||||
"LAST_UPDATE_BY" = #{token.userId},
|
||||
"LAST_UPDATE_TIME" = datetime('now','localtime')
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" = #{request.id}
|
||||
AND "ROW_VERSION" = #{request.rowVersion}
|
||||
</update>
|
||||
|
||||
<select id="select" resultMap="locations">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
<if test="request.serviceId != null">
|
||||
AND "SERVICE_ID" = #{request.serviceId}
|
||||
</if>
|
||||
<if test="request.localTitle != null and request.localTitle != ''">
|
||||
AND "LOCAL_TITLE" = #{request.localTitle}
|
||||
</if>
|
||||
<if test="request.localPath != null and request.localPath != ''">
|
||||
AND "LOCAL_PATH" = #{request.localPath}
|
||||
</if>
|
||||
<if test="request.localValid != null">
|
||||
AND "LOCAL_VALID" = #{request.localValid}
|
||||
</if>
|
||||
<if test="request.filter != null">
|
||||
AND "FILTER" = #{request.filter}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="find" resultMap="locations">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
<if test="request.serviceId != null">
|
||||
AND "SERVICE_ID" = #{request.serviceId}
|
||||
</if>
|
||||
<if test="request.localTitle != null and request.localTitle != ''">
|
||||
AND "LOCAL_TITLE" = #{request.localTitle}
|
||||
</if>
|
||||
<if test="request.localTitleLike != null and request.localTitleLike != ''">
|
||||
AND "LOCAL_TITLE" LIKE '%'||#{request.localTitleLike}||'%'
|
||||
</if>
|
||||
<if test="request.localNoteLike != null and request.localNoteLike != ''">
|
||||
AND "LOCAL_NOTE" LIKE '%'||#{request.localNoteLike}||'%'
|
||||
</if>
|
||||
<if test="request.localPath != null and request.localPath != ''">
|
||||
AND "LOCAL_PATH" = #{request.localPath}
|
||||
</if>
|
||||
<if test="request.localPathLike != null and request.localPathLike != ''">
|
||||
AND "LOCAL_PATH" LIKE '%'||#{request.localPathLike}||'%'
|
||||
</if>
|
||||
<if test="request.localValid != null">
|
||||
AND "LOCAL_VALID" = #{request.localValid}
|
||||
</if>
|
||||
<if test="request.filter != null">
|
||||
AND "FILTER" = #{request.filter}
|
||||
</if>
|
||||
<if test="request.startDate != null">
|
||||
AND strftime('%s',"CREATE_TIME", 'utc')*1000 >= #{request.startDate}
|
||||
</if>
|
||||
<if test="request.endDate != null">
|
||||
AND strftime('%s',"CREATE_TIME", 'utc')*1000 <= #{request.endDate}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="search" resultMap="locations">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
</select>
|
||||
|
||||
<select id="getById" resultMap="locations">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getByIds" resultMap="locations">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" IN
|
||||
<foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,100 @@
|
||||
package xyz.wbsite.module.admin.mpr;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import xyz.wbsite.frame.base.Token;
|
||||
import xyz.wbsite.module.admin.ent.Services;
|
||||
import xyz.wbsite.module.admin.req.ServicesFindRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* SERVICES - 虚拟主机
|
||||
*
|
||||
* @author wangbing
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
@Mapper
|
||||
public interface ServicesMapper {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insert(@Param("request") Services request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 批量插入
|
||||
*
|
||||
* @param list 对象集合
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insertBatch(@Param("list") List<Services> list, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param id 主键
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long delete(@Param("id") Long id, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 批量逻辑删除
|
||||
*
|
||||
* @param list 主键集合
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long deleteBatch(@Param("list") List<Long> list, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long update(@Param("request") Services request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 普通查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
List<Services> select(@Param("request") Services request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 高级查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
List<Services> find(@Param("request") ServicesFindRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param id 主键
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
Services getById(@Param("id") Long id, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param ids 主键集合
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
List<Services> getByIds(@Param("ids") Long[] ids, @Param("token") Token token);
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package xyz.wbsite.module.admin.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseRequest;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import xyz.wbsite.frame.validation.Select;
|
||||
|
||||
/**
|
||||
* ConfigCreateRequest - 配置预设新增
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ConfigCreateRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 配置名称.
|
||||
*/
|
||||
@NotBlank(message = "[confName]配置名称不能为空")
|
||||
@Length(min = 0, max = 50, message = "[confName]配置名称长度不合法(0-50)")
|
||||
private String confName;
|
||||
|
||||
/**
|
||||
* 配置类型.
|
||||
* HTTP:全局配置
|
||||
* SERVER:主机配置
|
||||
* LOCATION:路径配置
|
||||
*/
|
||||
@NotNull(message = "[confType]配置类型不能为NULL")
|
||||
@Select({"HTTP", "SERVER", "LOCATION"})
|
||||
private String confType;
|
||||
|
||||
/**
|
||||
* 配置属值.
|
||||
*/
|
||||
@Length(min = 0, max = 255, message = "[confValue]配置属值长度不合法(0-255)")
|
||||
private String confValue;
|
||||
|
||||
/**
|
||||
* 配置备注.
|
||||
*/
|
||||
@Length(min = 0, max = 255, message = "[confNote]配置备注长度不合法(0-255)")
|
||||
private String confNote;
|
||||
|
||||
public String getConfName() {
|
||||
return this.confName;
|
||||
}
|
||||
|
||||
public void setConfName(String confName) {
|
||||
this.confName = confName;
|
||||
}
|
||||
|
||||
public String getConfType() {
|
||||
return this.confType;
|
||||
}
|
||||
|
||||
public void setConfType(String confType) {
|
||||
this.confType = confType;
|
||||
}
|
||||
|
||||
public String getConfValue() {
|
||||
return this.confValue;
|
||||
}
|
||||
|
||||
public void setConfValue(String confValue) {
|
||||
this.confValue = confValue;
|
||||
}
|
||||
|
||||
public String getConfNote() {
|
||||
return this.confNote;
|
||||
}
|
||||
|
||||
public void setConfNote(String confNote) {
|
||||
this.confNote = confNote;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package xyz.wbsite.module.admin.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseRequest;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
* ConfigDataDeleteRequest - 配置数据删除
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ConfigDataDeleteRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 主键.
|
||||
*/
|
||||
@NotNull(message = "[id]主键不能为空")
|
||||
private Long id;
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
package xyz.wbsite.module.admin.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseUpdateRequest;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import xyz.wbsite.frame.validation.Select;
|
||||
|
||||
/**
|
||||
* ConfigDataUpdateRequest - 配置数据更新
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ConfigDataUpdateRequest extends BaseUpdateRequest {
|
||||
|
||||
/**
|
||||
* 主键.
|
||||
*/
|
||||
@NotNull(message = "[id]主键不能为NULL")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 目标主键.
|
||||
*/
|
||||
@NotNull(message = "[targetId]目标主键不能为NULL")
|
||||
private Long targetId;
|
||||
|
||||
/**
|
||||
* 配置名称.
|
||||
*/
|
||||
@NotBlank(message = "[confName]配置名称不能为空")
|
||||
@Length(min = 0, max = 50, message = "[confName]配置名称长度不合法(0-50)")
|
||||
private String confName;
|
||||
|
||||
/**
|
||||
* 配置类型.
|
||||
* HTTP:全局配置
|
||||
* SERVER:主机配置
|
||||
* LOCATION:路径配置
|
||||
*/
|
||||
@NotNull(message = "[confType]配置类型不能为NULL")
|
||||
@Select({"HTTP", "SERVER", "LOCATION"})
|
||||
private String confType;
|
||||
|
||||
/**
|
||||
* 配置属值.
|
||||
*/
|
||||
@NotBlank(message = "[confValue]配置属值不能为空")
|
||||
@Length(min = 0, max = 255, message = "[confValue]配置属值长度不合法(0-255)")
|
||||
private String confValue;
|
||||
|
||||
/**
|
||||
* 配置备注.
|
||||
*/
|
||||
@Length(min = 0, max = 255, message = "[confNote]配置备注长度不合法(0-255)")
|
||||
private String confNote;
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getTargetId() {
|
||||
return this.targetId;
|
||||
}
|
||||
|
||||
public void setTargetId(Long targetId) {
|
||||
this.targetId = targetId;
|
||||
}
|
||||
|
||||
public String getConfName() {
|
||||
return this.confName;
|
||||
}
|
||||
|
||||
public void setConfName(String confName) {
|
||||
this.confName = confName;
|
||||
}
|
||||
|
||||
public String getConfType() {
|
||||
return this.confType;
|
||||
}
|
||||
|
||||
public void setConfType(String confType) {
|
||||
this.confType = confType;
|
||||
}
|
||||
|
||||
public String getConfValue() {
|
||||
return this.confValue;
|
||||
}
|
||||
|
||||
public void setConfValue(String confValue) {
|
||||
this.confValue = confValue;
|
||||
}
|
||||
|
||||
public String getConfNote() {
|
||||
return this.confNote;
|
||||
}
|
||||
|
||||
public void setConfNote(String confNote) {
|
||||
this.confNote = confNote;
|
||||
}
|
||||
}
|
@ -1,28 +1,30 @@
|
||||
package xyz.wbsite.module.conf.req;
|
||||
package xyz.wbsite.module.admin.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseRequest;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
* MappingGetRequest - 映射获取
|
||||
* ConfigDeleteRequest - 配置预设删除
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-03-18
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class MappingGetRequest extends BaseRequest {
|
||||
public class ConfigDeleteRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
* 主键.
|
||||
*/
|
||||
@NotNull(message = "[id]主键不能为空")
|
||||
private long id;
|
||||
private Long id;
|
||||
|
||||
public long getId() {
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
package xyz.wbsite.module.admin.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseRequest;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
/**
|
||||
* LocationsCreateRequest - 路径配置新增
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class LocationsCreateRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 服务主键.
|
||||
*/
|
||||
@NotNull(message = "[serviceId]服务主键不能为NULL")
|
||||
private Long serviceId;
|
||||
|
||||
/**
|
||||
* 配置标题.
|
||||
*/
|
||||
@NotBlank(message = "[localTitle]配置标题不能为空")
|
||||
@Length(min = 0, max = 50, message = "[localTitle]配置标题长度不合法(0-50)")
|
||||
private String localTitle;
|
||||
|
||||
/**
|
||||
* 配置备注.
|
||||
*/
|
||||
@Length(min = 0, max = 255, message = "[localNote]配置备注长度不合法(0-255)")
|
||||
private String localNote;
|
||||
|
||||
/**
|
||||
* 配置路径.
|
||||
*/
|
||||
@NotBlank(message = "[localPath]配置路径不能为空")
|
||||
@Length(min = 0, max = 50, message = "[localPath]配置路径长度不合法(0-50)")
|
||||
private String localPath;
|
||||
|
||||
/**
|
||||
* 是否启用.
|
||||
*/
|
||||
@NotNull(message = "[localValid]是否启用不能为NULL")
|
||||
private Boolean localValid;
|
||||
|
||||
/**
|
||||
* 启用过滤.
|
||||
*/
|
||||
@NotNull(message = "[filter]启用过滤不能为NULL")
|
||||
private Boolean filter;
|
||||
|
||||
/**
|
||||
* 过滤配置.
|
||||
*/
|
||||
@Length(min = 0, max = 500, message = "[filterConf]过滤配置长度不合法(0-500)")
|
||||
private String filterConf;
|
||||
|
||||
public Long getServiceId() {
|
||||
return this.serviceId;
|
||||
}
|
||||
|
||||
public void setServiceId(Long serviceId) {
|
||||
this.serviceId = serviceId;
|
||||
}
|
||||
|
||||
public String getLocalTitle() {
|
||||
return this.localTitle;
|
||||
}
|
||||
|
||||
public void setLocalTitle(String localTitle) {
|
||||
this.localTitle = localTitle;
|
||||
}
|
||||
|
||||
public String getLocalNote() {
|
||||
return this.localNote;
|
||||
}
|
||||
|
||||
public void setLocalNote(String localNote) {
|
||||
this.localNote = localNote;
|
||||
}
|
||||
|
||||
public String getLocalPath() {
|
||||
return this.localPath;
|
||||
}
|
||||
|
||||
public void setLocalPath(String localPath) {
|
||||
this.localPath = localPath;
|
||||
}
|
||||
|
||||
public Boolean getLocalValid() {
|
||||
return this.localValid;
|
||||
}
|
||||
|
||||
public void setLocalValid(Boolean localValid) {
|
||||
this.localValid = localValid;
|
||||
}
|
||||
|
||||
public Boolean getFilter() {
|
||||
return this.filter;
|
||||
}
|
||||
|
||||
public void setFilter(Boolean filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public String getFilterConf() {
|
||||
return this.filterConf;
|
||||
}
|
||||
|
||||
public void setFilterConf(String filterConf) {
|
||||
this.filterConf = filterConf;
|
||||
}
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
package xyz.wbsite.module.admin.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseUpdateRequest;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* LocationsUpdateRequest - 路径配置更新
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class LocationsUpdateRequest extends BaseUpdateRequest {
|
||||
|
||||
/**
|
||||
* 主键.
|
||||
*/
|
||||
@NotNull(message = "[id]主键不能为NULL")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 服务主键.
|
||||
*/
|
||||
@NotNull(message = "[serviceId]服务主键不能为NULL")
|
||||
private Long serviceId;
|
||||
|
||||
/**
|
||||
* 配置标题.
|
||||
*/
|
||||
@NotBlank(message = "[localTitle]配置标题不能为空")
|
||||
@Length(min = 0, max = 50, message = "[localTitle]配置标题长度不合法(0-50)")
|
||||
private String localTitle;
|
||||
|
||||
/**
|
||||
* 配置备注.
|
||||
*/
|
||||
@Length(min = 0, max = 255, message = "[localNote]配置备注长度不合法(0-255)")
|
||||
private String localNote;
|
||||
|
||||
/**
|
||||
* 配置路径.
|
||||
*/
|
||||
@NotBlank(message = "[localPath]配置路径不能为空")
|
||||
@Length(min = 0, max = 50, message = "[localPath]配置路径长度不合法(0-50)")
|
||||
private String localPath;
|
||||
|
||||
/**
|
||||
* 是否启用.
|
||||
*/
|
||||
@NotNull(message = "[localValid]是否启用不能为NULL")
|
||||
private Boolean localValid;
|
||||
|
||||
/**
|
||||
* 启用过滤.
|
||||
*/
|
||||
@NotNull(message = "[filter]启用过滤不能为NULL")
|
||||
private Boolean filter;
|
||||
|
||||
/**
|
||||
* 过滤配置.
|
||||
*/
|
||||
@Length(min = 0, max = 500, message = "[filterConf]过滤配置长度不合法(0-500)")
|
||||
private String filterConf;
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getServiceId() {
|
||||
return this.serviceId;
|
||||
}
|
||||
|
||||
public void setServiceId(Long serviceId) {
|
||||
this.serviceId = serviceId;
|
||||
}
|
||||
|
||||
public String getLocalTitle() {
|
||||
return this.localTitle;
|
||||
}
|
||||
|
||||
public void setLocalTitle(String localTitle) {
|
||||
this.localTitle = localTitle;
|
||||
}
|
||||
|
||||
public String getLocalNote() {
|
||||
return this.localNote;
|
||||
}
|
||||
|
||||
public void setLocalNote(String localNote) {
|
||||
this.localNote = localNote;
|
||||
}
|
||||
|
||||
public String getLocalPath() {
|
||||
return this.localPath;
|
||||
}
|
||||
|
||||
public void setLocalPath(String localPath) {
|
||||
this.localPath = localPath;
|
||||
}
|
||||
|
||||
public Boolean getLocalValid() {
|
||||
return this.localValid;
|
||||
}
|
||||
|
||||
public void setLocalValid(Boolean localValid) {
|
||||
this.localValid = localValid;
|
||||
}
|
||||
|
||||
public Boolean getFilter() {
|
||||
return this.filter;
|
||||
}
|
||||
|
||||
public void setFilter(Boolean filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public String getFilterConf() {
|
||||
return this.filterConf;
|
||||
}
|
||||
|
||||
public void setFilterConf(String filterConf) {
|
||||
this.filterConf = filterConf;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package xyz.wbsite.module.admin.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseRequest;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
* ServicesDeleteRequest - 虚拟主机删除
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ServicesDeleteRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 主键.
|
||||
*/
|
||||
@NotNull(message = "[id]主键不能为空")
|
||||
private Long id;
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
package xyz.wbsite.module.admin.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseFindRequest;
|
||||
import java.util.Date;
|
||||
import xyz.wbsite.frame.validation.Select;
|
||||
|
||||
/**
|
||||
* ServicesFindRequest - 虚拟主机查询
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ServicesFindRequest extends BaseFindRequest {
|
||||
|
||||
/**
|
||||
* 主机标题.
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 主机标题模糊查询.
|
||||
*/
|
||||
private String titleLike;
|
||||
|
||||
/**
|
||||
* 主机域名.
|
||||
*/
|
||||
private String domain;
|
||||
|
||||
/**
|
||||
* 服务类型.
|
||||
* 反向代理:反向代理
|
||||
* 负载均衡:负载均衡
|
||||
* 正向代理:正向代理
|
||||
* 文件代理:文件代理
|
||||
* 端口转发:端口转发
|
||||
*/
|
||||
@Select({"反向代理", "负载均衡", "正向代理", "文件代理", "端口转发"})
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 服务端口.
|
||||
*/
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* 是否启用.
|
||||
*/
|
||||
private Boolean valid;
|
||||
|
||||
/**
|
||||
* 启用过滤.
|
||||
*/
|
||||
private Boolean filter;
|
||||
|
||||
/**
|
||||
* 开始日期.
|
||||
*/
|
||||
private Date startDate;
|
||||
|
||||
/**
|
||||
* 结束日期.
|
||||
*/
|
||||
private Date endDate;
|
||||
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getTitleLike() {
|
||||
return this.titleLike;
|
||||
}
|
||||
|
||||
public void setTitleLike(String titleLike) {
|
||||
this.titleLike = titleLike;
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
return this.domain;
|
||||
}
|
||||
|
||||
public void setDomain(String domain) {
|
||||
this.domain = domain;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getPort() {
|
||||
return this.port;
|
||||
}
|
||||
|
||||
public void setPort(Integer port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public Boolean getValid() {
|
||||
return this.valid;
|
||||
}
|
||||
|
||||
public void setValid(Boolean valid) {
|
||||
this.valid = valid;
|
||||
}
|
||||
|
||||
public Boolean getFilter() {
|
||||
return this.filter;
|
||||
}
|
||||
|
||||
public void setFilter(Boolean filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
package xyz.wbsite.module.conf.rsp;
|
||||
package xyz.wbsite.module.admin.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* MappingCreateResponse - 映射
|
||||
* ConfigCreateResponse - 配置预设
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-03-18
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class MappingCreateResponse extends BaseResponse {
|
||||
public class ConfigCreateResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 主键
|
@ -0,0 +1,26 @@
|
||||
package xyz.wbsite.module.admin.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* ConfigDataCreateResponse - 配置数据
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ConfigDataCreateResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package xyz.wbsite.module.admin.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseFindResponse;
|
||||
import xyz.wbsite.module.admin.ent.ConfigData;
|
||||
|
||||
/**
|
||||
* ConfigDataFindResponse - 配置数据
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ConfigDataFindResponse extends BaseFindResponse<ConfigData> {
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package xyz.wbsite.module.admin.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* ConfigDataUpdateResponse - 配置数据
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ConfigDataUpdateResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 更新数目
|
||||
*/
|
||||
private Long result;
|
||||
|
||||
public Long getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public void setResult(Long result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package xyz.wbsite.module.admin.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* ConfigDeleteResponse - 配置预设
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ConfigDeleteResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 删除数目
|
||||
*/
|
||||
private Long result;
|
||||
|
||||
public Long getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public void setResult(Long result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package xyz.wbsite.module.admin.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseFindResponse;
|
||||
import xyz.wbsite.module.admin.ent.Config;
|
||||
|
||||
/**
|
||||
* ConfigFindResponse - 配置预设
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ConfigFindResponse extends BaseFindResponse<Config> {
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package xyz.wbsite.module.admin.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* ConfigUpdateResponse - 配置预设
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ConfigUpdateResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 更新数目
|
||||
*/
|
||||
private Long result;
|
||||
|
||||
public Long getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public void setResult(Long result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package xyz.wbsite.module.admin.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* LocationsDeleteResponse - 路径配置
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class LocationsDeleteResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 删除数目
|
||||
*/
|
||||
private Long result;
|
||||
|
||||
public Long getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public void setResult(Long result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package xyz.wbsite.module.admin.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseFindResponse;
|
||||
import xyz.wbsite.module.admin.ent.Locations;
|
||||
|
||||
/**
|
||||
* LocationsFindResponse - 路径配置
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class LocationsFindResponse extends BaseFindResponse<Locations> {
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package xyz.wbsite.module.admin.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* LocationsUpdateResponse - 路径配置
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class LocationsUpdateResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 更新数目
|
||||
*/
|
||||
private Long result;
|
||||
|
||||
public Long getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public void setResult(Long result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package xyz.wbsite.module.admin.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* ServicesUpdateResponse - 虚拟主机
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ServicesUpdateResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 更新数目
|
||||
*/
|
||||
private Long result;
|
||||
|
||||
public Long getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public void setResult(Long result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
package xyz.wbsite.module.conf.ent;
|
||||
|
||||
|
||||
import xyz.wbsite.frame.utils.ProcessUtil;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class NginxCtrl {
|
||||
|
||||
private String startCmd = "start nginx";
|
||||
private String stopCmd = "nginx.exe -s quit";
|
||||
private String reloadCmd = "nginx.exe -s reload";
|
||||
private String versionCmd = "nginx -v";
|
||||
private File config = null;
|
||||
|
||||
public void doStart() {
|
||||
ProcessUtil.exec(startCmd);
|
||||
}
|
||||
|
||||
public void doStop() {
|
||||
ProcessUtil.exec(stopCmd);
|
||||
}
|
||||
|
||||
public void doReload() {
|
||||
ProcessUtil.exec(reloadCmd);
|
||||
}
|
||||
|
||||
public String getStartCmd() {
|
||||
return startCmd;
|
||||
}
|
||||
|
||||
public void setStartCmd(String startCmd) {
|
||||
this.startCmd = startCmd;
|
||||
}
|
||||
|
||||
public String getStopCmd() {
|
||||
return stopCmd;
|
||||
}
|
||||
|
||||
public void setStopCmd(String stopCmd) {
|
||||
this.stopCmd = stopCmd;
|
||||
}
|
||||
|
||||
public String getReloadCmd() {
|
||||
return reloadCmd;
|
||||
}
|
||||
|
||||
public void setReloadCmd(String reloadCmd) {
|
||||
this.reloadCmd = reloadCmd;
|
||||
}
|
||||
|
||||
public String getVersionCmd() {
|
||||
return versionCmd;
|
||||
}
|
||||
|
||||
public void setVersionCmd(String versionCmd) {
|
||||
this.versionCmd = versionCmd;
|
||||
}
|
||||
|
||||
public File getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public void setConfig(File config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public boolean isRunning() {
|
||||
return ProcessUtil.findProcess("nginx.exe");
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
package xyz.wbsite.module.conf.mgr;
|
||||
|
||||
import xyz.wbsite.module.conf.req.MappingCreateRequest;
|
||||
import xyz.wbsite.module.conf.req.MappingDeleteRequest;
|
||||
import xyz.wbsite.module.conf.req.MappingFindRequest;
|
||||
import xyz.wbsite.module.conf.req.MappingGetRequest;
|
||||
import xyz.wbsite.module.conf.req.MappingUpdateRequest;
|
||||
import xyz.wbsite.module.conf.rsp.MappingCreateResponse;
|
||||
import xyz.wbsite.module.conf.rsp.MappingDeleteResponse;
|
||||
import xyz.wbsite.module.conf.rsp.MappingFindResponse;
|
||||
import xyz.wbsite.module.conf.rsp.MappingGetResponse;
|
||||
import xyz.wbsite.module.conf.rsp.MappingUpdateResponse;
|
||||
import xyz.wbsite.frame.auth.Token;
|
||||
|
||||
/**
|
||||
* 映射
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-03-18
|
||||
*/
|
||||
public interface MappingManager {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
MappingCreateResponse create(MappingCreateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
MappingDeleteResponse delete(MappingDeleteRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
MappingUpdateResponse update(MappingUpdateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
MappingFindResponse find(MappingFindRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
MappingGetResponse get(MappingGetRequest request, Token token);
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
package xyz.wbsite.module.conf.mpr;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import xyz.wbsite.module.conf.ent.Mapping;
|
||||
import xyz.wbsite.module.conf.req.MappingCreateRequest;
|
||||
import xyz.wbsite.module.conf.req.MappingDeleteRequest;
|
||||
import xyz.wbsite.module.conf.req.MappingFindRequest;
|
||||
import xyz.wbsite.module.conf.req.MappingGetRequest;
|
||||
import xyz.wbsite.module.conf.req.MappingUpdateRequest;
|
||||
import xyz.wbsite.frame.auth.Token;
|
||||
|
||||
/**
|
||||
* MAPPING - 映射
|
||||
*
|
||||
* @author wangbing
|
||||
* @date 2020-03-18
|
||||
*/
|
||||
@Mapper
|
||||
public interface MappingMapper {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insert(@Param("request") Mapping request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 批量插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insertBatch(@Param("list") List<Mapping> request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long delete(@Param("request") MappingDeleteRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long update(@Param("request") MappingUpdateRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
List<Mapping> find(@Param("request") MappingFindRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
Mapping get(@Param("request") MappingGetRequest request, @Param("token") Token token);
|
||||
}
|
@ -1,151 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="xyz.wbsite.module.conf.mpr.MappingMapper">
|
||||
|
||||
<sql id="table">"CONF_MAPPING"</sql>
|
||||
|
||||
<sql id="entityColumnList">
|
||||
"ID","NAME","PORT","PATH","TYPE","LOCATION","NOTE","ROW_VERSION","IS_DELETED","CREATE_BY","CREATE_TIME","LAST_UPDATE_BY","LAST_UPDATE_TIME"
|
||||
</sql>
|
||||
|
||||
<resultMap id="mapping" type="xyz.wbsite.module.conf.ent.Mapping">
|
||||
<result column="ID" jdbcType="BIGINT" property="id"/>
|
||||
<result column="NAME" jdbcType="VARCHAR" property="name"/>
|
||||
<result column="PORT" jdbcType="VARCHAR" property="port"/>
|
||||
<result column="PATH" jdbcType="VARCHAR" property="path"/>
|
||||
<result column="TYPE" jdbcType="VARCHAR" property="type"/>
|
||||
<result column="LOCATION" jdbcType="VARCHAR" property="location"/>
|
||||
<result column="NOTE" jdbcType="VARCHAR" property="note"/>
|
||||
<result column="ROW_VERSION" jdbcType="BIGINT" property="rowVersion"/>
|
||||
<result column="IS_DELETED" jdbcType="BIT" property="isDeleted"/>
|
||||
<result column="CREATE_BY" jdbcType="BIGINT" property="createBy"/>
|
||||
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="LAST_UPDATE_BY" jdbcType="BIGINT" property="lastUpdateBy"/>
|
||||
<result column="LAST_UPDATE_TIME" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="find" resultMap="mapping">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
"IS_DELETED" = 0
|
||||
<if test="request.name != null and request.name != ''">
|
||||
AND NAME = #{request.name}
|
||||
</if>
|
||||
<if test="request.port != null and request.port != ''">
|
||||
AND PORT = #{request.port}
|
||||
</if>
|
||||
<if test="request.path != null and request.path != ''">
|
||||
AND PATH = #{request.path}
|
||||
</if>
|
||||
<if test="request.type != null and request.type != ''">
|
||||
AND TYPE = #{request.type}
|
||||
</if>
|
||||
<if test="request.location != null and request.location != ''">
|
||||
AND LOCATION = #{request.location}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="search" resultMap="mapping">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
"IS_DELETED" = 0
|
||||
<if test="request.keyword != null and request.keyword != ''">
|
||||
1 = 2
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
#{request.id},
|
||||
#{request.name,jdbcType=VARCHAR},
|
||||
#{request.port,jdbcType=VARCHAR},
|
||||
#{request.path,jdbcType=VARCHAR},
|
||||
#{request.type,jdbcType=VARCHAR},
|
||||
#{request.location,jdbcType=VARCHAR},
|
||||
#{request.note,jdbcType=VARCHAR},
|
||||
0,
|
||||
0,
|
||||
#{token.userId,jdbcType=NUMERIC},
|
||||
datetime('now','localtime'),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item= "item" index ="index" separator=",">
|
||||
(
|
||||
#{item.id},
|
||||
#{item.name,jdbcType=VARCHAR},
|
||||
#{item.port,jdbcType=VARCHAR},
|
||||
#{item.path,jdbcType=VARCHAR},
|
||||
#{item.type,jdbcType=VARCHAR},
|
||||
#{item.location,jdbcType=VARCHAR},
|
||||
#{item.note,jdbcType=VARCHAR},
|
||||
0,
|
||||
0,
|
||||
#{token.userId,jdbcType=NUMERIC},
|
||||
datetime('now','localtime'),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</foreach >
|
||||
</insert>
|
||||
|
||||
<update id="delete">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET "IS_DELETED" = 1
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" = #{request.id}
|
||||
</update>
|
||||
|
||||
<update id="update">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET
|
||||
NAME = #{request.name,jdbcType=VARCHAR},
|
||||
PORT = #{request.port,jdbcType=VARCHAR},
|
||||
PATH = #{request.path,jdbcType=VARCHAR},
|
||||
TYPE = #{request.type,jdbcType=VARCHAR},
|
||||
LOCATION = #{request.location,jdbcType=VARCHAR},
|
||||
NOTE = #{request.note,jdbcType=VARCHAR},
|
||||
"ROW_VERSION" = "ROW_VERSION" + 1,
|
||||
"LAST_UPDATE_BY" = #{token.userId},
|
||||
"LAST_UPDATE_TIME" = datetime('now','localtime')
|
||||
WHERE
|
||||
"IS_DELETED" = 0
|
||||
AND "ID" = #{request.id}
|
||||
AND "ROW_VERSION" = #{request.rowVersion}
|
||||
</update>
|
||||
|
||||
<select id="get" resultMap="mapping">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
IS_DELETED = 0
|
||||
AND ID = #{request.id}
|
||||
</select>
|
||||
</mapper>
|
@ -1,105 +0,0 @@
|
||||
package xyz.wbsite.module.conf.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseRequest;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
/**
|
||||
* MappingCreateRequest - 映射新增
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-03-18
|
||||
*/
|
||||
public class MappingCreateRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@NotBlank(message = "[name]名称不能为空")
|
||||
@Length(min = 0, max = 50, message = "[name]名称长度不合法(0-50)")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 端口
|
||||
*/
|
||||
@NotBlank(message = "[port]端口不能为空")
|
||||
@Length(min = 0, max = 50, message = "[port]端口长度不合法(0-50)")
|
||||
private String port;
|
||||
|
||||
/**
|
||||
* 路径
|
||||
*/
|
||||
@NotBlank(message = "[path]路径不能为空")
|
||||
@Length(min = 0, max = 50, message = "[path]路径长度不合法(0-50)")
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@NotBlank(message = "[type]类型不能为空")
|
||||
@Length(min = 0, max = 50, message = "[type]类型长度不合法(0-50)")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 代理地址
|
||||
*/
|
||||
@NotBlank(message = "[location]代理地址不能为空")
|
||||
@Length(min = 0, max = 50, message = "[location]代理地址长度不合法(0-50)")
|
||||
private String location;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Length(min = 0, max = 50, message = "[note]备注长度不合法(0-50)")
|
||||
private String note;
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPort() {
|
||||
return this.port;
|
||||
}
|
||||
|
||||
public void setPort(String port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return this.path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return this.location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return this.note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package xyz.wbsite.module.conf.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseUpdateRequest;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* MappingDeleteRequest - 映射删除
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-03-18
|
||||
*/
|
||||
public class MappingDeleteRequest extends BaseUpdateRequest {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "[id]主键不能为空")
|
||||
private long id;
|
||||
|
||||
public long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
package xyz.wbsite.module.conf.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseFindRequest;
|
||||
|
||||
/**
|
||||
* MappingRequest - 映射查询
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-03-18
|
||||
*/
|
||||
public class MappingFindRequest extends BaseFindRequest {
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 端口
|
||||
*/
|
||||
private String port;
|
||||
|
||||
/**
|
||||
* 路径
|
||||
*/
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 代理地址
|
||||
*/
|
||||
private String location;
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPort() {
|
||||
return this.port;
|
||||
}
|
||||
|
||||
public void setPort(String port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return this.path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return this.location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
package xyz.wbsite.module.conf.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseUpdateRequest;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* MappingUpdateRequest - 映射更新
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-03-18
|
||||
*/
|
||||
public class MappingUpdateRequest extends BaseUpdateRequest {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "[id]主键不能为NULL")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@NotBlank(message = "[name]名称不能为空")
|
||||
@Length(min = 0, max = 50, message = "[name]名称长度不合法(0-50)")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 端口
|
||||
*/
|
||||
@NotBlank(message = "[port]端口不能为空")
|
||||
@Length(min = 0, max = 50, message = "[port]端口长度不合法(0-50)")
|
||||
private String port;
|
||||
|
||||
/**
|
||||
* 路径
|
||||
*/
|
||||
@NotBlank(message = "[path]路径不能为空")
|
||||
@Length(min = 0, max = 50, message = "[path]路径长度不合法(0-50)")
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@NotBlank(message = "[type]类型不能为空")
|
||||
@Length(min = 0, max = 50, message = "[type]类型长度不合法(0-50)")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 代理地址
|
||||
*/
|
||||
@NotBlank(message = "[location]代理地址不能为空")
|
||||
@Length(min = 0, max = 50, message = "[location]代理地址长度不合法(0-50)")
|
||||
private String location;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Length(min = 0, max = 50, message = "[note]备注长度不合法(0-50)")
|
||||
private String note;
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPort() {
|
||||
return this.port;
|
||||
}
|
||||
|
||||
public void setPort(String port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return this.path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return this.location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return this.note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package xyz.wbsite.module.conf.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseRequest;
|
||||
|
||||
public class NginxReloadRequest extends BaseRequest {
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package xyz.wbsite.module.conf.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseFindResponse;
|
||||
import xyz.wbsite.module.conf.ent.Mapping;
|
||||
|
||||
/**
|
||||
* MappingFindResponse - 映射
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-03-18
|
||||
*/
|
||||
public class MappingFindResponse extends BaseFindResponse<Mapping> {
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package xyz.wbsite.module.conf.rsp;
|
||||
|
||||
import xyz.wbsite.module.conf.ent.Mapping;
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* MappingGetResponse - 映射
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-03-18
|
||||
*/
|
||||
public class MappingGetResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 映射
|
||||
*/
|
||||
private Mapping mapping;
|
||||
|
||||
public Mapping getMapping() {
|
||||
return this.mapping;
|
||||
}
|
||||
|
||||
public void setMapping(Mapping mapping) {
|
||||
this.mapping = mapping;
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package xyz.wbsite.module.conf.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
public class NginxReloadResponse extends BaseResponse {
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package xyz.wbsite.module.conf.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
public class NginxStopResponse extends BaseResponse {
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue