Commit c87be97d by yubaogu

tett

parent b1a82e7b
......@@ -10,6 +10,7 @@ import ${entityUrl}.${entityName};
import ${facadeUrl}.${entityName}Facade;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.dubbo.config.annotation.Reference;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.IPage;
<#if isSwagger=="true" >
......@@ -25,18 +26,18 @@ import io.swagger.annotations.Api;
*
*/
<#if isSwagger=="true" >
@Api(description = "${tableInfo.tableName}",value="${tableInfo.tableName}" )
@Api(description = "${tableInfo.tableComment}控制器",value="${tableInfo.tableName}" )
</#if>
@RestController
@RequestMapping("/${objectName}")
public class ${entityName}Controller extends AbstractController<${entityName}Service,${entityName}>{
public class ${entityName}Controller{
@Reference
protected ${entityName}Facade baseFacade;
@Reference
protected ${entityName}Facade baseFacade;
/**
* @explain 查询对象 <swagger GET请求>
* @param 对象参数:id
/**
* @explain 查询对象 <swagger GET请求>
* @param 对象参数 id
* @return BaseDtoResponse
* @author ${author}
* @time ${createTime}
......@@ -53,7 +54,7 @@ protected ${entityName}Facade baseFacade;
/**
* @explain 删除对象
* @param 对象参数:id
* @param 对象参数 id
* @return BaseDtoResponse
* @author ${author}
* @time ${createTime}
......@@ -99,7 +100,7 @@ protected ${entityName}Facade baseFacade;
/**
* @explain 分页条件查询用户
* @param 对象参数:PageableDto<${entityName}>
* @param 对象参数 IPage<${entityName}>
* @return PageInfo<${entityName}>
* @author ${author}
* @time ${createTime}
......
......@@ -16,6 +16,8 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
<#list pkgs as ps>
<#if ps??>
import ${ps};
......@@ -34,7 +36,7 @@ import ${ps};
@Accessors(chain = true)
public class ${entityName} implements Serializable{
private static final long serialVersionUID = ${agile}L;
private static final long serialVersionUID = -1L;
<#list cis as ci>
<#if ci.javaType=="Date">
......@@ -60,9 +62,5 @@ public class ${entityName} implements Serializable{
</#list>
@Override
protected Serializable pkVal() {
return this.id;
}
}
\ No newline at end of file
......@@ -21,18 +21,18 @@ import com.github.pagehelper.IPage;
*/
public interface ${entityName}Facade {
public BaseDtoResponse<${entityName}> getById(Long id);
BaseDtoResponse<${entityName}> getById(Long id);
public BaseDtoResponse<Boolean> deleteById(Long id);
BaseDtoResponse<Boolean> deleteById(Long id);
public BaseDtoResponse<${entityName}> insert(${entityName} entity);
BaseDtoResponse<${entityName}> insert(${entityName} entity);
public BaseDtoResponse<Boolean> update(${entityName} entity);
BaseDtoResponse<Boolean> update(${entityName} entity);
public BaseDtoResponse<PageInfo<${entityName}>> getPages(IPage param);
BaseDtoResponse<PageInfo<${entityName}>> getPages(IPage param);
}
\ No newline at end of file
......@@ -4,15 +4,15 @@
* Copyright(c) 2018 ${author} Co. Ltd.
* All right reserved.
*/
package ${serviceImplUrl};
package ${facadeImplUrl};
import ${entityUrl}.${entityName};
import ${facadeUrl}.${entityName}Facade;
import org.springframework.stereotype.Service;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.IPage;
import com.ydl.common.dto.BaseDtoResponse;
/**
* @Description:TODO(${entityComment}服务实现)
*
......@@ -34,7 +34,7 @@ public class ${entityName}FacadeImpl implements ${entityName}Facade {
}
@Override
public BaseDtoResponse<Doctor> insert(${entityName} entity) {
public BaseDtoResponse<${entityName}> insert(${entityName} entity) {
return null;
}
......
......@@ -11,7 +11,6 @@ import ${daoUrl}.${entityName}Mapper;
import ${serviceUrl}.${entityName}Service;
import org.springframework.stereotype.Service;
import com.ydl.common.service.impl.BaseService;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import com.github.pagehelper.PageHelper;
/**
......
......@@ -39,24 +39,41 @@ public class MyGenerator implements Serializable {
public static final String DATABASE = "ydl";
// 类信息:类名、对象名(一般是【类名】的首字母小些)、类说明、时间
public static final String TABLE = "doctor";
public static final String[] TABLES = {"doctor"};
public static final String[] TABLES = {"user_emergency_contact"
};
/**
"doctor_base_data","doctor_order","doctor","expert_interview","expert_interview_result","expert_result",
"doctor_education","doctor_certificate","doctor_certification","doctor_handle_cfg",
"doctor_team_certification","doctor_certificate","doctor_spirit_qualification","doctor_spirit_qualification","doctor_training_background",
"config_role","doctor_template","doctor_honorary_title","doctor_honorary_title","doctor_ren_zhi_background","doctor_interview",
"doctor_examine","doctor_examine_type_info","doctor_examine_flow","doctor_examine_log","doctor_modify",
*/
public static final String CLASSCOMMENT = "专家";
public static final String TIME = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
public static final String AGILE = new Date().getTime() + "";
// 路径信息,分开路径方便聚合工程项目,微服务项目
public static final String ENTITY_URL = "com.ydl.demo.po";
public static final String DAO_URL = "com.ydl.demo.mapper";
public static final String XML_URL = "com.ydl.demo.mapper.xml";
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 FACADE_URL = "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 String ENTITY_URL = "com.ydl.*project*.po";
public static String DAO_URL = "com.ydl.*project*.mapper";
public static String XML_URL = "sqlmap\\";
public static String SERVICE_URL = "com.ydl.*project*.service";
public static String SERVICE_IMPL_URL = "com.ydl.*project*.service.impl";
public static String FACADE_URL = "com.ydl.*project*.facade";
public static String FACADE_URL_IMPL = "com.ydl.*project*.facade";
public static String CONTROLLER_URL = "com.ydl.*project*.api";
//是否是Swagger配置
public static final String IS_SWAGGER = "false";
public static final String IS_SWAGGER = "true";
public static final String PROJECT_NAME = "user";
public static void main(String[] args) throws IOException {
System.out.println(MyGenerator.class.getResource("").getPath());
ENTITY_URL = ENTITY_URL.replace("*project*",PROJECT_NAME);
DAO_URL = DAO_URL.replace("*project*",PROJECT_NAME);
SERVICE_URL = SERVICE_URL.replace("*project*",PROJECT_NAME);
SERVICE_IMPL_URL = SERVICE_IMPL_URL.replace("*project*",PROJECT_NAME);
FACADE_URL = FACADE_URL.replace("*project*",PROJECT_NAME);
FACADE_URL_IMPL = FACADE_URL_IMPL.replace("*project*",PROJECT_NAME);
CONTROLLER_URL = CONTROLLER_URL.replace("*project*",PROJECT_NAME);
BasisInfo bi = new BasisInfo(PROJECT, AUTHOR, VERSION, URL, NAME, PASS, DATABASE, TIME, AGILE, ENTITY_URL,
DAO_URL, XML_URL, SERVICE_URL, SERVICE_IMPL_URL,FACADE_URL, FACADE_URL_IMPL, CONTROLLER_URL,IS_SWAGGER);
for(String table : TABLES) {
......@@ -66,30 +83,40 @@ public class MyGenerator implements Serializable {
bi.setEntityComment(CLASSCOMMENT);
try {
bi = EntityInfoUtil.getInfo(bi);
String fileUrl = "D:\\ydlwork\\generator\\demo\\src\\main\\java\\";// 生成文件存放位置
String localproject = "D:\\ydlwork\\user-center\\ydl-user\\";
String fileServiceUrl = localproject + "ydl-*project*-service\\src\\main\\"+ "java\\";// 生成文件存放位置
String fileServiceMapper = localproject + "ydl-*project*-service\\src\\main\\" + "resources\\";// 生成文件存放位置
String fileIntfUrl = localproject + "ydl-*project*-intf\\src\\main\\java\\";// 生成文件存放位置
String fileApiUrl = localproject + "ydl-*project*-api\\src\\main\\java\\";// 生成文件存放位置
fileServiceUrl = fileServiceUrl.replace("*project*",PROJECT_NAME);
fileServiceMapper = fileServiceMapper.replace("*project*",PROJECT_NAME);
fileIntfUrl = fileIntfUrl.replace("*project*",PROJECT_NAME);
fileApiUrl = fileApiUrl.replace("*project*",PROJECT_NAME);
//开始生成文件
String aa1 = Generator.createEntity(fileUrl, bi).toString();
String aa2 = Generator.createDao(fileUrl, bi).toString();
String aa3 = Generator.createDaoImpl(fileUrl, bi).toString();
String aa4 = Generator.createService(fileUrl, bi).toString();
String aa5 = Generator.createServiceImpl(fileUrl, bi).toString();
String aa6 = Generator.createController(fileUrl, bi).toString();
String aa1 = Generator.createEntity(fileIntfUrl, bi).toString();
String aa2 = Generator.createDao(fileServiceUrl, bi).toString();
String aa3 = Generator.createDaoImpl(fileServiceMapper, bi).toString();
String aa4 = Generator.createService(fileServiceUrl, bi).toString();
String aa5 = Generator.createServiceImpl(fileServiceUrl, bi).toString();
//String aa6 = Generator.createController(fileApiUrl, bi).toString();
// 是否创建swagger配置文件
//String aa7 = Generator.createSwaggerConfig(fileUrl, bi).toString();
String aa9 = Generator.createFacade(fileUrl, bi).toString();
String aa10 = Generator.createFacadeImpl(fileUrl, bi).toString();
//String aa9 = Generator.createFacade(fileIntfUrl, bi).toString();
//String aa10 = Generator.createFacadeImpl(fileServiceUrl, bi).toString();
System.out.println(aa1);
System.out.println(aa2);
System.out.println(aa3);
System.out.println(aa4);
System.out.println(aa5);
System.out.println(aa6);
//System.out.println(aa6);
//System.out.println(aa7);
System.out.println(aa9);
System.out.println(aa10);
//System.out.println(aa9);
//System.out.println(aa10);
} catch (SQLException e) {
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