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 ClassInfo adminVO;
|
private boolean jsonp;
|
|
private boolean responseBody;
|
//主键类型
|
private String identifyIdType;
|
|
//名称
|
private String controllerName;
|
|
private boolean add;
|
private boolean update;
|
private boolean delete;
|
|
|
public static class Builder {
|
private AdminGeneraterInfo generaterInfo;
|
//包名
|
private String packageName;
|
//后台查询DTO
|
private ClassInfo query;
|
//
|
private ClassInfo service;
|
|
private boolean responseBody;
|
|
private ClassInfo adminVO;
|
|
|
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 Builder setAdminVO(ClassInfo adminVO) {
|
this.adminVO = adminVO;
|
return this;
|
}
|
|
public Builder setResponseBody(boolean responseBody) {
|
this.responseBody = responseBody;
|
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().getMapping());
|
vo.setEntity(new ClassInfo(generaterInfo.getEntity().getSimpleName(), generaterInfo.getEntity().getName()));
|
vo.setJsonp(generaterInfo.getControllerData().isJsonp());
|
vo.setPackageName(packageName);
|
vo.setQueryVO(query);
|
vo.setService(service);
|
vo.setAdminVO(adminVO);
|
vo.setAdd(generaterInfo.getAddFormRows() != null && generaterInfo.getAddFormRows().size() > 0);
|
vo.setUpdate(generaterInfo.getUpdateFormRows() != null && generaterInfo.getUpdateFormRows().size() > 0);
|
vo.setDelete(true);
|
vo.setResponseBody(generaterInfo.getControllerData().isResponseBody());
|
|
vo.setIdentifyIdType(EntityUtil.getIdentifyId(generaterInfo.getEntity()).getType().getSimpleName());
|
vo.setControllerName(vo.getEntity().getName() + "AdminController");
|
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;
|
}
|
|
public String getControllerName() {
|
return controllerName;
|
}
|
|
public void setControllerName(String controllerName) {
|
this.controllerName = controllerName;
|
}
|
|
public boolean isAdd() {
|
return add;
|
}
|
|
public void setAdd(boolean add) {
|
this.add = add;
|
}
|
|
public boolean isUpdate() {
|
return update;
|
}
|
|
public void setUpdate(boolean update) {
|
this.update = update;
|
}
|
|
public boolean isDelete() {
|
return delete;
|
}
|
|
public void setDelete(boolean delete) {
|
this.delete = delete;
|
}
|
|
public boolean isResponseBody() {
|
return responseBody;
|
}
|
|
public void setResponseBody(boolean responseBody) {
|
this.responseBody = responseBody;
|
}
|
|
public ClassInfo getAdminVO() {
|
return adminVO;
|
}
|
|
public void setAdminVO(ClassInfo adminVO) {
|
this.adminVO = adminVO;
|
}
|
}
|