Commit b1a82e7b by yubaogu

tett

parent 1bc03dab
...@@ -83,6 +83,8 @@ public class BasisInfo implements Serializable{ ...@@ -83,6 +83,8 @@ public class BasisInfo implements Serializable{
private String idJdbcType; private String idJdbcType;
private TableInfo tableInfo;
private List<PropertyInfo> cis; private List<PropertyInfo> cis;
private String isSwagger="true"; private String isSwagger="true";
......
...@@ -31,13 +31,17 @@ public class GeneratorFileUrl implements Serializable{ ...@@ -31,13 +31,17 @@ public class GeneratorFileUrl implements Serializable{
private String entityUrl; private String entityUrl;
private String daoUrl;
private String mapperUrl; private String mapperUrl;
private String mapperXml;
private String serviceUrl; private String serviceUrl;
private String serviceImplUrl; private String serviceImplUrl;
private String facadeUrl;
private String facadeImplUrl;
private String controllerUrl; private String controllerUrl;
} }
/**
* Copyright © 2019 dream horse Info. Tech Ltd. All rights reserved.
* @Package: com.gitee.mybatis.fl.entity
* @author: flying-cattle
* @date: 2019年4月9日 下午8:15:25
*/
package com.gitee.flying.cattle.mdg.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* Copyright: Copyright (c) 2019
*
* <p>说明: 获取到数据库的信息</P>
* @version: v3.0.0
* @author: flying-cattle
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------------*
* 2019年4月9日 flying-cattle v3.0.0 initialize
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TableInfo implements Serializable{
private static final long serialVersionUID = 123124L;
private String tableName;
private String tableComment;
}
...@@ -17,6 +17,9 @@ import java.util.Set; ...@@ -17,6 +17,9 @@ import java.util.Set;
import com.gitee.flying.cattle.mdg.entity.BasisInfo; import com.gitee.flying.cattle.mdg.entity.BasisInfo;
import com.gitee.flying.cattle.mdg.entity.PropertyInfo; import com.gitee.flying.cattle.mdg.entity.PropertyInfo;
import com.gitee.flying.cattle.mdg.entity.TableInfo;
import javafx.scene.control.TableColumnBase;
/** /**
* Copyright: Copyright (c) 2019 * Copyright: Copyright (c) 2019
* *
...@@ -31,15 +34,28 @@ import com.gitee.flying.cattle.mdg.entity.PropertyInfo; ...@@ -31,15 +34,28 @@ import com.gitee.flying.cattle.mdg.entity.PropertyInfo;
*/ */
public class EntityInfoUtil { public class EntityInfoUtil {
public static BasisInfo getInfo(BasisInfo bi) throws SQLException { public static BasisInfo getInfo(BasisInfo bi) throws SQLException {
TableInfo tableInfo = new TableInfo();
List<PropertyInfo> columns= new ArrayList<PropertyInfo>(); List<PropertyInfo> columns= new ArrayList<PropertyInfo>();
// 创建连接 // 创建连接
Connection con = null; Connection con = null;
PreparedStatement pstemt = null; PreparedStatement pstemt = null;
ResultSet rs = null; ResultSet rs = null;
//sql //sql
String tableSql="select table_name,table_comment from information_schema.tables where table_schema='"+bi.getDatabase()+"' and table_name='"+bi.getTable()+"'";
String sql="select column_name,data_type,column_comment from information_schema.columns where table_schema='"+bi.getDatabase()+"' and table_name='"+bi.getTable()+"'"; String sql="select column_name,data_type,column_comment from information_schema.columns where table_schema='"+bi.getDatabase()+"' and table_name='"+bi.getTable()+"'";
try { try {
con = DriverManager.getConnection(bi.getDbUrl(), bi.getDbName(), bi.getDbPassword()); con = DriverManager.getConnection(bi.getDbUrl(), bi.getDbName(), bi.getDbPassword());
pstemt = con.prepareStatement(tableSql);
rs = pstemt.executeQuery();
if(rs.next()) {
tableInfo.setTableName(rs.getString(1));
tableInfo.setTableComment(rs.getString(2));
bi.setTableInfo(tableInfo);
}else{
throw new RuntimeException("表不存在");
}
pstemt = con.prepareStatement(sql); pstemt = con.prepareStatement(sql);
rs = pstemt.executeQuery(); rs = pstemt.executeQuery();
while (rs.next()) { while (rs.next()) {
......
...@@ -26,11 +26,13 @@ import com.gitee.flying.cattle.mdg.entity.PropertyInfo; ...@@ -26,11 +26,13 @@ import com.gitee.flying.cattle.mdg.entity.PropertyInfo;
*/ */
public class Generator { public class Generator {
//路径信息 //路径信息
public static final String ENTITY="entity"; public static final String ENTITY="po";
public static final String DAO="dao"; public static final String MAPPER="mapper";
public static final String DAO_IMPL="daoImpl"; public static final String MAPPER_IMPL="mapperxml";
public static final String SERVICE="service"; public static final String SERVICE="service";
public static final String SERVICE_IMPL="serviceImpl"; public static final String SERVICE_IMPL="serviceImpl";
public static final String FACADE="facade";
public static final String FACADE_IMPL="facadeImpl";
public static final String CONTROLLER="controller"; public static final String CONTROLLER="controller";
public static final String SWAGGER_CONFIG="swaggerConfig"; public static final String SWAGGER_CONFIG="swaggerConfig";
...@@ -42,13 +44,13 @@ public class Generator { ...@@ -42,13 +44,13 @@ public class Generator {
//②创建DAO //②创建DAO
public static ResultJson createDao(String url,BasisInfo bi) { public static ResultJson createDao(String url,BasisInfo bi) {
String fileUrl= getGeneratorFileUrl(url, bi.getDaoUrl(), bi.getEntityName(), DAO); String fileUrl= getGeneratorFileUrl(url, bi.getDaoUrl(), bi.getEntityName(), MAPPER);
return FreemarkerUtil.createFile(bi, "dao.ftl", fileUrl); return FreemarkerUtil.createFile(bi, "dao.ftl", fileUrl);
} }
//③创建mapper配置文件 //③创建mapper配置文件
public static ResultJson createDaoImpl(String url,BasisInfo bi) { public static ResultJson createDaoImpl(String url,BasisInfo bi) {
String fileUrl= getGeneratorFileUrl(url, bi.getMapperUrl(), bi.getEntityName(), DAO_IMPL); String fileUrl= getGeneratorFileUrl(url, bi.getMapperUrl(), bi.getEntityName(), MAPPER_IMPL);
List<PropertyInfo> list=bi.getCis(); List<PropertyInfo> list=bi.getCis();
String agile=""; String agile="";
for (PropertyInfo propertyInfo : list) { for (PropertyInfo propertyInfo : list) {
...@@ -65,6 +67,16 @@ public class Generator { ...@@ -65,6 +67,16 @@ public class Generator {
return FreemarkerUtil.createFile(bi, "service.ftl", fileUrl); return FreemarkerUtil.createFile(bi, "service.ftl", fileUrl);
} }
public static ResultJson createFacade(String url,BasisInfo bi) {
String fileUrl= getGeneratorFileUrl(url, bi.getFacadeUrl(), bi.getEntityName(), FACADE);
return FreemarkerUtil.createFile(bi, "facade.ftl", fileUrl);
}
public static ResultJson createFacadeImpl(String url,BasisInfo bi) {
String fileUrl= getGeneratorFileUrl(url, bi.getFacadeImplUrl(), bi.getEntityName(), FACADE_IMPL);
return FreemarkerUtil.createFile(bi, "facadeImpl.ftl", fileUrl);
}
//⑤创建SERVICE_IMPL //⑤创建SERVICE_IMPL
public static ResultJson createServiceImpl(String url,BasisInfo bi) { public static ResultJson createServiceImpl(String url,BasisInfo bi) {
String fileUrl= getGeneratorFileUrl(url, bi.getServiceImplUrl(), bi.getEntityName(), SERVICE_IMPL); String fileUrl= getGeneratorFileUrl(url, bi.getServiceImplUrl(), bi.getEntityName(), SERVICE_IMPL);
...@@ -73,7 +85,7 @@ public class Generator { ...@@ -73,7 +85,7 @@ public class Generator {
//⑥创建CONTROLLER //⑥创建CONTROLLER
public static ResultJson createController(String url,BasisInfo bi) { public static ResultJson createController(String url,BasisInfo bi) {
createAbstractController( url, bi); //保证父类一直存在 //createAbstractController( url, bi); //保证父类一直存在
String fileUrl= getGeneratorFileUrl(url, bi.getControllerUrl(), bi.getEntityName(), CONTROLLER); String fileUrl= getGeneratorFileUrl(url, bi.getControllerUrl(), bi.getEntityName(), CONTROLLER);
return FreemarkerUtil.createFile(bi, "controller.ftl", fileUrl); return FreemarkerUtil.createFile(bi, "controller.ftl", fileUrl);
} }
...@@ -91,16 +103,20 @@ public class Generator { ...@@ -91,16 +103,20 @@ public class Generator {
} }
//生成文件路径和名字 //生成文件路径和名字
public static String getGeneratorFileUrl(String url,String packageUrl,String entityName, String type){ public static String getGeneratorFileUrl(String url,String packageUrl,String entityName, String type){
if (type.equals("entity")) { if (type.equals("po")) {
return url+pageToUrl(packageUrl)+entityName+".java"; return url+pageToUrl(packageUrl)+entityName+".java";
}else if(type.equals("dao")) { }else if(type.equals("mapper")) {
return url+pageToUrl(packageUrl)+entityName+"Dao.java"; return url+pageToUrl(packageUrl)+entityName+"Mapper.java";
}else if(type.equals("daoImpl")) { }else if(type.equals("mapperxml")) {
return url+pageToUrl(packageUrl)+entityName+"Mapper.xml"; return url+pageToUrl(packageUrl)+entityName+"Mapper.xml";
}else if(type.equals("service")) { }else if(type.equals("service")) {
return url+pageToUrl(packageUrl)+entityName+"Service.java"; return url+pageToUrl(packageUrl)+entityName+"Service.java";
}else if(type.equals("serviceImpl")) { }else if(type.equals("serviceImpl")) {
return url+pageToUrl(packageUrl)+entityName+"ServiceImpl.java"; return url+pageToUrl(packageUrl)+entityName+"ServiceImpl.java";
}else if(type.equals("facade")) {
return url+pageToUrl(packageUrl)+entityName+"Facade.java";
}else if(type.equals("facadeImpl")) {
return url+pageToUrl(packageUrl)+entityName+"FacadeImpl.java";
}else if(type.equals("controller")) { }else if(type.equals("controller")) {
return url+pageToUrl(packageUrl)+entityName+"Controller.java"; return url+pageToUrl(packageUrl)+entityName+"Controller.java";
}else if(type.equals("swaggerConfig")){ }else if(type.equals("swaggerConfig")){
......
/**
* @filename:${entityName}Controller ${createTime}
* @project ${project} ${version}
* Copyright(c) 2020 ${author} Co. Ltd.
* All right reserved.
*/
package ${abstractControllerUrl};
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import com.gitee.flying.cattle.mdg.aid.JsonResult;
import com.gitee.flying.cattle.mdg.aid.PageParam;
<#if isSwagger=="true" >
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
</#if>
/**
* @Description:TODO(${entityComment}API接口层)
*
* @version: ${version}
* @author: ${author}
* @time ${createTime}
*/
public class AbstractController<S extends IService<T>,T>{
@Autowired
protected S baseService;
protected JsonResult<T> result = new JsonResult<T>();
/**
* @explain 查询对象 <swagger GET请求>
* @param 对象参数:id
* @return JsonResult
* @author ${author}
* @time ${createTime}
*/
@GetMapping("/getById/{id}")
<#if isSwagger=="true" >
@ApiOperation(value = "获取对象", notes = "作者:${author}")
@ApiImplicitParam(paramType="path", name = "id", value = "对象id", required = true, dataType = "Long")
</#if>
public JsonResult<T> getById(@PathVariable("id")Long id){
T obj=baseService.getById(id);
if (null!=obj ) {
result.success(obj);
}else {
result.error("查询对象不存在!");
}
return result;
}
/**
* @explain 删除对象
* @param 对象参数:id
* @return JsonResult
* @author ${author}
* @time ${createTime}
*/
@PostMapping("/deleteById")
<#if isSwagger=="true" >
@ApiOperation(value = "删除", notes = "作者:${author}")
@ApiImplicitParam(paramType="query", name = "id", value = "对象id", required = true, dataType = "Long")
</#if>
public JsonResult<T> deleteById(Long id){
JsonResult<T> result=new JsonResult<T>();
T obj=baseService.getById(id);
if (null!=obj) {
boolean rsg = baseService.removeById(id);
if (rsg) {
result.success("删除成功");
}else {
result.error("删除失败!");
}
}else {
result.error("删除的对象不存在!");
}
return result;
}
/**
* @explain 添加
* @param 对象参数:T
* @return Boolean
* @author ${author}
* @time ${createTime}
*/
@PostMapping("/insert")
<#if isSwagger=="true" >
@ApiOperation(value = "添加", notes = "作者:${author}")
</#if>
public JsonResult<T> insert(T entity){
JsonResult<T> result=new JsonResult<T>();
if (null!=entity) {
boolean rsg = baseService.save(entity);
if (rsg) {
result.success("添加成功");
}else {
result.error("添加失败!");
}
}else {
result.error("请传入正确参数!");
}
return result;
}
/**
* @explain 修改
* @param 对象参数:T
* @return Boolean
* @author ${author}
* @time ${createTime}
*/
@PostMapping("/update")
<#if isSwagger=="true" >
@ApiOperation(value = "修改", notes = "作者:${author}")
</#if>
public JsonResult<T> update(T entity){
JsonResult<T> result=new JsonResult<T>();
if (null!=entity) {
boolean rsg = baseService.updateById(entity);
if (rsg) {
result.success("修改成功");
}else {
result.error("修改失败!");
}
}else {
result.error("请传入正确参数!");
}
return result;
}
/**
* @explain 分页条件查询用户
* @param 对象参数:AppPage<${entityName}>
* @return PageInfo<${entityName}>
* @author ${author}
* @time ${createTime}
*/
@GetMapping("/getPages")
<#if isSwagger=="true" >
@ApiOperation(value = "分页查询", notes = "分页查询返回[IPage<T>],作者:${author}")
</#if>
public JsonResult<IPage<T>> getPages(PageParam<T> param){
JsonResult<IPage<T>> returnPage=new JsonResult<IPage<T>>();
Page<T> page=new Page<T>(param.getPageNum(),param.getPageSize());
QueryWrapper<T> queryWrapper =new QueryWrapper<T>();
queryWrapper.setEntity(param.getParam());
//分页数据
IPage<T> pageData=baseService.page(page, queryWrapper);
returnPage.success(pageData);
return returnPage;
}
}
...@@ -6,11 +6,12 @@ ...@@ -6,11 +6,12 @@
*/ */
package ${controllerUrl}; package ${controllerUrl};
import ${abstractControllerUrl}.AbstractController;
import ${entityUrl}.${entityName}; import ${entityUrl}.${entityName};
import ${serviceUrl}.${entityName}Service; import ${facadeUrl}.${entityName}Facade;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.IPage;
<#if isSwagger=="true" > <#if isSwagger=="true" >
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
</#if> </#if>
...@@ -24,10 +25,91 @@ import io.swagger.annotations.Api; ...@@ -24,10 +25,91 @@ import io.swagger.annotations.Api;
* *
*/ */
<#if isSwagger=="true" > <#if isSwagger=="true" >
@Api(description = "${entityComment}",value="${entityComment}" ) @Api(description = "${tableInfo.tableName}",value="${tableInfo.tableName}" )
</#if> </#if>
@RestController @RestController
@RequestMapping("/${objectName}") @RequestMapping("/${objectName}")
public class ${entityName}Controller extends AbstractController<${entityName}Service,${entityName}>{ public class ${entityName}Controller extends AbstractController<${entityName}Service,${entityName}>{
@Reference
protected ${entityName}Facade baseFacade;
/**
* @explain 查询对象 <swagger GET请求>
* @param 对象参数:id
* @return BaseDtoResponse
* @author ${author}
* @time ${createTime}
*/
@GetMapping("/getById/{id}")
<#if isSwagger=="true" >
@ApiOperation(value = "获取对象", notes = "作者:${author}")
@ApiImplicitParam(paramType="path", name = "id", value = "对象id", required = true, dataType = "Long")
</#if>
public BaseDtoResponse<${entityName}> getById(@PathVariable("id")Long id){
return null;
}
/**
* @explain 删除对象
* @param 对象参数:id
* @return BaseDtoResponse
* @author ${author}
* @time ${createTime}
*/
@PostMapping("/deleteById")
<#if isSwagger=="true" >
@ApiOperation(value = "删除", notes = "作者:${author}")
@ApiImplicitParam(paramType="query", name = "id", value = "对象id", required = true, dataType = "Long")
</#if>
public BaseDtoResponse<Boolean> deleteById(Long id){
return null;
}
/**
* @explain 添加
* @param 对象参数:${entityName}
* @return Boolean
* @author ${author}
* @time ${createTime}
*/
@PostMapping("/insert")
<#if isSwagger=="true" >
@ApiOperation(value = "添加", notes = "作者:${author}")
</#if>
public BaseDtoResponse<${entityName}> insert(${entityName} entity){
return null;
}
/**
* @explain 修改
* @param 对象参数:${entityName}
* @return Boolean
* @author ${author}
* @time ${createTime}
*/
@PostMapping("/update")
<#if isSwagger=="true" >
@ApiOperation(value = "修改", notes = "作者:${author}")
</#if>
public BaseDtoResponse<Boolean> update(${entityName} entity){
return null;
}
/**
* @explain 分页条件查询用户
* @param 对象参数:PageableDto<${entityName}>
* @return PageInfo<${entityName}>
* @author ${author}
* @time ${createTime}
*/
@GetMapping("/getPages")
<#if isSwagger=="true" >
@ApiOperation(value = "分页查询", notes = "分页查询返回[IPage<T>],作者:${author}")
</#if>
public BaseDtoResponse<PageInfo<${entityName}>> getPages(IPage param){
return null;
}
} }
\ No newline at end of file
...@@ -50,7 +50,8 @@ public class ${entityName} implements Serializable{ ...@@ -50,7 +50,8 @@ public class ${entityName} implements Serializable{
</#if> </#if>
</#if> </#if>
<#if ci.property=="id"> <#if ci.property=="id">
@TableId(value = "id", type = IdType.AUTO) @Id
@GeneratedValue(generator = "JDBC")
</#if> </#if>
<#if isSwagger=="true" > <#if isSwagger=="true" >
@ApiModelProperty(name = "${ci.property}" , value = "${ci.comment}") @ApiModelProperty(name = "${ci.property}" , value = "${ci.comment}")
......
...@@ -10,6 +10,8 @@ import ${entityUrl}.${entityName}; ...@@ -10,6 +10,8 @@ import ${entityUrl}.${entityName};
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import com.ydl.common.dto.BaseDtoResponse; import com.ydl.common.dto.BaseDtoResponse;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.IPage;
/** /**
* @Description:TODO(${entityComment}服务层) * @Description:TODO(${entityComment}服务层)
...@@ -19,4 +21,18 @@ import com.ydl.common.dto.BaseDtoResponse; ...@@ -19,4 +21,18 @@ import com.ydl.common.dto.BaseDtoResponse;
*/ */
public interface ${entityName}Facade { public interface ${entityName}Facade {
public BaseDtoResponse<${entityName}> getById(Long id);
public BaseDtoResponse<Boolean> deleteById(Long id);
public BaseDtoResponse<${entityName}> insert(${entityName} entity);
public BaseDtoResponse<Boolean> update(${entityName} entity);
public BaseDtoResponse<PageInfo<${entityName}>> getPages(IPage param);
} }
\ No newline at end of file
...@@ -11,6 +11,8 @@ import ${facadeUrl}.${entityName}Facade; ...@@ -11,6 +11,8 @@ import ${facadeUrl}.${entityName}Facade;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.alibaba.dubbo.config.annotation.Service; import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.IPage;
/** /**
* @Description:TODO(${entityComment}服务实现) * @Description:TODO(${entityComment}服务实现)
* *
...@@ -21,4 +23,28 @@ import com.github.pagehelper.PageHelper; ...@@ -21,4 +23,28 @@ import com.github.pagehelper.PageHelper;
@Service(version = "1.0.0", interfaceClass = ${entityName}Facade.class) @Service(version = "1.0.0", interfaceClass = ${entityName}Facade.class)
public class ${entityName}FacadeImpl implements ${entityName}Facade { public class ${entityName}FacadeImpl implements ${entityName}Facade {
@Override
public BaseDtoResponse<${entityName}> getById(Long id) {
return null;
}
@Override
public BaseDtoResponse<Boolean> deleteById(Long id) {
return null;
}
@Override
public BaseDtoResponse<Doctor> insert(${entityName} entity) {
return null;
}
@Override
public BaseDtoResponse<Boolean> update(${entityName} entity) {
return null;
}
@Override
public BaseDtoResponse<PageInfo<${entityName}>> getPages(IPage param) {
return null;
}
} }
\ No newline at end of file
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
package ${serviceImplUrl}; package ${serviceImplUrl};
import ${entityUrl}.${entityName}; import ${entityUrl}.${entityName};
import ${daoUrl}.${entityName}Dao; import ${daoUrl}.${entityName}Mapper;
import ${serviceUrl}.${entityName}Service; import ${serviceUrl}.${entityName}Service;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ydl.common.service.impl.BaseService; import com.ydl.common.service.impl.BaseService;
......
...@@ -50,10 +50,10 @@ public class MyGenerator implements Serializable { ...@@ -50,10 +50,10 @@ public class MyGenerator implements Serializable {
public static final String SERVICE_URL = "com.ydl.demo.service"; public static final String SERVICE_URL = "com.ydl.demo.service";
public static final String SERVICE_IMPL_URL = "com.ydl.demo.service.impl"; public static final String SERVICE_IMPL_URL = "com.ydl.demo.service.impl";
public static final String FACADE_URL = "com.ydl.demo.facade"; public static final String FACADE_URL = "com.ydl.demo.facade";
public static final String FACADE_URL_IMPL = "com.ydl.demo.facade"; public static final String FACADE_URL_IMPL = "com.ydl.demo.facade.impl";
public static final String CONTROLLER_URL = "com.ydl.demo.api"; public static final String CONTROLLER_URL = "com.ydl.demo.api";
//是否是Swagger配置 //是否是Swagger配置
public static final String IS_SWAGGER = "true"; public static final String IS_SWAGGER = "false";
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
System.out.println(MyGenerator.class.getResource("").getPath()); System.out.println(MyGenerator.class.getResource("").getPath());
...@@ -66,26 +66,30 @@ public class MyGenerator implements Serializable { ...@@ -66,26 +66,30 @@ public class MyGenerator implements Serializable {
bi.setEntityComment(CLASSCOMMENT); bi.setEntityComment(CLASSCOMMENT);
try { try {
bi = EntityInfoUtil.getInfo(bi); bi = EntityInfoUtil.getInfo(bi);
String fileUrl = "D:\\ydlwork\\ydl-demo\\ydl-demo-api\\src\\main\\java\\";// 生成文件存放位置 String fileUrl = "D:\\ydlwork\\generator\\demo\\src\\main\\java\\";// 生成文件存放位置
//开始生成文件 //开始生成文件
// String aa1 = Generator.createEntity(fileUrl, bi).toString(); String aa1 = Generator.createEntity(fileUrl, bi).toString();
// String aa2 = Generator.createDao(fileUrl, bi).toString(); String aa2 = Generator.createDao(fileUrl, bi).toString();
// String aa3 = Generator.createDaoImpl(fileUrl, bi).toString(); String aa3 = Generator.createDaoImpl(fileUrl, bi).toString();
String aa4 = Generator.createService(fileUrl, bi).toString(); String aa4 = Generator.createService(fileUrl, bi).toString();
String aa5 = Generator.createServiceImpl(fileUrl, bi).toString(); String aa5 = Generator.createServiceImpl(fileUrl, bi).toString();
String aa6 = Generator.createController(fileUrl, bi).toString(); String aa6 = Generator.createController(fileUrl, bi).toString();
// 是否创建swagger配置文件 // 是否创建swagger配置文件
// String aa7 = Generator.createSwaggerConfig(fileUrl, bi).toString(); //String aa7 = Generator.createSwaggerConfig(fileUrl, bi).toString();
// System.out.println(aa1); String aa9 = Generator.createFacade(fileUrl, bi).toString();
// System.out.println(aa2); String aa10 = Generator.createFacadeImpl(fileUrl, bi).toString();
// System.out.println(aa3);
System.out.println(aa1);
System.out.println(aa2);
System.out.println(aa3);
System.out.println(aa4); System.out.println(aa4);
System.out.println(aa5); System.out.println(aa5);
System.out.println(aa6); System.out.println(aa6);
// System.out.println(aa7);
//System.out.println(aa7); //System.out.println(aa7);
System.out.println(aa9);
System.out.println(aa10);
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment