diff --git a/api/v1/businesses/species_name.go b/api/v1/businesses/species_name.go new file mode 100644 index 0000000..d2395ed --- /dev/null +++ b/api/v1/businesses/species_name.go @@ -0,0 +1,78 @@ +// ========================================================================== +// GFast自动生成api操作代码。 +// 生成日期:2025-08-06 11:24:51 +// 生成路径: api/v1/demo/species_name.go +// 生成人:gfast +// desc:相关参数 +// company:云南奇讯科技有限公司 +// ========================================================================== + +package demo + +import ( + "github.com/gogf/gf/v2/frame/g" + commonApi "github.com/tiger1103/gfast/v3/api/v1/common" + "github.com/tiger1103/gfast/v3/internal/app/businesses/model" +) + +// SpeciesNameSearchReq 分页请求参数 +type SpeciesNameSearchReq struct { + g.Meta `path:"/list" tags:"" method:"get" summary:"列表"` + commonApi.Author + model.SpeciesNameSearchReq +} + +// SpeciesNameSearchRes 列表返回结果 +type SpeciesNameSearchRes struct { + g.Meta `mime:"application/json"` + *model.SpeciesNameSearchRes +} + +// SpeciesNameAddReq 添加操作请求参数 +type SpeciesNameAddReq struct { + g.Meta `path:"/add" tags:"" method:"post" summary:"添加"` + commonApi.Author + *model.SpeciesNameAddReq +} + +// SpeciesNameAddRes 添加操作返回结果 +type SpeciesNameAddRes struct { + commonApi.EmptyRes +} + +// SpeciesNameEditReq 修改操作请求参数 +type SpeciesNameEditReq struct { + g.Meta `path:"/edit" tags:"" method:"put" summary:"修改"` + commonApi.Author + *model.SpeciesNameEditReq +} + +// SpeciesNameEditRes 修改操作返回结果 +type SpeciesNameEditRes struct { + commonApi.EmptyRes +} + +// SpeciesNameGetReq 获取一条数据请求 +type SpeciesNameGetReq struct { + g.Meta `path:"/get" tags:"" method:"get" summary:"获取信息"` + commonApi.Author + Id int `p:"id" v:"required#主键必须"` //通过主键获取 +} + +// SpeciesNameGetRes 获取一条数据结果 +type SpeciesNameGetRes struct { + g.Meta `mime:"application/json"` + *model.SpeciesNameInfoRes +} + +// SpeciesNameDeleteReq 删除数据请求 +type SpeciesNameDeleteReq struct { + g.Meta `path:"/delete" tags:"" method:"delete" summary:"删除"` + commonApi.Author + Ids []int `p:"ids" v:"required#主键必须"` //通过主键删除 +} + +// SpeciesNameDeleteRes 删除数据返回 +type SpeciesNameDeleteRes struct { + commonApi.EmptyRes +} diff --git a/go.mod b/go.mod index fc22822..3de7a23 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/tiger1103/gfast/v3 -go 1.23 +go 1.23.0 -toolchain go1.23.2 +toolchain go1.24.0 require ( github.com/ArtisanCloud/PowerWeChat/v3 v3.2.45 @@ -26,8 +26,8 @@ require ( github.com/tiger1103/gfast-token v1.0.9 github.com/wenlng/go-captcha v1.2.5 github.com/xuri/excelize/v2 v2.7.1 - golang.org/x/net v0.32.0 - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d + golang.org/x/net v0.42.0 + golang.org/x/tools v0.35.0 ) require ( @@ -41,14 +41,16 @@ require ( github.com/dgraph-io/badger/v4 v4.2.0 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect - github.com/dustin/go-humanize v1.0.0 // indirect + github.com/dustin/go-humanize v1.0.1 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/fatih/color v1.18.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/glebarez/go-sqlite v1.21.2 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-sql-driver/mysql v1.8.1 // indirect + github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.9.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v5 v5.0.0 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect @@ -61,6 +63,8 @@ require ( github.com/google/go-querystring v1.0.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.12.3 // indirect github.com/konsorten/go-windows-terminal-sequences v1.0.1 // indirect @@ -75,11 +79,13 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/mozillazg/go-httpheader v0.2.1 // indirect + github.com/ncruces/go-strftime v0.1.9 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/pkg/errors v0.9.1 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect github.com/redis/go-redis/v9 v9.7.0 // indirect + github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/richardlehane/mscfb v1.0.4 // indirect github.com/richardlehane/msoleps v1.0.3 // indirect github.com/rivo/uniseg v0.4.7 // indirect @@ -102,15 +108,21 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/crypto v0.30.0 // indirect + golang.org/x/crypto v0.40.0 // indirect + golang.org/x/exp v0.0.0-20250718183923-645b1fa84792 // indirect golang.org/x/image v0.16.0 // indirect - golang.org/x/mod v0.17.0 // indirect - golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.28.0 // indirect - golang.org/x/term v0.27.0 // indirect - golang.org/x/text v0.21.0 // indirect + golang.org/x/mod v0.26.0 // indirect + golang.org/x/sync v0.16.0 // indirect + golang.org/x/sys v0.34.0 // indirect + golang.org/x/term v0.33.0 // indirect + golang.org/x/text v0.27.0 // indirect golang.org/x/time v0.3.0 // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + gorm.io/gorm v1.30.1 // indirect + modernc.org/libc v1.66.6 // indirect + modernc.org/mathutil v1.7.1 // indirect + modernc.org/memory v1.11.0 // indirect + modernc.org/sqlite v1.38.2 // indirect ) diff --git a/go.sum b/go.sum index 9043e8c..9bc7059 100644 --- a/go.sum +++ b/go.sum @@ -46,6 +46,8 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= @@ -53,6 +55,12 @@ github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/glebarez/go-sqlite v1.21.2 h1:3a6LFC4sKahUunAmynQKLZceZCOzUthkRkEAl9gAXWo= +github.com/glebarez/go-sqlite v1.21.2/go.mod h1:sfxdZyhQjTM2Wry3gVYWaW072Ri1WMdWJi0k6+3382k= +github.com/glebarez/go-sqlite v1.22.0 h1:uAcMJhaA6r3LHMTFgP0SifzgXg46yJkgxqyuyec+ruQ= +github.com/glebarez/go-sqlite v1.22.0/go.mod h1:PlBIdHe0+aUEFn+r2/uthrWq4FxbzugL0L8Li6yQJbc= +github.com/glebarez/sqlite v1.11.0 h1:wSG0irqzP6VurnMEpFGer5Li19RpIRi2qvQz++w0GMw= +github.com/glebarez/sqlite v1.11.0/go.mod h1:h8/o8j5wiAsqSPoWELDUdJXhjAhsVliSn7bWZjOhrgQ= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -73,6 +81,8 @@ github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.0 h1:1f7EeD0lfPHoXfaJDSL7cxRcSR github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.0/go.mod h1:tToO1PjGkLIR+9DbJ0wrKicYma0H/EUHXOpwel6Dw+0= github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.9.0 h1:F/XfLI3TsgFU22AqJ2Df+ZUlF7lzkPo7oB5Cmx6VqOQ= github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.9.0/go.mod h1:p0c5ZhIITNrqgOz7+dhlk4eDCIC3Tt0ocUVhRjpUw+I= +github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.9.0 h1:8dg4KHNBJ8OmIfRCGnN5zrP13iENThh4i71IwIa2VP8= +github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.9.0/go.mod h1:hr3GNf9+LJs9TbjEGb7vEGOg2YWfrJBLrXgOcerKRlU= github.com/gogf/gf/contrib/nosql/redis/v2 v2.9.0 h1:EEZqu1PNRSmm+7Cqm9A/8+ObgfbMzhE1ps9Z3LD7HgM= github.com/gogf/gf/contrib/nosql/redis/v2 v2.9.0/go.mod h1:LHrxY+2IzNTHVTPG/s5yaz1VmXbj+CQ7Hr5SeVkHiTw= github.com/gogf/gf/v2 v2.9.0 h1:semN5Q5qGjDQEv4620VzxcJzJlSD07gmyJ9Sy9zfbHk= @@ -120,6 +130,10 @@ github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aN github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grokify/html-strip-tags-go v0.1.0 h1:03UrQLjAny8xci+R+qjCce/MYnpNXCtgzltlQbOBae4= github.com/grokify/html-strip-tags-go v0.1.0/go.mod h1:ZdzgfHEzAfz9X6Xe5eBLVblWIxXfYSQ40S/VKrAOGpc= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= @@ -154,6 +168,8 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-sqlite3 v1.14.30 h1:bVreufq3EAIG1Quvws73du3/QgdeZ3myglJlrzSYYCY= +github.com/mattn/go-sqlite3 v1.14.30/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= @@ -168,6 +184,8 @@ github.com/mozillazg/go-httpheader v0.2.1 h1:geV7TrjbL8KXSyvghnFm+NyTux/hxwueTSr github.com/mozillazg/go-httpheader v0.2.1/go.mod h1:jJ8xECTlalr6ValeXYdOF8fFUISeBAdw6E61aqQma60= github.com/mssola/user_agent v0.5.3 h1:lBRPML9mdFuIZgI2cmlQ+atbpJdLdeVl2IDodjBR578= github.com/mssola/user_agent v0.5.3/go.mod h1:TTPno8LPY3wAIEKRpAtkdMT0f8SE24pLRGPahjCH4uw= +github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= +github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/nsqio/go-nsq v1.1.0 h1:PQg+xxiUjA7V+TLdXw7nVrJ5Jbl3sN86EhGCQj4+FYE= github.com/nsqio/go-nsq v1.1.0/go.mod h1:vKq36oyeVXgsS5Q8YEO7WghqidAVXQlcFxzQbQTuDEY= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= @@ -188,6 +206,8 @@ github.com/qiniu/go-sdk/v7 v7.13.0/go.mod h1:btsaOc8CA3hdVloULfFdDgDc+g4f3TDZEFs github.com/qiniu/x v1.10.5/go.mod h1:03Ni9tj+N2h2aKnAz+6N0Xfl8FwMEDRC2PAlxekASDs= github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E= github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/richardlehane/mscfb v1.0.4 h1:WULscsljNPConisD5hR0+OyZjwK46Pfyr6mPu5ZawpM= github.com/richardlehane/mscfb v1.0.4/go.mod h1:YzVpcZg9czvAuhk9T+a3avCpcFPMUWm7gK3DypaEsUk= github.com/richardlehane/msoleps v1.0.1/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg= @@ -288,7 +308,11 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= golang.org/x/crypto v0.30.0 h1:RwoQn3GkWiMkzlX562cLB7OxWvjH1L8xutO2WoJcRoY= golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= +golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20250718183923-645b1fa84792 h1:R9PFI6EUdfVKgwKjZef7QIwGcBKu86OEFpJ9nUEP2l4= +golang.org/x/exp v0.0.0-20250718183923-645b1fa84792/go.mod h1:A+z0yzpGtvnG90cToK5n2tu8UJVP2XUATh+r+sfOOOc= golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= golang.org/x/image v0.5.0/go.mod h1:FVC7BI/5Ym8R25iw5OLsgshdUBbT1h5jZTpA+mvAdZ4= golang.org/x/image v0.13.0/go.mod h1:6mmbMOeV28HuMTgA6OSRkdXKYw/t5W9Uwn2Yv1r3Yxk= @@ -304,6 +328,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg= +golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -318,6 +344,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= +golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= +golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -330,6 +358,8 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= +golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -352,12 +382,16 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= +golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= +golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= +golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -368,6 +402,8 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= +golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -384,6 +420,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= +golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -412,6 +450,16 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/gorm v1.30.1 h1:lSHg33jJTBxs2mgJRfRZeLDG+WZaHYCk3Wtfl6Ngzo4= +gorm.io/gorm v1.30.1/go.mod h1:8Z33v652h4//uMA76KjeDH8mJXPm1QNCYrMeatR0DOE= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +modernc.org/libc v1.66.6 h1:RyQpwAhM/19nXD8y3iejM/AjmKwY2TjxZTlUWTsWw2U= +modernc.org/libc v1.66.6/go.mod h1:j8z0EYAuumoMQ3+cWXtmw6m+LYn3qm8dcZDFtFTSq+M= +modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU= +modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg= +modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI= +modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw= +modernc.org/sqlite v1.38.2 h1:Aclu7+tgjgcQVShZqim41Bbw9Cho0y/7WzYptXqkEek= +modernc.org/sqlite v1.38.2/go.mod h1:cPTJYSlgg3Sfg046yBShXENNtPrWrDX8bsbAQBzgQ5E= stathat.com/c/consistent v1.0.0 h1:ezyc51EGcRPJUxfHGSgJjWzJdj3NiMU9pNfLNGiXV0c= stathat.com/c/consistent v1.0.0/go.mod h1:QkzMWzcbB+yQBL2AttO6sgsQS/JSTapcDISJalmCDS0= diff --git a/internal/app/boot/boot.go b/internal/app/boot/boot.go index fabed2a..6498680 100644 --- a/internal/app/boot/boot.go +++ b/internal/app/boot/boot.go @@ -8,6 +8,7 @@ package boot import ( + _ "github.com/tiger1103/gfast/v3/internal/app/businesses/logic" _ "github.com/tiger1103/gfast/v3/internal/app/common/logic" _ "github.com/tiger1103/gfast/v3/internal/app/mqueue/logic" _ "github.com/tiger1103/gfast/v3/internal/app/system/logic" diff --git a/internal/app/businesses/controller/species_name.go b/internal/app/businesses/controller/species_name.go new file mode 100644 index 0000000..9a5922c --- /dev/null +++ b/internal/app/businesses/controller/species_name.go @@ -0,0 +1,56 @@ +// ========================================================================== +// GFast自动生成controller操作代码。 +// 生成日期:2025-08-06 11:24:51 +// 生成路径: internal/app/demo/controller/species_name.go +// 生成人:gfast +// desc: +// company:云南奇讯科技有限公司 +// ========================================================================== + +package controller + +import ( + "context" + + "github.com/tiger1103/gfast/v3/api/v1/businesses" + "github.com/tiger1103/gfast/v3/internal/app/businesses/service" + systemController "github.com/tiger1103/gfast/v3/internal/app/system/controller" +) + +type speciesNameController struct { + systemController.BaseController +} + +var SpeciesName = new(speciesNameController) + +// List 列表 +func (c *speciesNameController) List(ctx context.Context, req *demo.SpeciesNameSearchReq) (res *demo.SpeciesNameSearchRes, err error) { + res = new(demo.SpeciesNameSearchRes) + res.SpeciesNameSearchRes, err = service.SpeciesName().List(ctx, &req.SpeciesNameSearchReq) + return +} + +// Get 获取 +func (c *speciesNameController) Get(ctx context.Context, req *demo.SpeciesNameGetReq) (res *demo.SpeciesNameGetRes, err error) { + res = new(demo.SpeciesNameGetRes) + res.SpeciesNameInfoRes, err = service.SpeciesName().GetById(ctx, req.Id) + return +} + +// Add 添加 +func (c *speciesNameController) Add(ctx context.Context, req *demo.SpeciesNameAddReq) (res *demo.SpeciesNameAddRes, err error) { + err = service.SpeciesName().Add(ctx, req.SpeciesNameAddReq) + return +} + +// Edit 修改 +func (c *speciesNameController) Edit(ctx context.Context, req *demo.SpeciesNameEditReq) (res *demo.SpeciesNameEditRes, err error) { + err = service.SpeciesName().Edit(ctx, req.SpeciesNameEditReq) + return +} + +// Delete 删除 +func (c *speciesNameController) Delete(ctx context.Context, req *demo.SpeciesNameDeleteReq) (res *demo.SpeciesNameDeleteRes, err error) { + err = service.SpeciesName().Delete(ctx, req.Ids) + return +} diff --git a/internal/app/businesses/dao/internal/species_name.go b/internal/app/businesses/dao/internal/species_name.go new file mode 100644 index 0000000..fb98a9b --- /dev/null +++ b/internal/app/businesses/dao/internal/species_name.go @@ -0,0 +1,94 @@ +// ========================================================================== +// GFast自动生成dao internal操作代码。 +// 生成日期:2025-08-06 11:24:51 +// 生成路径: internal/app/demo/dao/internal/species_name.go +// 生成人:gfast +// desc: +// company:云南奇讯科技有限公司 +// ========================================================================== + +package internal + +import ( + "context" + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SpeciesNameDao is the manager for logic model data accessing and custom defined data operations functions management. +type SpeciesNameDao struct { + table string // Table is the underlying table name of the DAO. + group string // Group is the database configuration group name of current DAO. + columns SpeciesNameColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage. +} + +// SpeciesNameColumns defines and stores column names for table species_name. +type SpeciesNameColumns struct { + Id string // 主键 + SpeciesCode string // 物种编号 + Name string // 物种名称 + Content string // 物种名称内容 + SourcesData string // 数据来源 + CreateUser string // 数据采集人 + CreateDate string // 数据采集信息 + AuditUser string // 数据核查人 + AuditDate string // 数据核查日期 + Remark string // 备注 +} + +var speciesNameColumns = SpeciesNameColumns{ + Id: "id", + SpeciesCode: "species_code", + Name: "name", + Content: "content", + SourcesData: "sources_data", + CreateUser: "create_user", + CreateDate: "create_date", + AuditUser: "audit_user", + AuditDate: "audit_date", + Remark: "remark", +} + +// NewSpeciesNameDao creates and returns a new DAO object for table data access. +func NewSpeciesNameDao() *SpeciesNameDao { + return &SpeciesNameDao{ + group: "default", + table: "species_name", + columns: speciesNameColumns, + } +} + +// DB retrieves and returns the underlying raw database management object of current DAO. +func (dao *SpeciesNameDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of current dao. +func (dao *SpeciesNameDao) Table() string { + return dao.table +} + +// Columns returns all column names of current dao. +func (dao *SpeciesNameDao) Columns() SpeciesNameColumns { + return dao.columns +} + +// Group returns the configuration group name of database of current dao. +func (dao *SpeciesNameDao) Group() string { + return dao.group +} + +// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. +func (dao *SpeciesNameDao) Ctx(ctx context.Context) *gdb.Model { + return dao.DB().Model(dao.table).Safe().Ctx(ctx) +} + +// Transaction wraps the transaction logic using function f. +// It rollbacks the transaction and returns the error from function f if it returns non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note that, you should not Commit or Rollback the transaction in function f +// as it is automatically handled by this function. +func (dao *SpeciesNameDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/app/businesses/dao/species_name.go b/internal/app/businesses/dao/species_name.go new file mode 100644 index 0000000..e04d2c6 --- /dev/null +++ b/internal/app/businesses/dao/species_name.go @@ -0,0 +1,18 @@ +package dao + +import "github.com/tiger1103/gfast/v3/internal/app/businesses/dao/internal" + +// speciesNameDao is the manager for logic model data accessing and custom defined data operations functions management. +// You can define custom methods on it to extend its functionality as you wish. +type speciesNameDao struct { + *internal.SpeciesNameDao +} + +var ( + // SpeciesName is globally public accessible object for table tools_gen_table operations. + SpeciesName = speciesNameDao{ + internal.NewSpeciesNameDao(), + } +) + +// Fill with you ideas below. diff --git a/internal/app/businesses/logic/species_name.go b/internal/app/businesses/logic/species_name.go new file mode 100644 index 0000000..8707fb2 --- /dev/null +++ b/internal/app/businesses/logic/species_name.go @@ -0,0 +1,142 @@ +package logic + +import ( + "context" + + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/util/gconv" + "github.com/tiger1103/gfast/v3/internal/app/businesses/dao" + "github.com/tiger1103/gfast/v3/internal/app/businesses/model" + "github.com/tiger1103/gfast/v3/internal/app/businesses/model/do" + "github.com/tiger1103/gfast/v3/internal/app/businesses/service" + "github.com/tiger1103/gfast/v3/internal/app/system/consts" + "github.com/tiger1103/gfast/v3/library/liberr" +) + +func init() { + service.RegisterSpeciesName(New()) +} + +func New() service.ISpeciesName { + return &sSpeciesName{} +} + +type sSpeciesName struct{} + +func (s *sSpeciesName) List(ctx context.Context, req *model.SpeciesNameSearchReq) (listRes *model.SpeciesNameSearchRes, err error) { + listRes = new(model.SpeciesNameSearchRes) + err = g.Try(ctx, func(ctx context.Context) { + m := dao.SpeciesName.Ctx(ctx).WithAll() + if req.Id != "" { + m = m.Where(dao.SpeciesName.Columns().Id+" = ?", req.Id) + } + if req.SpeciesCode != "" { + m = m.Where(dao.SpeciesName.Columns().SpeciesCode+" = ?", req.SpeciesCode) + } + if req.Name != "" { + m = m.Where(dao.SpeciesName.Columns().Name+" like ?", "%"+req.Name+"%") + } + if req.Content != "" { + m = m.Where(dao.SpeciesName.Columns().Content+" = ?", req.Content) + } + if req.SourcesData != "" { + m = m.Where(dao.SpeciesName.Columns().SourcesData+" = ?", req.SourcesData) + } + if req.CreateUser != "" { + m = m.Where(dao.SpeciesName.Columns().CreateUser+" = ?", gconv.Int(req.CreateUser)) + } + if req.CreateDate != "" { + m = m.Where(dao.SpeciesName.Columns().CreateDate+" = ?", gconv.Time(req.CreateDate)) + } + if req.AuditUser != "" { + m = m.Where(dao.SpeciesName.Columns().AuditUser+" = ?", gconv.Int(req.AuditUser)) + } + if req.AuditDate != "" { + m = m.Where(dao.SpeciesName.Columns().AuditDate+" = ?", gconv.Time(req.AuditDate)) + } + listRes.Total, err = m.Count() + liberr.ErrIsNil(ctx, err, "获取总行数失败") + if req.PageNum == 0 { + req.PageNum = 1 + } + listRes.CurrentPage = req.PageNum + if req.PageSize == 0 { + req.PageSize = consts.PageSize + } + order := "id asc" + if req.OrderBy != "" { + order = req.OrderBy + } + var res []*model.SpeciesNameListRes + err = m.Page(req.PageNum, req.PageSize).Order(order).Scan(&res) + liberr.ErrIsNil(ctx, err, "获取数据失败") + listRes.List = make([]*model.SpeciesNameListRes, len(res)) + for k, v := range res { + listRes.List[k] = &model.SpeciesNameListRes{ + Id: v.Id, + SpeciesCode: v.SpeciesCode, + Name: v.Name, + Content: v.Content, + SourcesData: v.SourcesData, + CreateUser: v.CreateUser, + CreateDate: v.CreateDate, + AuditUser: v.AuditUser, + AuditDate: v.AuditDate, + Remark: v.Remark, + } + } + }) + return +} + +func (s *sSpeciesName) GetById(ctx context.Context, id int) (res *model.SpeciesNameInfoRes, err error) { + err = g.Try(ctx, func(ctx context.Context) { + err = dao.SpeciesName.Ctx(ctx).WithAll().Where(dao.SpeciesName.Columns().Id, id).Scan(&res) + liberr.ErrIsNil(ctx, err, "获取信息失败") + }) + return +} + +func (s *sSpeciesName) Add(ctx context.Context, req *model.SpeciesNameAddReq) (err error) { + err = g.Try(ctx, func(ctx context.Context) { + _, err = dao.SpeciesName.Ctx(ctx).Insert(do.SpeciesName{ + SpeciesCode: req.SpeciesCode, + Name: req.Name, + Content: req.Content, + SourcesData: req.SourcesData, + CreateUser: req.CreateUser, + CreateDate: req.CreateDate, + AuditUser: req.AuditUser, + AuditDate: req.AuditDate, + Remark: req.Remark, + }) + liberr.ErrIsNil(ctx, err, "添加失败") + }) + return +} + +func (s *sSpeciesName) Edit(ctx context.Context, req *model.SpeciesNameEditReq) (err error) { + err = g.Try(ctx, func(ctx context.Context) { + _, err = dao.SpeciesName.Ctx(ctx).WherePri(req.Id).Update(do.SpeciesName{ + SpeciesCode: req.SpeciesCode, + Name: req.Name, + Content: req.Content, + SourcesData: req.SourcesData, + CreateUser: req.CreateUser, + CreateDate: req.CreateDate, + AuditUser: req.AuditUser, + AuditDate: req.AuditDate, + Remark: req.Remark, + }) + liberr.ErrIsNil(ctx, err, "修改失败") + }) + return +} + +func (s *sSpeciesName) Delete(ctx context.Context, ids []int) (err error) { + err = g.Try(ctx, func(ctx context.Context) { + _, err = dao.SpeciesName.Ctx(ctx).Delete(dao.SpeciesName.Columns().Id+" in (?)", ids) + liberr.ErrIsNil(ctx, err, "删除失败") + }) + return +} diff --git a/internal/app/businesses/model/do/species_name.go b/internal/app/businesses/model/do/species_name.go new file mode 100644 index 0000000..8d935d1 --- /dev/null +++ b/internal/app/businesses/model/do/species_name.go @@ -0,0 +1,21 @@ +package do + +import ( + "github.com/gogf/gf/v2/os/gtime" + "github.com/gogf/gf/v2/util/gmeta" +) + +// SpeciesName is the golang structure for table species_name. +type SpeciesName struct { + gmeta.Meta `orm:"table:species_name, do:true"` + Id interface{} `orm:"id,primary" json:"id"` // 主键 + SpeciesCode interface{} `orm:"species_code" json:"speciesCode"` // 物种编号 + Name interface{} `orm:"name" json:"name"` // 物种名称 + Content interface{} `orm:"content" json:"content"` // 物种名称内容 + SourcesData interface{} `orm:"sources_data" json:"sourcesData"` // 数据来源 + CreateUser interface{} `orm:"create_user" json:"createUser"` // 数据采集人 + CreateDate *gtime.Time `orm:"create_date" json:"createDate"` // 数据采集信息 + AuditUser interface{} `orm:"audit_user" json:"auditUser"` // 数据核查人 + AuditDate *gtime.Time `orm:"audit_date" json:"auditDate"` // 数据核查日期 + Remark interface{} `orm:"remark" json:"remark"` // 备注 +} diff --git a/internal/app/businesses/model/entity/species_name.go b/internal/app/businesses/model/entity/species_name.go new file mode 100644 index 0000000..a9f5d34 --- /dev/null +++ b/internal/app/businesses/model/entity/species_name.go @@ -0,0 +1,21 @@ +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" + "github.com/gogf/gf/v2/util/gmeta" +) + +// SpeciesName is the golang structure for table species_name. +type SpeciesName struct { + gmeta.Meta `orm:"table:species_name"` + Id int `orm:"id,primary" json:"id"` // 主键 + SpeciesCode string `orm:"species_code" json:"speciesCode"` // 物种编号 + Name string `orm:"name" json:"name"` // 物种名称 + Content string `orm:"content" json:"content"` // 物种名称内容 + SourcesData string `orm:"sources_data" json:"sourcesData"` // 数据来源 + CreateUser int `orm:"create_user" json:"createUser"` // 数据采集人 + CreateDate *gtime.Time `orm:"create_date" json:"createDate"` // 数据采集信息 + AuditUser int `orm:"audit_user" json:"auditUser"` // 数据核查人 + AuditDate *gtime.Time `orm:"audit_date" json:"auditDate"` // 数据核查日期 + Remark string `orm:"remark" json:"remark"` // 备注 +} diff --git a/internal/app/businesses/model/species_name.go b/internal/app/businesses/model/species_name.go new file mode 100644 index 0000000..ab79d43 --- /dev/null +++ b/internal/app/businesses/model/species_name.go @@ -0,0 +1,82 @@ +package model + +import ( + "github.com/gogf/gf/v2/os/gtime" + "github.com/gogf/gf/v2/util/gmeta" + comModel "github.com/tiger1103/gfast/v3/internal/app/common/model" +) + +// SpeciesNameInfoRes is the golang structure for table species_name. +type SpeciesNameInfoRes struct { + gmeta.Meta `orm:"table:species_name"` + Id int `orm:"id,primary" json:"id" dc:"主键"` // 主键 + SpeciesCode string `orm:"species_code" json:"speciesCode" dc:"物种编号"` // 物种编号 + Name string `orm:"name" json:"name" dc:"物种名称"` // 物种名称 + Content string `orm:"content" json:"content" dc:"物种名称内容"` // 物种名称内容 + SourcesData string `orm:"sources_data" json:"sourcesData" dc:"数据来源"` // 数据来源 + CreateUser int `orm:"create_user" json:"createUser" dc:"数据采集人"` // 数据采集人 + CreateDate *gtime.Time `orm:"create_date" json:"createDate" dc:"数据采集信息"` // 数据采集信息 + AuditUser int `orm:"audit_user" json:"auditUser" dc:"数据核查人"` // 数据核查人 + AuditDate *gtime.Time `orm:"audit_date" json:"auditDate" dc:"数据核查日期"` // 数据核查日期 + Remark string `orm:"remark" json:"remark" dc:"备注"` // 备注 +} + +type SpeciesNameListRes struct { + Id int `json:"id" dc:"主键"` + SpeciesCode string `json:"speciesCode" dc:"物种编号"` + Name string `json:"name" dc:"物种名称"` + Content string `json:"content" dc:"物种名称内容"` + SourcesData string `json:"sourcesData" dc:"数据来源"` + CreateUser int `json:"createUser" dc:"数据采集人"` + CreateDate *gtime.Time `json:"createDate" dc:"数据采集信息"` + AuditUser int `json:"auditUser" dc:"数据核查人"` + AuditDate *gtime.Time `json:"auditDate" dc:"数据核查日期"` + Remark string `json:"remark" dc:"备注"` +} + +// SpeciesNameSearchReq 分页请求参数 +type SpeciesNameSearchReq struct { + comModel.PageReq + Id string `p:"id" dc:"主键"` //主键 + SpeciesCode string `p:"speciesCode" dc:"物种编号"` //物种编号 + Name string `p:"name" dc:"物种名称"` //物种名称 + Content string `p:"content" dc:"物种名称内容"` //物种名称内容 + SourcesData string `p:"sourcesData" dc:"数据来源"` //数据来源 + CreateUser string `p:"createUser" v:"createUser@integer#数据采集人需为整数" dc:"数据采集人"` //数据采集人 + CreateDate string `p:"createDate" v:"createDate@datetime#数据采集信息需为YYYY-MM-DD hh:mm:ss格式" dc:"数据采集信息"` //数据采集信息 + AuditUser string `p:"auditUser" v:"auditUser@integer#数据核查人需为整数" dc:"数据核查人"` //数据核查人 + AuditDate string `p:"auditDate" v:"auditDate@datetime#数据核查日期需为YYYY-MM-DD hh:mm:ss格式" dc:"数据核查日期"` //数据核查日期 +} + +// SpeciesNameSearchRes 列表返回结果 +type SpeciesNameSearchRes struct { + comModel.ListRes + List []*SpeciesNameListRes `json:"list"` +} + +// SpeciesNameAddReq 添加操作请求参数 +type SpeciesNameAddReq struct { + SpeciesCode string `p:"speciesCode" dc:"物种编号"` + Name string `p:"name" v:"required#物种名称不能为空" dc:"物种名称"` + Content string `p:"content" dc:"物种名称内容"` + SourcesData string `p:"sourcesData" dc:"数据来源"` + CreateUser int `p:"createUser" dc:"数据采集人"` + CreateDate *gtime.Time `p:"createDate" dc:"数据采集信息"` + AuditUser int `p:"auditUser" dc:"数据核查人"` + AuditDate *gtime.Time `p:"auditDate" dc:"数据核查日期"` + Remark string `p:"remark" dc:"备注"` +} + +// SpeciesNameEditReq 修改操作请求参数 +type SpeciesNameEditReq struct { + Id int `p:"id" v:"required#主键ID不能为空" dc:"主键"` + SpeciesCode string `p:"speciesCode" dc:"物种编号"` + Name string `p:"name" v:"required#物种名称不能为空" dc:"物种名称"` + Content string `p:"content" dc:"物种名称内容"` + SourcesData string `p:"sourcesData" dc:"数据来源"` + CreateUser int `p:"createUser" dc:"数据采集人"` + CreateDate *gtime.Time `p:"createDate" dc:"数据采集信息"` + AuditUser int `p:"auditUser" dc:"数据核查人"` + AuditDate *gtime.Time `p:"auditDate" dc:"数据核查日期"` + Remark string `p:"remark" dc:"备注"` +} diff --git a/internal/app/businesses/router/router.go b/internal/app/businesses/router/router.go new file mode 100644 index 0000000..4eb4c6b --- /dev/null +++ b/internal/app/businesses/router/router.go @@ -0,0 +1,30 @@ +package router + +import ( + "context" + + "github.com/gogf/gf/v2/net/ghttp" + "github.com/tiger1103/gfast/v3/internal/app/system/service" + "github.com/tiger1103/gfast/v3/library/libRouter" +) + +var R = new(Router) + +type Router struct{} + +func (router *Router) BindController(ctx context.Context, group *ghttp.RouterGroup) { + group.Group("/businesses", func(group *ghttp.RouterGroup) { + //context拦截器 + group.Middleware(service.Middleware().Ctx) + + //登录验证拦截 + service.GfToken().Middleware(group) + group.Middleware(service.Middleware().Auth) + //后台操作日志记录 + group.Hook("/*", ghttp.HookAfterOutput, service.OperateLog().OperationLog) + //自动绑定定义的控制器 + if err := libRouter.RouterAutoBind(ctx, router, group); err != nil { + panic(err) + } + }) +} diff --git a/internal/app/businesses/router/species_name.go b/internal/app/businesses/router/species_name.go new file mode 100644 index 0000000..5b72785 --- /dev/null +++ b/internal/app/businesses/router/species_name.go @@ -0,0 +1,16 @@ +package router + +import ( + "context" + + "github.com/gogf/gf/v2/net/ghttp" + "github.com/tiger1103/gfast/v3/internal/app/businesses/controller" +) + +func (router *Router) BindSpeciesNameController(ctx context.Context, group *ghttp.RouterGroup) { + group.Group("/speciesName", func(group *ghttp.RouterGroup) { + group.Bind( + controller.SpeciesName, + ) + }) +} diff --git a/internal/app/businesses/service/species_name.go b/internal/app/businesses/service/species_name.go new file mode 100644 index 0000000..9bf6889 --- /dev/null +++ b/internal/app/businesses/service/species_name.go @@ -0,0 +1,27 @@ +package service + +import ( + "context" + "github.com/tiger1103/gfast/v3/internal/app/businesses/model" +) + +type ISpeciesName interface { + List(ctx context.Context, req *model.SpeciesNameSearchReq) (res *model.SpeciesNameSearchRes, err error) + GetById(ctx context.Context, Id int) (res *model.SpeciesNameInfoRes, err error) + Add(ctx context.Context, req *model.SpeciesNameAddReq) (err error) + Edit(ctx context.Context, req *model.SpeciesNameEditReq) (err error) + Delete(ctx context.Context, Id []int) (err error) +} + +var localSpeciesName ISpeciesName + +func SpeciesName() ISpeciesName { + if localSpeciesName == nil { + panic("implement not found for interface ISpeciesName, forgot register?") + } + return localSpeciesName +} + +func RegisterSpeciesName(i ISpeciesName) { + localSpeciesName = i +} diff --git a/internal/router/router.go b/internal/router/router.go index 065b886..9032a9c 100644 --- a/internal/router/router.go +++ b/internal/router/router.go @@ -1,15 +1,9 @@ -/* -* @desc:路由绑定 -* @company:云南奇讯科技有限公司 -* @Author: yixiaohu -* @Date: 2022/2/18 16:23 - */ - package router import ( "context" "github.com/gogf/gf/v2/net/ghttp" + businesses "github.com/tiger1103/gfast/v3/internal/app/businesses/router" commonRouter "github.com/tiger1103/gfast/v3/internal/app/common/router" commonService "github.com/tiger1103/gfast/v3/internal/app/common/service" mqueueRouter "github.com/tiger1103/gfast/v3/internal/app/mqueue/router" @@ -32,6 +26,8 @@ func (router *Router) BindController(ctx context.Context, group *ghttp.RouterGro commonRouter.R.BindController(ctx, group) // 测试消息队列用,可以删除 mqueueRouter.R.BindController(ctx, group) + businesses.R.BindController(ctx, group) + //自动绑定定义的模块 if err := libRouter.RouterAutoBind(ctx, router, group); err != nil { panic(err) diff --git a/main.go b/main.go index 8b55f2c..d15b9a4 100644 --- a/main.go +++ b/main.go @@ -1,8 +1,12 @@ package main import ( - _ "github.com/gogf/gf/contrib/drivers/mysql/v2" + "fmt" _ "github.com/gogf/gf/contrib/drivers/pgsql/v2" + "github.com/gogf/gf/v2/frame/g" + + //_ "github.com/gogf/gf/contrib/drivers/sqlite/v2" + _ "github.com/gogf/gf/contrib/drivers/mysql/v2" _ "github.com/gogf/gf/contrib/nosql/redis/v2" "github.com/gogf/gf/v2/os/gctx" _ "github.com/tiger1103/gfast/v3/internal/app/boot" @@ -14,4 +18,22 @@ import ( func main() { cmd.Main.Run(gctx.New()) + fmt.Println(g.Server().GetRoutes()) + /*// 数据库文件路径 + dbPath := "zky.db" + // 打开数据库连接 + db, err := sql.Open("sqlite", dbPath) + if err != nil { + fmt.Println("无法打开数据库:", err) + return + } + defer db.Close() + + // 测试数据库连接 + err = db.Ping() + if err != nil { + fmt.Println("无法连接到数据库:", err) + return + } + fmt.Println("成功连接到数据库")*/ }