package org.yeshi.utils.generater.vo.admin.controller;
|
|
import org.yeshi.utils.StringUtil;
|
import org.yeshi.utils.generater.entity.ClassInfo;
|
import org.yeshi.utils.generater.entity.admin.AdminGeneraterInfo;
|
import org.yeshi.utils.generater.util.EntityUtil;
|
|
/**
|
* @author Administrator
|
* @title: FormAddInfo
|
* @description: 构建新增的实体类
|
* @date 2021/9/26 10:07
|
*/
|
public class AdminControllerInfoVO {
|
|
private String packageName;
|
private String mapping;
|
private ClassInfo entity;
|
private ClassInfo service;
|
private ClassInfo query;
|
private boolean jsonp;
|
//主键类型
|
private String identifyIdType;
|
|
|
public static class Builder {
|
private AdminGeneraterInfo generaterInfo;
|
//包名
|
private String packageName;
|
//后台查询DTO
|
private ClassInfo query;
|
//
|
private ClassInfo service;
|
|
|
public Builder setAdminInfo(AdminGeneraterInfo generaterInfo) {
|
this.generaterInfo = generaterInfo;
|
return this;
|
}
|
|
public Builder setPackageName(String packageName) {
|
this.packageName = packageName;
|
return this;
|
}
|
|
public Builder setQueryVO(ClassInfo query) {
|
this.query = query;
|
return this;
|
}
|
|
public Builder setService(ClassInfo service) {
|
this.service = service;
|
return this;
|
}
|
|
public AdminControllerInfoVO build() throws Exception {
|
if (generaterInfo == null) {
|
throw new Exception("generaterInfo不能为空");
|
}
|
if (StringUtil.isNullOrEmpty(packageName)) {
|
throw new Exception("包名不能为空");
|
}
|
if (query == null) {
|
throw new Exception("查询条件不能为空");
|
}
|
if (service == null) {
|
throw new Exception("服务不能为空");
|
}
|
|
AdminControllerInfoVO vo = new AdminControllerInfoVO();
|
vo.setMapping(generaterInfo.getControllerData().mapping());
|
vo.setEntity(new ClassInfo(generaterInfo.getEntity().getSimpleName(), generaterInfo.getEntity().getName()));
|
vo.setJsonp(generaterInfo.getControllerData().jsonp());
|
vo.setPackageName(packageName);
|
vo.setQueryVO(query);
|
vo.setService(service);
|
vo.setIdentifyIdType(EntityUtil.getIdentifyId(generaterInfo.getEntity()).getType().getSimpleName());
|
return vo;
|
}
|
|
|
}
|
|
public String getPackageName() {
|
return packageName;
|
}
|
|
public void setPackageName(String packageName) {
|
this.packageName = packageName;
|
}
|
|
public String getMapping() {
|
return mapping;
|
}
|
|
public void setMapping(String mapping) {
|
this.mapping = mapping;
|
}
|
|
public ClassInfo getEntity() {
|
return entity;
|
}
|
|
public void setEntity(ClassInfo entity) {
|
this.entity = entity;
|
}
|
|
public ClassInfo getService() {
|
return service;
|
}
|
|
public void setService(ClassInfo service) {
|
this.service = service;
|
}
|
|
public ClassInfo getQuery() {
|
return query;
|
}
|
|
public void setQueryVO(ClassInfo query) {
|
this.query = query;
|
}
|
|
public void setQuery(ClassInfo query) {
|
this.query = query;
|
}
|
|
public boolean isJsonp() {
|
return jsonp;
|
}
|
|
public void setJsonp(boolean jsonp) {
|
this.jsonp = jsonp;
|
}
|
|
public String getIdentifyIdType() {
|
return identifyIdType;
|
}
|
|
public void setIdentifyIdType(String identifyIdType) {
|
this.identifyIdType = identifyIdType;
|
}
|
}
|