master
周文涛 2 years ago
parent 643d516be0
commit ec26095232

@ -68,9 +68,9 @@ public class Main {
String user = "enjoy";
String password = "Nomi1234";
//2.选择表配置
String table= "oqc_report_template";
String entityName="OqcReportTemplate";//实体类
String description = "报告模板";//备注
String table= "oqc_sampling_plan";
String entityName="OqcSamplingPlan";//实体类
String description = "抽样方案";//备注
String primaryKeyField = "id";//主键
List<TableEntityVo> tableEntityVoList = printTableStructure(driver, url, user, password, table);
//3.生成
@ -182,8 +182,10 @@ public class Main {
int nullable = columnResultSet.getInt("NULLABLE");
// 描述
String remarks = columnResultSet.getString("REMARKS");
if (remarks==null) {
remarks="";
}
System.out.println(columnName + " " + columnType + " " + datasize + " " + digits + " " + nullable + " " + remarks);
//System.out.println("1"+TableFieldUtil.fieldTypeParseJava(dbType,columnType));
String entityField = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, columnName);
tableEntityVoList.add(new TableEntityVo(columnName,entityField,TableFieldUtil.fieldTypeParseJava(dbType, columnType), columnType, remarks));
}

@ -15,18 +15,18 @@ public class TableEntityVo {
//数据库中字段类型
private String fieldDbType;
//字段描述
private String filedComment;
private String fieldComment;
public TableEntityVo() {
}
public TableEntityVo(String fieldColumn,String fieldName,String fieldType,String fieldDbType,String filedComment) {
public TableEntityVo(String fieldColumn,String fieldName,String fieldType,String fieldDbType,String fieldComment) {
this.fieldColumn = fieldColumn;
this.fieldName = fieldName;
this.fieldType = fieldType;
this.fieldDbType = fieldDbType;
this.filedComment = filedComment;
this.fieldComment = fieldComment;
}
public String getFieldColumn() {
@ -37,12 +37,12 @@ public class TableEntityVo {
this.fieldColumn = fieldColumn;
}
public String getFiledComment() {
return filedComment;
public String getFieldComment() {
return fieldComment;
}
public void setFiledComment(String filedComment) {
this.filedComment = filedComment;
public void setFieldComment(String fieldComment) {
this.fieldComment = fieldComment;
}
public String getFieldName() {
@ -75,7 +75,7 @@ public class TableEntityVo {
"fieldName='" + fieldName + '\'' +
", fieldType='" + fieldType + '\'' +
", fieldDbType='" + fieldDbType + '\'' +
", filedComment='" + filedComment + '\'' +
", fieldComment='" + fieldComment + '\'' +
'}';
}
}

@ -1,9 +1,6 @@
package ${bussiPackage}.${entityPackage};
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.*;
import com.enjoy.common.core.annotation.Excel;
import com.enjoy.common.core.utils.iqc.ExcelImport;
import com.enjoy.oqc.domain.BaseEntity;
@ -32,38 +29,33 @@ public class ${entityName} extends BaseEntity{
private static final long serialVersionUID = 1L;
<#list originalColumns as po>
<#if po.fieldName == 'creatorId' || po.fieldName == 'createBy' || po.fieldName == 'createTime' || po.fieldName == 'updaterId' || po.fieldName == 'updateBy' || po.fieldName == 'updateTime' || po.fieldName == 'tenantId'><#else>
/**${po.filedComment}*/
<#if po.fieldName == primaryKeyField>
@TableId(type = IdType.ASSIGN_ID)
<#else>
<#if po.fieldType =='Date'>
<#if po.fieldDbType =='date'>
@Excel(name = "${po.filedComment}", width = 15)
@ExcelImport("${po.filedComment}")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
<#elseif po.fieldDbType =='datetime'>
@Excel(name = "${po.filedComment}", width = 20)
@ExcelImport("${po.filedComment}")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
<#elseif po.fieldDbType =='timestamp'>
@Excel(name = "${po.filedComment}", width = 20)
@ExcelImport("${po.filedComment}")
<#elseif po.fieldDbType =='datetime' || po.fieldDbType = 'timestamp'>
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#else>
@Excel(name = "${po.filedComment}", width = 15)
@ExcelImport("${po.filedComment}")
</#if>
</#if>
@ApiModelProperty(value = "${po.filedComment}",example = "${po.filedComment}")
<#if po.fieldComment !=''>
/**${po.fieldComment}*/
@Excel(name = "${po.fieldComment}", width = 15)
@ExcelImport("${po.fieldComment}")
@ApiModelProperty(value = "${po.fieldComment}")
</#if>
@TableField(value="${po.fieldColumn}")
<#if po.fieldName == 'delFlag'>
@TableLogic
</#if>
private <#if po.fieldType=='java.sql.Blob'>byte[]<#else>${po.fieldType}</#if> ${po.fieldName};
</#if>
</#if>
</#list>
}

@ -26,7 +26,7 @@ public class Add${entityName}PVO implements Serializable{
<#list originalColumns as po>
<#if po.fieldName == primaryKeyField>
<#else>
/**${po.filedComment}*/
/**${po.fieldComment}*/
<#if po.fieldType =='Date'>
<#if po.fieldDbType =='date'>
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@ -42,7 +42,7 @@ public class Add${entityName}PVO implements Serializable{
</#if>
</#if>
<#if po.fieldName != primaryKeyField>
@ApiModelProperty(value = "${po.filedComment}")
@ApiModelProperty(value = "${po.fieldComment}")
private <#if po.fieldType=='java.sql.Blob'>byte[]<#else>${po.fieldType}</#if> ${po.fieldName};
</#if>
</#list>

@ -23,7 +23,7 @@ import java.util.Date;
@ApiModel(value="编辑${tableName}对象", description="${tableVo.ftlDescription}")
public class Edit${entityName}PVO implements Serializable{
<#list originalColumns as po>
/**${po.filedComment}*/
/**${po.fieldComment}*/
<#if po.fieldName == primaryKeyField>
<#else>
<#if po.fieldType =='Date'>
@ -40,7 +40,7 @@ public class Edit${entityName}PVO implements Serializable{
<#else>
</#if>
</#if>
@ApiModelProperty(value = "${po.filedComment}")
@ApiModelProperty(value = "${po.fieldComment}")
<#if po.fieldName == 'delFlag'>
</#if>
private <#if po.fieldType=='java.sql.Blob'>byte[]<#else>${po.fieldType}</#if> ${po.fieldName};

@ -25,33 +25,33 @@ public class ${entityName}Excel{
private static final long serialVersionUID = 1L;
<#list originalColumns as po>
<#if po.fieldName =='id'|| po.fieldName=='delFlag' || po.fieldName == 'creatorId' || po.fieldName == 'createBy' || po.fieldName == 'createTime' || po.fieldName == 'updaterId' || po.fieldName == 'updateBy' || po.fieldName == 'updateTime' || po.fieldName == 'tenantId'><#else>
/**${po.filedComment}*/
/**${po.fieldComment}*/
<#if po.fieldName == primaryKeyField>
@TableId(type = IdType.ASSIGN_ID)
<#else>
<#if po.fieldType =='Date'>
<#if po.fieldDbType =='date'>
@Excel(name = "${po.filedComment}", width = 15)
@ExcelImport("${po.filedComment}")
@Excel(name = "${po.fieldComment}", width = 15)
@ExcelImport("${po.fieldComment}")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
<#elseif po.fieldDbType =='datetime'>
@Excel(name = "${po.filedComment}", width = 20)
@ExcelImport("${po.filedComment}")
@Excel(name = "${po.fieldComment}", width = 20)
@ExcelImport("${po.fieldComment}")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
<#elseif po.fieldDbType =='timestamp'>
@Excel(name = "${po.filedComment}", width = 20)
@ExcelImport("${po.filedComment}")
@Excel(name = "${po.fieldComment}", width = 20)
@ExcelImport("${po.fieldComment}")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#else>
@Excel(name = "${po.filedComment}", width = 15)
@ExcelImport("${po.filedComment}")
@Excel(name = "${po.fieldComment}", width = 15)
@ExcelImport("${po.fieldComment}")
</#if>
</#if>
@ApiModelProperty(value = "${po.filedComment}",example = "${po.filedComment}")
@ApiModelProperty(value = "${po.fieldComment}",example = "${po.fieldComment}")
<#if po.fieldName == 'delFlag'>
@TableLogic
</#if>

@ -23,7 +23,7 @@ import java.util.Date;
@ApiModel(value="查询${entityName}对象", description="${tableVo.ftlDescription}")
public class Query${entityName}VO implements Serializable{
<#list originalColumns as po>
/**${po.filedComment}*/
/**${po.fieldComment}*/
<#if po.fieldName == primaryKeyField>
<#else>
<#if po.fieldType =='Date'>
@ -40,7 +40,7 @@ public class Query${entityName}VO implements Serializable{
<#else>
</#if>
</#if>
@ApiModelProperty(value = "${po.filedComment}")
@ApiModelProperty(value = "${po.fieldComment}")
<#if po.fieldName == 'delFlag'>
</#if>
private <#if po.fieldType=='java.sql.Blob'>byte[]<#else>${po.fieldType}</#if> ${po.fieldName};

@ -83,6 +83,7 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
/**
* 全部
*/
@Override
public AjaxResult listAll(Query${entityName}VO query${entityName}VO){
List<${entityName}DTO> list=new ArrayList();
QueryWrapper<${entityName}> queryWrapper=new QueryWrapper();
@ -100,6 +101,7 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
/**
* 详情
*/
@Override
public AjaxResult get${entityName}Detail(String id){
${entityName}DTO ${uncap_first}DTO=new ${entityName}DTO();
${uncap_first}DTO =(${entityName}DTO) BeanHkUtils.copyProperties(this.getById(id),${uncap_first}DTO);

Loading…
Cancel
Save