forked from pingfangushi/screw
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of gitee.com:leshalv/screw into master
- Loading branch information
Showing
14 changed files
with
98 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,8 +26,12 @@ | |
* Created by [email protected] on 2020-08-17 | ||
*/ | ||
public interface TypeDialect { | ||
|
||
Class getClassTypeByFieldType(String type); | ||
/** | ||
* 通过字段类型获取类类型 | ||
* @param type {@link String} | ||
* @return {@link Class} | ||
*/ | ||
Class<?> getClassTypeByFieldType(String type); | ||
|
||
/** | ||
* 根据提供的map查询对应的java类型 | ||
|
@@ -36,43 +40,61 @@ public interface TypeDialect { | |
* @param type 提供的类型 | ||
* @return 查找类型,可能null | ||
*/ | ||
default Class getTypeByMap(Map<String, Class> map, String type) { | ||
if (type == null || map == null || map.size() == 0) | ||
default Class<?> getTypeByMap(Map<String, Class<?>> map, String type) { | ||
if (type == null || map == null || map.size() == 0) { | ||
return null; | ||
if (type.startsWith("date")) | ||
} | ||
if (type.startsWith("date")) { | ||
return map.get("date"); | ||
if (type.startsWith("mediumint")) | ||
} | ||
if (type.startsWith("mediumint")) { | ||
return map.get("mediumint"); | ||
if (type.startsWith("double")) | ||
} | ||
if (type.startsWith("double")) { | ||
return map.get("double"); | ||
if (type.startsWith("varchar")) | ||
} | ||
if (type.startsWith("varchar")) { | ||
return map.get("varchar"); | ||
if (type.startsWith("tinyint")) | ||
} | ||
if (type.startsWith("tinyint")) { | ||
return map.get("tinyint"); | ||
if (type.startsWith("bit")) | ||
} | ||
if (type.startsWith("bit")) { | ||
return map.get("bit"); | ||
if (type.startsWith("float")) | ||
} | ||
if (type.startsWith("float")) { | ||
return map.get("float"); | ||
if (type.startsWith("int")) | ||
} | ||
if (type.startsWith("int")) { | ||
return map.get("int"); | ||
if (type.startsWith("smallint")) | ||
} | ||
if (type.startsWith("smallint")) { | ||
return map.get("smallint"); | ||
if (type.startsWith("datetime")) | ||
} | ||
if (type.startsWith("datetime")) { | ||
return map.get("datetime"); | ||
if (type.startsWith("blob")) | ||
} | ||
if (type.startsWith("blob")) { | ||
return map.get("blob"); | ||
if (type.startsWith("char")) | ||
} | ||
if (type.startsWith("char")) { | ||
return map.get("char"); | ||
if (type.startsWith("text")) | ||
} | ||
if (type.startsWith("text")) { | ||
return map.get("text"); | ||
if (type.startsWith("time")) | ||
} | ||
if (type.startsWith("time")) { | ||
return map.get("time"); | ||
if (type.startsWith("decimal")) | ||
} | ||
if (type.startsWith("decimal")) { | ||
return map.get("decimal"); | ||
if (type.startsWith("bigint")) | ||
} | ||
if (type.startsWith("bigint")) { | ||
return map.get("bigint"); | ||
if (type.startsWith("timestamp")) | ||
} | ||
if (type.startsWith("timestamp")) { | ||
return map.get("timestamp"); | ||
} | ||
return null; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,11 +21,19 @@ | |
import cn.smallbun.screw.extension.pojo.metadata.model.PojoModel; | ||
|
||
/** | ||
* POJO 引擎 | ||
* | ||
* @author liu·yu | ||
* Created by [email protected] on 2020-08-14 | ||
*/ | ||
public interface PojoEngine { | ||
|
||
void produce(PojoModel info, String docName) throws ProduceException; | ||
/** | ||
* 生成 | ||
* | ||
* @param info {@link PojoModel} | ||
* @param file {@link String} | ||
* @throws ProduceException ProduceException | ||
*/ | ||
void produce(PojoModel info, String file) throws ProduceException; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
|
||
import lombok.Data; | ||
|
||
import java.io.Serializable; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
|
@@ -29,7 +30,7 @@ | |
* Created by [email protected] on 2020-08-14 | ||
*/ | ||
@Data | ||
public class PojoModel { | ||
public class PojoModel implements Serializable { | ||
|
||
/** | ||
* 包名 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,14 +19,16 @@ | |
|
||
import lombok.Data; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* TypeModel | ||
* | ||
* @author liu·yu | ||
* Created by [email protected] on 2020-08-14 | ||
*/ | ||
@Data | ||
public class TypeModel { | ||
public class TypeModel implements Serializable { | ||
|
||
/** | ||
* 数据库字段类型 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,11 @@ | |
* Created by [email protected] on 2020-08-20 | ||
*/ | ||
public interface PojoProcess { | ||
|
||
/** | ||
* 获取pojo模型 | ||
* | ||
* @return {@link PojoModel} | ||
*/ | ||
List<PojoModel> getPojoModel(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,3 +47,4 @@ public class ${className} { | |
</#list> | ||
</#if> | ||
} | ||
|