作者 yangfu

接口服务初始化

正在显示 100 个修改的文件 包含 3665 行增加42 行删除

要显示太多修改。

为保证性能只显示 100 of 100+ 个文件。

... ... @@ -27,4 +27,5 @@ _testmain.go
swagger.json
swagger.yaml
*.log
\ No newline at end of file
*.log
lastupdate.tmp
\ No newline at end of file
... ...
... ... @@ -3,13 +3,26 @@ module gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture
go 1.16
require (
github.com/ajg/form v1.5.1 // indirect
github.com/beego/beego/v2 v2.0.1
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/gavv/httpexpect v2.0.0+incompatible
github.com/go-pg/pg/v10 v10.9.0
github.com/klauspost/compress v1.11.8 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/imkira/go-interpol v1.1.0 // indirect
github.com/linmadan/egglib-go v0.0.0-20210313060205-8b5e456b11f7
github.com/onsi/ginkgo v1.15.2 // indirect
github.com/onsi/gomega v1.11.0 // indirect
golang.org/x/text v0.3.5 // indirect
github.com/moul/http2curl v1.0.0 // indirect
github.com/onsi/ginkgo v1.15.2
github.com/onsi/gomega v1.11.0
github.com/sergi/go-diff v1.2.0 // indirect
github.com/smartystreets/goconvey v1.7.2 // indirect
github.com/valyala/fasthttp v1.32.0 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 // indirect
github.com/yudai/gojsondiff v1.0.0 // indirect
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
github.com/yudai/pp v2.0.1+incompatible // indirect
)
replace github.com/linmadan/egglib-go v0.0.0-20210313060205-8b5e456b11f7 => github.com/tiptok/egglib-go v0.0.0-20210608073225-c852ce95ae34
... ...
... ... @@ -8,12 +8,18 @@ github.com/Shopify/sarama v1.25.0/go.mod h1:y/CFFTO9eaMTNriwu/Q+W4eioLqiDMGkA1W+
github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWsokNbMijUGhmcoBJc=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/StackExchange/wmi v0.0.0-20170410192909-ea383cf3ba6e/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU=
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6 h1:45bxf7AZMwWcqkLzDAQugVEwedisr5nRJ1r+7LYnv0U=
github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
github.com/alicebob/miniredis v2.5.0+incompatible h1:yBHoLpsyjupjz3NL3MhKMVkR41j82Yjf3KFv7ApYzUI=
github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk=
github.com/andybalholm/brotli v1.0.2 h1:JKnhI/XQ75uFBTiuzXpzFrUriDPiZjlOSzh6wXogP0E=
github.com/andybalholm/brotli v1.0.2/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
github.com/beego/beego/v2 v2.0.1 h1:07a7Z0Ok5vbqyqh+q53sDPl9LdhKh0ZDy3gbyGrhFnE=
github.com/beego/beego/v2 v2.0.1/go.mod h1:8zyHi1FnWO1mZLwTn62aKRIZF/aIKvkCBB2JYs+eqQI=
... ... @@ -71,8 +77,12 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 h1:DddqAaWDpywytcG8w/qoQ5sAN8X12d3Z3koB0C3Rxsc=
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/frankban/quicktest v1.4.1/go.mod h1:36zfPVQyHxymz4cH7wlDmVwDrJuljRB60qkgn7rorfQ=
... ... @@ -81,6 +91,8 @@ github.com/frankban/quicktest v1.7.2/go.mod h1:jaStnuzAqU1AJdCO0l53JDCJrVDKcS03D
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/gavv/httpexpect v2.0.0+incompatible h1:1X9kcRshkSKEjNJJxX9Y9mQ5BRfbxU5kORdjhlA1yX8=
github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/glendc/gopher-json v0.0.0-20170414221815-dc4743023d0c/go.mod h1:Gja1A+xZ9BoviGJNA2E9vFkPjjsl+CoJxSXiQM1UXtw=
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
... ... @@ -95,6 +107,7 @@ github.com/go-pg/pg/v10 v10.9.0/go.mod h1:rgmTPgHgl5EN2CNKKoMwC7QT62t8BqsdpEkUQu
github.com/go-pg/zerochecker v0.2.0 h1:pp7f72c3DobMWOb2ErtZsnrPaSvHd2W4o9//8HtF4mU=
github.com/go-pg/zerochecker v0.2.0/go.mod h1:NJZ4wKL0NmTtz0GKCoJ8kym6Xn/EQzXRl2OnAe7MmDo=
github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
github.com/go-redis/redis v6.15.7+incompatible h1:3skhDh95XQMpnqeqNftPkQD9jL9e5e36z/1SUm6dy1U=
github.com/go-redis/redis v6.15.7+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg=
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
... ... @@ -126,8 +139,10 @@ github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA=
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0=
github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
... ... @@ -135,21 +150,28 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gops v0.3.7/go.mod h1:bj0cwMmX1X4XIJFTjR99R5sCxNssNJ8HebFNvoQlmgY=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.14.3/go.mod h1:6CwZWGDSPRJidgKAtJVvND6soZe6fT7iteq8wDPdhb0=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
... ... @@ -157,6 +179,8 @@ github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+l
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/iancoleman/strcase v0.1.2/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE=
github.com/imkira/go-interpol v1.1.0 h1:KIiKr0VSG2CUW1hl1jpiyuzuJeKUUpC8iM1AIE7N1Vk=
github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03 h1:FUwcHNlEqkqLjLBdCp5PRlCFijNjvcYANOZXzCfXwCM=
github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o=
... ... @@ -168,6 +192,8 @@ github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/justinas/alice v1.2.0/go.mod h1:fN5HRH/reO/zrUflLfTN43t3vXvKzvZIENsNEe7i7qA=
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
... ... @@ -177,8 +203,8 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.9.7/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/klauspost/compress v1.11.8 h1:difgzQsp5mdAz9v8lm3P/I+EpDKMU/6uTMw1y1FObuo=
github.com/klauspost/compress v1.11.8/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.13.4 h1:0zhec2I8zGnjWcKyLl6i3gPqKANCCn5e9xmviEEeX6s=
github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
... ... @@ -196,10 +222,12 @@ github.com/magefile/mage v1.10.0 h1:3HiXzCUY12kh9bIuyXShaVe529fJfyqoVM42o/uom2g=
github.com/magefile/mage v1.10.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
... ... @@ -214,7 +242,10 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJ
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs=
github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
... ... @@ -279,6 +310,8 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo=
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
github.com/shirou/gopsutil v0.0.0-20180427012116-c95755e4bcd7/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
... ... @@ -291,7 +324,12 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.8.0 h1:nfhvjKcUMhBMVqbKHJlk5RPrrfYr/NMo3692g0dwfWU=
github.com/sirupsen/logrus v1.8.0/go.mod h1:4GuYW9TZmE769R5STWrRakJc4UqQ3+QQ95fyz7ENv1A=
github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs=
github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg=
github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
... ... @@ -307,6 +345,7 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
github.com/tal-tech/go-zero v1.0.27 h1:QMIbaTxibMc/OsO5RTAuKZ8ndbl2dGN6pITQEtp2x/A=
github.com/tal-tech/go-zero v1.0.27/go.mod h1:JtNXlsh/CgeIHyQnt5C5M2IcSevW7V0NAnqO93TQgm8=
github.com/tiptok/egglib-go v0.0.0-20210608073225-c852ce95ae34 h1:9iDNyYbfpv5KLWDLpDywD/aIODg+PNnwn+v9on7KGlE=
github.com/tiptok/egglib-go v0.0.0-20210608073225-c852ce95ae34/go.mod h1:KT8WFA2LPo5zVKbomCR6HocO4prnIY9DUVGekA3Ifo4=
... ... @@ -317,6 +356,11 @@ github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GH
github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.32.0 h1:keswgWzyKyNIIjz2a7JmCYHOOIkRp6HMx9oTV6QrZWY=
github.com/valyala/fasthttp v1.32.0/go.mod h1:2rsYD01CKFrjjsvFxx75KlEUNpWNBY9JWD3K/7o2Cus=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
github.com/vmihailenco/bufpool v0.1.11 h1:gOq2WmBrq0i2yW5QJ16ykccQ4wH9UyEsgLm6czKAd94=
github.com/vmihailenco/bufpool v0.1.11/go.mod h1:AFf/MOy3l2CFTKbxwt0mp2MwnqjNEs5H/UxrkA5jxTQ=
github.com/vmihailenco/msgpack/v5 v5.2.0/go.mod h1:fEM7KuHcnm0GvDCztRpw9hV0PuoO2ciTismP6vjggcM=
... ... @@ -329,12 +373,27 @@ github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV
github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc=
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg=
github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2/go.mod h1:hzfGeIUDq/j97IG+FhNqkowIyEcD88LrW6fyU3K3WqY=
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 h1:6fRhSjgLCkTD3JnJxvaJ4Sj+TYblw757bqYgZaOq5ZY=
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI=
github.com/yudai/gojsondiff v1.0.0 h1:27cbfqXLVEJ1o8I6v3y9lg8Ydm53EKqHXAOMxEGlCOA=
github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg=
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3IfnEUduWvb9is428/nNb5L3U01M=
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM=
github.com/yudai/pp v2.0.1+incompatible h1:Q4//iY4pNF6yPLZIigmvcl7k/bPgrcTPIFIcmawg5bI=
github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU=
github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb h1:ZkM6LRnq40pR1Ox0hTHlnpkcOTuFIDQpZ1IN8rKKhX0=
github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ=
go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698/go.mod h1:YoUyTScD3Vcv2RBm3eGVOq7i1ULiz3OuXoQFWOirmAM=
... ... @@ -352,6 +411,7 @@ go.opentelemetry.io/otel/trace v0.17.0/go.mod h1:bIujpqg6ZL6xUTubIUgziI1jSaUPthm
go.opentelemetry.io/otel/trace v0.19.0 h1:1ucYlenXIDA1OlHVLDZKX0ObXV5RLaq06DtUKz5e5zc=
go.opentelemetry.io/otel/trace v0.19.0/go.mod h1:4IXiNextNOpPnRlI4ryK69mn5iC84bjBWZQA5DXz/qg=
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/automaxprocs v1.3.0 h1:II28aZoGdaglS5vVNnspf28lnZpXScxtIozx1lAjdb0=
go.uber.org/automaxprocs v1.3.0/go.mod h1:9CWT6lKIep8U41DDaPiH6eFscnTyjfTANNQNx6LrIcA=
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
... ... @@ -366,8 +426,9 @@ golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210218145215-b8e89b74b9df/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 h1:It14KIkyBFYkHkwZ7k45minvA9aorojkyjGk9KJ5B/w=
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
... ... @@ -401,8 +462,9 @@ golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210510120150-4163338589ed h1:p9UgmWI9wKpfYmgaV/IZKGdXc5qEK45tDwwwDyjS26I=
golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
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=
... ... @@ -440,16 +502,18 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210218155724-8ebf48af031b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E=
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
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=
golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
... ... @@ -458,6 +522,7 @@ golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
... ... @@ -511,6 +576,7 @@ gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qS
gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/h2non/gock.v1 v1.0.15 h1:SzLqcIlb/fDfg7UvukMpNcWsu7sI5tWwL+KCATZqks0=
gopkg.in/h2non/gock.v1 v1.0.15/go.mod h1:sX4zAkdYX1TRGJ2JY156cFspQn4yRWn6p9EMdODlynE=
gopkg.in/jcmturner/aescts.v1 v1.0.1 h1:cVVZBK2b1zY26haWB4vbBiZrfFQnfbTVrE3xZq6hrEw=
gopkg.in/jcmturner/aescts.v1 v1.0.1/go.mod h1:nsR8qBOg+OucoIW+WMhB3GspUQXq9XorLnQb9XtvcOo=
... ...
... ... @@ -6,6 +6,12 @@ import (
"github.com/linmadan/egglib-go/log/logrus"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/constant"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/log"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/constant"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/redis"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/log"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego"
)
func main() {
... ...
... ... @@ -5,9 +5,9 @@ import (
"github.com/go-pg/pg/v10"
"github.com/go-pg/pg/v10/orm"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/constant"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
"reflect"
//_ "gitlab.fjmaimaimai.com/allied-creation/manufacture/pkg/infrastructure/pg/models"
"github.com/linmadan/egglib-go/persistent/pg/comment"
"github.com/linmadan/egglib-go/persistent/pg/hooks"
)
... ... @@ -24,7 +24,18 @@ func init() {
DB.AddQueryHook(hooks.SqlGeneratePrintHook{})
}
if !constant.DISABLE_CREATE_TABLE {
for _, model := range []interface{}{} {
for _, model := range []interface{}{
(*models.Device)(nil),
(*models.Product)(nil),
(*models.ProductAttendanceRecord)(nil),
(*models.ProductCalendar)(nil),
(*models.ProductGroup)(nil),
(*models.ProductJob)(nil),
(*models.ProductPlan)(nil),
(*models.ProductRecord)(nil),
(*models.UnitConversion)(nil),
(*models.Workshop)(nil),
} {
err := DB.Model(model).CreateTable(&orm.CreateTableOptions{
Temp: false,
IfNotExists: true,
... ... @@ -33,7 +44,32 @@ func init() {
if err != nil {
panic(err)
}
comment.AddComments(DB, model)
if !constant.DISABLE_SQL_GENERATE_COMMENT {
AddComments(DB, model)
}
}
}
}
func AddComments(db *pg.DB, model interface{}) {
tableName := db.Model(model).TableModel().Table().SQLName
columnsMap := make(map[string]*orm.Field)
columns := db.Model(model).TableModel().Table().Fields
for _, item := range columns {
columnsMap[item.GoName] = item
}
valueOf := reflect.TypeOf(model)
for i := 0; i < valueOf.Elem().NumField(); i++ {
field := valueOf.Elem().Field(i)
comment := field.Tag.Get("comment")
if comment != "" {
if field.Name == "tableName" {
_, _ = db.Exec(fmt.Sprintf("COMMENT ON TABLE %s IS '%s';", tableName, comment))
} else {
if columnField, ok := columnsMap[field.Name]; ok {
_, _ = db.Exec(fmt.Sprintf("COMMENT ON COLUMN %s.%s IS '%s';", tableName, columnField.SQLName, comment))
}
}
}
}
}
... ...
... ... @@ -6,13 +6,15 @@ import (
)
type Device struct {
tableName string `comment:"设备" pg:"devices,alias:device"`
tableName string `comment:"设备" pg:"manufacture.device,alias:device"`
// 设备Id
DeviceId int `comment:"设备Id" pg:"pk:device_id"`
// 企业id
CompanyId int `comment:"企业id"`
// 组织ID
OrgId int `comment:"组织ID"`
// 所属位置
WorkStation *domain.WorkStation `comment:"所属位置"`
// 设备编号
DeviceCode string `comment:"设备编号"`
// 设备名称
... ... @@ -32,7 +34,5 @@ type Device struct {
// 更新时间
UpdatedAt time.Time `comment:"更新时间"`
// 删除时间
DeletedAt time.Time `comment:"删除时间"`
// 所属位置
WorkStation *domain.WorkStation `comment:"所属位置"`
DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"`
}
... ...
... ... @@ -6,7 +6,7 @@ import (
)
type Product struct {
tableName string `comment:"产品信息" pg:"products,alias:product"`
tableName string `comment:"产品信息" pg:"manufacture.product,alias:product"`
// 企业id
CompanyId int `comment:"企业id"`
// 组织ID
... ... @@ -26,5 +26,5 @@ type Product struct {
// 更新时间
UpdatedAt time.Time `comment:"更新时间"`
// 删除时间
DeletedAt time.Time `comment:"删除时间"`
DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"`
}
... ...
... ... @@ -6,9 +6,11 @@ import (
)
type ProductAttendanceRecord struct {
tableName string `comment:"生产考勤记录" pg:"product_attendance_records,alias:product_attendance_record"`
tableName string `comment:"生产考勤记录" pg:"manufacture.product_attendance_record,alias:product_attendance_record"`
// 考勤记录ID
ProductAttendanceId int `comment:"考勤记录ID"`
// 企业id
CompanyId int `comment:"企业id"`
// 组织ID
OrgId int `comment:"组织ID"`
// 产品ID
... ... @@ -34,5 +36,5 @@ type ProductAttendanceRecord struct {
// 更新时间
UpdatedAt time.Time `comment:"更新时间"`
// 删除时间
DeletedAt time.Time `comment:"删除时间"`
DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"`
}
... ...
... ... @@ -6,7 +6,7 @@ import (
)
type ProductCalendar struct {
tableName string `comment:"工厂日历" pg:"product_calendars,alias:product_calendar"`
tableName string `comment:"工厂日历" pg:"manufacture.product_calendar,alias:product_calendar"`
// 工厂日历ID
ProductCalendarId int `comment:"工厂日历ID" pg:"pk:product_calendar_id"`
// 企业id
... ... @@ -32,5 +32,5 @@ type ProductCalendar struct {
// 更新时间
UpdatedAt time.Time `comment:"更新时间"`
// 删除时间
DeletedAt time.Time `comment:"删除时间"`
DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"`
}
... ...
... ... @@ -6,7 +6,7 @@ import (
)
type ProductGroup struct {
tableName string `comment:"生产班组" pg:"product_groups,alias:product_group"`
tableName string `comment:"生产班组" pg:"manufacture.product_group,alias:product_group"`
// 生产小组ID
ProductGroupId int `comment:"生产小组ID" pg:"pk:product_group_id"`
// 企业id
... ... @@ -18,7 +18,7 @@ type ProductGroup struct {
// 班组长
GroupLeader *domain.User `comment:"班组长"`
// 帮组成员列表
GroupMembers []*domain.User `comment:"帮组成员列表" pg:",array"`
GroupMembers []*domain.User `comment:"帮组成员列表"`
// 上班班次 1:全天 2:白班 4:中班 8:夜班
WorkOn int `comment:"上班班次 1:全天 2:白班 4:中班 8:夜班"`
// 工作位置
... ... @@ -28,5 +28,5 @@ type ProductGroup struct {
// 更新时间
UpdatedAt time.Time `comment:"更新时间"`
// 删除时间
DeletedAt time.Time `comment:"删除时间"`
DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"`
}
... ...
... ... @@ -6,7 +6,7 @@ import (
)
type ProductJob struct {
tableName string `comment:"工位(车间-生产线-工段-工位)" pg:"product_jobs,alias:product_job"`
tableName string `comment:"工位(车间-生产线-工段-工位)" pg:"manufacture.product_job,alias:product_job"`
// 工位ID
ProductJobId int `comment:"工位ID" pg:"pk:product_job_id"`
// 企业id
... ... @@ -24,5 +24,5 @@ type ProductJob struct {
// 工作位置
WorkStation *domain.WorkStation `comment:"工作位置"`
// 关联设备列表
RelatedDevices []int `comment:"关联设备列表" pg:",array"`
RelatedDevices []int `pg:",soft_delete" comment:"关联设备列表" pg:",array"`
}
... ...
... ... @@ -6,7 +6,7 @@ import (
)
type ProductPlan struct {
tableName string `comment:"生产计划" pg:"product_plans,alias:product_plan"`
tableName string `comment:"生产计划" pg:"product_plans,alias:manufacture.product_plan"`
// 生产计划ID
ProductPlanId int `comment:"生产计划ID" pg:"pk:product_plan_id"`
// 企业id
... ... @@ -38,5 +38,5 @@ type ProductPlan struct {
// 更新时间
UpdatedAt time.Time `comment:"更新时间"`
// 删除时间
DeletedAt time.Time `comment:"删除时间"`
DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"`
}
... ...
... ... @@ -6,7 +6,7 @@ import (
)
type ProductRecord struct {
tableName string `comment:"生产记录" pg:"product_records,alias:product_record"`
tableName string `comment:"生产记录" pg:"manufacture.product_records,alias:product_record"`
// 生产记录ID
ProductRecordId int `comment:"生产记录ID" pg:"pk:product_record_id"`
// 企业id
... ... @@ -24,7 +24,7 @@ type ProductRecord struct {
// 更新时间
UpdatedAt time.Time `comment:"更新时间"`
// 删除时间
DeletedAt time.Time `comment:"删除时间"`
DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"`
// 生产记录信息
ProductRecordInfo *domain.ProductRecordInfo `comment:"生产记录信息"`
}
... ...
... ... @@ -6,7 +6,7 @@ import (
)
type UnitConversion struct {
tableName string `comment:"单位换算" pg:"unit_conversions,alias:unit_conversion"`
tableName string `comment:"单位换算" pg:"manufacture.unit_conversion,alias:unit_conversion"`
// 单位换算ID
UnitConversionId int `comment:"单位换算ID" pg:"pk:unit_conversion_id"`
// 企业id
... ... @@ -28,5 +28,5 @@ type UnitConversion struct {
// 更新时间
UpdatedAt time.Time `comment:"更新时间"`
// 删除时间
DeletedAt time.Time `comment:"删除时间"`
DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"`
}
... ...
... ... @@ -6,7 +6,7 @@ import (
)
type Workshop struct {
tableName string `comment:"车间" pg:"workshops,alias:workshop"`
tableName string `comment:"车间" pg:"manufacture.workshop,alias:workshop"`
// 企业id
CompanyId int `comment:"企业id"`
// 组织ID
... ... @@ -18,11 +18,11 @@ type Workshop struct {
// 负责人 (用户对象)
Principal *domain.User `comment:"负责人 (用户对象)"`
// 生产线
ProductLines []*domain.ProductLine `comment:"生产线" pg:",array"`
ProductLines []*domain.ProductLine `comment:"生产线" `
// 创建时间
CreatedAt time.Time `comment:"创建时间"`
// 更新时间
UpdatedAt time.Time `comment:"更新时间"`
// 删除时间
DeletedAt time.Time `comment:"删除时间"`
DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"`
}
... ...
package redis
import (
ilog "github.com/linmadan/egglib-go/log"
"github.com/linmadan/egglib-go/persistent/cache"
"github.com/linmadan/egglib-go/persistent/cache/gzcache"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/constant"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/log"
)
func init() {
cache.NewDefaultCache(cache.WithDebugLog(true, func() ilog.Logger { return log.Logger }))
cache.RegisterCache(gzcache.NewNodeCache(constant.REDIS_HOST+":"+constant.REDIS_PORT, constant.REDIS_AUTH))
}
... ...
... ... @@ -6,8 +6,8 @@ import (
"os"
"strconv"
//_ "gitlab.fjmaimaimai.com/allied-creation/manufacture/pkg/port/beego/routers"
. "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/log"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego/routers"
)
func init() {
... ...
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/device/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/device/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/device/service"
)
type DeviceController struct {
beego.BaseController
}
func (controller *DeviceController) CreateDevice() {
deviceService := service.NewDeviceService(nil)
createDeviceCommand := &command.CreateDeviceCommand{}
controller.Unmarshal(createDeviceCommand)
data, err := deviceService.CreateDevice(createDeviceCommand)
controller.Response(data, err)
}
func (controller *DeviceController) UpdateDevice() {
deviceService := service.NewDeviceService(nil)
updateDeviceCommand := &command.UpdateDeviceCommand{}
controller.Unmarshal(updateDeviceCommand)
deviceId, _ := controller.GetInt(":deviceId")
updateDeviceCommand.DeviceId = deviceId
data, err := deviceService.UpdateDevice(updateDeviceCommand)
controller.Response(data, err)
}
func (controller *DeviceController) GetDevice() {
deviceService := service.NewDeviceService(nil)
getDeviceQuery := &query.GetDeviceQuery{}
deviceId, _ := controller.GetInt(":deviceId")
getDeviceQuery.DeviceId = deviceId
data, err := deviceService.GetDevice(getDeviceQuery)
controller.Response(data, err)
}
func (controller *DeviceController) RemoveDevice() {
deviceService := service.NewDeviceService(nil)
removeDeviceCommand := &command.RemoveDeviceCommand{}
controller.Unmarshal(removeDeviceCommand)
deviceId, _ := controller.GetInt(":deviceId")
removeDeviceCommand.DeviceId = deviceId
data, err := deviceService.RemoveDevice(removeDeviceCommand)
controller.Response(data, err)
}
func (controller *DeviceController) ListDevice() {
deviceService := service.NewDeviceService(nil)
listDeviceQuery := &query.ListDeviceQuery{}
offset, _ := controller.GetInt("offset")
listDeviceQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listDeviceQuery.Limit = limit
data, err := deviceService.ListDevice(listDeviceQuery)
controller.Response(data, err)
}
... ...
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productCalendar/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productCalendar/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productCalendar/service"
)
type ProductCalendarController struct {
beego.BaseController
}
func (controller *ProductCalendarController) CreateProductCalendar() {
productCalendarService := service.NewProductCalendarService(nil)
createProductCalendarCommand := &command.CreateProductCalendarCommand{}
controller.Unmarshal(createProductCalendarCommand)
data, err := productCalendarService.CreateProductCalendar(createProductCalendarCommand)
controller.Response(data, err)
}
func (controller *ProductCalendarController) UpdateProductCalendar() {
productCalendarService := service.NewProductCalendarService(nil)
updateProductCalendarCommand := &command.UpdateProductCalendarCommand{}
controller.Unmarshal(updateProductCalendarCommand)
productCalendarId, _ := controller.GetInt(":productCalendarId")
updateProductCalendarCommand.ProductCalendarId = productCalendarId
data, err := productCalendarService.UpdateProductCalendar(updateProductCalendarCommand)
controller.Response(data, err)
}
func (controller *ProductCalendarController) GetProductCalendar() {
productCalendarService := service.NewProductCalendarService(nil)
getProductCalendarQuery := &query.GetProductCalendarQuery{}
productCalendarId, _ := controller.GetInt(":productCalendarId")
getProductCalendarQuery.ProductCalendarId = productCalendarId
data, err := productCalendarService.GetProductCalendar(getProductCalendarQuery)
controller.Response(data, err)
}
func (controller *ProductCalendarController) RemoveProductCalendar() {
productCalendarService := service.NewProductCalendarService(nil)
removeProductCalendarCommand := &command.RemoveProductCalendarCommand{}
controller.Unmarshal(removeProductCalendarCommand)
productCalendarId, _ := controller.GetInt(":productCalendarId")
removeProductCalendarCommand.ProductCalendarId = productCalendarId
data, err := productCalendarService.RemoveProductCalendar(removeProductCalendarCommand)
controller.Response(data, err)
}
func (controller *ProductCalendarController) ListProductCalendar() {
productCalendarService := service.NewProductCalendarService(nil)
listProductCalendarQuery := &query.ListProductCalendarQuery{}
offset, _ := controller.GetInt("offset")
listProductCalendarQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listProductCalendarQuery.Limit = limit
data, err := productCalendarService.ListProductCalendar(listProductCalendarQuery)
controller.Response(data, err)
}
... ...
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/product/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/product/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/product/service"
)
type ProductController struct {
beego.BaseController
}
func (controller *ProductController) CreateProduct() {
productService := service.NewProductService(nil)
createProductCommand := &command.CreateProductCommand{}
controller.Unmarshal(createProductCommand)
data, err := productService.CreateProduct(createProductCommand)
controller.Response(data, err)
}
func (controller *ProductController) UpdateProduct() {
productService := service.NewProductService(nil)
updateProductCommand := &command.UpdateProductCommand{}
controller.Unmarshal(updateProductCommand)
productId, _ := controller.GetInt(":productId")
updateProductCommand.ProductId = productId
data, err := productService.UpdateProduct(updateProductCommand)
controller.Response(data, err)
}
func (controller *ProductController) GetProduct() {
productService := service.NewProductService(nil)
getProductQuery := &query.GetProductQuery{}
productId, _ := controller.GetInt(":productId")
getProductQuery.ProductId = productId
data, err := productService.GetProduct(getProductQuery)
controller.Response(data, err)
}
func (controller *ProductController) RemoveProduct() {
productService := service.NewProductService(nil)
removeProductCommand := &command.RemoveProductCommand{}
controller.Unmarshal(removeProductCommand)
productId, _ := controller.GetInt(":productId")
removeProductCommand.ProductId = productId
data, err := productService.RemoveProduct(removeProductCommand)
controller.Response(data, err)
}
func (controller *ProductController) ListProduct() {
productService := service.NewProductService(nil)
listProductQuery := &query.ListProductQuery{}
offset, _ := controller.GetInt("offset")
listProductQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listProductQuery.Limit = limit
data, err := productService.ListProduct(listProductQuery)
controller.Response(data, err)
}
... ...
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productGroup/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productGroup/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productGroup/service"
)
type ProductGroupController struct {
beego.BaseController
}
func (controller *ProductGroupController) CreateProductGroup() {
productGroupService := service.NewProductGroupService(nil)
createProductGroupCommand := &command.CreateProductGroupCommand{}
controller.Unmarshal(createProductGroupCommand)
data, err := productGroupService.CreateProductGroup(createProductGroupCommand)
controller.Response(data, err)
}
func (controller *ProductGroupController) UpdateProductGroup() {
productGroupService := service.NewProductGroupService(nil)
updateProductGroupCommand := &command.UpdateProductGroupCommand{}
controller.Unmarshal(updateProductGroupCommand)
productGroupId, _ := controller.GetInt(":productGroupId")
updateProductGroupCommand.ProductGroupId = productGroupId
data, err := productGroupService.UpdateProductGroup(updateProductGroupCommand)
controller.Response(data, err)
}
func (controller *ProductGroupController) GetProductGroup() {
productGroupService := service.NewProductGroupService(nil)
getProductGroupQuery := &query.GetProductGroupQuery{}
productGroupId, _ := controller.GetInt(":productGroupId")
getProductGroupQuery.ProductGroupId = productGroupId
data, err := productGroupService.GetProductGroup(getProductGroupQuery)
controller.Response(data, err)
}
func (controller *ProductGroupController) RemoveProductGroup() {
productGroupService := service.NewProductGroupService(nil)
removeProductGroupCommand := &command.RemoveProductGroupCommand{}
controller.Unmarshal(removeProductGroupCommand)
productGroupId, _ := controller.GetInt(":productGroupId")
removeProductGroupCommand.ProductGroupId = productGroupId
data, err := productGroupService.RemoveProductGroup(removeProductGroupCommand)
controller.Response(data, err)
}
func (controller *ProductGroupController) ListProductGroup() {
productGroupService := service.NewProductGroupService(nil)
listProductGroupQuery := &query.ListProductGroupQuery{}
offset, _ := controller.GetInt("offset")
listProductGroupQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listProductGroupQuery.Limit = limit
data, err := productGroupService.ListProductGroup(listProductGroupQuery)
controller.Response(data, err)
}
... ...
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productJob/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productJob/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productJob/service"
)
type ProductJobController struct {
beego.BaseController
}
func (controller *ProductJobController) CreateProductJob() {
productJobService := service.NewProductJobService(nil)
createProductJobCommand := &command.CreateProductJobCommand{}
controller.Unmarshal(createProductJobCommand)
data, err := productJobService.CreateProductJob(createProductJobCommand)
controller.Response(data, err)
}
func (controller *ProductJobController) UpdateProductJob() {
productJobService := service.NewProductJobService(nil)
updateProductJobCommand := &command.UpdateProductJobCommand{}
controller.Unmarshal(updateProductJobCommand)
productJobId, _ := controller.GetInt(":productJobId")
updateProductJobCommand.ProductJobId = productJobId
data, err := productJobService.UpdateProductJob(updateProductJobCommand)
controller.Response(data, err)
}
func (controller *ProductJobController) GetProductJob() {
productJobService := service.NewProductJobService(nil)
getProductJobQuery := &query.GetProductJobQuery{}
productJobId, _ := controller.GetInt(":productJobId")
getProductJobQuery.ProductJobId = productJobId
data, err := productJobService.GetProductJob(getProductJobQuery)
controller.Response(data, err)
}
func (controller *ProductJobController) RemoveProductJob() {
productJobService := service.NewProductJobService(nil)
removeProductJobCommand := &command.RemoveProductJobCommand{}
controller.Unmarshal(removeProductJobCommand)
productJobId, _ := controller.GetInt(":productJobId")
removeProductJobCommand.ProductJobId = productJobId
data, err := productJobService.RemoveProductJob(removeProductJobCommand)
controller.Response(data, err)
}
func (controller *ProductJobController) ListProductJob() {
productJobService := service.NewProductJobService(nil)
listProductJobQuery := &query.ListProductJobQuery{}
offset, _ := controller.GetInt("offset")
listProductJobQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listProductJobQuery.Limit = limit
data, err := productJobService.ListProductJob(listProductJobQuery)
controller.Response(data, err)
}
... ...
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productLine/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productLine/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productLine/service"
)
type ProductLineController struct {
beego.BaseController
}
func (controller *ProductLineController) CreateProductLine() {
productLineService := service.NewProductLineService(nil)
createProductLineCommand := &command.CreateProductLineCommand{}
controller.Unmarshal(createProductLineCommand)
data, err := productLineService.CreateProductLine(createProductLineCommand)
controller.Response(data, err)
}
func (controller *ProductLineController) UpdateProductLine() {
productLineService := service.NewProductLineService(nil)
updateProductLineCommand := &command.UpdateProductLineCommand{}
controller.Unmarshal(updateProductLineCommand)
lineId, _ := controller.GetInt(":lineId")
updateProductLineCommand.LineId = lineId
data, err := productLineService.UpdateProductLine(updateProductLineCommand)
controller.Response(data, err)
}
func (controller *ProductLineController) GetProductLine() {
productLineService := service.NewProductLineService(nil)
getProductLineQuery := &query.GetProductLineQuery{}
lineId, _ := controller.GetInt(":lineId")
getProductLineQuery.LineId = lineId
data, err := productLineService.GetProductLine(getProductLineQuery)
controller.Response(data, err)
}
func (controller *ProductLineController) RemoveProductLine() {
productLineService := service.NewProductLineService(nil)
removeProductLineCommand := &command.RemoveProductLineCommand{}
controller.Unmarshal(removeProductLineCommand)
lineId, _ := controller.GetInt(":lineId")
removeProductLineCommand.LineId = lineId
data, err := productLineService.RemoveProductLine(removeProductLineCommand)
controller.Response(data, err)
}
func (controller *ProductLineController) ListProductLine() {
productLineService := service.NewProductLineService(nil)
listProductLineQuery := &query.ListProductLineQuery{}
offset, _ := controller.GetInt("offset")
listProductLineQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listProductLineQuery.Limit = limit
data, err := productLineService.ListProductLine(listProductLineQuery)
controller.Response(data, err)
}
... ...
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productPlan/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productPlan/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productPlan/service"
)
type ProductPlanController struct {
beego.BaseController
}
func (controller *ProductPlanController) CreateProductPlan() {
productPlanService := service.NewProductPlanService(nil)
createProductPlanCommand := &command.CreateProductPlanCommand{}
controller.Unmarshal(createProductPlanCommand)
data, err := productPlanService.CreateProductPlan(createProductPlanCommand)
controller.Response(data, err)
}
func (controller *ProductPlanController) UpdateProductPlan() {
productPlanService := service.NewProductPlanService(nil)
updateProductPlanCommand := &command.UpdateProductPlanCommand{}
controller.Unmarshal(updateProductPlanCommand)
productPlanId, _ := controller.GetInt(":productPlanId")
updateProductPlanCommand.ProductPlanId = productPlanId
data, err := productPlanService.UpdateProductPlan(updateProductPlanCommand)
controller.Response(data, err)
}
func (controller *ProductPlanController) GetProductPlan() {
productPlanService := service.NewProductPlanService(nil)
getProductPlanQuery := &query.GetProductPlanQuery{}
productPlanId, _ := controller.GetInt(":productPlanId")
getProductPlanQuery.ProductPlanId = productPlanId
data, err := productPlanService.GetProductPlan(getProductPlanQuery)
controller.Response(data, err)
}
func (controller *ProductPlanController) RemoveProductPlan() {
productPlanService := service.NewProductPlanService(nil)
removeProductPlanCommand := &command.RemoveProductPlanCommand{}
controller.Unmarshal(removeProductPlanCommand)
productPlanId, _ := controller.GetInt(":productPlanId")
removeProductPlanCommand.ProductPlanId = productPlanId
data, err := productPlanService.RemoveProductPlan(removeProductPlanCommand)
controller.Response(data, err)
}
func (controller *ProductPlanController) ListProductPlan() {
productPlanService := service.NewProductPlanService(nil)
listProductPlanQuery := &query.ListProductPlanQuery{}
offset, _ := controller.GetInt("offset")
listProductPlanQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listProductPlanQuery.Limit = limit
data, err := productPlanService.ListProductPlan(listProductPlanQuery)
controller.Response(data, err)
}
func (controller *ProductPlanController) ReceiveMaterial() {
productPlanService := service.NewProductPlanService(nil)
receiveMaterialCommand := &command.ReceiveMaterialCommand{}
controller.Unmarshal(receiveMaterialCommand)
data, err := productPlanService.ReceiveMaterial(receiveMaterialCommand)
controller.Response(data, err)
}
func (controller *ProductPlanController) ReturnMaterial() {
productPlanService := service.NewProductPlanService(nil)
returnMaterialCommand := &command.ReturnMaterialCommand{}
controller.Unmarshal(returnMaterialCommand)
data, err := productPlanService.ReturnMaterial(returnMaterialCommand)
controller.Response(data, err)
}
func (controller *ProductPlanController) SetOnline() {
productPlanService := service.NewProductPlanService(nil)
setOnlineCommand := &command.SetOnlineCommand{}
controller.Unmarshal(setOnlineCommand)
data, err := productPlanService.SetOnline(setOnlineCommand)
controller.Response(data, err)
}
func (controller *ProductPlanController) Switch() {
productPlanService := service.NewProductPlanService(nil)
switchCommand := &command.SwitchCommand{}
controller.Unmarshal(switchCommand)
data, err := productPlanService.Switch(switchCommand)
controller.Response(data, err)
}
func (controller *ProductPlanController) SubmitProductRecord() {
productPlanService := service.NewProductPlanService(nil)
submitProductRecordCommand := &command.SubmitProductRecordCommand{}
controller.Unmarshal(submitProductRecordCommand)
data, err := productPlanService.SubmitProductRecord(submitProductRecordCommand)
controller.Response(data, err)
}
... ...
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productSection/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productSection/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productSection/service"
)
type ProductSectionController struct {
beego.BaseController
}
func (controller *ProductSectionController) CreateProductSection() {
productSectionService := service.NewProductSectionService(nil)
createProductSectionCommand := &command.CreateProductSectionCommand{}
controller.Unmarshal(createProductSectionCommand)
data, err := productSectionService.CreateProductSection(createProductSectionCommand)
controller.Response(data, err)
}
func (controller *ProductSectionController) UpdateProductSection() {
productSectionService := service.NewProductSectionService(nil)
updateProductSectionCommand := &command.UpdateProductSectionCommand{}
controller.Unmarshal(updateProductSectionCommand)
sectionId, _ := controller.GetInt(":sectionId")
updateProductSectionCommand.SectionId = sectionId
data, err := productSectionService.UpdateProductSection(updateProductSectionCommand)
controller.Response(data, err)
}
func (controller *ProductSectionController) GetProductSection() {
productSectionService := service.NewProductSectionService(nil)
getProductSectionQuery := &query.GetProductSectionQuery{}
sectionId, _ := controller.GetInt(":sectionId")
getProductSectionQuery.SectionId = sectionId
data, err := productSectionService.GetProductSection(getProductSectionQuery)
controller.Response(data, err)
}
func (controller *ProductSectionController) RemoveProductSection() {
productSectionService := service.NewProductSectionService(nil)
removeProductSectionCommand := &command.RemoveProductSectionCommand{}
controller.Unmarshal(removeProductSectionCommand)
sectionId, _ := controller.GetInt(":sectionId")
removeProductSectionCommand.SectionId = sectionId
data, err := productSectionService.RemoveProductSection(removeProductSectionCommand)
controller.Response(data, err)
}
func (controller *ProductSectionController) ListProductSection() {
productSectionService := service.NewProductSectionService(nil)
listProductSectionQuery := &query.ListProductSectionQuery{}
offset, _ := controller.GetInt("offset")
listProductSectionQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listProductSectionQuery.Limit = limit
data, err := productSectionService.ListProductSection(listProductSectionQuery)
controller.Response(data, err)
}
... ...
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/unitConversion/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/unitConversion/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/unitConversion/service"
)
type UnitConversionController struct {
beego.BaseController
}
func (controller *UnitConversionController) CreateUnitConversion() {
unitConversionService := service.NewUnitConversionService(nil)
createUnitConversionCommand := &command.CreateUnitConversionCommand{}
controller.Unmarshal(createUnitConversionCommand)
data, err := unitConversionService.CreateUnitConversion(createUnitConversionCommand)
controller.Response(data, err)
}
func (controller *UnitConversionController) UpdateUnitConversion() {
unitConversionService := service.NewUnitConversionService(nil)
updateUnitConversionCommand := &command.UpdateUnitConversionCommand{}
controller.Unmarshal(updateUnitConversionCommand)
unitConversionId, _ := controller.GetInt(":unitConversionId")
updateUnitConversionCommand.UnitConversionId = unitConversionId
data, err := unitConversionService.UpdateUnitConversion(updateUnitConversionCommand)
controller.Response(data, err)
}
func (controller *UnitConversionController) GetUnitConversion() {
unitConversionService := service.NewUnitConversionService(nil)
getUnitConversionQuery := &query.GetUnitConversionQuery{}
unitConversionId, _ := controller.GetInt(":unitConversionId")
getUnitConversionQuery.UnitConversionId = unitConversionId
data, err := unitConversionService.GetUnitConversion(getUnitConversionQuery)
controller.Response(data, err)
}
func (controller *UnitConversionController) RemoveUnitConversion() {
unitConversionService := service.NewUnitConversionService(nil)
removeUnitConversionCommand := &command.RemoveUnitConversionCommand{}
controller.Unmarshal(removeUnitConversionCommand)
unitConversionId, _ := controller.GetInt(":unitConversionId")
removeUnitConversionCommand.UnitConversionId = unitConversionId
data, err := unitConversionService.RemoveUnitConversion(removeUnitConversionCommand)
controller.Response(data, err)
}
func (controller *UnitConversionController) ListUnitConversion() {
unitConversionService := service.NewUnitConversionService(nil)
listUnitConversionQuery := &query.ListUnitConversionQuery{}
offset, _ := controller.GetInt("offset")
listUnitConversionQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listUnitConversionQuery.Limit = limit
data, err := unitConversionService.ListUnitConversion(listUnitConversionQuery)
controller.Response(data, err)
}
... ...
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/workshop/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/workshop/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/workshop/service"
)
type WorkshopController struct {
beego.BaseController
}
func (controller *WorkshopController) CreateWorkshop() {
workshopService := service.NewWorkshopService(nil)
createWorkshopCommand := &command.CreateWorkshopCommand{}
controller.Unmarshal(createWorkshopCommand)
data, err := workshopService.CreateWorkshop(createWorkshopCommand)
controller.Response(data, err)
}
func (controller *WorkshopController) UpdateWorkshop() {
workshopService := service.NewWorkshopService(nil)
updateWorkshopCommand := &command.UpdateWorkshopCommand{}
controller.Unmarshal(updateWorkshopCommand)
workshopId, _ := controller.GetInt(":workshopId")
updateWorkshopCommand.WorkshopId = workshopId
data, err := workshopService.UpdateWorkshop(updateWorkshopCommand)
controller.Response(data, err)
}
func (controller *WorkshopController) GetWorkshop() {
workshopService := service.NewWorkshopService(nil)
getWorkshopQuery := &query.GetWorkshopQuery{}
workshopId, _ := controller.GetInt(":workshopId")
getWorkshopQuery.WorkshopId = workshopId
data, err := workshopService.GetWorkshop(getWorkshopQuery)
controller.Response(data, err)
}
func (controller *WorkshopController) RemoveWorkshop() {
workshopService := service.NewWorkshopService(nil)
removeWorkshopCommand := &command.RemoveWorkshopCommand{}
controller.Unmarshal(removeWorkshopCommand)
workshopId, _ := controller.GetInt(":workshopId")
removeWorkshopCommand.WorkshopId = workshopId
data, err := workshopService.RemoveWorkshop(removeWorkshopCommand)
controller.Response(data, err)
}
func (controller *WorkshopController) ListWorkshop() {
workshopService := service.NewWorkshopService(nil)
listWorkshopQuery := &query.ListWorkshopQuery{}
offset, _ := controller.GetInt("offset")
listWorkshopQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listWorkshopQuery.Limit = limit
data, err := workshopService.ListWorkshop(listWorkshopQuery)
controller.Response(data, err)
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego/controllers"
)
func init() {
web.Router("/devices/", &controllers.DeviceController{}, "Post:CreateDevice")
web.Router("/devices/:deviceId", &controllers.DeviceController{}, "Put:UpdateDevice")
web.Router("/devices/:deviceId", &controllers.DeviceController{}, "Get:GetDevice")
web.Router("/devices/:deviceId", &controllers.DeviceController{}, "Delete:RemoveDevice")
web.Router("/devices/", &controllers.DeviceController{}, "Get:ListDevice")
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego/controllers"
)
func init() {
web.Router("/product-calendars/", &controllers.ProductCalendarController{}, "Post:CreateProductCalendar")
web.Router("/product-calendars/:productCalendarId", &controllers.ProductCalendarController{}, "Put:UpdateProductCalendar")
web.Router("/product-calendars/:productCalendarId", &controllers.ProductCalendarController{}, "Get:GetProductCalendar")
web.Router("/product-calendars/:productCalendarId", &controllers.ProductCalendarController{}, "Delete:RemoveProductCalendar")
web.Router("/product-calendars/", &controllers.ProductCalendarController{}, "Get:ListProductCalendar")
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego/controllers"
)
func init() {
web.Router("/product-groups/", &controllers.ProductGroupController{}, "Post:CreateProductGroup")
web.Router("/product-groups/:productGroupId", &controllers.ProductGroupController{}, "Put:UpdateProductGroup")
web.Router("/product-groups/:productGroupId", &controllers.ProductGroupController{}, "Get:GetProductGroup")
web.Router("/product-groups/:productGroupId", &controllers.ProductGroupController{}, "Delete:RemoveProductGroup")
web.Router("/product-groups/", &controllers.ProductGroupController{}, "Get:ListProductGroup")
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego/controllers"
)
func init() {
web.Router("/product-jobs/", &controllers.ProductJobController{}, "Post:CreateProductJob")
web.Router("/product-jobs/:productJobId", &controllers.ProductJobController{}, "Put:UpdateProductJob")
web.Router("/product-jobs/:productJobId", &controllers.ProductJobController{}, "Get:GetProductJob")
web.Router("/product-jobs/:productJobId", &controllers.ProductJobController{}, "Delete:RemoveProductJob")
web.Router("/product-jobs/", &controllers.ProductJobController{}, "Get:ListProductJob")
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego/controllers"
)
func init() {
web.Router("/product-lines/", &controllers.ProductLineController{}, "Post:CreateProductLine")
web.Router("/product-lines/:lineId", &controllers.ProductLineController{}, "Put:UpdateProductLine")
web.Router("/product-lines/:lineId", &controllers.ProductLineController{}, "Get:GetProductLine")
web.Router("/product-lines/:lineId", &controllers.ProductLineController{}, "Delete:RemoveProductLine")
web.Router("/product-lines/", &controllers.ProductLineController{}, "Get:ListProductLine")
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego/controllers"
)
func init() {
web.Router("/product-plans/", &controllers.ProductPlanController{}, "Post:CreateProductPlan")
web.Router("/product-plans/:productPlanId", &controllers.ProductPlanController{}, "Put:UpdateProductPlan")
web.Router("/product-plans/:productPlanId", &controllers.ProductPlanController{}, "Get:GetProductPlan")
web.Router("/product-plans/:productPlanId", &controllers.ProductPlanController{}, "Delete:RemoveProductPlan")
web.Router("/product-plans/", &controllers.ProductPlanController{}, "Get:ListProductPlan")
web.Router("/product-plans/receive-material", &controllers.ProductPlanController{}, "Post:ReceiveMaterial")
web.Router("/product-plans/return-material", &controllers.ProductPlanController{}, "Post:ReturnMaterial")
web.Router("/product-plans/set-online", &controllers.ProductPlanController{}, "Post:SetOnline")
web.Router("/product-plans/switch", &controllers.ProductPlanController{}, "Post:Switch")
web.Router("/product-plans/submit-product-record", &controllers.ProductPlanController{}, "Post:SubmitProductRecord")
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego/controllers"
)
func init() {
web.Router("/products/", &controllers.ProductController{}, "Post:CreateProduct")
web.Router("/products/:productId", &controllers.ProductController{}, "Put:UpdateProduct")
web.Router("/products/:productId", &controllers.ProductController{}, "Get:GetProduct")
web.Router("/products/:productId", &controllers.ProductController{}, "Delete:RemoveProduct")
web.Router("/products/", &controllers.ProductController{}, "Get:ListProduct")
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego/controllers"
)
func init() {
web.Router("/product-sections/", &controllers.ProductSectionController{}, "Post:CreateProductSection")
web.Router("/product-sections/:sectionId", &controllers.ProductSectionController{}, "Put:UpdateProductSection")
web.Router("/product-sections/:sectionId", &controllers.ProductSectionController{}, "Get:GetProductSection")
web.Router("/product-sections/:sectionId", &controllers.ProductSectionController{}, "Delete:RemoveProductSection")
web.Router("/product-sections/", &controllers.ProductSectionController{}, "Get:ListProductSection")
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego/controllers"
)
func init() {
web.Router("/unit-conversions/", &controllers.UnitConversionController{}, "Post:CreateUnitConversion")
web.Router("/unit-conversions/:unitConversionId", &controllers.UnitConversionController{}, "Put:UpdateUnitConversion")
web.Router("/unit-conversions/:unitConversionId", &controllers.UnitConversionController{}, "Get:GetUnitConversion")
web.Router("/unit-conversions/:unitConversionId", &controllers.UnitConversionController{}, "Delete:RemoveUnitConversion")
web.Router("/unit-conversions/", &controllers.UnitConversionController{}, "Get:ListUnitConversion")
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego/controllers"
)
func init() {
web.Router("/workshops/", &controllers.WorkshopController{}, "Post:CreateWorkshop")
web.Router("/workshops/:workshopId", &controllers.WorkshopController{}, "Put:UpdateWorkshop")
web.Router("/workshops/:workshopId", &controllers.WorkshopController{}, "Get:GetWorkshop")
web.Router("/workshops/:workshopId", &controllers.WorkshopController{}, "Delete:RemoveWorkshop")
web.Router("/workshops/", &controllers.WorkshopController{}, "Get:ListWorkshop")
}
... ...
package device
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("创建设备服务", func() {
Describe("提交数据创建设备服务", func() {
Context("提交正确的新设备数据", func() {
It("返回设备数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"companyId": "int",
"orgId": "int",
"deviceCode": "string",
"deviceName": "string",
"deviceModel": "string",
"deviceType": "string",
"workshopId": "int",
"lineId": "int",
"sectionId": "int",
"brand": "string",
"deviceStatus": "int",
"riskLevel": "int",
}
httpExpect.POST("/devices/").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("deviceId").ValueNotEqual("deviceId", BeZero())
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM devices WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package device
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/beego/beego/v2/server/web"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego"
)
func TestDevice(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Beego Port Device Correlations Test Case Suite")
}
var handler http.Handler
var server *httptest.Server
var _ = BeforeSuite(func() {
handler = web.BeeApp.Handlers
server = httptest.NewServer(handler)
})
var _ = AfterSuite(func() {
server.Close()
})
... ...
package device
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回设备服务", func() {
var deviceId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&deviceId),
"INSERT INTO devices (device_id, company_id, org_id, device_code, device_name, device_model, device_type, brand, device_status, risk_level, created_at, updated_at, deleted_at, work_station) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING device_id",
"testDeviceId", "testCompanyId", "testOrgId", "testDeviceCode", "testDeviceName", "testDeviceModel", "testDeviceType", "testBrand", "testDeviceStatus", "testRiskLevel", "testCreatedAt", "testUpdatedAt", "testDeletedAt", "testWorkStation")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据deviceId参数返回设备", func() {
Context("传入有效的deviceId", func() {
It("返回设备数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/devices/{deviceId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM devices WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package device
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回设备服务列表", func() {
var deviceId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&deviceId),
"INSERT INTO devices (device_id, company_id, org_id, device_code, device_name, device_model, device_type, brand, device_status, risk_level, created_at, updated_at, deleted_at, work_station) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING device_id",
"testDeviceId", "testCompanyId", "testOrgId", "testDeviceCode", "testDeviceName", "testDeviceModel", "testDeviceType", "testBrand", "testDeviceStatus", "testRiskLevel", "testCreatedAt", "testUpdatedAt", "testDeletedAt", "testWorkStation")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数返回设备列表", func() {
Context("传入有效的参数", func() {
It("返回设备数据列表", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/devices/").
WithQuery("offset", "int").
WithQuery("limit", "int").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("count").ValueEqual("count", 1).
ContainsKey("devices").Value("devices").Array()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM devices WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package device
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("移除设备服务", func() {
var deviceId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&deviceId),
"INSERT INTO devices (device_id, company_id, org_id, device_code, device_name, device_model, device_type, brand, device_status, risk_level, created_at, updated_at, deleted_at, work_station) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING device_id",
"testDeviceId", "testCompanyId", "testOrgId", "testDeviceCode", "testDeviceName", "testDeviceModel", "testDeviceType", "testBrand", "testDeviceStatus", "testRiskLevel", "testCreatedAt", "testUpdatedAt", "testDeletedAt", "testWorkStation")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数移除设备服务", func() {
Context("传入有效的deviceId", func() {
It("返回被移除设备的数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.DELETE("/devices/{deviceId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM devices WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package device
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("更新设备服务", func() {
var deviceId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&deviceId),
"INSERT INTO devices (device_id, company_id, org_id, device_code, device_name, device_model, device_type, brand, device_status, risk_level, created_at, updated_at, deleted_at, work_station) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING device_id",
"testDeviceId", "testCompanyId", "testOrgId", "testDeviceCode", "testDeviceName", "testDeviceModel", "testDeviceType", "testBrand", "testDeviceStatus", "testRiskLevel", "testCreatedAt", "testUpdatedAt", "testDeletedAt", "testWorkStation")
Expect(err).NotTo(HaveOccurred())
})
Describe("提交数据更新设备服务", func() {
Context("提交正确的设备数据", func() {
It("返回更新后的设备数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"deviceCode": "string",
"deviceName": "string",
"deviceModel": "string",
"deviceType": "string",
"workshopId": "int",
"lineId": "int",
"sectionId": "int",
"brand": "string",
"deviceStatus": "int",
"riskLevel": "int",
}
httpExpect.PUT("/devices/{deviceId}").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("deviceId").ValueEqual("deviceId", deviceId)
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM devices WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("创建产品服务", func() {
Describe("提交数据创建产品服务", func() {
Context("提交正确的新产品信息数据", func() {
It("返回产品信息数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"companyId": "int",
"orgId": "int",
"productCode": "string",
"productName": "string",
"productCategory": "string",
"quantity": "float64",
"unit": "string",
"unitWeight": "float64",
"weight": "float64",
}
httpExpect.POST("/products/").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("productId").ValueNotEqual("productId", BeZero())
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM products WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回产品服务", func() {
var productId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productId),
"INSERT INTO products (company_id, org_id, product_id, product_code, product_name, product_category, product_spec, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_id",
"testCompanyId", "testOrgId", "testProductId", "testProductCode", "testProductName", "testProductCategory", "testProductSpec", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据productId参数返回产品信息", func() {
Context("传入有效的productId", func() {
It("返回产品信息数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/products/{productId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM products WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回产品服务列表", func() {
var productId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productId),
"INSERT INTO products (company_id, org_id, product_id, product_code, product_name, product_category, product_spec, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_id",
"testCompanyId", "testOrgId", "testProductId", "testProductCode", "testProductName", "testProductCategory", "testProductSpec", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数返回产品信息列表", func() {
Context("传入有效的参数", func() {
It("返回产品信息数据列表", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/products/").
WithQuery("offset", "int").
WithQuery("limit", "int").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("count").ValueEqual("count", 1).
ContainsKey("products").Value("products").Array()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM products WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/beego/beego/v2/server/web"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego"
)
func TestProduct(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Beego Port Product Correlations Test Case Suite")
}
var handler http.Handler
var server *httptest.Server
var _ = BeforeSuite(func() {
handler = web.BeeApp.Handlers
server = httptest.NewServer(handler)
})
var _ = AfterSuite(func() {
server.Close()
})
... ...
package product
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("移除产品服务", func() {
var productId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productId),
"INSERT INTO products (company_id, org_id, product_id, product_code, product_name, product_category, product_spec, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_id",
"testCompanyId", "testOrgId", "testProductId", "testProductCode", "testProductName", "testProductCategory", "testProductSpec", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数移除产品服务", func() {
Context("传入有效的productId", func() {
It("返回被移除产品信息的数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.DELETE("/products/{productId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM products WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("更新产品服务", func() {
var productId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productId),
"INSERT INTO products (company_id, org_id, product_id, product_code, product_name, product_category, product_spec, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_id",
"testCompanyId", "testOrgId", "testProductId", "testProductCode", "testProductName", "testProductCategory", "testProductSpec", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("提交数据更新产品服务", func() {
Context("提交正确的产品信息数据", func() {
It("返回更新后的产品信息数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"productCode": "string",
"productName": "string",
"productCategory": "string",
"quantity": "float64",
"unit": "string",
"unitWeight": "float64",
"weight": "float64",
}
httpExpect.PUT("/products/{productId}").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("productId").ValueEqual("productId", productId)
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM products WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_calendar
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("创建工厂日历服务", func() {
Describe("提交数据创建工厂日历服务", func() {
Context("提交正确的新工厂日历数据", func() {
It("返回工厂日历数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"companyId": "int",
"orgId": "int",
"workshopId": "int",
"lineId": "int",
"sectionId": "int",
"workOn": "int",
"calendarSelected": "array",
"inWorkAt": "string",
"outWorkAt": "string",
"breakTime": "float64",
"workTime": "float64",
}
httpExpect.POST("/product-calendars/").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("productCalendarId").ValueNotEqual("productCalendarId", BeZero())
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_calendars WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_calendar
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回工厂日历服务", func() {
var productCalendarId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productCalendarId),
"INSERT INTO product_calendars (product_calendar_id, company_id, org_id, work_station, work_on, calendar_selected, in_work_at, out_work_at, break_time, work_time, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_calendar_id",
"testProductCalendarId", "testCompanyId", "testOrgId", "testWorkStation", "testWorkOn", "testCalendarSelected", "testInWorkAt", "testOutWorkAt", "testBreakTime", "testWorkTime", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据productCalendarId参数返回工厂日历", func() {
Context("传入有效的productCalendarId", func() {
It("返回工厂日历数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/product-calendars/{productCalendarId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_calendars WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_calendar
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回工厂日历服务列表", func() {
var productCalendarId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productCalendarId),
"INSERT INTO product_calendars (product_calendar_id, company_id, org_id, work_station, work_on, calendar_selected, in_work_at, out_work_at, break_time, work_time, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_calendar_id",
"testProductCalendarId", "testCompanyId", "testOrgId", "testWorkStation", "testWorkOn", "testCalendarSelected", "testInWorkAt", "testOutWorkAt", "testBreakTime", "testWorkTime", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数返回工厂日历列表", func() {
Context("传入有效的参数", func() {
It("返回工厂日历数据列表", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/product-calendars/").
WithQuery("offset", "int").
WithQuery("limit", "int").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("count").ValueEqual("count", 1).
ContainsKey("productCalendars").Value("productCalendars").Array()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_calendars WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_calendar
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/beego/beego/v2/server/web"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego"
)
func TestProductCalendar(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Beego Port ProductCalendar Correlations Test Case Suite")
}
var handler http.Handler
var server *httptest.Server
var _ = BeforeSuite(func() {
handler = web.BeeApp.Handlers
server = httptest.NewServer(handler)
})
var _ = AfterSuite(func() {
server.Close()
})
... ...
package product_calendar
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("移除工厂日历服务", func() {
var productCalendarId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productCalendarId),
"INSERT INTO product_calendars (product_calendar_id, company_id, org_id, work_station, work_on, calendar_selected, in_work_at, out_work_at, break_time, work_time, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_calendar_id",
"testProductCalendarId", "testCompanyId", "testOrgId", "testWorkStation", "testWorkOn", "testCalendarSelected", "testInWorkAt", "testOutWorkAt", "testBreakTime", "testWorkTime", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数移除工厂日历服务", func() {
Context("传入有效的productCalendarId", func() {
It("返回被移除工厂日历的数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.DELETE("/product-calendars/{productCalendarId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_calendars WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_calendar
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("更新工厂日历服务", func() {
var productCalendarId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productCalendarId),
"INSERT INTO product_calendars (product_calendar_id, company_id, org_id, work_station, work_on, calendar_selected, in_work_at, out_work_at, break_time, work_time, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_calendar_id",
"testProductCalendarId", "testCompanyId", "testOrgId", "testWorkStation", "testWorkOn", "testCalendarSelected", "testInWorkAt", "testOutWorkAt", "testBreakTime", "testWorkTime", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("提交数据更新工厂日历服务", func() {
Context("提交正确的工厂日历数据", func() {
It("返回更新后的工厂日历数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"workshopId": "int",
"lineId": "int",
"sectionId": "int",
"workOn": "int",
"calendarSelected": "array",
"inWorkAt": "string",
"outWorkAt": "string",
"breakTime": "float64",
"workTime": "float64",
}
httpExpect.PUT("/product-calendars/{productCalendarId}").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("productCalendarId").ValueEqual("productCalendarId", productCalendarId)
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_calendars WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_group
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("创建生产班组服务", func() {
Describe("提交数据创建生产班组服务", func() {
Context("提交正确的新生产班组数据", func() {
It("返回生产班组数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"companyId": "int",
"orgId": "int",
"workshopId": "int",
"lineId": "int",
"sectionId": "int",
"groupName": "string",
"userId": "int",
"userName": "string",
"employeeType": "int",
"icCardNumber": "string",
"avatar": "string",
"phone": "string",
"groupMembers": "array",
"workOn": "int",
}
httpExpect.POST("/product-groups/").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("productGroupId").ValueNotEqual("productGroupId", BeZero())
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_groups WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_group
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回生产班组服务", func() {
var productGroupId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productGroupId),
"INSERT INTO product_groups (product_group_id, company_id, org_id, group_name, group_leader, group_members, work_on, work_station, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_group_id",
"testProductGroupId", "testCompanyId", "testOrgId", "testGroupName", "testGroupLeader", "testGroupMembers", "testWorkOn", "testWorkStation", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据productGroupId参数返回生产班组", func() {
Context("传入有效的productGroupId", func() {
It("返回生产班组数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/product-groups/{productGroupId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_groups WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_group
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回生产班组服务列表", func() {
var productGroupId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productGroupId),
"INSERT INTO product_groups (product_group_id, company_id, org_id, group_name, group_leader, group_members, work_on, work_station, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_group_id",
"testProductGroupId", "testCompanyId", "testOrgId", "testGroupName", "testGroupLeader", "testGroupMembers", "testWorkOn", "testWorkStation", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数返回生产班组列表", func() {
Context("传入有效的参数", func() {
It("返回生产班组数据列表", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/product-groups/").
WithQuery("offset", "int").
WithQuery("limit", "int").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("count").ValueEqual("count", 1).
ContainsKey("productGroups").Value("productGroups").Array()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_groups WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_group
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/beego/beego/v2/server/web"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego"
)
func TestProductGroup(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Beego Port ProductGroup Correlations Test Case Suite")
}
var handler http.Handler
var server *httptest.Server
var _ = BeforeSuite(func() {
handler = web.BeeApp.Handlers
server = httptest.NewServer(handler)
})
var _ = AfterSuite(func() {
server.Close()
})
... ...
package product_group
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("移除生产班组服务", func() {
var productGroupId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productGroupId),
"INSERT INTO product_groups (product_group_id, company_id, org_id, group_name, group_leader, group_members, work_on, work_station, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_group_id",
"testProductGroupId", "testCompanyId", "testOrgId", "testGroupName", "testGroupLeader", "testGroupMembers", "testWorkOn", "testWorkStation", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数移除生产班组服务", func() {
Context("传入有效的productGroupId", func() {
It("返回被移除生产班组的数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.DELETE("/product-groups/{productGroupId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_groups WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_group
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("更新生产班组服务", func() {
var productGroupId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productGroupId),
"INSERT INTO product_groups (product_group_id, company_id, org_id, group_name, group_leader, group_members, work_on, work_station, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_group_id",
"testProductGroupId", "testCompanyId", "testOrgId", "testGroupName", "testGroupLeader", "testGroupMembers", "testWorkOn", "testWorkStation", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("提交数据更新生产班组服务", func() {
Context("提交正确的生产班组数据", func() {
It("返回更新后的生产班组数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"workshopId": "int",
"lineId": "int",
"sectionId": "int",
"groupName": "string",
"userId": "int",
"userName": "string",
"employeeType": "int",
"icCardNumber": "string",
"avatar": "string",
"phone": "string",
"groupMembers": "array",
"workOn": "int",
}
httpExpect.PUT("/product-groups/{productGroupId}").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("productGroupId").ValueEqual("productGroupId", productGroupId)
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_groups WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_job
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("创建工位服务", func() {
Describe("提交数据创建工位服务", func() {
Context("提交正确的新工位(车间-生产线-工段-工位)数据", func() {
It("返回工位(车间-生产线-工段-工位)数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"companyId": "int",
"orgId": "int",
"jobName": "string",
"workshopId": "int",
"lineId": "int",
"sectionId": "int",
"relatedDevices": "array",
}
httpExpect.POST("/product-jobs/").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("productJobId").ValueNotEqual("productJobId", BeZero())
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_jobs WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_job
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回工位服务", func() {
var productJobId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productJobId),
"INSERT INTO product_jobs (product_job_id, company_id, org_id, job_name, created_at, updated_at, deleted_at, work_station, related_devices) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_job_id",
"testProductJobId", "testCompanyId", "testOrgId", "testJobName", "testCreatedAt", "testUpdatedAt", "testDeletedAt", "testWorkStation", "testRelatedDevices")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据productJobId参数返回工位(车间-生产线-工段-工位)", func() {
Context("传入有效的productJobId", func() {
It("返回工位(车间-生产线-工段-工位)数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/product-jobs/{productJobId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_jobs WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_job
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回工位服务列表", func() {
var productJobId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productJobId),
"INSERT INTO product_jobs (product_job_id, company_id, org_id, job_name, created_at, updated_at, deleted_at, work_station, related_devices) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_job_id",
"testProductJobId", "testCompanyId", "testOrgId", "testJobName", "testCreatedAt", "testUpdatedAt", "testDeletedAt", "testWorkStation", "testRelatedDevices")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数返回工位(车间-生产线-工段-工位)列表", func() {
Context("传入有效的参数", func() {
It("返回工位(车间-生产线-工段-工位)数据列表", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/product-jobs/").
WithQuery("offset", "int").
WithQuery("limit", "int").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("count").ValueEqual("count", 1).
ContainsKey("productJobs").Value("productJobs").Array()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_jobs WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_job
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/beego/beego/v2/server/web"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego"
)
func TestProductJob(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Beego Port ProductJob Correlations Test Case Suite")
}
var handler http.Handler
var server *httptest.Server
var _ = BeforeSuite(func() {
handler = web.BeeApp.Handlers
server = httptest.NewServer(handler)
})
var _ = AfterSuite(func() {
server.Close()
})
... ...
package product_job
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("移除工位服务", func() {
var productJobId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productJobId),
"INSERT INTO product_jobs (product_job_id, company_id, org_id, job_name, created_at, updated_at, deleted_at, work_station, related_devices) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_job_id",
"testProductJobId", "testCompanyId", "testOrgId", "testJobName", "testCreatedAt", "testUpdatedAt", "testDeletedAt", "testWorkStation", "testRelatedDevices")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数移除工位服务", func() {
Context("传入有效的productJobId", func() {
It("返回被移除工位(车间-生产线-工段-工位)的数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.DELETE("/product-jobs/{productJobId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_jobs WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_job
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("更新工位服务", func() {
var productJobId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productJobId),
"INSERT INTO product_jobs (product_job_id, company_id, org_id, job_name, created_at, updated_at, deleted_at, work_station, related_devices) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_job_id",
"testProductJobId", "testCompanyId", "testOrgId", "testJobName", "testCreatedAt", "testUpdatedAt", "testDeletedAt", "testWorkStation", "testRelatedDevices")
Expect(err).NotTo(HaveOccurred())
})
Describe("提交数据更新工位服务", func() {
Context("提交正确的工位(车间-生产线-工段-工位)数据", func() {
It("返回更新后的工位(车间-生产线-工段-工位)数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"jobName": "string",
"workshopId": "int",
"lineId": "int",
"sectionId": "int",
"relatedDevices": "array",
}
httpExpect.PUT("/product-jobs/{productJobId}").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("productJobId").ValueEqual("productJobId", productJobId)
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_jobs WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_line
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("创建生产线", func() {
Describe("提交数据创建生产线", func() {
Context("提交正确的新生产线数据", func() {
It("返回生产线数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"workshopId": "int",
"lineName": "string",
}
httpExpect.POST("/product-lines/").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("productLineId").ValueNotEqual("productLineId", BeZero())
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_lines WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_line
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回生产线", func() {
var productLineId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productLineId),
"INSERT INTO product_lines (line_id, line_name, product_sections) VALUES (?, ?, ?) RETURNING product_line_id",
"testLineId", "testLineName", "testProductSections")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据productLineId参数返回生产线", func() {
Context("传入有效的productLineId", func() {
It("返回生产线数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/product-lines/{lineId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_lines WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_line
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回生产线列表", func() {
var productLineId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productLineId),
"INSERT INTO product_lines (line_id, line_name, product_sections) VALUES (?, ?, ?) RETURNING product_line_id",
"testLineId", "testLineName", "testProductSections")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数返回生产线列表", func() {
Context("传入有效的参数", func() {
It("返回生产线数据列表", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/product-lines/").
WithQuery("offset", "int").
WithQuery("limit", "int").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("count").ValueEqual("count", 1).
ContainsKey("productLines").Value("productLines").Array()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_lines WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_line
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/beego/beego/v2/server/web"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego"
)
func TestProductLine(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Beego Port ProductLine Correlations Test Case Suite")
}
var handler http.Handler
var server *httptest.Server
var _ = BeforeSuite(func() {
handler = web.BeeApp.Handlers
server = httptest.NewServer(handler)
})
var _ = AfterSuite(func() {
server.Close()
})
... ...
package product_line
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("移除生产线", func() {
var productLineId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productLineId),
"INSERT INTO product_lines (line_id, line_name, product_sections) VALUES (?, ?, ?) RETURNING product_line_id",
"testLineId", "testLineName", "testProductSections")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数移除生产线", func() {
Context("传入有效的productLineId", func() {
It("返回被移除生产线的数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.DELETE("/product-lines/{lineId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_lines WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_line
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("更新生产线", func() {
var productLineId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productLineId),
"INSERT INTO product_lines (line_id, line_name, product_sections) VALUES (?, ?, ?) RETURNING product_line_id",
"testLineId", "testLineName", "testProductSections")
Expect(err).NotTo(HaveOccurred())
})
Describe("提交数据更新生产线", func() {
Context("提交正确的生产线数据", func() {
It("返回更新后的生产线数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"workshopId": "int",
"lineName": "string",
}
httpExpect.PUT("/product-lines/{lineId}").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("productLineId").ValueEqual("productLineId", productLineId)
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_lines WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_plan
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("创建生产计划服务", func() {
Describe("提交数据创建生产计划服务", func() {
Context("提交正确的新生产计划数据", func() {
It("返回生产计划数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"companyId": "int",
"orgId": "int",
"workshopId": "int",
"batchNumber": "string",
"productDate": "datetime",
"workOn": "int",
"machine": "string",
"planProductName": "string",
"quantity": "float64",
"unit": "string",
"unitWeight": "float64",
"weight": "float64",
"remark": "string",
}
httpExpect.POST("/product-plans/").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("productPlanId").ValueNotEqual("productPlanId", BeZero())
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_plans WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_plan
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回生产计划服务", func() {
var productPlanId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productPlanId),
"INSERT INTO product_plans (product_plan_id, company_id, org_id, batch_number, product_date, workshop, work_on, machine, plan_product_name, plan_devoted, plan_status, work_station, remark, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_plan_id",
"testProductPlanId", "testCompanyId", "testOrgId", "testBatchNumber", "testProductDate", "testWorkshop", "testWorkOn", "testMachine", "testPlanProductName", "testPlanDevoted", "testPlanStatus", "testWorkStation", "testRemark", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据productPlanId参数返回生产计划", func() {
Context("传入有效的productPlanId", func() {
It("返回生产计划数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/product-plans/{productPlanId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_plans WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_plan
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回生产计划服务列表", func() {
var productPlanId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productPlanId),
"INSERT INTO product_plans (product_plan_id, company_id, org_id, batch_number, product_date, workshop, work_on, machine, plan_product_name, plan_devoted, plan_status, work_station, remark, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_plan_id",
"testProductPlanId", "testCompanyId", "testOrgId", "testBatchNumber", "testProductDate", "testWorkshop", "testWorkOn", "testMachine", "testPlanProductName", "testPlanDevoted", "testPlanStatus", "testWorkStation", "testRemark", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数返回生产计划列表", func() {
Context("传入有效的参数", func() {
It("返回生产计划数据列表", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/product-plans/").
WithQuery("offset", "int").
WithQuery("limit", "int").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("count").ValueEqual("count", 1).
ContainsKey("productPlans").Value("productPlans").Array()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_plans WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_plan
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/beego/beego/v2/server/web"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego"
)
func TestProductPlan(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Beego Port ProductPlan Correlations Test Case Suite")
}
var handler http.Handler
var server *httptest.Server
var _ = BeforeSuite(func() {
handler = web.BeeApp.Handlers
server = httptest.NewServer(handler)
})
var _ = AfterSuite(func() {
server.Close()
})
... ...
package product_plan
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("领料", func() {
var productPlanId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productPlanId),
"INSERT INTO product_plans (product_plan_id, company_id, org_id, batch_number, product_date, workshop, work_on, machine, plan_product_name, plan_devoted, plan_status, work_station, remark, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_plan_id",
"testProductPlanId", "testCompanyId", "testOrgId", "testBatchNumber", "testProductDate", "testWorkshop", "testWorkOn", "testMachine", "testPlanProductName", "testPlanDevoted", "testPlanStatus", "testWorkStation", "testRemark", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("领料", func() {
Context("", func() {
It("", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"productPlanId": "int",
}
httpExpect.POST("/product-plans/receive-material").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_plans WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_plan
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("移除生产计划服务", func() {
var productPlanId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productPlanId),
"INSERT INTO product_plans (product_plan_id, company_id, org_id, batch_number, product_date, workshop, work_on, machine, plan_product_name, plan_devoted, plan_status, work_station, remark, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_plan_id",
"testProductPlanId", "testCompanyId", "testOrgId", "testBatchNumber", "testProductDate", "testWorkshop", "testWorkOn", "testMachine", "testPlanProductName", "testPlanDevoted", "testPlanStatus", "testWorkStation", "testRemark", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数移除生产计划服务", func() {
Context("传入有效的productPlanId", func() {
It("返回被移除生产计划的数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.DELETE("/product-plans/{productPlanId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_plans WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_plan
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("退料", func() {
var productPlanId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productPlanId),
"INSERT INTO product_plans (product_plan_id, company_id, org_id, batch_number, product_date, workshop, work_on, machine, plan_product_name, plan_devoted, plan_status, work_station, remark, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_plan_id",
"testProductPlanId", "testCompanyId", "testOrgId", "testBatchNumber", "testProductDate", "testWorkshop", "testWorkOn", "testMachine", "testPlanProductName", "testPlanDevoted", "testPlanStatus", "testWorkStation", "testRemark", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("退料", func() {
Context("", func() {
It("", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"productPlanId": "int",
}
httpExpect.POST("/product-plans/return-material").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_plans WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_plan
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("计划上线", func() {
var productPlanId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productPlanId),
"INSERT INTO product_plans (product_plan_id, company_id, org_id, batch_number, product_date, workshop, work_on, machine, plan_product_name, plan_devoted, plan_status, work_station, remark, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_plan_id",
"testProductPlanId", "testCompanyId", "testOrgId", "testBatchNumber", "testProductDate", "testWorkshop", "testWorkOn", "testMachine", "testPlanProductName", "testPlanDevoted", "testPlanStatus", "testWorkStation", "testRemark", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("计划上线", func() {
Context("", func() {
It("", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"productPlanId": "int",
"workshopId": "int",
"lineId": "int",
"sectionId": "int",
}
httpExpect.POST("/product-plans/set-online").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_plans WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_plan
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("提交成品记录 (成品 二级品)", func() {
var productPlanId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productPlanId),
"INSERT INTO product_plans (product_plan_id, company_id, org_id, batch_number, product_date, workshop, work_on, machine, plan_product_name, plan_devoted, plan_status, work_station, remark, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_plan_id",
"testProductPlanId", "testCompanyId", "testOrgId", "testBatchNumber", "testProductDate", "testWorkshop", "testWorkOn", "testMachine", "testPlanProductName", "testPlanDevoted", "testPlanStatus", "testWorkStation", "testRemark", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("提交成品记录 (成品 二级品)", func() {
Context("", func() {
It("", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"productPlanId": "int",
}
httpExpect.POST("/product-plans/submit-product-record").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_plans WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_plan
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("换单", func() {
var productPlanId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productPlanId),
"INSERT INTO product_plans (product_plan_id, company_id, org_id, batch_number, product_date, workshop, work_on, machine, plan_product_name, plan_devoted, plan_status, work_station, remark, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_plan_id",
"testProductPlanId", "testCompanyId", "testOrgId", "testBatchNumber", "testProductDate", "testWorkshop", "testWorkOn", "testMachine", "testPlanProductName", "testPlanDevoted", "testPlanStatus", "testWorkStation", "testRemark", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("换单", func() {
Context("", func() {
It("", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"fromProductPlanId": "int",
"toProductPlanId": "int",
}
httpExpect.POST("/product-plans/switch").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_plans WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_plan
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("更新生产计划服务", func() {
var productPlanId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productPlanId),
"INSERT INTO product_plans (product_plan_id, company_id, org_id, batch_number, product_date, workshop, work_on, machine, plan_product_name, plan_devoted, plan_status, work_station, remark, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_plan_id",
"testProductPlanId", "testCompanyId", "testOrgId", "testBatchNumber", "testProductDate", "testWorkshop", "testWorkOn", "testMachine", "testPlanProductName", "testPlanDevoted", "testPlanStatus", "testWorkStation", "testRemark", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("提交数据更新生产计划服务", func() {
Context("提交正确的生产计划数据", func() {
It("返回更新后的生产计划数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"companyId": "int",
"orgId": "int",
"workshopId": "int",
"batchNumber": "string",
"productDate": "datetime",
"workOn": "int",
"machine": "string",
"planProductName": "string",
"quantity": "float64",
"unit": "string",
"unitWeight": "float64",
"weight": "float64",
"remark": "string",
}
httpExpect.PUT("/product-plans/{productPlanId}").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("productPlanId").ValueEqual("productPlanId", productPlanId)
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_plans WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_section
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("创建工段服务", func() {
Describe("提交数据创建工段服务", func() {
Context("提交正确的新工段数据", func() {
It("返回工段数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"workshopId": "int",
"lineId": "int",
"sectionName": "string",
}
httpExpect.POST("/product-sections/").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("productSectionId").ValueNotEqual("productSectionId", BeZero())
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_sections WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_section
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回工段服务", func() {
var productSectionId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productSectionId),
"INSERT INTO product_sections (section_id, section_name) VALUES (?, ?) RETURNING product_section_id",
"testSectionId", "testSectionName")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据productSectionId参数返回工段", func() {
Context("传入有效的productSectionId", func() {
It("返回工段数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/product-sections/{sectionId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_sections WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_section
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回工段服务列表", func() {
var productSectionId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productSectionId),
"INSERT INTO product_sections (section_id, section_name) VALUES (?, ?) RETURNING product_section_id",
"testSectionId", "testSectionName")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数返回工段列表", func() {
Context("传入有效的参数", func() {
It("返回工段数据列表", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/product-sections/").
WithQuery("offset", "int").
WithQuery("limit", "int").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("count").ValueEqual("count", 1).
ContainsKey("productSections").Value("productSections").Array()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_sections WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_section
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/beego/beego/v2/server/web"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego"
)
func TestProductSection(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Beego Port ProductSection Correlations Test Case Suite")
}
var handler http.Handler
var server *httptest.Server
var _ = BeforeSuite(func() {
handler = web.BeeApp.Handlers
server = httptest.NewServer(handler)
})
var _ = AfterSuite(func() {
server.Close()
})
... ...
package product_section
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("移除工段服务", func() {
var productSectionId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productSectionId),
"INSERT INTO product_sections (section_id, section_name) VALUES (?, ?) RETURNING product_section_id",
"testSectionId", "testSectionName")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数移除工段服务", func() {
Context("传入有效的productSectionId", func() {
It("返回被移除工段的数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.DELETE("/product-sections/{sectionId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_sections WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package product_section
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("更新工段服务", func() {
var productSectionId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productSectionId),
"INSERT INTO product_sections (section_id, section_name) VALUES (?, ?) RETURNING product_section_id",
"testSectionId", "testSectionName")
Expect(err).NotTo(HaveOccurred())
})
Describe("提交数据更新工段服务", func() {
Context("提交正确的工段数据", func() {
It("返回更新后的工段数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"workshopId": "int",
"sectionName": "string",
}
httpExpect.PUT("/product-sections/{sectionId}").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("productSectionId").ValueEqual("productSectionId", productSectionId)
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM product_sections WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package unit_conversion
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("创建单位换算服务", func() {
Describe("提交数据创建单位换算服务", func() {
Context("提交正确的新单位换算数据", func() {
It("返回单位换算数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"companyId": "int",
"orgId": "int",
"workshopId": "int",
"lineId": "int",
"sectionId": "int",
"materialName": "string",
"materialCategory": "string",
"quantity": "float64",
"unit": "string",
"unitWeight": "float64",
"weight": "float64",
"intelligentWeighingFlag": "boolean",
}
httpExpect.POST("/unit-conversions/").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("unitConversionId").ValueNotEqual("unitConversionId", BeZero())
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM unit_conversions WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package unit_conversion
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回单位换算服务", func() {
var unitConversionId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&unitConversionId),
"INSERT INTO unit_conversions (unit_conversion_id, company_id, org_id, work_station, material, from_unit_quantity, to_unit_quantity, intelligent_weighing_flag, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING unit_conversion_id",
"testUnitConversionId", "testCompanyId", "testOrgId", "testWorkStation", "testMaterial", "testFromUnitQuantity", "testToUnitQuantity", "testIntelligentWeighingFlag", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据unitConversionId参数返回单位换算", func() {
Context("传入有效的unitConversionId", func() {
It("返回单位换算数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/unit-conversions/{unitConversionId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM unit_conversions WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package unit_conversion
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回单位换算服务列表", func() {
var unitConversionId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&unitConversionId),
"INSERT INTO unit_conversions (unit_conversion_id, company_id, org_id, work_station, material, from_unit_quantity, to_unit_quantity, intelligent_weighing_flag, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING unit_conversion_id",
"testUnitConversionId", "testCompanyId", "testOrgId", "testWorkStation", "testMaterial", "testFromUnitQuantity", "testToUnitQuantity", "testIntelligentWeighingFlag", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数返回单位换算列表", func() {
Context("传入有效的参数", func() {
It("返回单位换算数据列表", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/unit-conversions/").
WithQuery("offset", "int").
WithQuery("limit", "int").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("count").ValueEqual("count", 1).
ContainsKey("unitConversions").Value("unitConversions").Array()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM unit_conversions WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package unit_conversion
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("移除单位换算服务", func() {
var unitConversionId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&unitConversionId),
"INSERT INTO unit_conversions (unit_conversion_id, company_id, org_id, work_station, material, from_unit_quantity, to_unit_quantity, intelligent_weighing_flag, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING unit_conversion_id",
"testUnitConversionId", "testCompanyId", "testOrgId", "testWorkStation", "testMaterial", "testFromUnitQuantity", "testToUnitQuantity", "testIntelligentWeighingFlag", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数移除单位换算服务", func() {
Context("传入有效的unitConversionId", func() {
It("返回被移除单位换算的数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.DELETE("/unit-conversions/{unitConversionId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM unit_conversions WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package unit_conversion
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/beego/beego/v2/server/web"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego"
)
func TestUnitConversion(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Beego Port UnitConversion Correlations Test Case Suite")
}
var handler http.Handler
var server *httptest.Server
var _ = BeforeSuite(func() {
handler = web.BeeApp.Handlers
server = httptest.NewServer(handler)
})
var _ = AfterSuite(func() {
server.Close()
})
... ...
package unit_conversion
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("更新单位换算服务", func() {
var unitConversionId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&unitConversionId),
"INSERT INTO unit_conversions (unit_conversion_id, company_id, org_id, work_station, material, from_unit_quantity, to_unit_quantity, intelligent_weighing_flag, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING unit_conversion_id",
"testUnitConversionId", "testCompanyId", "testOrgId", "testWorkStation", "testMaterial", "testFromUnitQuantity", "testToUnitQuantity", "testIntelligentWeighingFlag", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("提交数据更新单位换算服务", func() {
Context("提交正确的单位换算数据", func() {
It("返回更新后的单位换算数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"companyId": "int",
"orgId": "int",
"workshopId": "int",
"lineId": "int",
"sectionId": "int",
"materialName": "string",
"materialCategory": "string",
"quantity": "float64",
"unit": "string",
"unitWeight": "float64",
"weight": "float64",
"intelligentWeighingFlag": "boolean",
}
httpExpect.PUT("/unit-conversions/{unitConversionId}").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("unitConversionId").ValueEqual("unitConversionId", unitConversionId)
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM unit_conversions WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package workshop
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("创建车间服务", func() {
Describe("提交数据创建车间服务", func() {
Context("提交正确的新车间数据", func() {
It("返回车间数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"workshopName": "string",
"principalId": "int",
}
httpExpect.POST("/workshops/").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("workshopId").ValueNotEqual("workshopId", BeZero())
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM workshops WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package workshop
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回车间服务", func() {
var workshopId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&workshopId),
"INSERT INTO workshops (company_id, org_id, workshop_id, workshop_name, principal, product_lines, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING workshop_id",
"testCompanyId", "testOrgId", "testWorkshopId", "testWorkshopName", "testPrincipal", "testProductLines", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据workshopId参数返回车间", func() {
Context("传入有效的workshopId", func() {
It("返回车间数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/workshops/{workshopId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM workshops WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package workshop
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("返回车间服务列表", func() {
var workshopId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&workshopId),
"INSERT INTO workshops (company_id, org_id, workshop_id, workshop_name, principal, product_lines, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING workshop_id",
"testCompanyId", "testOrgId", "testWorkshopId", "testWorkshopName", "testPrincipal", "testProductLines", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数返回车间列表", func() {
Context("传入有效的参数", func() {
It("返回车间数据列表", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/workshops/").
WithQuery("offset", "int").
WithQuery("limit", "int").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("count").ValueEqual("count", 1).
ContainsKey("workshops").Value("workshops").Array()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM workshops WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package workshop
import (
"github.com/go-pg/pg/v10"
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("移除车间服务", func() {
var workshopId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&workshopId),
"INSERT INTO workshops (company_id, org_id, workshop_id, workshop_name, principal, product_lines, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING workshop_id",
"testCompanyId", "testOrgId", "testWorkshopId", "testWorkshopName", "testPrincipal", "testProductLines", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数移除车间服务", func() {
Context("传入有效的workshopId", func() {
It("返回被移除车间的数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.DELETE("/workshops/{workshopId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM workshops WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...