|
|
@@ -103,7 +103,7 @@ func formatSqlType(str string) string {
|
|
|
case "varchar":
|
|
|
return "string"
|
|
|
case "int":
|
|
|
- return "int"
|
|
|
+ return "int64"
|
|
|
case "decimal":
|
|
|
return "float64"
|
|
|
case "datetime":
|
|
|
@@ -129,7 +129,7 @@ func MysqlToStruct(engine *xorm.Engine) {
|
|
|
var toString = ""
|
|
|
for i := range cols {
|
|
|
if cols[i].aaBbName == "id" && cols[i].IsKey {
|
|
|
- structString += fmt.Sprint(" ", cols[i].AaBbName, " ", cols[i].TypeName, " `json:\"", cols[i].aaBbName, "\"`",
|
|
|
+ structString += fmt.Sprint(" ", cols[i].AaBbName, " int64 `json:\"", cols[i].aaBbName, "\"`",
|
|
|
"// ", cols[i].Length, " ", cols[i].Length2, " 注释:", cols[i].Comment, "\n")
|
|
|
toString += fmt.Sprint(cols[i].AaBbName, ":\", receiver.", cols[i].AaBbName, ", \",")
|
|
|
|
|
|
@@ -190,7 +190,7 @@ func MysqlToDao(engine *xorm.Engine) {
|
|
|
"\n\treturn " + table.aaBbName + ", nil" +
|
|
|
"\n}\n\n"
|
|
|
}
|
|
|
- dao += "func GetInIdList" + table.AaBbName + "(ids []int) ([]domain." + table.AaBbName + ", error) {" +
|
|
|
+ dao += "func GetInIdList" + table.AaBbName + "(ids []int64) ([]domain." + table.AaBbName + ", error) {" +
|
|
|
"\n\trows, err := configs.Engine.In(\"id\", ids).Rows(&domain." + table.AaBbName + "{})" +
|
|
|
"\n\tif err != nil {" +
|
|
|
"\n\t\treturn make([]domain." + table.AaBbName + ", 0), err" +
|
|
|
@@ -232,7 +232,7 @@ func MysqlToDao(engine *xorm.Engine) {
|
|
|
"\n\t}" +
|
|
|
"\n\treturn *" + table.aaBbName + ", nil" +
|
|
|
"\n}\n\n"
|
|
|
- dao += "func Set" + table.AaBbName + "(" + table.aaBbName + "Map map[string]interface{}, id int) (domain." + table.AaBbName + ", bool, error) {" +
|
|
|
+ dao += "func Set" + table.AaBbName + "(" + table.aaBbName + "Map map[string]interface{}, id int64) (domain." + table.AaBbName + ", bool, error) {" +
|
|
|
"\n\tvar " + table.aaBbName + " domain." + table.AaBbName + "" +
|
|
|
"\n\t_, err := configs.Engine.Table(\"" + table.Name + "\").Where(\"" + idColumn.Name + " = ?\", id).Update(" + table.aaBbName + "Map)" +
|
|
|
"\n\tif err != nil {" +
|