提交 | 用户 | age
|
826b66
|
1 |
package com.hx.auto.common; |
C |
2 |
|
|
3 |
import java.util.ArrayList; |
|
4 |
import java.util.List; |
|
5 |
|
|
6 |
/**实体类对应生成mapper.xml的数据*/ |
|
7 |
public class ReadEntityData { |
|
8 |
//实体类的主键id名称 |
|
9 |
private String entityIdName; |
|
10 |
//表的主键id名称 |
|
11 |
private String tableIdName; |
|
12 |
//主键类型 |
|
13 |
private String keyType; |
|
14 |
//表的名称 |
|
15 |
private String tableName; |
|
16 |
//实体类和表的所有字段名称(除了主键) |
|
17 |
private List<FieldAttribute> fields = new ArrayList<FieldAttribute>(); |
|
18 |
//特殊字段,主键id,如:#{id} |
|
19 |
private String entityIdData; |
|
20 |
//特殊字段,mybatis的排序 |
|
21 |
private String orderBy = "${orderBy}"; |
|
22 |
//特殊字段,mybatis的实体类匹配表字段 |
|
23 |
private String createData = "#{createData.obj}"; |
|
24 |
//特殊字段,mybatis的传的值 |
|
25 |
private String valueData = "#{value}"; |
|
26 |
|
|
27 |
/********************************************************************/ |
|
28 |
/** 存储实体类的表字段 |
|
29 |
* @param entityName 实体类字段名称 |
|
30 |
* @param tableName1 表名称 |
|
31 |
* @param dataType 类型 |
|
32 |
*/ |
|
33 |
public void fielData(String entityName,String tableName1,String dataType,Integer isBlob,String mybatisName) { |
|
34 |
fields.add(new FieldAttribute(entityName,tableName1, dataType,isBlob,mybatisName)); |
|
35 |
} |
|
36 |
|
|
37 |
/******************************************************************/ |
|
38 |
public String getEntityIdName() { |
|
39 |
return entityIdName; |
|
40 |
} |
|
41 |
public void setEntityIdName(String entityIdName) { |
|
42 |
this.entityIdName = entityIdName; |
|
43 |
} |
|
44 |
public String getTableIdName() { |
|
45 |
return tableIdName; |
|
46 |
} |
|
47 |
public void setTableIdName(String tableIdName) { |
|
48 |
this.tableIdName = tableIdName; |
|
49 |
} |
|
50 |
public String getTableName() { |
|
51 |
return tableName; |
|
52 |
} |
|
53 |
public void setTableName(String tableName) { |
|
54 |
this.tableName = tableName; |
|
55 |
} |
|
56 |
public List<FieldAttribute> getFields() { |
|
57 |
return fields; |
|
58 |
} |
|
59 |
public void setFields(List<FieldAttribute> fields) { |
|
60 |
this.fields = fields; |
|
61 |
} |
|
62 |
public String getOrderBy() { |
|
63 |
return orderBy; |
|
64 |
} |
|
65 |
public void setOrderBy(String orderBy) { |
|
66 |
this.orderBy = orderBy; |
|
67 |
} |
|
68 |
public String getKeyType() { |
|
69 |
return keyType; |
|
70 |
} |
|
71 |
public void setKeyType(String keyType) { |
|
72 |
this.keyType = keyType; |
|
73 |
} |
|
74 |
|
|
75 |
public String getCreateData() { |
|
76 |
return createData; |
|
77 |
} |
|
78 |
public void setCreateData(String createData) { |
|
79 |
this.createData = createData; |
|
80 |
} |
|
81 |
public String getValueData() { |
|
82 |
return valueData; |
|
83 |
} |
|
84 |
|
|
85 |
public void setValueData(String valueData) { |
|
86 |
this.valueData = valueData; |
|
87 |
} |
|
88 |
|
|
89 |
public String getEntityIdData() { |
|
90 |
return entityIdData; |
|
91 |
} |
|
92 |
|
|
93 |
public void setEntityIdData(String entityIdData) { |
|
94 |
this.entityIdData = entityIdData; |
|
95 |
} |
|
96 |
|
|
97 |
/*****************************************************************/ |
|
98 |
public static class FieldAttribute { |
|
99 |
//实体类字段名称 |
|
100 |
private String entityName; |
|
101 |
//表字段名称 |
|
102 |
private String tableName; |
|
103 |
//数据库类型 |
|
104 |
private String dataType; |
|
105 |
//是否大数据 |
|
106 |
private Integer isBlob = 0; |
|
107 |
//特殊字段,如在mybati中 #{id}的表示 |
|
108 |
private String mybatisName; |
|
109 |
|
|
110 |
/**********************************/ |
|
111 |
public FieldAttribute(String entityName,String tableName,String dataType,Integer isBlob |
|
112 |
,String mybatisName) { |
|
113 |
this.entityName = entityName; |
|
114 |
this.tableName = tableName; |
|
115 |
this.dataType = dataType; |
|
116 |
this.isBlob = isBlob; |
|
117 |
this.mybatisName = mybatisName; |
|
118 |
} |
|
119 |
|
|
120 |
/*********************************/ |
|
121 |
public String getDataType() { |
|
122 |
return dataType; |
|
123 |
} |
|
124 |
public void setDataType(String dataType) { |
|
125 |
this.dataType = dataType; |
|
126 |
} |
|
127 |
public String getEntityName() { |
|
128 |
return entityName; |
|
129 |
} |
|
130 |
public void setEntityName(String entityName) { |
|
131 |
this.entityName = entityName; |
|
132 |
} |
|
133 |
public String getTableName() { |
|
134 |
return tableName; |
|
135 |
} |
|
136 |
public void setTableName(String tableName) { |
|
137 |
this.tableName = tableName; |
|
138 |
} |
|
139 |
public Integer getIsBlob() { |
|
140 |
return isBlob; |
|
141 |
} |
|
142 |
public void setIsBlob(Integer isBlob) { |
|
143 |
this.isBlob = isBlob; |
|
144 |
} |
|
145 |
|
|
146 |
public String getMybatisName() { |
|
147 |
return mybatisName; |
|
148 |
} |
|
149 |
public void setMybatisName(String mybatisName) { |
|
150 |
this.mybatisName = mybatisName; |
|
151 |
} |
|
152 |
} |
|
153 |
} |
|
154 |
|