diff --git a/command/gen/gen_dao.go b/command/gen/gen_dao.go index 0a3c9f7..6f8e1e4 100644 --- a/command/gen/gen_dao.go +++ b/command/gen/gen_dao.go @@ -18,6 +18,7 @@ import ( "github.com/gogf/gf/v2/text/gregex" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" + "github.com/jinzhu/inflection" "github.com/olekukonko/tablewriter" _ "github.com/denisenkom/go-mssqldb" @@ -284,7 +285,7 @@ func doGenDaoForArray(index int, parser *gcmd.Parser) { // Generating dao & model go files one by one according to given table name. newTableNames := make([]string, len(tableNames)) for i, tableName := range tableNames { - newTableName := tableName + newTableName := inflection.Singular(tableName) for _, v := range removePrefixArray { newTableName = gstr.TrimLeftStr(newTableName, v, 1) } diff --git a/go.mod b/go.mod index 9b751c8..85d6c42 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.14 require ( github.com/denisenkom/go-mssqldb v0.0.0-20200206145737-bbfc9a55622e + github.com/jinzhu/inflection v1.0.0 github.com/gogf/gf/v2 v2.0.0-alpha.0.20211025111756-4717e017087f github.com/lib/pq v1.2.0 github.com/mattn/go-runewidth v0.0.10 // indirect