From 71a2d912e21a4a4c582ab430f6ff81946638dc68 Mon Sep 17 00:00:00 2001 From: Chever John Date: Sat, 28 Feb 2026 15:29:16 +0800 Subject: [PATCH] feat: initial commit for muyu-apiserver Go service with gateway, RPC, model layers and k8s deploy configs. Made-with: Cursor --- .gitignore | 31 + cmd/genhash/main.go | 12 + deploy/Dockerfile.gateway | 7 + deploy/Dockerfile.inventory | 7 + deploy/Dockerfile.system | 7 + deploy/docker-compose.yaml | 115 + deploy/etc/gateway.yaml | 26 + deploy/etc/inventory.yaml | 17 + deploy/etc/system.yaml | 17 + deploy/mysql/init.sql | 312 ++ deploy/nginx/nginx.conf | 34 + gateway/etc/gateway-api.yaml | 3 + gateway/etc/gateway.yaml | 26 + gateway/gateway.api | 638 +++ gateway/gateway.go | 56 + gateway/internal/config/config.go | 19 + .../handler/auth/changePasswordHandler.go | 31 + .../handler/auth/getUserInfoHandler.go | 24 + gateway/internal/handler/auth/loginHandler.go | 31 + .../internal/handler/auth/logoutHandler.go | 24 + .../adjust/approveStockAdjustHandler.go | 31 + .../adjust/createStockAdjustHandler.go | 31 + .../inventory/adjust/getStockAdjustHandler.go | 24 + .../adjust/listStockAdjustHandler.go | 31 + .../check/confirmStockCheckHandler.go | 24 + .../check/createStockCheckHandler.go | 31 + .../inventory/check/getStockCheckHandler.go | 24 + .../inventory/check/listStockCheckHandler.go | 31 + .../check/updateStockCheckHandler.go | 31 + .../inventory/product/createProductHandler.go | 31 + .../inventory/product/deleteProductHandler.go | 24 + .../inventory/product/exportProductHandler.go | 24 + .../inventory/product/getProductHandler.go | 24 + .../inventory/product/importProductHandler.go | 24 + .../inventory/product/listProductHandler.go | 31 + .../inventory/product/updateProductHandler.go | 31 + .../inventory/stock/getStockByColorHandler.go | 24 + .../stock/getStockByLocationHandler.go | 24 + .../inventory/stock/getStockSummaryHandler.go | 24 + .../inventory/stock/listStockHandler.go | 31 + gateway/internal/handler/routes.go | 347 ++ .../system/config/listConfigHandler.go | 24 + .../system/config/updateConfigHandler.go | 31 + .../handler/system/log/listLogHandler.go | 31 + .../handler/system/menu/createMenuHandler.go | 31 + .../handler/system/menu/deleteMenuHandler.go | 24 + .../handler/system/menu/getMenuHandler.go | 24 + .../handler/system/menu/listMenuHandler.go | 24 + .../handler/system/menu/updateMenuHandler.go | 31 + .../handler/system/role/createRoleHandler.go | 31 + .../handler/system/role/deleteRoleHandler.go | 24 + .../handler/system/role/getRoleHandler.go | 24 + .../handler/system/role/listRoleHandler.go | 31 + .../system/role/setRolePermissionsHandler.go | 31 + .../handler/system/role/updateRoleHandler.go | 31 + .../handler/system/user/createUserHandler.go | 31 + .../handler/system/user/deleteUserHandler.go | 24 + .../handler/system/user/getUserHandler.go | 24 + .../handler/system/user/listUserHandler.go | 31 + .../handler/system/user/updateUserHandler.go | 31 + .../system/user/updateUserStatusHandler.go | 31 + .../logic/auth/changePasswordLogic.go | 41 + .../internal/logic/auth/getUserInfoLogic.go | 80 + gateway/internal/logic/auth/loginLogic.go | 57 + gateway/internal/logic/auth/logoutLogic.go | 28 + .../adjust/approveStockAdjustLogic.go | 42 + .../adjust/createStockAdjustLogic.go | 52 + .../inventory/adjust/getStockAdjustLogic.go | 65 + .../inventory/adjust/listStockAdjustLogic.go | 76 + .../inventory/check/confirmStockCheckLogic.go | 41 + .../inventory/check/createStockCheckLogic.go | 48 + .../inventory/check/getStockCheckLogic.go | 64 + .../inventory/check/listStockCheckLogic.go | 74 + .../inventory/check/updateStockCheckLogic.go | 50 + .../inventory/product/createProductLogic.go | 46 + .../inventory/product/deleteProductLogic.go | 39 + .../inventory/product/exportProductLogic.go | 28 + .../inventory/product/getProductLogic.go | 55 + .../inventory/product/importProductLogic.go | 29 + .../inventory/product/listProductLogic.go | 66 + .../inventory/product/updateProductLogic.go | 50 + .../inventory/stock/getStockByColorLogic.go | 47 + .../stock/getStockByLocationLogic.go | 47 + .../inventory/stock/getStockSummaryLogic.go | 40 + .../logic/inventory/stock/listStockLogic.go | 66 + .../logic/system/config/listConfigLogic.go | 49 + .../logic/system/config/updateConfigLogic.go | 40 + .../internal/logic/system/log/listLogLogic.go | 62 + .../logic/system/menu/createMenuLogic.go | 43 + .../logic/system/menu/deleteMenuLogic.go | 39 + .../logic/system/menu/getMenuLogic.go | 69 + .../logic/system/menu/listMenuLogic.go | 43 + .../logic/system/menu/updateMenuLogic.go | 48 + .../logic/system/role/createRoleLogic.go | 39 + .../logic/system/role/deleteRoleLogic.go | 39 + .../logic/system/role/getRoleLogic.go | 49 + .../logic/system/role/listRoleLogic.go | 57 + .../system/role/setRolePermissionsLogic.go | 40 + .../logic/system/role/updateRoleLogic.go | 43 + .../logic/system/user/createUserLogic.go | 41 + .../logic/system/user/deleteUserLogic.go | 39 + .../logic/system/user/getUserLogic.go | 52 + .../logic/system/user/listUserLogic.go | 62 + .../logic/system/user/updateUserLogic.go | 44 + .../system/user/updateUserStatusLogic.go | 40 + .../middleware/authorityMiddleware.go | 19 + gateway/internal/svc/serviceContext.go | 26 + gateway/internal/types/types.go | 411 ++ go.mod | 129 + go.sum | 522 +++ model/casbinrulemodel.go | 27 + model/casbinrulemodel_gen.go | 151 + model/invproductmodel.go | 116 + model/invproductmodel_gen.go | 186 + model/invstockadjustdetailmodel.go | 55 + model/invstockadjustdetailmodel_gen.go | 151 + model/invstockadjustmodel.go | 71 + model/invstockadjustmodel_gen.go | 180 + model/invstockcheckdetailmodel.go | 62 + model/invstockcheckdetailmodel_gen.go | 152 + model/invstockcheckmodel.go | 67 + model/invstockcheckmodel_gen.go | 178 + model/invstockimportlogmodel.go | 46 + model/invstockimportlogmodel_gen.go | 153 + model/sysconfigmodel.go | 56 + model/sysconfigmodel_gen.go | 178 + model/sysmenumodel.go | 38 + model/sysmenumodel_gen.go | 158 + model/sysoperationlogmodel.go | 71 + model/sysoperationlogmodel_gen.go | 159 + model/sysrolemenumodel.go | 64 + model/sysrolemenumodel_gen.go | 146 + model/sysrolemodel.go | 70 + model/sysrolemodel_gen.go | 178 + model/sysusermodel.go | 67 + model/sysusermodel_gen.go | 184 + model/sysuserrolemodel.go | 47 + model/sysuserrolemodel_gen.go | 146 + model/vars.go | 5 + pkg/casbin/casbin.go | 65 + pkg/ctxdata/ctxdata.go | 31 + pkg/jwt/jwt.go | 41 + pkg/result/response.go | 44 + pkg/uid/uid.go | 12 + pkg/xerr/errcode.go | 38 + pkg/xerr/errors.go | 24 + rpc/inventory/etc/inventory.yaml | 17 + rpc/inventory/internal/config/config.go | 12 + .../internal/logic/approvestockadjustlogic.go | 75 + .../internal/logic/confirmstockchecklogic.go | 63 + .../internal/logic/createproductlogic.go | 61 + .../internal/logic/createstockadjustlogic.go | 84 + .../internal/logic/createstockchecklogic.go | 91 + .../internal/logic/deleteproductlogic.go | 45 + .../internal/logic/getproductlogic.go | 52 + .../internal/logic/getstockadjustlogic.go | 73 + .../internal/logic/getstockchecklogic.go | 72 + .../internal/logic/getstockgrouplogic.go | 56 + .../internal/logic/getstocksummarylogic.go | 42 + .../internal/logic/importproductslogic.go | 95 + .../internal/logic/listimportloglogic.go | 52 + .../internal/logic/listproductlogic.go | 60 + .../internal/logic/liststockadjustlogic.go | 54 + .../internal/logic/liststockchecklogic.go | 52 + .../internal/logic/updateproductlogic.go | 58 + .../internal/logic/updatestockchecklogic.go | 84 + .../internal/server/inventoryserviceserver.go | 119 + rpc/inventory/internal/svc/servicecontext.go | 31 + rpc/inventory/inventory.go | 39 + rpc/inventory/inventory.proto | 314 ++ .../inventoryservice/inventoryservice.go | 184 + rpc/inventory/pb/inventory.pb.go | 3705 +++++++++++++++++ rpc/inventory/pb/inventory_grpc.pb.go | 727 ++++ rpc/system/etc/system.yaml | 17 + rpc/system/internal/config/config.go | 12 + .../internal/logic/changepasswordlogic.go | 57 + rpc/system/internal/logic/createmenulogic.go | 51 + .../internal/logic/createoperationloglogic.go | 52 + rpc/system/internal/logic/createrolelogic.go | 46 + rpc/system/internal/logic/createuserlogic.go | 60 + rpc/system/internal/logic/deletemenulogic.go | 45 + rpc/system/internal/logic/deleterolelogic.go | 47 + rpc/system/internal/logic/deleteuserlogic.go | 50 + rpc/system/internal/logic/getmenulogic.go | 54 + rpc/system/internal/logic/getrolelogic.go | 56 + rpc/system/internal/logic/getuserlogic.go | 68 + rpc/system/internal/logic/listconfiglogic.go | 64 + rpc/system/internal/logic/listmenulogic.go | 54 + .../internal/logic/listoperationloglogic.go | 55 + rpc/system/internal/logic/listrolelogic.go | 59 + rpc/system/internal/logic/listuserlogic.go | 71 + rpc/system/internal/logic/loginlogic.go | 73 + .../internal/logic/setrolepermissionslogic.go | 40 + .../internal/logic/updateconfiglogic.go | 39 + rpc/system/internal/logic/updatemenulogic.go | 55 + rpc/system/internal/logic/updaterolelogic.go | 50 + rpc/system/internal/logic/updateuserlogic.go | 60 + .../internal/logic/updateuserstatuslogic.go | 46 + .../internal/server/systemserviceserver.go | 145 + rpc/system/internal/svc/servicecontext.go | 33 + rpc/system/pb/system.pb.go | 3624 ++++++++++++++++ rpc/system/pb/system_grpc.pb.go | 909 ++++ rpc/system/system.go | 39 + rpc/system/system.proto | 319 ++ rpc/system/systemservice/systemservice.go | 216 + 205 files changed, 22474 insertions(+) create mode 100644 .gitignore create mode 100644 cmd/genhash/main.go create mode 100644 deploy/Dockerfile.gateway create mode 100644 deploy/Dockerfile.inventory create mode 100644 deploy/Dockerfile.system create mode 100644 deploy/docker-compose.yaml create mode 100644 deploy/etc/gateway.yaml create mode 100644 deploy/etc/inventory.yaml create mode 100644 deploy/etc/system.yaml create mode 100644 deploy/mysql/init.sql create mode 100644 deploy/nginx/nginx.conf create mode 100644 gateway/etc/gateway-api.yaml create mode 100644 gateway/etc/gateway.yaml create mode 100644 gateway/gateway.api create mode 100644 gateway/gateway.go create mode 100644 gateway/internal/config/config.go create mode 100644 gateway/internal/handler/auth/changePasswordHandler.go create mode 100644 gateway/internal/handler/auth/getUserInfoHandler.go create mode 100644 gateway/internal/handler/auth/loginHandler.go create mode 100644 gateway/internal/handler/auth/logoutHandler.go create mode 100644 gateway/internal/handler/inventory/adjust/approveStockAdjustHandler.go create mode 100644 gateway/internal/handler/inventory/adjust/createStockAdjustHandler.go create mode 100644 gateway/internal/handler/inventory/adjust/getStockAdjustHandler.go create mode 100644 gateway/internal/handler/inventory/adjust/listStockAdjustHandler.go create mode 100644 gateway/internal/handler/inventory/check/confirmStockCheckHandler.go create mode 100644 gateway/internal/handler/inventory/check/createStockCheckHandler.go create mode 100644 gateway/internal/handler/inventory/check/getStockCheckHandler.go create mode 100644 gateway/internal/handler/inventory/check/listStockCheckHandler.go create mode 100644 gateway/internal/handler/inventory/check/updateStockCheckHandler.go create mode 100644 gateway/internal/handler/inventory/product/createProductHandler.go create mode 100644 gateway/internal/handler/inventory/product/deleteProductHandler.go create mode 100644 gateway/internal/handler/inventory/product/exportProductHandler.go create mode 100644 gateway/internal/handler/inventory/product/getProductHandler.go create mode 100644 gateway/internal/handler/inventory/product/importProductHandler.go create mode 100644 gateway/internal/handler/inventory/product/listProductHandler.go create mode 100644 gateway/internal/handler/inventory/product/updateProductHandler.go create mode 100644 gateway/internal/handler/inventory/stock/getStockByColorHandler.go create mode 100644 gateway/internal/handler/inventory/stock/getStockByLocationHandler.go create mode 100644 gateway/internal/handler/inventory/stock/getStockSummaryHandler.go create mode 100644 gateway/internal/handler/inventory/stock/listStockHandler.go create mode 100644 gateway/internal/handler/routes.go create mode 100644 gateway/internal/handler/system/config/listConfigHandler.go create mode 100644 gateway/internal/handler/system/config/updateConfigHandler.go create mode 100644 gateway/internal/handler/system/log/listLogHandler.go create mode 100644 gateway/internal/handler/system/menu/createMenuHandler.go create mode 100644 gateway/internal/handler/system/menu/deleteMenuHandler.go create mode 100644 gateway/internal/handler/system/menu/getMenuHandler.go create mode 100644 gateway/internal/handler/system/menu/listMenuHandler.go create mode 100644 gateway/internal/handler/system/menu/updateMenuHandler.go create mode 100644 gateway/internal/handler/system/role/createRoleHandler.go create mode 100644 gateway/internal/handler/system/role/deleteRoleHandler.go create mode 100644 gateway/internal/handler/system/role/getRoleHandler.go create mode 100644 gateway/internal/handler/system/role/listRoleHandler.go create mode 100644 gateway/internal/handler/system/role/setRolePermissionsHandler.go create mode 100644 gateway/internal/handler/system/role/updateRoleHandler.go create mode 100644 gateway/internal/handler/system/user/createUserHandler.go create mode 100644 gateway/internal/handler/system/user/deleteUserHandler.go create mode 100644 gateway/internal/handler/system/user/getUserHandler.go create mode 100644 gateway/internal/handler/system/user/listUserHandler.go create mode 100644 gateway/internal/handler/system/user/updateUserHandler.go create mode 100644 gateway/internal/handler/system/user/updateUserStatusHandler.go create mode 100644 gateway/internal/logic/auth/changePasswordLogic.go create mode 100644 gateway/internal/logic/auth/getUserInfoLogic.go create mode 100644 gateway/internal/logic/auth/loginLogic.go create mode 100644 gateway/internal/logic/auth/logoutLogic.go create mode 100644 gateway/internal/logic/inventory/adjust/approveStockAdjustLogic.go create mode 100644 gateway/internal/logic/inventory/adjust/createStockAdjustLogic.go create mode 100644 gateway/internal/logic/inventory/adjust/getStockAdjustLogic.go create mode 100644 gateway/internal/logic/inventory/adjust/listStockAdjustLogic.go create mode 100644 gateway/internal/logic/inventory/check/confirmStockCheckLogic.go create mode 100644 gateway/internal/logic/inventory/check/createStockCheckLogic.go create mode 100644 gateway/internal/logic/inventory/check/getStockCheckLogic.go create mode 100644 gateway/internal/logic/inventory/check/listStockCheckLogic.go create mode 100644 gateway/internal/logic/inventory/check/updateStockCheckLogic.go create mode 100644 gateway/internal/logic/inventory/product/createProductLogic.go create mode 100644 gateway/internal/logic/inventory/product/deleteProductLogic.go create mode 100644 gateway/internal/logic/inventory/product/exportProductLogic.go create mode 100644 gateway/internal/logic/inventory/product/getProductLogic.go create mode 100644 gateway/internal/logic/inventory/product/importProductLogic.go create mode 100644 gateway/internal/logic/inventory/product/listProductLogic.go create mode 100644 gateway/internal/logic/inventory/product/updateProductLogic.go create mode 100644 gateway/internal/logic/inventory/stock/getStockByColorLogic.go create mode 100644 gateway/internal/logic/inventory/stock/getStockByLocationLogic.go create mode 100644 gateway/internal/logic/inventory/stock/getStockSummaryLogic.go create mode 100644 gateway/internal/logic/inventory/stock/listStockLogic.go create mode 100644 gateway/internal/logic/system/config/listConfigLogic.go create mode 100644 gateway/internal/logic/system/config/updateConfigLogic.go create mode 100644 gateway/internal/logic/system/log/listLogLogic.go create mode 100644 gateway/internal/logic/system/menu/createMenuLogic.go create mode 100644 gateway/internal/logic/system/menu/deleteMenuLogic.go create mode 100644 gateway/internal/logic/system/menu/getMenuLogic.go create mode 100644 gateway/internal/logic/system/menu/listMenuLogic.go create mode 100644 gateway/internal/logic/system/menu/updateMenuLogic.go create mode 100644 gateway/internal/logic/system/role/createRoleLogic.go create mode 100644 gateway/internal/logic/system/role/deleteRoleLogic.go create mode 100644 gateway/internal/logic/system/role/getRoleLogic.go create mode 100644 gateway/internal/logic/system/role/listRoleLogic.go create mode 100644 gateway/internal/logic/system/role/setRolePermissionsLogic.go create mode 100644 gateway/internal/logic/system/role/updateRoleLogic.go create mode 100644 gateway/internal/logic/system/user/createUserLogic.go create mode 100644 gateway/internal/logic/system/user/deleteUserLogic.go create mode 100644 gateway/internal/logic/system/user/getUserLogic.go create mode 100644 gateway/internal/logic/system/user/listUserLogic.go create mode 100644 gateway/internal/logic/system/user/updateUserLogic.go create mode 100644 gateway/internal/logic/system/user/updateUserStatusLogic.go create mode 100644 gateway/internal/middleware/authorityMiddleware.go create mode 100644 gateway/internal/svc/serviceContext.go create mode 100644 gateway/internal/types/types.go create mode 100644 go.mod create mode 100644 go.sum create mode 100755 model/casbinrulemodel.go create mode 100755 model/casbinrulemodel_gen.go create mode 100755 model/invproductmodel.go create mode 100755 model/invproductmodel_gen.go create mode 100755 model/invstockadjustdetailmodel.go create mode 100755 model/invstockadjustdetailmodel_gen.go create mode 100755 model/invstockadjustmodel.go create mode 100755 model/invstockadjustmodel_gen.go create mode 100755 model/invstockcheckdetailmodel.go create mode 100755 model/invstockcheckdetailmodel_gen.go create mode 100755 model/invstockcheckmodel.go create mode 100755 model/invstockcheckmodel_gen.go create mode 100755 model/invstockimportlogmodel.go create mode 100755 model/invstockimportlogmodel_gen.go create mode 100755 model/sysconfigmodel.go create mode 100755 model/sysconfigmodel_gen.go create mode 100755 model/sysmenumodel.go create mode 100755 model/sysmenumodel_gen.go create mode 100755 model/sysoperationlogmodel.go create mode 100755 model/sysoperationlogmodel_gen.go create mode 100755 model/sysrolemenumodel.go create mode 100755 model/sysrolemenumodel_gen.go create mode 100755 model/sysrolemodel.go create mode 100755 model/sysrolemodel_gen.go create mode 100755 model/sysusermodel.go create mode 100755 model/sysusermodel_gen.go create mode 100755 model/sysuserrolemodel.go create mode 100755 model/sysuserrolemodel_gen.go create mode 100644 model/vars.go create mode 100644 pkg/casbin/casbin.go create mode 100644 pkg/ctxdata/ctxdata.go create mode 100644 pkg/jwt/jwt.go create mode 100644 pkg/result/response.go create mode 100644 pkg/uid/uid.go create mode 100644 pkg/xerr/errcode.go create mode 100644 pkg/xerr/errors.go create mode 100644 rpc/inventory/etc/inventory.yaml create mode 100755 rpc/inventory/internal/config/config.go create mode 100644 rpc/inventory/internal/logic/approvestockadjustlogic.go create mode 100644 rpc/inventory/internal/logic/confirmstockchecklogic.go create mode 100644 rpc/inventory/internal/logic/createproductlogic.go create mode 100644 rpc/inventory/internal/logic/createstockadjustlogic.go create mode 100644 rpc/inventory/internal/logic/createstockchecklogic.go create mode 100644 rpc/inventory/internal/logic/deleteproductlogic.go create mode 100644 rpc/inventory/internal/logic/getproductlogic.go create mode 100644 rpc/inventory/internal/logic/getstockadjustlogic.go create mode 100644 rpc/inventory/internal/logic/getstockchecklogic.go create mode 100644 rpc/inventory/internal/logic/getstockgrouplogic.go create mode 100644 rpc/inventory/internal/logic/getstocksummarylogic.go create mode 100644 rpc/inventory/internal/logic/importproductslogic.go create mode 100644 rpc/inventory/internal/logic/listimportloglogic.go create mode 100644 rpc/inventory/internal/logic/listproductlogic.go create mode 100644 rpc/inventory/internal/logic/liststockadjustlogic.go create mode 100644 rpc/inventory/internal/logic/liststockchecklogic.go create mode 100644 rpc/inventory/internal/logic/updateproductlogic.go create mode 100644 rpc/inventory/internal/logic/updatestockchecklogic.go create mode 100644 rpc/inventory/internal/server/inventoryserviceserver.go create mode 100644 rpc/inventory/internal/svc/servicecontext.go create mode 100644 rpc/inventory/inventory.go create mode 100644 rpc/inventory/inventory.proto create mode 100644 rpc/inventory/inventoryservice/inventoryservice.go create mode 100644 rpc/inventory/pb/inventory.pb.go create mode 100644 rpc/inventory/pb/inventory_grpc.pb.go create mode 100644 rpc/system/etc/system.yaml create mode 100755 rpc/system/internal/config/config.go create mode 100644 rpc/system/internal/logic/changepasswordlogic.go create mode 100644 rpc/system/internal/logic/createmenulogic.go create mode 100644 rpc/system/internal/logic/createoperationloglogic.go create mode 100644 rpc/system/internal/logic/createrolelogic.go create mode 100644 rpc/system/internal/logic/createuserlogic.go create mode 100644 rpc/system/internal/logic/deletemenulogic.go create mode 100644 rpc/system/internal/logic/deleterolelogic.go create mode 100644 rpc/system/internal/logic/deleteuserlogic.go create mode 100644 rpc/system/internal/logic/getmenulogic.go create mode 100644 rpc/system/internal/logic/getrolelogic.go create mode 100644 rpc/system/internal/logic/getuserlogic.go create mode 100644 rpc/system/internal/logic/listconfiglogic.go create mode 100644 rpc/system/internal/logic/listmenulogic.go create mode 100644 rpc/system/internal/logic/listoperationloglogic.go create mode 100644 rpc/system/internal/logic/listrolelogic.go create mode 100644 rpc/system/internal/logic/listuserlogic.go create mode 100644 rpc/system/internal/logic/loginlogic.go create mode 100644 rpc/system/internal/logic/setrolepermissionslogic.go create mode 100644 rpc/system/internal/logic/updateconfiglogic.go create mode 100644 rpc/system/internal/logic/updatemenulogic.go create mode 100644 rpc/system/internal/logic/updaterolelogic.go create mode 100644 rpc/system/internal/logic/updateuserlogic.go create mode 100644 rpc/system/internal/logic/updateuserstatuslogic.go create mode 100644 rpc/system/internal/server/systemserviceserver.go create mode 100644 rpc/system/internal/svc/servicecontext.go create mode 100644 rpc/system/pb/system.pb.go create mode 100644 rpc/system/pb/system_grpc.pb.go create mode 100644 rpc/system/system.go create mode 100644 rpc/system/system.proto create mode 100644 rpc/system/systemservice/systemservice.go diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b03a219 --- /dev/null +++ b/.gitignore @@ -0,0 +1,31 @@ +# Binaries +*.exe +*.exe~ +*.dll +*.so +*.dylib +/bin/ +/output/ + +# Test +*.test +*.out +coverage.txt + +# Dependency +/vendor/ + +# IDE +.idea/ +.vscode/ +*.swp +*.swo +*~ + +# OS +.DS_Store +Thumbs.db + +# Env +.env +.env.local diff --git a/cmd/genhash/main.go b/cmd/genhash/main.go new file mode 100644 index 0000000..afe83cc --- /dev/null +++ b/cmd/genhash/main.go @@ -0,0 +1,12 @@ +package main + +import ( + "fmt" + + "golang.org/x/crypto/bcrypt" +) + +func main() { + hash, _ := bcrypt.GenerateFromPassword([]byte("admin123"), bcrypt.DefaultCost) + fmt.Println(string(hash)) +} diff --git a/deploy/Dockerfile.gateway b/deploy/Dockerfile.gateway new file mode 100644 index 0000000..de3f122 --- /dev/null +++ b/deploy/Dockerfile.gateway @@ -0,0 +1,7 @@ +FROM alpine:3.19 +RUN apk add --no-cache ca-certificates tzdata +WORKDIR /app +COPY deploy/bin/gateway . +COPY deploy/etc/gateway.yaml etc/gateway.yaml +EXPOSE 8888 +CMD ["./gateway", "-f", "etc/gateway.yaml"] diff --git a/deploy/Dockerfile.inventory b/deploy/Dockerfile.inventory new file mode 100644 index 0000000..80ede24 --- /dev/null +++ b/deploy/Dockerfile.inventory @@ -0,0 +1,7 @@ +FROM alpine:3.19 +RUN apk add --no-cache ca-certificates tzdata +WORKDIR /app +COPY deploy/bin/inventory . +COPY deploy/etc/inventory.yaml etc/inventory.yaml +EXPOSE 9002 +CMD ["./inventory", "-f", "etc/inventory.yaml"] diff --git a/deploy/Dockerfile.system b/deploy/Dockerfile.system new file mode 100644 index 0000000..e27367e --- /dev/null +++ b/deploy/Dockerfile.system @@ -0,0 +1,7 @@ +FROM alpine:3.19 +RUN apk add --no-cache ca-certificates tzdata +WORKDIR /app +COPY deploy/bin/system . +COPY deploy/etc/system.yaml etc/system.yaml +EXPOSE 9001 +CMD ["./system", "-f", "etc/system.yaml"] diff --git a/deploy/docker-compose.yaml b/deploy/docker-compose.yaml new file mode 100644 index 0000000..78c25d6 --- /dev/null +++ b/deploy/docker-compose.yaml @@ -0,0 +1,115 @@ +services: + mysql: + image: mysql:8.0 + container_name: muyu-mysql + restart: always + environment: + MYSQL_ROOT_PASSWORD: muyu2026 + MYSQL_DATABASE: muyu_wms + TZ: Asia/Shanghai + ports: + - "3306:3306" + volumes: + - ./mysql/init.sql:/docker-entrypoint-initdb.d/init.sql + - ../data/mysql:/var/lib/mysql + command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] + interval: 10s + timeout: 5s + retries: 5 + + redis: + image: redis:7-alpine + container_name: muyu-redis + restart: always + ports: + - "6379:6379" + volumes: + - ../data/redis:/data + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 10s + timeout: 5s + retries: 5 + + etcd: + image: quay.io/coreos/etcd:v3.5.17 + container_name: muyu-etcd + restart: always + command: + - etcd + - --name=default + - --data-dir=/etcd-data + - --listen-client-urls=http://0.0.0.0:2379 + - --advertise-client-urls=http://etcd:2379 + - --listen-peer-urls=http://0.0.0.0:2380 + - --initial-advertise-peer-urls=http://etcd:2380 + - --initial-cluster=default=http://etcd:2380 + - --initial-cluster-state=new + ports: + - "2379:2379" + healthcheck: + test: ["CMD", "etcdctl", "endpoint", "health"] + interval: 10s + timeout: 5s + retries: 5 + + system-rpc: + build: + context: .. + dockerfile: deploy/Dockerfile.system + container_name: muyu-system-rpc + restart: always + depends_on: + mysql: + condition: service_healthy + redis: + condition: service_healthy + etcd: + condition: service_healthy + environment: + TZ: Asia/Shanghai + + inventory-rpc: + build: + context: .. + dockerfile: deploy/Dockerfile.inventory + container_name: muyu-inventory-rpc + restart: always + depends_on: + mysql: + condition: service_healthy + redis: + condition: service_healthy + etcd: + condition: service_healthy + environment: + TZ: Asia/Shanghai + + gateway: + build: + context: .. + dockerfile: deploy/Dockerfile.gateway + container_name: muyu-gateway + restart: always + ports: + - "8888:8888" + depends_on: + - system-rpc + - inventory-rpc + environment: + TZ: Asia/Shanghai + + nginx: + image: nginx:alpine + container_name: muyu-nginx + restart: always + ports: + - "8080:80" + volumes: + - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf + - ../../muyu-portal/dist:/usr/share/nginx/html + - ../data/uploads:/usr/share/nginx/uploads + depends_on: + - gateway diff --git a/deploy/etc/gateway.yaml b/deploy/etc/gateway.yaml new file mode 100644 index 0000000..9613f02 --- /dev/null +++ b/deploy/etc/gateway.yaml @@ -0,0 +1,26 @@ +Name: gateway-api +Host: 0.0.0.0 +Port: 8888 + +Auth: + AccessSecret: muyu-wms-jwt-secret-key-2026 + AccessExpire: 7200 + +SystemRpc: + Etcd: + Hosts: + - etcd:2379 + Key: system.rpc + NonBlock: true + +InventoryRpc: + Etcd: + Hosts: + - etcd:2379 + Key: inventory.rpc + NonBlock: true + +Log: + ServiceName: gateway-api + Mode: console + Level: info diff --git a/deploy/etc/inventory.yaml b/deploy/etc/inventory.yaml new file mode 100644 index 0000000..4c6c6d4 --- /dev/null +++ b/deploy/etc/inventory.yaml @@ -0,0 +1,17 @@ +Name: inventory.rpc +ListenOn: 0.0.0.0:9002 + +Etcd: + Hosts: + - etcd:2379 + Key: inventory.rpc + +DataSource: root:muyu2026@tcp(mysql:3306)/muyu_wms?charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai + +Cache: + - Host: redis:6379 + +Log: + ServiceName: inventory-rpc + Mode: console + Level: info diff --git a/deploy/etc/system.yaml b/deploy/etc/system.yaml new file mode 100644 index 0000000..199ffb6 --- /dev/null +++ b/deploy/etc/system.yaml @@ -0,0 +1,17 @@ +Name: system.rpc +ListenOn: 0.0.0.0:9001 + +Etcd: + Hosts: + - etcd:2379 + Key: system.rpc + +DataSource: root:muyu2026@tcp(mysql:3306)/muyu_wms?charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai + +Cache: + - Host: redis:6379 + +Log: + ServiceName: system-rpc + Mode: console + Level: info diff --git a/deploy/mysql/init.sql b/deploy/mysql/init.sql new file mode 100644 index 0000000..19e972e --- /dev/null +++ b/deploy/mysql/init.sql @@ -0,0 +1,312 @@ +-- Muyu Warehouse Management System - Database Init Script + +SET NAMES utf8mb4; +SET CHARACTER SET utf8mb4; + +CREATE DATABASE IF NOT EXISTS `muyu_wms` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +USE `muyu_wms`; + +-- ==================== System Management Tables ==================== + +CREATE TABLE `sys_user` ( + `id` BIGINT NOT NULL AUTO_INCREMENT, + `user_id` VARCHAR(32) NOT NULL, + `username` VARCHAR(50) NOT NULL, + `password` VARCHAR(255) NOT NULL, + `salt` VARCHAR(32) NOT NULL, + `real_name` VARCHAR(50) NOT NULL DEFAULT '', + `phone` VARCHAR(20) NOT NULL DEFAULT '', + `email` VARCHAR(100) NOT NULL DEFAULT '', + `avatar` VARCHAR(255) NOT NULL DEFAULT '', + `status` TINYINT NOT NULL DEFAULT 1 COMMENT '1:enabled 0:disabled', + `last_login_time` DATETIME DEFAULT NULL, + `last_login_ip` VARCHAR(50) NOT NULL DEFAULT '', + `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `deleted_at` DATETIME DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_user_id` (`user_id`), + UNIQUE KEY `uk_username` (`username`), + KEY `idx_status` (`status`), + KEY `idx_deleted_at` (`deleted_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE `sys_role` ( + `id` BIGINT NOT NULL AUTO_INCREMENT, + `role_id` VARCHAR(32) NOT NULL, + `role_name` VARCHAR(50) NOT NULL, + `role_key` VARCHAR(50) NOT NULL, + `role_desc` VARCHAR(200) NOT NULL DEFAULT '', + `sort_order` INT NOT NULL DEFAULT 0, + `status` TINYINT NOT NULL DEFAULT 1 COMMENT '1:enabled 0:disabled', + `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_role_id` (`role_id`), + UNIQUE KEY `uk_role_key` (`role_key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE `sys_user_role` ( + `id` BIGINT NOT NULL AUTO_INCREMENT, + `user_id` VARCHAR(32) NOT NULL, + `role_id` VARCHAR(32) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_user_role` (`user_id`, `role_id`), + KEY `idx_role_id` (`role_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE `sys_menu` ( + `id` BIGINT NOT NULL AUTO_INCREMENT, + `menu_id` VARCHAR(32) NOT NULL, + `parent_id` VARCHAR(32) NOT NULL DEFAULT '', + `menu_name` VARCHAR(50) NOT NULL, + `menu_type` TINYINT NOT NULL DEFAULT 1 COMMENT '1:directory 2:menu 3:button', + `path` VARCHAR(200) NOT NULL DEFAULT '', + `component` VARCHAR(200) NOT NULL DEFAULT '', + `permission` VARCHAR(100) NOT NULL DEFAULT '', + `icon` VARCHAR(50) NOT NULL DEFAULT '', + `sort_order` INT NOT NULL DEFAULT 0, + `visible` TINYINT NOT NULL DEFAULT 1 COMMENT '1:visible 0:hidden', + `status` TINYINT NOT NULL DEFAULT 1 COMMENT '1:enabled 0:disabled', + `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_menu_id` (`menu_id`), + KEY `idx_parent_id` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE `sys_role_menu` ( + `id` BIGINT NOT NULL AUTO_INCREMENT, + `role_id` VARCHAR(32) NOT NULL, + `menu_id` VARCHAR(32) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_role_menu` (`role_id`, `menu_id`), + KEY `idx_menu_id` (`menu_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE `sys_operation_log` ( + `id` BIGINT NOT NULL AUTO_INCREMENT, + `log_id` VARCHAR(32) NOT NULL, + `user_id` VARCHAR(32) NOT NULL DEFAULT '', + `username` VARCHAR(50) NOT NULL DEFAULT '', + `module` VARCHAR(50) NOT NULL DEFAULT '', + `operation` VARCHAR(20) NOT NULL DEFAULT '', + `method` VARCHAR(10) NOT NULL DEFAULT '', + `path` VARCHAR(200) NOT NULL DEFAULT '', + `request_body` TEXT, + `response_body` TEXT, + `ip` VARCHAR(50) NOT NULL DEFAULT '', + `user_agent` VARCHAR(500) NOT NULL DEFAULT '', + `duration` INT NOT NULL DEFAULT 0 COMMENT 'milliseconds', + `status` TINYINT NOT NULL DEFAULT 1 COMMENT '1:success 0:fail', + `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_log_id` (`log_id`), + KEY `idx_user_id` (`user_id`), + KEY `idx_module` (`module`), + KEY `idx_created_at` (`created_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE `sys_config` ( + `id` BIGINT NOT NULL AUTO_INCREMENT, + `config_id` VARCHAR(32) NOT NULL, + `config_key` VARCHAR(50) NOT NULL, + `config_value` TEXT, + `config_name` VARCHAR(100) NOT NULL DEFAULT '', + `config_group` VARCHAR(50) NOT NULL DEFAULT '', + `remark` TEXT, + `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_config_id` (`config_id`), + UNIQUE KEY `uk_config_key` (`config_key`), + KEY `idx_config_group` (`config_group`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ==================== Inventory Management Tables ==================== + +CREATE TABLE `inv_product` ( + `id` BIGINT NOT NULL AUTO_INCREMENT, + `product_id` VARCHAR(32) NOT NULL, + `product_name` VARCHAR(100) NOT NULL, + `image_url` VARCHAR(255) NOT NULL DEFAULT '', + `spec` VARCHAR(100) NOT NULL DEFAULT '', + `color` VARCHAR(50) NOT NULL DEFAULT '', + `unit_pieces` INT NOT NULL DEFAULT 0, + `unit_rolls` INT NOT NULL DEFAULT 0, + `stock_quantity` DECIMAL(10,2) NOT NULL DEFAULT 0.00, + `location` VARCHAR(100) NOT NULL DEFAULT '', + `cost_price` DECIMAL(10,2) NOT NULL DEFAULT 0.00, + `sales_price` DECIMAL(10,2) NOT NULL DEFAULT 0.00, + `remark` TEXT, + `status` TINYINT NOT NULL DEFAULT 1 COMMENT '1:enabled 0:disabled', + `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `deleted_at` DATETIME DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_product_id` (`product_id`), + UNIQUE KEY `uk_product_name` (`product_name`), + KEY `idx_color` (`color`), + KEY `idx_location` (`location`), + KEY `idx_status` (`status`), + KEY `idx_deleted_at` (`deleted_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE `inv_stock_import_log` ( + `id` BIGINT NOT NULL AUTO_INCREMENT, + `import_id` VARCHAR(32) NOT NULL, + `file_name` VARCHAR(200) NOT NULL DEFAULT '', + `total_count` INT NOT NULL DEFAULT 0, + `success_count` INT NOT NULL DEFAULT 0, + `fail_count` INT NOT NULL DEFAULT 0, + `error_msg` TEXT, + `operator` VARCHAR(50) NOT NULL DEFAULT '', + `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_import_id` (`import_id`), + KEY `idx_created_at` (`created_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE `inv_stock_check` ( + `id` BIGINT NOT NULL AUTO_INCREMENT, + `check_id` VARCHAR(32) NOT NULL, + `check_no` VARCHAR(32) NOT NULL, + `check_date` DATE NOT NULL, + `checker` VARCHAR(50) NOT NULL DEFAULT '', + `status` TINYINT NOT NULL DEFAULT 0 COMMENT '0:draft 1:in_progress 2:completed', + `remark` TEXT, + `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_check_id` (`check_id`), + UNIQUE KEY `uk_check_no` (`check_no`), + KEY `idx_status` (`status`), + KEY `idx_check_date` (`check_date`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE `inv_stock_check_detail` ( + `id` BIGINT NOT NULL AUTO_INCREMENT, + `detail_id` VARCHAR(32) NOT NULL, + `check_id` VARCHAR(32) NOT NULL, + `product_id` VARCHAR(32) NOT NULL, + `system_quantity` DECIMAL(10,2) NOT NULL DEFAULT 0.00, + `actual_quantity` DECIMAL(10,2) NOT NULL DEFAULT 0.00, + `diff_quantity` DECIMAL(10,2) NOT NULL DEFAULT 0.00, + `diff_amount` DECIMAL(12,2) NOT NULL DEFAULT 0.00, + `remark` TEXT, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_detail_id` (`detail_id`), + KEY `idx_check_id` (`check_id`), + KEY `idx_product_id` (`product_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE `inv_stock_adjust` ( + `id` BIGINT NOT NULL AUTO_INCREMENT, + `adjust_id` VARCHAR(32) NOT NULL, + `adjust_no` VARCHAR(32) NOT NULL, + `adjust_date` DATE NOT NULL, + `adjust_reason` VARCHAR(50) NOT NULL DEFAULT '', + `operator` VARCHAR(50) NOT NULL DEFAULT '', + `approver` VARCHAR(50) NOT NULL DEFAULT '', + `status` TINYINT NOT NULL DEFAULT 0 COMMENT '0:pending 1:approved 2:rejected', + `remark` TEXT, + `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_adjust_id` (`adjust_id`), + UNIQUE KEY `uk_adjust_no` (`adjust_no`), + KEY `idx_status` (`status`), + KEY `idx_adjust_date` (`adjust_date`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE `inv_stock_adjust_detail` ( + `id` BIGINT NOT NULL AUTO_INCREMENT, + `detail_id` VARCHAR(32) NOT NULL, + `adjust_id` VARCHAR(32) NOT NULL, + `product_id` VARCHAR(32) NOT NULL, + `before_quantity` DECIMAL(10,2) NOT NULL DEFAULT 0.00, + `adjust_quantity` DECIMAL(10,2) NOT NULL DEFAULT 0.00, + `after_quantity` DECIMAL(10,2) NOT NULL DEFAULT 0.00, + `remark` TEXT, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_detail_id` (`detail_id`), + KEY `idx_adjust_id` (`adjust_id`), + KEY `idx_product_id` (`product_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- Casbin policy storage +CREATE TABLE `casbin_rule` ( + `id` BIGINT NOT NULL AUTO_INCREMENT, + `ptype` VARCHAR(100) NOT NULL DEFAULT '', + `v0` VARCHAR(100) NOT NULL DEFAULT '', + `v1` VARCHAR(100) NOT NULL DEFAULT '', + `v2` VARCHAR(100) NOT NULL DEFAULT '', + `v3` VARCHAR(100) NOT NULL DEFAULT '', + `v4` VARCHAR(100) NOT NULL DEFAULT '', + `v5` VARCHAR(100) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_casbin` (`ptype`, `v0`, `v1`, `v2`, `v3`, `v4`, `v5`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ==================== Initial Data ==================== + +-- Default admin user (password: admin123, bcrypt hashed) +INSERT INTO `sys_user` (`user_id`, `username`, `password`, `salt`, `real_name`, `status`) +VALUES ('u_admin_001', 'admin', '$2a$10$S5XPWRXUnexAt9KJw2CefeHMa6aude7j5dm5qgWM1YMQAAwRgsGXa', 'bcrypt', 'System Admin', 1); + +-- Default roles +INSERT INTO `sys_role` (`role_id`, `role_name`, `role_key`, `role_desc`, `sort_order`, `status`) VALUES +('r_001', '系统管理员', 'admin', 'Full system access', 1, 1), +('r_002', '仓库管理员', 'warehouse', 'Warehouse management access', 2, 1), +('r_003', '普通用户', 'user', 'Basic read access', 3, 1); + +-- Assign admin role to admin user +INSERT INTO `sys_user_role` (`user_id`, `role_id`) VALUES ('u_admin_001', 'r_001'); + +-- Default menus +INSERT INTO `sys_menu` (`menu_id`, `parent_id`, `menu_name`, `menu_type`, `path`, `component`, `permission`, `icon`, `sort_order`, `visible`, `status`) VALUES +-- Dashboard +('m_001', '', '首页', 1, '/dashboard', './Dashboard', '', 'DashboardOutlined', 1, 1, 1), +-- System Management +('m_100', '', '系统管理', 1, '/system', '', '', 'SettingOutlined', 100, 1, 1), +('m_101', 'm_100', '用户管理', 2, '/system/users', './System/Users', 'system:user:list', 'UserOutlined', 1, 1, 1), +('m_102', 'm_100', '角色管理', 2, '/system/roles', './System/Roles', 'system:role:list', 'TeamOutlined', 2, 1, 1), +('m_103', 'm_100', '菜单管理', 2, '/system/menus', './System/Menus', 'system:menu:list', 'MenuOutlined', 3, 1, 1), +('m_104', 'm_100', '操作日志', 2, '/system/logs', './System/Logs', 'system:log:list', 'FileTextOutlined', 4, 1, 1), +('m_105', 'm_100', '系统配置', 2, '/system/configs', './System/Configs', 'system:config:list', 'ToolOutlined', 5, 1, 1), +-- Inventory Management +('m_200', '', '库存管理', 1, '/inventory', '', '', 'DatabaseOutlined', 200, 1, 1), +('m_201', 'm_200', '产品档案', 2, '/inventory/products', './Inventory/Products', 'inventory:product:list', 'AppstoreOutlined', 1, 1, 1), +('m_202', 'm_200', '库存查询', 2, '/inventory/stocks', './Inventory/Stocks', 'inventory:stock:list', 'SearchOutlined', 2, 1, 1), +('m_203', 'm_200', '库存统计', 2, '/inventory/stats', './Inventory/Stats', 'inventory:stock:stats', 'BarChartOutlined', 3, 1, 1), +('m_204', 'm_200', '库存盘点', 2, '/inventory/checks', './Inventory/Checks', 'inventory:check:list', 'AuditOutlined', 4, 1, 1), +('m_205', 'm_200', '库存调整', 2, '/inventory/adjusts', './Inventory/Adjusts', 'inventory:adjust:list', 'SwapOutlined', 5, 1, 1), +('m_206', 'm_200', 'Excel导入', 2, '/inventory/import', './Inventory/Import', 'inventory:import:exec', 'ImportOutlined', 6, 1, 1); + +-- Assign all menus to admin role +INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) +SELECT 'r_001', `menu_id` FROM `sys_menu`; + +-- Assign inventory menus to warehouse role +INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES +('r_002', 'm_001'), +('r_002', 'm_200'), ('r_002', 'm_201'), ('r_002', 'm_202'), +('r_002', 'm_203'), ('r_002', 'm_204'), ('r_002', 'm_205'), ('r_002', 'm_206'); + +-- Default Casbin policies +INSERT INTO `casbin_rule` (`ptype`, `v0`, `v1`, `v2`) VALUES +('p', 'admin', '/api/v1/*', '*'), +('p', 'warehouse', '/api/v1/auth/*', '*'), +('p', 'warehouse', '/api/v1/inventory/*', '*'), +('p', 'user', '/api/v1/auth/*', '*'), +('p', 'user', '/api/v1/inventory/products', 'GET'), +('p', 'user', '/api/v1/inventory/stocks', 'GET'), +('p', 'user', '/api/v1/inventory/stocks/*', 'GET'); + +-- Default system configs +INSERT INTO `sys_config` (`config_id`, `config_key`, `config_value`, `config_name`, `config_group`, `remark`) VALUES +('c_001', 'sys_name', 'muyuqingfeng仓储管理系统', 'System Name', 'basic', 'System display name'), +('c_002', 'sys_logo', '', 'System Logo', 'basic', 'System logo URL'), +('c_003', 'upload_max_size', '10', 'Upload Max Size (MB)', 'upload', 'Maximum file upload size'), +('c_004', 'upload_allowed_types', 'jpg,jpeg,png,gif,xlsx,xls,csv', 'Allowed Upload Types', 'upload', 'Allowed file extensions'); diff --git a/deploy/nginx/nginx.conf b/deploy/nginx/nginx.conf new file mode 100644 index 0000000..7035d8e --- /dev/null +++ b/deploy/nginx/nginx.conf @@ -0,0 +1,34 @@ +server { + listen 80; + server_name localhost; + + root /usr/share/nginx/html; + index index.html; + + # Frontend SPA + location / { + try_files $uri $uri/ /index.html; + } + + # API proxy + location /api/ { + proxy_pass http://gateway:8888; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + # Upload files + location /uploads/ { + alias /usr/share/nginx/uploads/; + expires 30d; + add_header Cache-Control "public, immutable"; + } + + # Static assets cache + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { + expires 30d; + add_header Cache-Control "public, immutable"; + } +} diff --git a/gateway/etc/gateway-api.yaml b/gateway/etc/gateway-api.yaml new file mode 100644 index 0000000..8144aae --- /dev/null +++ b/gateway/etc/gateway-api.yaml @@ -0,0 +1,3 @@ +Name: gateway-api +Host: 0.0.0.0 +Port: 8888 diff --git a/gateway/etc/gateway.yaml b/gateway/etc/gateway.yaml new file mode 100644 index 0000000..54f9b17 --- /dev/null +++ b/gateway/etc/gateway.yaml @@ -0,0 +1,26 @@ +Name: gateway-api +Host: 0.0.0.0 +Port: 8888 + +Auth: + AccessSecret: muyu-wms-jwt-secret-key-2026 + AccessExpire: 7200 + +SystemRpc: + Etcd: + Hosts: + - 127.0.0.1:2379 + Key: system.rpc + NonBlock: true + +InventoryRpc: + Etcd: + Hosts: + - 127.0.0.1:2379 + Key: inventory.rpc + NonBlock: true + +Log: + ServiceName: gateway-api + Mode: console + Level: info diff --git a/gateway/gateway.api b/gateway/gateway.api new file mode 100644 index 0000000..700647a --- /dev/null +++ b/gateway/gateway.api @@ -0,0 +1,638 @@ +syntax = "v1" + +info ( + title: "Muyu WMS Gateway API" + desc: "Warehouse Management System API Gateway" + author: "muyu" + version: "1.0" +) + +// ==================== Common Types ==================== +type IdResp { + Id string `json:"id"` +} + +type PageReq { + Page int64 `form:"page,default=1"` + PageSize int64 `form:"pageSize,default=20"` +} + +// ==================== Auth Types ==================== +type ( + LoginReq { + Username string `json:"username"` + Password string `json:"password"` + } + LoginResp { + Token string `json:"token"` + UserInfo UserInfo `json:"userInfo"` + } + ChangePasswordReq { + OldPassword string `json:"oldPassword"` + NewPassword string `json:"newPassword"` + } +) + +// ==================== User Types ==================== +type ( + UserInfo { + UserId string `json:"userId"` + Username string `json:"username"` + RealName string `json:"realName"` + Phone string `json:"phone"` + Email string `json:"email"` + Avatar string `json:"avatar"` + Status int64 `json:"status"` + RoleId string `json:"roleId"` + RoleName string `json:"roleName"` + LastLoginTime string `json:"lastLoginTime"` + CreatedAt string `json:"createdAt"` + UpdatedAt string `json:"updatedAt"` + } + CreateUserReq { + Username string `json:"username"` + Password string `json:"password"` + RealName string `json:"realName"` + Phone string `json:"phone,optional"` + Email string `json:"email,optional"` + RoleId string `json:"roleId"` + } + UpdateUserReq { + RealName string `json:"realName,optional"` + Phone string `json:"phone,optional"` + Email string `json:"email,optional"` + RoleId string `json:"roleId,optional"` + Avatar string `json:"avatar,optional"` + } + UpdateUserStatusReq { + Status int64 `json:"status"` + } + ListUserReq { + Page int64 `form:"page,default=1"` + PageSize int64 `form:"pageSize,default=20"` + Username string `form:"username,optional"` + RealName string `form:"realName,optional"` + Phone string `form:"phone,optional"` + Status int64 `form:"status,optional,default=-1"` + } + ListUserResp { + Total int64 `json:"total"` + List []UserInfo `json:"list"` + } +) + +// ==================== Role Types ==================== +type ( + RoleInfo { + RoleId string `json:"roleId"` + RoleName string `json:"roleName"` + RoleKey string `json:"roleKey"` + RoleDesc string `json:"roleDesc"` + SortOrder int64 `json:"sortOrder"` + Status int64 `json:"status"` + MenuIds []string `json:"menuIds"` + CreatedAt string `json:"createdAt"` + UpdatedAt string `json:"updatedAt"` + } + CreateRoleReq { + RoleName string `json:"roleName"` + RoleKey string `json:"roleKey"` + RoleDesc string `json:"roleDesc,optional"` + SortOrder int64 `json:"sortOrder,optional"` + } + UpdateRoleReq { + RoleName string `json:"roleName,optional"` + RoleKey string `json:"roleKey,optional"` + RoleDesc string `json:"roleDesc,optional"` + SortOrder int64 `json:"sortOrder,optional"` + } + SetRolePermissionsReq { + MenuIds []string `json:"menuIds"` + } + ListRoleReq { + Page int64 `form:"page,default=1"` + PageSize int64 `form:"pageSize,default=20"` + RoleName string `form:"roleName,optional"` + Status int64 `form:"status,optional,default=-1"` + } + ListRoleResp { + Total int64 `json:"total"` + List []RoleInfo `json:"list"` + } +) + +// ==================== Menu Types ==================== +type ( + MenuInfo { + MenuId string `json:"menuId"` + ParentId string `json:"parentId"` + MenuName string `json:"menuName"` + MenuType int64 `json:"menuType"` + Path string `json:"path"` + Component string `json:"component"` + Permission string `json:"permission"` + Icon string `json:"icon"` + SortOrder int64 `json:"sortOrder"` + Visible int64 `json:"visible"` + Status int64 `json:"status"` + Children []MenuInfo `json:"children"` + CreatedAt string `json:"createdAt"` + UpdatedAt string `json:"updatedAt"` + } + CreateMenuReq { + ParentId string `json:"parentId,optional"` + MenuName string `json:"menuName"` + MenuType int64 `json:"menuType"` + Path string `json:"path,optional"` + Component string `json:"component,optional"` + Permission string `json:"permission,optional"` + Icon string `json:"icon,optional"` + SortOrder int64 `json:"sortOrder,optional"` + } + UpdateMenuReq { + ParentId string `json:"parentId,optional"` + MenuName string `json:"menuName,optional"` + MenuType int64 `json:"menuType,optional"` + Path string `json:"path,optional"` + Component string `json:"component,optional"` + Permission string `json:"permission,optional"` + Icon string `json:"icon,optional"` + SortOrder int64 `json:"sortOrder,optional"` + Visible int64 `json:"visible,optional"` + } + ListMenuResp { + List []MenuInfo `json:"list"` + } +) + +// ==================== Operation Log Types ==================== +type ( + OperationLogInfo { + LogId string `json:"logId"` + UserId string `json:"userId"` + Username string `json:"username"` + Module string `json:"module"` + Operation string `json:"operation"` + Method string `json:"method"` + Path string `json:"path"` + Ip string `json:"ip"` + Duration int64 `json:"duration"` + Status int64 `json:"status"` + CreatedAt string `json:"createdAt"` + } + ListLogReq { + Page int64 `form:"page,default=1"` + PageSize int64 `form:"pageSize,default=20"` + Username string `form:"username,optional"` + Module string `form:"module,optional"` + Operation string `form:"operation,optional"` + StartTime string `form:"startTime,optional"` + EndTime string `form:"endTime,optional"` + } + ListLogResp { + Total int64 `json:"total"` + List []OperationLogInfo `json:"list"` + } +) + +// ==================== Config Types ==================== +type ( + ConfigInfo { + ConfigId string `json:"configId"` + ConfigKey string `json:"configKey"` + ConfigValue string `json:"configValue"` + ConfigName string `json:"configName"` + ConfigGroup string `json:"configGroup"` + Remark string `json:"remark"` + UpdatedAt string `json:"updatedAt"` + } + UpdateConfigReq { + ConfigValue string `json:"configValue"` + } + ListConfigResp { + List []ConfigInfo `json:"list"` + } +) + +// ==================== Product Types ==================== +type ( + ProductInfo { + ProductId string `json:"productId"` + ProductName string `json:"productName"` + ImageUrl string `json:"imageUrl"` + Spec string `json:"spec"` + Color string `json:"color"` + UnitPieces int64 `json:"unitPieces"` + UnitRolls int64 `json:"unitRolls"` + StockQuantity string `json:"stockQuantity"` + Location string `json:"location"` + CostPrice string `json:"costPrice"` + SalesPrice string `json:"salesPrice"` + Remark string `json:"remark"` + Status int64 `json:"status"` + CreatedAt string `json:"createdAt"` + UpdatedAt string `json:"updatedAt"` + } + CreateProductReq { + ProductName string `json:"productName"` + ImageUrl string `json:"imageUrl,optional"` + Spec string `json:"spec,optional"` + Color string `json:"color,optional"` + UnitPieces int64 `json:"unitPieces,optional"` + UnitRolls int64 `json:"unitRolls,optional"` + StockQuantity string `json:"stockQuantity,optional"` + Location string `json:"location,optional"` + CostPrice string `json:"costPrice,optional"` + SalesPrice string `json:"salesPrice,optional"` + Remark string `json:"remark,optional"` + } + UpdateProductReq { + ProductName string `json:"productName,optional"` + ImageUrl string `json:"imageUrl,optional"` + Spec string `json:"spec,optional"` + Color string `json:"color,optional"` + UnitPieces int64 `json:"unitPieces,optional"` + UnitRolls int64 `json:"unitRolls,optional"` + StockQuantity string `json:"stockQuantity,optional"` + Location string `json:"location,optional"` + CostPrice string `json:"costPrice,optional"` + SalesPrice string `json:"salesPrice,optional"` + Remark string `json:"remark,optional"` + } + ListProductReq { + Page int64 `form:"page,default=1"` + PageSize int64 `form:"pageSize,default=20"` + ProductName string `form:"productName,optional"` + Spec string `form:"spec,optional"` + Color string `form:"color,optional"` + Location string `form:"location,optional"` + Status int64 `form:"status,optional,default=-1"` + } + ListProductResp { + Total int64 `json:"total"` + List []ProductInfo `json:"list"` + } + ImportProductResp { + TotalCount int64 `json:"totalCount"` + SuccessCount int64 `json:"successCount"` + FailCount int64 `json:"failCount"` + ErrorMsg string `json:"errorMsg"` + ImportId string `json:"importId"` + } +) + +// ==================== Stock Statistics Types ==================== +type ( + StockSummaryResp { + ProductCount int64 `json:"productCount"` + TotalPieces int64 `json:"totalPieces"` + TotalRolls int64 `json:"totalRolls"` + TotalCostValue string `json:"totalCostValue"` + TotalSalesValue string `json:"totalSalesValue"` + } + StockGroupItem { + Name string `json:"name"` + Count int64 `json:"count"` + Quantity string `json:"quantity"` + } + StockGroupResp { + List []StockGroupItem `json:"list"` + } +) + +// ==================== Stock Check Types ==================== +type ( + StockCheckInfo { + CheckId string `json:"checkId"` + CheckNo string `json:"checkNo"` + CheckDate string `json:"checkDate"` + Checker string `json:"checker"` + Status int64 `json:"status"` + Remark string `json:"remark"` + CreatedAt string `json:"createdAt"` + UpdatedAt string `json:"updatedAt"` + Details []StockCheckDetailInfo `json:"details"` + } + StockCheckDetailInfo { + DetailId string `json:"detailId"` + CheckId string `json:"checkId"` + ProductId string `json:"productId"` + ProductName string `json:"productName"` + SystemQuantity string `json:"systemQuantity"` + ActualQuantity string `json:"actualQuantity"` + DiffQuantity string `json:"diffQuantity"` + DiffAmount string `json:"diffAmount"` + Remark string `json:"remark"` + } + CreateStockCheckReq { + CheckDate string `json:"checkDate"` + Checker string `json:"checker"` + Remark string `json:"remark,optional"` + Details []StockCheckDetailReq `json:"details"` + } + StockCheckDetailReq { + ProductId string `json:"productId"` + ActualQuantity string `json:"actualQuantity"` + Remark string `json:"remark,optional"` + } + UpdateStockCheckReq { + Remark string `json:"remark,optional"` + Details []StockCheckDetailReq `json:"details"` + } + ListStockCheckReq { + Page int64 `form:"page,default=1"` + PageSize int64 `form:"pageSize,default=20"` + CheckNo string `form:"checkNo,optional"` + Status int64 `form:"status,optional,default=-1"` + StartDate string `form:"startDate,optional"` + EndDate string `form:"endDate,optional"` + } + ListStockCheckResp { + Total int64 `json:"total"` + List []StockCheckInfo `json:"list"` + } +) + +// ==================== Stock Adjust Types ==================== +type ( + StockAdjustInfo { + AdjustId string `json:"adjustId"` + AdjustNo string `json:"adjustNo"` + AdjustDate string `json:"adjustDate"` + AdjustReason string `json:"adjustReason"` + Operator string `json:"operator"` + Approver string `json:"approver"` + Status int64 `json:"status"` + Remark string `json:"remark"` + CreatedAt string `json:"createdAt"` + UpdatedAt string `json:"updatedAt"` + Details []StockAdjustDetailInfo `json:"details"` + } + StockAdjustDetailInfo { + DetailId string `json:"detailId"` + AdjustId string `json:"adjustId"` + ProductId string `json:"productId"` + ProductName string `json:"productName"` + BeforeQuantity string `json:"beforeQuantity"` + AdjustQuantity string `json:"adjustQuantity"` + AfterQuantity string `json:"afterQuantity"` + Remark string `json:"remark"` + } + CreateStockAdjustReq { + AdjustDate string `json:"adjustDate"` + AdjustReason string `json:"adjustReason"` + Remark string `json:"remark,optional"` + Details []StockAdjustDetailReq `json:"details"` + } + StockAdjustDetailReq { + ProductId string `json:"productId"` + AdjustQuantity string `json:"adjustQuantity"` + Remark string `json:"remark,optional"` + } + ApproveStockAdjustReq { + Action int64 `json:"action"` + } + ListStockAdjustReq { + Page int64 `form:"page,default=1"` + PageSize int64 `form:"pageSize,default=20"` + AdjustNo string `form:"adjustNo,optional"` + AdjustReason string `form:"adjustReason,optional"` + Status int64 `form:"status,optional,default=-1"` + StartDate string `form:"startDate,optional"` + EndDate string `form:"endDate,optional"` + } + ListStockAdjustResp { + Total int64 `json:"total"` + List []StockAdjustInfo `json:"list"` + } +) + +// ==================== Services ==================== +// Auth - No JWT required +@server ( + prefix: /api/v1/auth + group: auth +) +service gateway-api { + @handler LoginHandler + post /login (LoginReq) returns (LoginResp) +} + +// Auth - JWT required +@server ( + prefix: /api/v1/auth + group: auth + jwt: Auth +) +service gateway-api { + @handler LogoutHandler + post /logout returns (IdResp) + + @handler GetUserInfoHandler + get /info returns (UserInfo) + + @handler ChangePasswordHandler + put /password (ChangePasswordReq) returns (IdResp) +} + +// System - User Management +@server ( + prefix: /api/v1/system + group: system/user + jwt: Auth + middleware: AuthorityMiddleware +) +service gateway-api { + @handler ListUserHandler + get /users (ListUserReq) returns (ListUserResp) + + @handler GetUserHandler + get /users/:id returns (UserInfo) + + @handler CreateUserHandler + post /users (CreateUserReq) returns (IdResp) + + @handler UpdateUserHandler + put /users/:id (UpdateUserReq) returns (IdResp) + + @handler DeleteUserHandler + delete /users/:id returns (IdResp) + + @handler UpdateUserStatusHandler + put /users/:id/status (UpdateUserStatusReq) returns (IdResp) +} + +// System - Role Management +@server ( + prefix: /api/v1/system + group: system/role + jwt: Auth + middleware: AuthorityMiddleware +) +service gateway-api { + @handler ListRoleHandler + get /roles (ListRoleReq) returns (ListRoleResp) + + @handler GetRoleHandler + get /roles/:id returns (RoleInfo) + + @handler CreateRoleHandler + post /roles (CreateRoleReq) returns (IdResp) + + @handler UpdateRoleHandler + put /roles/:id (UpdateRoleReq) returns (IdResp) + + @handler DeleteRoleHandler + delete /roles/:id returns (IdResp) + + @handler SetRolePermissionsHandler + put /roles/:id/permissions (SetRolePermissionsReq) returns (IdResp) +} + +// System - Menu Management +@server ( + prefix: /api/v1/system + group: system/menu + jwt: Auth + middleware: AuthorityMiddleware +) +service gateway-api { + @handler ListMenuHandler + get /menus returns (ListMenuResp) + + @handler GetMenuHandler + get /menus/:id returns (MenuInfo) + + @handler CreateMenuHandler + post /menus (CreateMenuReq) returns (IdResp) + + @handler UpdateMenuHandler + put /menus/:id (UpdateMenuReq) returns (IdResp) + + @handler DeleteMenuHandler + delete /menus/:id returns (IdResp) +} + +// System - Operation Logs +@server ( + prefix: /api/v1/system + group: system/log + jwt: Auth + middleware: AuthorityMiddleware +) +service gateway-api { + @handler ListLogHandler + get /logs (ListLogReq) returns (ListLogResp) +} + +// System - Config +@server ( + prefix: /api/v1/system + group: system/config + jwt: Auth + middleware: AuthorityMiddleware +) +service gateway-api { + @handler ListConfigHandler + get /configs returns (ListConfigResp) + + @handler UpdateConfigHandler + put /configs/:key (UpdateConfigReq) returns (IdResp) +} + +// Inventory - Product Management +@server ( + prefix: /api/v1/inventory + group: inventory/product + jwt: Auth + middleware: AuthorityMiddleware +) +service gateway-api { + @handler ListProductHandler + get /products (ListProductReq) returns (ListProductResp) + + @handler GetProductHandler + get /products/:id returns (ProductInfo) + + @handler CreateProductHandler + post /products (CreateProductReq) returns (IdResp) + + @handler UpdateProductHandler + put /products/:id (UpdateProductReq) returns (IdResp) + + @handler DeleteProductHandler + delete /products/:id returns (IdResp) + + @handler ImportProductHandler + post /products/import returns (ImportProductResp) + + @handler ExportProductHandler + get /products/export +} + +// Inventory - Stock Query & Statistics +@server ( + prefix: /api/v1/inventory + group: inventory/stock + jwt: Auth + middleware: AuthorityMiddleware +) +service gateway-api { + @handler ListStockHandler + get /stocks (ListProductReq) returns (ListProductResp) + + @handler GetStockSummaryHandler + get /stocks/summary returns (StockSummaryResp) + + @handler GetStockByColorHandler + get /stocks/by-color returns (StockGroupResp) + + @handler GetStockByLocationHandler + get /stocks/by-location returns (StockGroupResp) +} + +// Inventory - Stock Check +@server ( + prefix: /api/v1/inventory + group: inventory/check + jwt: Auth + middleware: AuthorityMiddleware +) +service gateway-api { + @handler ListStockCheckHandler + get /checks (ListStockCheckReq) returns (ListStockCheckResp) + + @handler GetStockCheckHandler + get /checks/:id returns (StockCheckInfo) + + @handler CreateStockCheckHandler + post /checks (CreateStockCheckReq) returns (IdResp) + + @handler UpdateStockCheckHandler + put /checks/:id (UpdateStockCheckReq) returns (IdResp) + + @handler ConfirmStockCheckHandler + post /checks/:id/confirm returns (IdResp) +} + +// Inventory - Stock Adjust +@server ( + prefix: /api/v1/inventory + group: inventory/adjust + jwt: Auth + middleware: AuthorityMiddleware +) +service gateway-api { + @handler ListStockAdjustHandler + get /adjusts (ListStockAdjustReq) returns (ListStockAdjustResp) + + @handler GetStockAdjustHandler + get /adjusts/:id returns (StockAdjustInfo) + + @handler CreateStockAdjustHandler + post /adjusts (CreateStockAdjustReq) returns (IdResp) + + @handler ApproveStockAdjustHandler + post /adjusts/:id/approve (ApproveStockAdjustReq) returns (IdResp) +} + diff --git a/gateway/gateway.go b/gateway/gateway.go new file mode 100644 index 0000000..e002bdd --- /dev/null +++ b/gateway/gateway.go @@ -0,0 +1,56 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package main + +import ( + "context" + "flag" + "fmt" + "net/http" + + "muyu-apiserver/gateway/internal/config" + "muyu-apiserver/gateway/internal/handler" + "muyu-apiserver/gateway/internal/svc" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/rest" + "github.com/zeromicro/go-zero/rest/httpx" + "google.golang.org/grpc/status" +) + +var configFile = flag.String("f", "etc/gateway-api.yaml", "the config file") + +type Response struct { + Code int `json:"code"` + Msg string `json:"msg"` + Data interface{} `json:"data,omitempty"` +} + +func main() { + flag.Parse() + + var c config.Config + conf.MustLoad(*configFile, &c) + + server := rest.MustNewServer(c.RestConf, rest.WithCors()) + defer server.Stop() + + httpx.SetErrorHandlerCtx(func(ctx context.Context, err error) (int, interface{}) { + s, ok := status.FromError(err) + if ok { + return http.StatusOK, &Response{Code: int(s.Code()), Msg: s.Message()} + } + return http.StatusOK, &Response{Code: 1001, Msg: err.Error()} + }) + + httpx.SetOkHandler(func(ctx context.Context, a interface{}) interface{} { + return &Response{Code: 0, Msg: "success", Data: a} + }) + + ctx := svc.NewServiceContext(c) + handler.RegisterHandlers(server, ctx) + + fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port) + server.Start() +} diff --git a/gateway/internal/config/config.go b/gateway/internal/config/config.go new file mode 100644 index 0000000..9ae6a40 --- /dev/null +++ b/gateway/internal/config/config.go @@ -0,0 +1,19 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package config + +import ( + "github.com/zeromicro/go-zero/rest" + "github.com/zeromicro/go-zero/zrpc" +) + +type Config struct { + rest.RestConf + Auth struct { + AccessSecret string + AccessExpire int64 + } + SystemRpc zrpc.RpcClientConf + InventoryRpc zrpc.RpcClientConf +} diff --git a/gateway/internal/handler/auth/changePasswordHandler.go b/gateway/internal/handler/auth/changePasswordHandler.go new file mode 100644 index 0000000..31c6106 --- /dev/null +++ b/gateway/internal/handler/auth/changePasswordHandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package auth + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/auth" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func ChangePasswordHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ChangePasswordReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := auth.NewChangePasswordLogic(r.Context(), svcCtx) + resp, err := l.ChangePassword(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/auth/getUserInfoHandler.go b/gateway/internal/handler/auth/getUserInfoHandler.go new file mode 100644 index 0000000..b72efce --- /dev/null +++ b/gateway/internal/handler/auth/getUserInfoHandler.go @@ -0,0 +1,24 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package auth + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/auth" + "muyu-apiserver/gateway/internal/svc" +) + +func GetUserInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := auth.NewGetUserInfoLogic(r.Context(), svcCtx) + resp, err := l.GetUserInfo() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/auth/loginHandler.go b/gateway/internal/handler/auth/loginHandler.go new file mode 100644 index 0000000..cb5324a --- /dev/null +++ b/gateway/internal/handler/auth/loginHandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package auth + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/auth" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func LoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.LoginReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := auth.NewLoginLogic(r.Context(), svcCtx) + resp, err := l.Login(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/auth/logoutHandler.go b/gateway/internal/handler/auth/logoutHandler.go new file mode 100644 index 0000000..89b1e9b --- /dev/null +++ b/gateway/internal/handler/auth/logoutHandler.go @@ -0,0 +1,24 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package auth + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/auth" + "muyu-apiserver/gateway/internal/svc" +) + +func LogoutHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := auth.NewLogoutLogic(r.Context(), svcCtx) + resp, err := l.Logout() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/inventory/adjust/approveStockAdjustHandler.go b/gateway/internal/handler/inventory/adjust/approveStockAdjustHandler.go new file mode 100644 index 0000000..ab6ca51 --- /dev/null +++ b/gateway/internal/handler/inventory/adjust/approveStockAdjustHandler.go @@ -0,0 +1,31 @@ +package adjust + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/inventory/adjust" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func ApproveStockAdjustHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ApproveStockAdjustReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) + l := adjust.NewApproveStockAdjustLogic(ctx, svcCtx) + resp, err := l.ApproveStockAdjust(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/inventory/adjust/createStockAdjustHandler.go b/gateway/internal/handler/inventory/adjust/createStockAdjustHandler.go new file mode 100644 index 0000000..d5b867f --- /dev/null +++ b/gateway/internal/handler/inventory/adjust/createStockAdjustHandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package adjust + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/inventory/adjust" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func CreateStockAdjustHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateStockAdjustReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adjust.NewCreateStockAdjustLogic(r.Context(), svcCtx) + resp, err := l.CreateStockAdjust(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/inventory/adjust/getStockAdjustHandler.go b/gateway/internal/handler/inventory/adjust/getStockAdjustHandler.go new file mode 100644 index 0000000..8fa41a6 --- /dev/null +++ b/gateway/internal/handler/inventory/adjust/getStockAdjustHandler.go @@ -0,0 +1,24 @@ +package adjust + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/inventory/adjust" + "muyu-apiserver/gateway/internal/svc" +) + +func GetStockAdjustHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) + l := adjust.NewGetStockAdjustLogic(ctx, svcCtx) + resp, err := l.GetStockAdjust() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/inventory/adjust/listStockAdjustHandler.go b/gateway/internal/handler/inventory/adjust/listStockAdjustHandler.go new file mode 100644 index 0000000..9634ca3 --- /dev/null +++ b/gateway/internal/handler/inventory/adjust/listStockAdjustHandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package adjust + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/inventory/adjust" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func ListStockAdjustHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListStockAdjustReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adjust.NewListStockAdjustLogic(r.Context(), svcCtx) + resp, err := l.ListStockAdjust(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/inventory/check/confirmStockCheckHandler.go b/gateway/internal/handler/inventory/check/confirmStockCheckHandler.go new file mode 100644 index 0000000..4fffcb7 --- /dev/null +++ b/gateway/internal/handler/inventory/check/confirmStockCheckHandler.go @@ -0,0 +1,24 @@ +package check + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/inventory/check" + "muyu-apiserver/gateway/internal/svc" +) + +func ConfirmStockCheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) + l := check.NewConfirmStockCheckLogic(ctx, svcCtx) + resp, err := l.ConfirmStockCheck() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/inventory/check/createStockCheckHandler.go b/gateway/internal/handler/inventory/check/createStockCheckHandler.go new file mode 100644 index 0000000..e9189b7 --- /dev/null +++ b/gateway/internal/handler/inventory/check/createStockCheckHandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package check + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/inventory/check" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func CreateStockCheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateStockCheckReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := check.NewCreateStockCheckLogic(r.Context(), svcCtx) + resp, err := l.CreateStockCheck(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/inventory/check/getStockCheckHandler.go b/gateway/internal/handler/inventory/check/getStockCheckHandler.go new file mode 100644 index 0000000..4f9387d --- /dev/null +++ b/gateway/internal/handler/inventory/check/getStockCheckHandler.go @@ -0,0 +1,24 @@ +package check + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/inventory/check" + "muyu-apiserver/gateway/internal/svc" +) + +func GetStockCheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) + l := check.NewGetStockCheckLogic(ctx, svcCtx) + resp, err := l.GetStockCheck() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/inventory/check/listStockCheckHandler.go b/gateway/internal/handler/inventory/check/listStockCheckHandler.go new file mode 100644 index 0000000..675cda4 --- /dev/null +++ b/gateway/internal/handler/inventory/check/listStockCheckHandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package check + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/inventory/check" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func ListStockCheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListStockCheckReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := check.NewListStockCheckLogic(r.Context(), svcCtx) + resp, err := l.ListStockCheck(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/inventory/check/updateStockCheckHandler.go b/gateway/internal/handler/inventory/check/updateStockCheckHandler.go new file mode 100644 index 0000000..bb5a473 --- /dev/null +++ b/gateway/internal/handler/inventory/check/updateStockCheckHandler.go @@ -0,0 +1,31 @@ +package check + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/inventory/check" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func UpdateStockCheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateStockCheckReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) + l := check.NewUpdateStockCheckLogic(ctx, svcCtx) + resp, err := l.UpdateStockCheck(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/inventory/product/createProductHandler.go b/gateway/internal/handler/inventory/product/createProductHandler.go new file mode 100644 index 0000000..7515e74 --- /dev/null +++ b/gateway/internal/handler/inventory/product/createProductHandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package product + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/inventory/product" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func CreateProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateProductReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := product.NewCreateProductLogic(r.Context(), svcCtx) + resp, err := l.CreateProduct(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/inventory/product/deleteProductHandler.go b/gateway/internal/handler/inventory/product/deleteProductHandler.go new file mode 100644 index 0000000..1b7da71 --- /dev/null +++ b/gateway/internal/handler/inventory/product/deleteProductHandler.go @@ -0,0 +1,24 @@ +package product + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/inventory/product" + "muyu-apiserver/gateway/internal/svc" +) + +func DeleteProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) + l := product.NewDeleteProductLogic(ctx, svcCtx) + resp, err := l.DeleteProduct() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/inventory/product/exportProductHandler.go b/gateway/internal/handler/inventory/product/exportProductHandler.go new file mode 100644 index 0000000..1c046f7 --- /dev/null +++ b/gateway/internal/handler/inventory/product/exportProductHandler.go @@ -0,0 +1,24 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package product + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/inventory/product" + "muyu-apiserver/gateway/internal/svc" +) + +func ExportProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := product.NewExportProductLogic(r.Context(), svcCtx) + err := l.ExportProduct() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/gateway/internal/handler/inventory/product/getProductHandler.go b/gateway/internal/handler/inventory/product/getProductHandler.go new file mode 100644 index 0000000..279e96a --- /dev/null +++ b/gateway/internal/handler/inventory/product/getProductHandler.go @@ -0,0 +1,24 @@ +package product + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/inventory/product" + "muyu-apiserver/gateway/internal/svc" +) + +func GetProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) + l := product.NewGetProductLogic(ctx, svcCtx) + resp, err := l.GetProduct() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/inventory/product/importProductHandler.go b/gateway/internal/handler/inventory/product/importProductHandler.go new file mode 100644 index 0000000..812f99a --- /dev/null +++ b/gateway/internal/handler/inventory/product/importProductHandler.go @@ -0,0 +1,24 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package product + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/inventory/product" + "muyu-apiserver/gateway/internal/svc" +) + +func ImportProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := product.NewImportProductLogic(r.Context(), svcCtx) + resp, err := l.ImportProduct() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/inventory/product/listProductHandler.go b/gateway/internal/handler/inventory/product/listProductHandler.go new file mode 100644 index 0000000..4f88f90 --- /dev/null +++ b/gateway/internal/handler/inventory/product/listProductHandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package product + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/inventory/product" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func ListProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListProductReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := product.NewListProductLogic(r.Context(), svcCtx) + resp, err := l.ListProduct(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/inventory/product/updateProductHandler.go b/gateway/internal/handler/inventory/product/updateProductHandler.go new file mode 100644 index 0000000..06fec54 --- /dev/null +++ b/gateway/internal/handler/inventory/product/updateProductHandler.go @@ -0,0 +1,31 @@ +package product + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/inventory/product" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func UpdateProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateProductReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) + l := product.NewUpdateProductLogic(ctx, svcCtx) + resp, err := l.UpdateProduct(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/inventory/stock/getStockByColorHandler.go b/gateway/internal/handler/inventory/stock/getStockByColorHandler.go new file mode 100644 index 0000000..5c3da89 --- /dev/null +++ b/gateway/internal/handler/inventory/stock/getStockByColorHandler.go @@ -0,0 +1,24 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package stock + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/inventory/stock" + "muyu-apiserver/gateway/internal/svc" +) + +func GetStockByColorHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := stock.NewGetStockByColorLogic(r.Context(), svcCtx) + resp, err := l.GetStockByColor() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/inventory/stock/getStockByLocationHandler.go b/gateway/internal/handler/inventory/stock/getStockByLocationHandler.go new file mode 100644 index 0000000..a480557 --- /dev/null +++ b/gateway/internal/handler/inventory/stock/getStockByLocationHandler.go @@ -0,0 +1,24 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package stock + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/inventory/stock" + "muyu-apiserver/gateway/internal/svc" +) + +func GetStockByLocationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := stock.NewGetStockByLocationLogic(r.Context(), svcCtx) + resp, err := l.GetStockByLocation() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/inventory/stock/getStockSummaryHandler.go b/gateway/internal/handler/inventory/stock/getStockSummaryHandler.go new file mode 100644 index 0000000..0e4c3d3 --- /dev/null +++ b/gateway/internal/handler/inventory/stock/getStockSummaryHandler.go @@ -0,0 +1,24 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package stock + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/inventory/stock" + "muyu-apiserver/gateway/internal/svc" +) + +func GetStockSummaryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := stock.NewGetStockSummaryLogic(r.Context(), svcCtx) + resp, err := l.GetStockSummary() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/inventory/stock/listStockHandler.go b/gateway/internal/handler/inventory/stock/listStockHandler.go new file mode 100644 index 0000000..581b1fd --- /dev/null +++ b/gateway/internal/handler/inventory/stock/listStockHandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package stock + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/inventory/stock" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func ListStockHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListProductReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := stock.NewListStockLogic(r.Context(), svcCtx) + resp, err := l.ListStock(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/routes.go b/gateway/internal/handler/routes.go new file mode 100644 index 0000000..5e85ea3 --- /dev/null +++ b/gateway/internal/handler/routes.go @@ -0,0 +1,347 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.9.2 + +package handler + +import ( + "net/http" + + auth "muyu-apiserver/gateway/internal/handler/auth" + inventoryadjust "muyu-apiserver/gateway/internal/handler/inventory/adjust" + inventorycheck "muyu-apiserver/gateway/internal/handler/inventory/check" + inventoryproduct "muyu-apiserver/gateway/internal/handler/inventory/product" + inventorystock "muyu-apiserver/gateway/internal/handler/inventory/stock" + systemconfig "muyu-apiserver/gateway/internal/handler/system/config" + systemlog "muyu-apiserver/gateway/internal/handler/system/log" + systemmenu "muyu-apiserver/gateway/internal/handler/system/menu" + systemrole "muyu-apiserver/gateway/internal/handler/system/role" + systemuser "muyu-apiserver/gateway/internal/handler/system/user" + "muyu-apiserver/gateway/internal/svc" + + "github.com/zeromicro/go-zero/rest" +) + +func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodPost, + Path: "/login", + Handler: auth.LoginHandler(serverCtx), + }, + }, + rest.WithPrefix("/api/v1/auth"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodGet, + Path: "/info", + Handler: auth.GetUserInfoHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/logout", + Handler: auth.LogoutHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/password", + Handler: auth.ChangePasswordHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/v1/auth"), + ) + + server.AddRoutes( + rest.WithMiddlewares( + []rest.Middleware{serverCtx.AuthorityMiddleware}, + []rest.Route{ + { + Method: http.MethodGet, + Path: "/adjusts", + Handler: inventoryadjust.ListStockAdjustHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/adjusts", + Handler: inventoryadjust.CreateStockAdjustHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/adjusts/:id", + Handler: inventoryadjust.GetStockAdjustHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/adjusts/:id/approve", + Handler: inventoryadjust.ApproveStockAdjustHandler(serverCtx), + }, + }..., + ), + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/v1/inventory"), + ) + + server.AddRoutes( + rest.WithMiddlewares( + []rest.Middleware{serverCtx.AuthorityMiddleware}, + []rest.Route{ + { + Method: http.MethodGet, + Path: "/checks", + Handler: inventorycheck.ListStockCheckHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/checks", + Handler: inventorycheck.CreateStockCheckHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/checks/:id", + Handler: inventorycheck.GetStockCheckHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/checks/:id", + Handler: inventorycheck.UpdateStockCheckHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/checks/:id/confirm", + Handler: inventorycheck.ConfirmStockCheckHandler(serverCtx), + }, + }..., + ), + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/v1/inventory"), + ) + + server.AddRoutes( + rest.WithMiddlewares( + []rest.Middleware{serverCtx.AuthorityMiddleware}, + []rest.Route{ + { + Method: http.MethodGet, + Path: "/products", + Handler: inventoryproduct.ListProductHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/products", + Handler: inventoryproduct.CreateProductHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/products/:id", + Handler: inventoryproduct.GetProductHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/products/:id", + Handler: inventoryproduct.UpdateProductHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/products/:id", + Handler: inventoryproduct.DeleteProductHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/products/export", + Handler: inventoryproduct.ExportProductHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/products/import", + Handler: inventoryproduct.ImportProductHandler(serverCtx), + }, + }..., + ), + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/v1/inventory"), + ) + + server.AddRoutes( + rest.WithMiddlewares( + []rest.Middleware{serverCtx.AuthorityMiddleware}, + []rest.Route{ + { + Method: http.MethodGet, + Path: "/stocks", + Handler: inventorystock.ListStockHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/stocks/by-color", + Handler: inventorystock.GetStockByColorHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/stocks/by-location", + Handler: inventorystock.GetStockByLocationHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/stocks/summary", + Handler: inventorystock.GetStockSummaryHandler(serverCtx), + }, + }..., + ), + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/v1/inventory"), + ) + + server.AddRoutes( + rest.WithMiddlewares( + []rest.Middleware{serverCtx.AuthorityMiddleware}, + []rest.Route{ + { + Method: http.MethodGet, + Path: "/configs", + Handler: systemconfig.ListConfigHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/configs/:key", + Handler: systemconfig.UpdateConfigHandler(serverCtx), + }, + }..., + ), + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/v1/system"), + ) + + server.AddRoutes( + rest.WithMiddlewares( + []rest.Middleware{serverCtx.AuthorityMiddleware}, + []rest.Route{ + { + Method: http.MethodGet, + Path: "/logs", + Handler: systemlog.ListLogHandler(serverCtx), + }, + }..., + ), + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/v1/system"), + ) + + server.AddRoutes( + rest.WithMiddlewares( + []rest.Middleware{serverCtx.AuthorityMiddleware}, + []rest.Route{ + { + Method: http.MethodGet, + Path: "/menus", + Handler: systemmenu.ListMenuHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/menus", + Handler: systemmenu.CreateMenuHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/menus/:id", + Handler: systemmenu.GetMenuHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/menus/:id", + Handler: systemmenu.UpdateMenuHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/menus/:id", + Handler: systemmenu.DeleteMenuHandler(serverCtx), + }, + }..., + ), + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/v1/system"), + ) + + server.AddRoutes( + rest.WithMiddlewares( + []rest.Middleware{serverCtx.AuthorityMiddleware}, + []rest.Route{ + { + Method: http.MethodGet, + Path: "/roles", + Handler: systemrole.ListRoleHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/roles", + Handler: systemrole.CreateRoleHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/roles/:id", + Handler: systemrole.GetRoleHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/roles/:id", + Handler: systemrole.UpdateRoleHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/roles/:id", + Handler: systemrole.DeleteRoleHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/roles/:id/permissions", + Handler: systemrole.SetRolePermissionsHandler(serverCtx), + }, + }..., + ), + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/v1/system"), + ) + + server.AddRoutes( + rest.WithMiddlewares( + []rest.Middleware{serverCtx.AuthorityMiddleware}, + []rest.Route{ + { + Method: http.MethodGet, + Path: "/users", + Handler: systemuser.ListUserHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/users", + Handler: systemuser.CreateUserHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/users/:id", + Handler: systemuser.GetUserHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/users/:id", + Handler: systemuser.UpdateUserHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/users/:id", + Handler: systemuser.DeleteUserHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/users/:id/status", + Handler: systemuser.UpdateUserStatusHandler(serverCtx), + }, + }..., + ), + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/v1/system"), + ) +} diff --git a/gateway/internal/handler/system/config/listConfigHandler.go b/gateway/internal/handler/system/config/listConfigHandler.go new file mode 100644 index 0000000..9176482 --- /dev/null +++ b/gateway/internal/handler/system/config/listConfigHandler.go @@ -0,0 +1,24 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package config + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/system/config" + "muyu-apiserver/gateway/internal/svc" +) + +func ListConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := config.NewListConfigLogic(r.Context(), svcCtx) + resp, err := l.ListConfig() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/system/config/updateConfigHandler.go b/gateway/internal/handler/system/config/updateConfigHandler.go new file mode 100644 index 0000000..c0e8d7f --- /dev/null +++ b/gateway/internal/handler/system/config/updateConfigHandler.go @@ -0,0 +1,31 @@ +package config + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/system/config" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func UpdateConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateConfigReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + ctx := context.WithValue(r.Context(), "pathKey", pathvar.Vars(r)["key"]) + l := config.NewUpdateConfigLogic(ctx, svcCtx) + resp, err := l.UpdateConfig(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/system/log/listLogHandler.go b/gateway/internal/handler/system/log/listLogHandler.go new file mode 100644 index 0000000..8cb8911 --- /dev/null +++ b/gateway/internal/handler/system/log/listLogHandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package log + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/system/log" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func ListLogHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListLogReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := log.NewListLogLogic(r.Context(), svcCtx) + resp, err := l.ListLog(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/system/menu/createMenuHandler.go b/gateway/internal/handler/system/menu/createMenuHandler.go new file mode 100644 index 0000000..7af3fdc --- /dev/null +++ b/gateway/internal/handler/system/menu/createMenuHandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package menu + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/system/menu" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func CreateMenuHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateMenuReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := menu.NewCreateMenuLogic(r.Context(), svcCtx) + resp, err := l.CreateMenu(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/system/menu/deleteMenuHandler.go b/gateway/internal/handler/system/menu/deleteMenuHandler.go new file mode 100644 index 0000000..8019e59 --- /dev/null +++ b/gateway/internal/handler/system/menu/deleteMenuHandler.go @@ -0,0 +1,24 @@ +package menu + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/system/menu" + "muyu-apiserver/gateway/internal/svc" +) + +func DeleteMenuHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) + l := menu.NewDeleteMenuLogic(ctx, svcCtx) + resp, err := l.DeleteMenu() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/system/menu/getMenuHandler.go b/gateway/internal/handler/system/menu/getMenuHandler.go new file mode 100644 index 0000000..774ad2f --- /dev/null +++ b/gateway/internal/handler/system/menu/getMenuHandler.go @@ -0,0 +1,24 @@ +package menu + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/system/menu" + "muyu-apiserver/gateway/internal/svc" +) + +func GetMenuHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) + l := menu.NewGetMenuLogic(ctx, svcCtx) + resp, err := l.GetMenu() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/system/menu/listMenuHandler.go b/gateway/internal/handler/system/menu/listMenuHandler.go new file mode 100644 index 0000000..68c3a93 --- /dev/null +++ b/gateway/internal/handler/system/menu/listMenuHandler.go @@ -0,0 +1,24 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package menu + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/system/menu" + "muyu-apiserver/gateway/internal/svc" +) + +func ListMenuHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := menu.NewListMenuLogic(r.Context(), svcCtx) + resp, err := l.ListMenu() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/system/menu/updateMenuHandler.go b/gateway/internal/handler/system/menu/updateMenuHandler.go new file mode 100644 index 0000000..7f9aee4 --- /dev/null +++ b/gateway/internal/handler/system/menu/updateMenuHandler.go @@ -0,0 +1,31 @@ +package menu + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/system/menu" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func UpdateMenuHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateMenuReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) + l := menu.NewUpdateMenuLogic(ctx, svcCtx) + resp, err := l.UpdateMenu(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/system/role/createRoleHandler.go b/gateway/internal/handler/system/role/createRoleHandler.go new file mode 100644 index 0000000..0d89082 --- /dev/null +++ b/gateway/internal/handler/system/role/createRoleHandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package role + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/system/role" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func CreateRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateRoleReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := role.NewCreateRoleLogic(r.Context(), svcCtx) + resp, err := l.CreateRole(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/system/role/deleteRoleHandler.go b/gateway/internal/handler/system/role/deleteRoleHandler.go new file mode 100644 index 0000000..79ac7b6 --- /dev/null +++ b/gateway/internal/handler/system/role/deleteRoleHandler.go @@ -0,0 +1,24 @@ +package role + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/system/role" + "muyu-apiserver/gateway/internal/svc" +) + +func DeleteRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) + l := role.NewDeleteRoleLogic(ctx, svcCtx) + resp, err := l.DeleteRole() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/system/role/getRoleHandler.go b/gateway/internal/handler/system/role/getRoleHandler.go new file mode 100644 index 0000000..c0ca85b --- /dev/null +++ b/gateway/internal/handler/system/role/getRoleHandler.go @@ -0,0 +1,24 @@ +package role + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/system/role" + "muyu-apiserver/gateway/internal/svc" +) + +func GetRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) + l := role.NewGetRoleLogic(ctx, svcCtx) + resp, err := l.GetRole() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/system/role/listRoleHandler.go b/gateway/internal/handler/system/role/listRoleHandler.go new file mode 100644 index 0000000..057dcc9 --- /dev/null +++ b/gateway/internal/handler/system/role/listRoleHandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package role + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/system/role" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func ListRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListRoleReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := role.NewListRoleLogic(r.Context(), svcCtx) + resp, err := l.ListRole(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/system/role/setRolePermissionsHandler.go b/gateway/internal/handler/system/role/setRolePermissionsHandler.go new file mode 100644 index 0000000..b4b6338 --- /dev/null +++ b/gateway/internal/handler/system/role/setRolePermissionsHandler.go @@ -0,0 +1,31 @@ +package role + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/system/role" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func SetRolePermissionsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.SetRolePermissionsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) + l := role.NewSetRolePermissionsLogic(ctx, svcCtx) + resp, err := l.SetRolePermissions(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/system/role/updateRoleHandler.go b/gateway/internal/handler/system/role/updateRoleHandler.go new file mode 100644 index 0000000..fe805cb --- /dev/null +++ b/gateway/internal/handler/system/role/updateRoleHandler.go @@ -0,0 +1,31 @@ +package role + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/system/role" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func UpdateRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateRoleReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) + l := role.NewUpdateRoleLogic(ctx, svcCtx) + resp, err := l.UpdateRole(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/system/user/createUserHandler.go b/gateway/internal/handler/system/user/createUserHandler.go new file mode 100644 index 0000000..efbcd27 --- /dev/null +++ b/gateway/internal/handler/system/user/createUserHandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package user + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/system/user" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func CreateUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateUserReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := user.NewCreateUserLogic(r.Context(), svcCtx) + resp, err := l.CreateUser(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/system/user/deleteUserHandler.go b/gateway/internal/handler/system/user/deleteUserHandler.go new file mode 100644 index 0000000..482cc94 --- /dev/null +++ b/gateway/internal/handler/system/user/deleteUserHandler.go @@ -0,0 +1,24 @@ +package user + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/system/user" + "muyu-apiserver/gateway/internal/svc" +) + +func DeleteUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) + l := user.NewDeleteUserLogic(ctx, svcCtx) + resp, err := l.DeleteUser() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/system/user/getUserHandler.go b/gateway/internal/handler/system/user/getUserHandler.go new file mode 100644 index 0000000..921cab6 --- /dev/null +++ b/gateway/internal/handler/system/user/getUserHandler.go @@ -0,0 +1,24 @@ +package user + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/system/user" + "muyu-apiserver/gateway/internal/svc" +) + +func GetUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) + l := user.NewGetUserLogic(ctx, svcCtx) + resp, err := l.GetUser() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/system/user/listUserHandler.go b/gateway/internal/handler/system/user/listUserHandler.go new file mode 100644 index 0000000..dee922b --- /dev/null +++ b/gateway/internal/handler/system/user/listUserHandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package user + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "muyu-apiserver/gateway/internal/logic/system/user" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func ListUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListUserReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := user.NewListUserLogic(r.Context(), svcCtx) + resp, err := l.ListUser(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/system/user/updateUserHandler.go b/gateway/internal/handler/system/user/updateUserHandler.go new file mode 100644 index 0000000..00cdd3a --- /dev/null +++ b/gateway/internal/handler/system/user/updateUserHandler.go @@ -0,0 +1,31 @@ +package user + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/system/user" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func UpdateUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateUserReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) + l := user.NewUpdateUserLogic(ctx, svcCtx) + resp, err := l.UpdateUser(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/handler/system/user/updateUserStatusHandler.go b/gateway/internal/handler/system/user/updateUserStatusHandler.go new file mode 100644 index 0000000..e8ddf8b --- /dev/null +++ b/gateway/internal/handler/system/user/updateUserStatusHandler.go @@ -0,0 +1,31 @@ +package user + +import ( + "context" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "github.com/zeromicro/go-zero/rest/pathvar" + "muyu-apiserver/gateway/internal/logic/system/user" + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" +) + +func UpdateUserStatusHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateUserStatusReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) + l := user.NewUpdateUserStatusLogic(ctx, svcCtx) + resp, err := l.UpdateUserStatus(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/gateway/internal/logic/auth/changePasswordLogic.go b/gateway/internal/logic/auth/changePasswordLogic.go new file mode 100644 index 0000000..e518d67 --- /dev/null +++ b/gateway/internal/logic/auth/changePasswordLogic.go @@ -0,0 +1,41 @@ +package auth + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ChangePasswordLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewChangePasswordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ChangePasswordLogic { + return &ChangePasswordLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ChangePasswordLogic) ChangePassword(req *types.ChangePasswordReq) (resp *types.IdResp, err error) { + userId := ctxdata.GetUserId(l.ctx) + + _, err = l.svcCtx.SystemRpc.ChangePassword(l.ctx, &pb.ChangePasswordReq{ + UserId: userId, + OldPassword: req.OldPassword, + NewPassword: req.NewPassword, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: userId}, nil +} diff --git a/gateway/internal/logic/auth/getUserInfoLogic.go b/gateway/internal/logic/auth/getUserInfoLogic.go new file mode 100644 index 0000000..c6b0484 --- /dev/null +++ b/gateway/internal/logic/auth/getUserInfoLogic.go @@ -0,0 +1,80 @@ +package auth + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetUserInfoLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserInfoLogic { + return &GetUserInfoLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +type UserInfoWithMenus struct { + types.UserInfo + MenuPaths []string `json:"menuPaths"` +} + +func (l *GetUserInfoLogic) GetUserInfo() (*UserInfoWithMenus, error) { + userId := ctxdata.GetUserId(l.ctx) + + rpcResp, err := l.svcCtx.SystemRpc.GetUser(l.ctx, &pb.GetUserReq{ + UserId: userId, + }) + if err != nil { + return nil, err + } + + // Get user's role menus + var menuPaths []string + if rpcResp.RoleId != "" { + role, _ := l.svcCtx.SystemRpc.GetRole(l.ctx, &pb.GetRoleReq{RoleId: rpcResp.RoleId}) + if role != nil && len(role.MenuIds) > 0 { + menuList, _ := l.svcCtx.SystemRpc.ListMenu(l.ctx, &pb.ListMenuReq{}) + if menuList != nil { + menuIdSet := make(map[string]bool) + for _, id := range role.MenuIds { + menuIdSet[id] = true + } + for _, m := range menuList.List { + if menuIdSet[m.MenuId] && m.Path != "" { + menuPaths = append(menuPaths, m.Path) + } + } + } + } + } + + return &UserInfoWithMenus{ + UserInfo: types.UserInfo{ + UserId: rpcResp.UserId, + Username: rpcResp.Username, + RealName: rpcResp.RealName, + Phone: rpcResp.Phone, + Email: rpcResp.Email, + Avatar: rpcResp.Avatar, + Status: rpcResp.Status, + RoleId: rpcResp.RoleId, + RoleName: rpcResp.RoleName, + LastLoginTime: rpcResp.LastLoginTime, + CreatedAt: rpcResp.CreatedAt, + UpdatedAt: rpcResp.UpdatedAt, + }, + MenuPaths: menuPaths, + }, nil +} diff --git a/gateway/internal/logic/auth/loginLogic.go b/gateway/internal/logic/auth/loginLogic.go new file mode 100644 index 0000000..e6c7886 --- /dev/null +++ b/gateway/internal/logic/auth/loginLogic.go @@ -0,0 +1,57 @@ +package auth + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + jwtpkg "muyu-apiserver/pkg/jwt" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type LoginLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LoginLogic { + return &LoginLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *LoginLogic) Login(req *types.LoginReq) (resp *types.LoginResp, err error) { + rpcResp, err := l.svcCtx.SystemRpc.Login(l.ctx, &pb.LoginReq{ + Username: req.Username, + Password: req.Password, + }) + if err != nil { + return nil, err + } + + token, err := jwtpkg.GenerateToken( + l.svcCtx.Config.Auth.AccessSecret, + l.svcCtx.Config.Auth.AccessExpire, + rpcResp.UserId, + rpcResp.RoleKey, + ) + if err != nil { + return nil, err + } + + return &types.LoginResp{ + Token: token, + UserInfo: types.UserInfo{ + UserId: rpcResp.UserId, + Username: rpcResp.Username, + RealName: rpcResp.RealName, + Avatar: rpcResp.Avatar, + RoleName: rpcResp.RoleName, + }, + }, nil +} diff --git a/gateway/internal/logic/auth/logoutLogic.go b/gateway/internal/logic/auth/logoutLogic.go new file mode 100644 index 0000000..d5fc18b --- /dev/null +++ b/gateway/internal/logic/auth/logoutLogic.go @@ -0,0 +1,28 @@ +package auth + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type LogoutLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewLogoutLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LogoutLogic { + return &LogoutLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *LogoutLogic) Logout() (resp *types.IdResp, err error) { + return &types.IdResp{Id: ""}, nil +} diff --git a/gateway/internal/logic/inventory/adjust/approveStockAdjustLogic.go b/gateway/internal/logic/inventory/adjust/approveStockAdjustLogic.go new file mode 100644 index 0000000..84b8b01 --- /dev/null +++ b/gateway/internal/logic/inventory/adjust/approveStockAdjustLogic.go @@ -0,0 +1,42 @@ +package adjust + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ApproveStockAdjustLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewApproveStockAdjustLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ApproveStockAdjustLogic { + return &ApproveStockAdjustLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ApproveStockAdjustLogic) ApproveStockAdjust(req *types.ApproveStockAdjustReq) (resp *types.IdResp, err error) { + id := ctxdata.GetPathId(l.ctx) + userId := ctxdata.GetUserId(l.ctx) + + _, err = l.svcCtx.InventoryRpc.ApproveStockAdjust(l.ctx, &pb.ApproveStockAdjustReq{ + AdjustId: id, + Approver: userId, + Action: req.Action, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: id}, nil +} diff --git a/gateway/internal/logic/inventory/adjust/createStockAdjustLogic.go b/gateway/internal/logic/inventory/adjust/createStockAdjustLogic.go new file mode 100644 index 0000000..4d66c0b --- /dev/null +++ b/gateway/internal/logic/inventory/adjust/createStockAdjustLogic.go @@ -0,0 +1,52 @@ +package adjust + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateStockAdjustLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewCreateStockAdjustLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateStockAdjustLogic { + return &CreateStockAdjustLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CreateStockAdjustLogic) CreateStockAdjust(req *types.CreateStockAdjustReq) (resp *types.IdResp, err error) { + userId := ctxdata.GetUserId(l.ctx) + + details := make([]*pb.StockAdjustDetailReq, 0, len(req.Details)) + for _, d := range req.Details { + details = append(details, &pb.StockAdjustDetailReq{ + ProductId: d.ProductId, + AdjustQuantity: d.AdjustQuantity, + Remark: d.Remark, + }) + } + + rpcResp, err := l.svcCtx.InventoryRpc.CreateStockAdjust(l.ctx, &pb.CreateStockAdjustReq{ + AdjustDate: req.AdjustDate, + AdjustReason: req.AdjustReason, + Operator: userId, + Remark: req.Remark, + Details: details, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: rpcResp.Id}, nil +} diff --git a/gateway/internal/logic/inventory/adjust/getStockAdjustLogic.go b/gateway/internal/logic/inventory/adjust/getStockAdjustLogic.go new file mode 100644 index 0000000..a540424 --- /dev/null +++ b/gateway/internal/logic/inventory/adjust/getStockAdjustLogic.go @@ -0,0 +1,65 @@ +package adjust + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetStockAdjustLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetStockAdjustLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetStockAdjustLogic { + return &GetStockAdjustLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetStockAdjustLogic) GetStockAdjust() (resp *types.StockAdjustInfo, err error) { + id := ctxdata.GetPathId(l.ctx) + + rpcResp, err := l.svcCtx.InventoryRpc.GetStockAdjust(l.ctx, &pb.GetStockAdjustReq{ + AdjustId: id, + }) + if err != nil { + return nil, err + } + + details := make([]types.StockAdjustDetailInfo, 0, len(rpcResp.Details)) + for _, d := range rpcResp.Details { + details = append(details, types.StockAdjustDetailInfo{ + DetailId: d.DetailId, + AdjustId: d.AdjustId, + ProductId: d.ProductId, + ProductName: d.ProductName, + BeforeQuantity: d.BeforeQuantity, + AdjustQuantity: d.AdjustQuantity, + AfterQuantity: d.AfterQuantity, + Remark: d.Remark, + }) + } + + return &types.StockAdjustInfo{ + AdjustId: rpcResp.AdjustId, + AdjustNo: rpcResp.AdjustNo, + AdjustDate: rpcResp.AdjustDate, + AdjustReason: rpcResp.AdjustReason, + Operator: rpcResp.Operator, + Approver: rpcResp.Approver, + Status: rpcResp.Status, + Remark: rpcResp.Remark, + CreatedAt: rpcResp.CreatedAt, + UpdatedAt: rpcResp.UpdatedAt, + Details: details, + }, nil +} diff --git a/gateway/internal/logic/inventory/adjust/listStockAdjustLogic.go b/gateway/internal/logic/inventory/adjust/listStockAdjustLogic.go new file mode 100644 index 0000000..9657847 --- /dev/null +++ b/gateway/internal/logic/inventory/adjust/listStockAdjustLogic.go @@ -0,0 +1,76 @@ +package adjust + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ListStockAdjustLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewListStockAdjustLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListStockAdjustLogic { + return &ListStockAdjustLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ListStockAdjustLogic) ListStockAdjust(req *types.ListStockAdjustReq) (resp *types.ListStockAdjustResp, err error) { + rpcResp, err := l.svcCtx.InventoryRpc.ListStockAdjust(l.ctx, &pb.ListStockAdjustReq{ + Page: req.Page, + PageSize: req.PageSize, + AdjustNo: req.AdjustNo, + AdjustReason: req.AdjustReason, + Status: req.Status, + StartDate: req.StartDate, + EndDate: req.EndDate, + }) + if err != nil { + return nil, err + } + + list := make([]types.StockAdjustInfo, 0, len(rpcResp.List)) + for _, a := range rpcResp.List { + details := make([]types.StockAdjustDetailInfo, 0, len(a.Details)) + for _, d := range a.Details { + details = append(details, types.StockAdjustDetailInfo{ + DetailId: d.DetailId, + AdjustId: d.AdjustId, + ProductId: d.ProductId, + ProductName: d.ProductName, + BeforeQuantity: d.BeforeQuantity, + AdjustQuantity: d.AdjustQuantity, + AfterQuantity: d.AfterQuantity, + Remark: d.Remark, + }) + } + + list = append(list, types.StockAdjustInfo{ + AdjustId: a.AdjustId, + AdjustNo: a.AdjustNo, + AdjustDate: a.AdjustDate, + AdjustReason: a.AdjustReason, + Operator: a.Operator, + Approver: a.Approver, + Status: a.Status, + Remark: a.Remark, + CreatedAt: a.CreatedAt, + UpdatedAt: a.UpdatedAt, + Details: details, + }) + } + + return &types.ListStockAdjustResp{ + Total: rpcResp.Total, + List: list, + }, nil +} diff --git a/gateway/internal/logic/inventory/check/confirmStockCheckLogic.go b/gateway/internal/logic/inventory/check/confirmStockCheckLogic.go new file mode 100644 index 0000000..657975f --- /dev/null +++ b/gateway/internal/logic/inventory/check/confirmStockCheckLogic.go @@ -0,0 +1,41 @@ +package check + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ConfirmStockCheckLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewConfirmStockCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ConfirmStockCheckLogic { + return &ConfirmStockCheckLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ConfirmStockCheckLogic) ConfirmStockCheck() (resp *types.IdResp, err error) { + id := ctxdata.GetPathId(l.ctx) + userId := ctxdata.GetUserId(l.ctx) + + _, err = l.svcCtx.InventoryRpc.ConfirmStockCheck(l.ctx, &pb.ConfirmStockCheckReq{ + CheckId: id, + Operator: userId, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: id}, nil +} diff --git a/gateway/internal/logic/inventory/check/createStockCheckLogic.go b/gateway/internal/logic/inventory/check/createStockCheckLogic.go new file mode 100644 index 0000000..479bcdb --- /dev/null +++ b/gateway/internal/logic/inventory/check/createStockCheckLogic.go @@ -0,0 +1,48 @@ +package check + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateStockCheckLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewCreateStockCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateStockCheckLogic { + return &CreateStockCheckLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CreateStockCheckLogic) CreateStockCheck(req *types.CreateStockCheckReq) (resp *types.IdResp, err error) { + details := make([]*pb.StockCheckDetailReq, 0, len(req.Details)) + for _, d := range req.Details { + details = append(details, &pb.StockCheckDetailReq{ + ProductId: d.ProductId, + ActualQuantity: d.ActualQuantity, + Remark: d.Remark, + }) + } + + rpcResp, err := l.svcCtx.InventoryRpc.CreateStockCheck(l.ctx, &pb.CreateStockCheckReq{ + CheckDate: req.CheckDate, + Checker: req.Checker, + Remark: req.Remark, + Details: details, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: rpcResp.Id}, nil +} diff --git a/gateway/internal/logic/inventory/check/getStockCheckLogic.go b/gateway/internal/logic/inventory/check/getStockCheckLogic.go new file mode 100644 index 0000000..1a4ecd5 --- /dev/null +++ b/gateway/internal/logic/inventory/check/getStockCheckLogic.go @@ -0,0 +1,64 @@ +package check + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetStockCheckLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetStockCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetStockCheckLogic { + return &GetStockCheckLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetStockCheckLogic) GetStockCheck() (resp *types.StockCheckInfo, err error) { + id := ctxdata.GetPathId(l.ctx) + + rpcResp, err := l.svcCtx.InventoryRpc.GetStockCheck(l.ctx, &pb.GetStockCheckReq{ + CheckId: id, + }) + if err != nil { + return nil, err + } + + details := make([]types.StockCheckDetailInfo, 0, len(rpcResp.Details)) + for _, d := range rpcResp.Details { + details = append(details, types.StockCheckDetailInfo{ + DetailId: d.DetailId, + CheckId: d.CheckId, + ProductId: d.ProductId, + ProductName: d.ProductName, + SystemQuantity: d.SystemQuantity, + ActualQuantity: d.ActualQuantity, + DiffQuantity: d.DiffQuantity, + DiffAmount: d.DiffAmount, + Remark: d.Remark, + }) + } + + return &types.StockCheckInfo{ + CheckId: rpcResp.CheckId, + CheckNo: rpcResp.CheckNo, + CheckDate: rpcResp.CheckDate, + Checker: rpcResp.Checker, + Status: rpcResp.Status, + Remark: rpcResp.Remark, + CreatedAt: rpcResp.CreatedAt, + UpdatedAt: rpcResp.UpdatedAt, + Details: details, + }, nil +} diff --git a/gateway/internal/logic/inventory/check/listStockCheckLogic.go b/gateway/internal/logic/inventory/check/listStockCheckLogic.go new file mode 100644 index 0000000..efd1288 --- /dev/null +++ b/gateway/internal/logic/inventory/check/listStockCheckLogic.go @@ -0,0 +1,74 @@ +package check + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ListStockCheckLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewListStockCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListStockCheckLogic { + return &ListStockCheckLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ListStockCheckLogic) ListStockCheck(req *types.ListStockCheckReq) (resp *types.ListStockCheckResp, err error) { + rpcResp, err := l.svcCtx.InventoryRpc.ListStockCheck(l.ctx, &pb.ListStockCheckReq{ + Page: req.Page, + PageSize: req.PageSize, + CheckNo: req.CheckNo, + Status: req.Status, + StartDate: req.StartDate, + EndDate: req.EndDate, + }) + if err != nil { + return nil, err + } + + list := make([]types.StockCheckInfo, 0, len(rpcResp.List)) + for _, c := range rpcResp.List { + details := make([]types.StockCheckDetailInfo, 0, len(c.Details)) + for _, d := range c.Details { + details = append(details, types.StockCheckDetailInfo{ + DetailId: d.DetailId, + CheckId: d.CheckId, + ProductId: d.ProductId, + ProductName: d.ProductName, + SystemQuantity: d.SystemQuantity, + ActualQuantity: d.ActualQuantity, + DiffQuantity: d.DiffQuantity, + DiffAmount: d.DiffAmount, + Remark: d.Remark, + }) + } + + list = append(list, types.StockCheckInfo{ + CheckId: c.CheckId, + CheckNo: c.CheckNo, + CheckDate: c.CheckDate, + Checker: c.Checker, + Status: c.Status, + Remark: c.Remark, + CreatedAt: c.CreatedAt, + UpdatedAt: c.UpdatedAt, + Details: details, + }) + } + + return &types.ListStockCheckResp{ + Total: rpcResp.Total, + List: list, + }, nil +} diff --git a/gateway/internal/logic/inventory/check/updateStockCheckLogic.go b/gateway/internal/logic/inventory/check/updateStockCheckLogic.go new file mode 100644 index 0000000..51bf0d6 --- /dev/null +++ b/gateway/internal/logic/inventory/check/updateStockCheckLogic.go @@ -0,0 +1,50 @@ +package check + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateStockCheckLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewUpdateStockCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateStockCheckLogic { + return &UpdateStockCheckLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *UpdateStockCheckLogic) UpdateStockCheck(req *types.UpdateStockCheckReq) (resp *types.IdResp, err error) { + id := ctxdata.GetPathId(l.ctx) + + details := make([]*pb.StockCheckDetailReq, 0, len(req.Details)) + for _, d := range req.Details { + details = append(details, &pb.StockCheckDetailReq{ + ProductId: d.ProductId, + ActualQuantity: d.ActualQuantity, + Remark: d.Remark, + }) + } + + _, err = l.svcCtx.InventoryRpc.UpdateStockCheck(l.ctx, &pb.UpdateStockCheckReq{ + CheckId: id, + Remark: req.Remark, + Details: details, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: id}, nil +} diff --git a/gateway/internal/logic/inventory/product/createProductLogic.go b/gateway/internal/logic/inventory/product/createProductLogic.go new file mode 100644 index 0000000..386eda1 --- /dev/null +++ b/gateway/internal/logic/inventory/product/createProductLogic.go @@ -0,0 +1,46 @@ +package product + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateProductLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewCreateProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateProductLogic { + return &CreateProductLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CreateProductLogic) CreateProduct(req *types.CreateProductReq) (resp *types.IdResp, err error) { + rpcResp, err := l.svcCtx.InventoryRpc.CreateProduct(l.ctx, &pb.CreateProductReq{ + ProductName: req.ProductName, + ImageUrl: req.ImageUrl, + Spec: req.Spec, + Color: req.Color, + UnitPieces: req.UnitPieces, + UnitRolls: req.UnitRolls, + StockQuantity: req.StockQuantity, + Location: req.Location, + CostPrice: req.CostPrice, + SalesPrice: req.SalesPrice, + Remark: req.Remark, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: rpcResp.Id}, nil +} diff --git a/gateway/internal/logic/inventory/product/deleteProductLogic.go b/gateway/internal/logic/inventory/product/deleteProductLogic.go new file mode 100644 index 0000000..ec859ff --- /dev/null +++ b/gateway/internal/logic/inventory/product/deleteProductLogic.go @@ -0,0 +1,39 @@ +package product + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeleteProductLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewDeleteProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteProductLogic { + return &DeleteProductLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *DeleteProductLogic) DeleteProduct() (resp *types.IdResp, err error) { + id := ctxdata.GetPathId(l.ctx) + + _, err = l.svcCtx.InventoryRpc.DeleteProduct(l.ctx, &pb.DeleteProductReq{ + ProductId: id, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: id}, nil +} diff --git a/gateway/internal/logic/inventory/product/exportProductLogic.go b/gateway/internal/logic/inventory/product/exportProductLogic.go new file mode 100644 index 0000000..ee46068 --- /dev/null +++ b/gateway/internal/logic/inventory/product/exportProductLogic.go @@ -0,0 +1,28 @@ +package product + +import ( + "context" + "errors" + + "muyu-apiserver/gateway/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ExportProductLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewExportProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ExportProductLogic { + return &ExportProductLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ExportProductLogic) ExportProduct() error { + return errors.New("export product requires response writer, will be implemented in handler layer") +} diff --git a/gateway/internal/logic/inventory/product/getProductLogic.go b/gateway/internal/logic/inventory/product/getProductLogic.go new file mode 100644 index 0000000..b5dc0b9 --- /dev/null +++ b/gateway/internal/logic/inventory/product/getProductLogic.go @@ -0,0 +1,55 @@ +package product + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetProductLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProductLogic { + return &GetProductLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetProductLogic) GetProduct() (resp *types.ProductInfo, err error) { + id := ctxdata.GetPathId(l.ctx) + + rpcResp, err := l.svcCtx.InventoryRpc.GetProduct(l.ctx, &pb.GetProductReq{ + ProductId: id, + }) + if err != nil { + return nil, err + } + + return &types.ProductInfo{ + ProductId: rpcResp.ProductId, + ProductName: rpcResp.ProductName, + ImageUrl: rpcResp.ImageUrl, + Spec: rpcResp.Spec, + Color: rpcResp.Color, + UnitPieces: rpcResp.UnitPieces, + UnitRolls: rpcResp.UnitRolls, + StockQuantity: rpcResp.StockQuantity, + Location: rpcResp.Location, + CostPrice: rpcResp.CostPrice, + SalesPrice: rpcResp.SalesPrice, + Remark: rpcResp.Remark, + Status: rpcResp.Status, + CreatedAt: rpcResp.CreatedAt, + UpdatedAt: rpcResp.UpdatedAt, + }, nil +} diff --git a/gateway/internal/logic/inventory/product/importProductLogic.go b/gateway/internal/logic/inventory/product/importProductLogic.go new file mode 100644 index 0000000..18594fc --- /dev/null +++ b/gateway/internal/logic/inventory/product/importProductLogic.go @@ -0,0 +1,29 @@ +package product + +import ( + "context" + "errors" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ImportProductLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewImportProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ImportProductLogic { + return &ImportProductLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ImportProductLogic) ImportProduct() (resp *types.ImportProductResp, err error) { + return nil, errors.New("import product requires file upload handling, will be implemented in handler layer") +} diff --git a/gateway/internal/logic/inventory/product/listProductLogic.go b/gateway/internal/logic/inventory/product/listProductLogic.go new file mode 100644 index 0000000..543244f --- /dev/null +++ b/gateway/internal/logic/inventory/product/listProductLogic.go @@ -0,0 +1,66 @@ +package product + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ListProductLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewListProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListProductLogic { + return &ListProductLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ListProductLogic) ListProduct(req *types.ListProductReq) (resp *types.ListProductResp, err error) { + rpcResp, err := l.svcCtx.InventoryRpc.ListProduct(l.ctx, &pb.ListProductReq{ + Page: req.Page, + PageSize: req.PageSize, + ProductName: req.ProductName, + Spec: req.Spec, + Color: req.Color, + Location: req.Location, + Status: req.Status, + }) + if err != nil { + return nil, err + } + + list := make([]types.ProductInfo, 0, len(rpcResp.List)) + for _, p := range rpcResp.List { + list = append(list, types.ProductInfo{ + ProductId: p.ProductId, + ProductName: p.ProductName, + ImageUrl: p.ImageUrl, + Spec: p.Spec, + Color: p.Color, + UnitPieces: p.UnitPieces, + UnitRolls: p.UnitRolls, + StockQuantity: p.StockQuantity, + Location: p.Location, + CostPrice: p.CostPrice, + SalesPrice: p.SalesPrice, + Remark: p.Remark, + Status: p.Status, + CreatedAt: p.CreatedAt, + UpdatedAt: p.UpdatedAt, + }) + } + + return &types.ListProductResp{ + Total: rpcResp.Total, + List: list, + }, nil +} diff --git a/gateway/internal/logic/inventory/product/updateProductLogic.go b/gateway/internal/logic/inventory/product/updateProductLogic.go new file mode 100644 index 0000000..06f47fb --- /dev/null +++ b/gateway/internal/logic/inventory/product/updateProductLogic.go @@ -0,0 +1,50 @@ +package product + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateProductLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewUpdateProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateProductLogic { + return &UpdateProductLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *UpdateProductLogic) UpdateProduct(req *types.UpdateProductReq) (resp *types.IdResp, err error) { + id := ctxdata.GetPathId(l.ctx) + + _, err = l.svcCtx.InventoryRpc.UpdateProduct(l.ctx, &pb.UpdateProductReq{ + ProductId: id, + ProductName: req.ProductName, + ImageUrl: req.ImageUrl, + Spec: req.Spec, + Color: req.Color, + UnitPieces: req.UnitPieces, + UnitRolls: req.UnitRolls, + StockQuantity: req.StockQuantity, + Location: req.Location, + CostPrice: req.CostPrice, + SalesPrice: req.SalesPrice, + Remark: req.Remark, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: id}, nil +} diff --git a/gateway/internal/logic/inventory/stock/getStockByColorLogic.go b/gateway/internal/logic/inventory/stock/getStockByColorLogic.go new file mode 100644 index 0000000..9c51dfc --- /dev/null +++ b/gateway/internal/logic/inventory/stock/getStockByColorLogic.go @@ -0,0 +1,47 @@ +package stock + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetStockByColorLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetStockByColorLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetStockByColorLogic { + return &GetStockByColorLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetStockByColorLogic) GetStockByColor() (resp *types.StockGroupResp, err error) { + rpcResp, err := l.svcCtx.InventoryRpc.GetStockGroup(l.ctx, &pb.StockGroupReq{ + GroupBy: "color", + }) + if err != nil { + return nil, err + } + + list := make([]types.StockGroupItem, 0, len(rpcResp.List)) + for _, item := range rpcResp.List { + list = append(list, types.StockGroupItem{ + Name: item.Name, + Count: item.Count, + Quantity: item.Quantity, + }) + } + + return &types.StockGroupResp{ + List: list, + }, nil +} diff --git a/gateway/internal/logic/inventory/stock/getStockByLocationLogic.go b/gateway/internal/logic/inventory/stock/getStockByLocationLogic.go new file mode 100644 index 0000000..f89810c --- /dev/null +++ b/gateway/internal/logic/inventory/stock/getStockByLocationLogic.go @@ -0,0 +1,47 @@ +package stock + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetStockByLocationLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetStockByLocationLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetStockByLocationLogic { + return &GetStockByLocationLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetStockByLocationLogic) GetStockByLocation() (resp *types.StockGroupResp, err error) { + rpcResp, err := l.svcCtx.InventoryRpc.GetStockGroup(l.ctx, &pb.StockGroupReq{ + GroupBy: "location", + }) + if err != nil { + return nil, err + } + + list := make([]types.StockGroupItem, 0, len(rpcResp.List)) + for _, item := range rpcResp.List { + list = append(list, types.StockGroupItem{ + Name: item.Name, + Count: item.Count, + Quantity: item.Quantity, + }) + } + + return &types.StockGroupResp{ + List: list, + }, nil +} diff --git a/gateway/internal/logic/inventory/stock/getStockSummaryLogic.go b/gateway/internal/logic/inventory/stock/getStockSummaryLogic.go new file mode 100644 index 0000000..0eb4cf0 --- /dev/null +++ b/gateway/internal/logic/inventory/stock/getStockSummaryLogic.go @@ -0,0 +1,40 @@ +package stock + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetStockSummaryLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetStockSummaryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetStockSummaryLogic { + return &GetStockSummaryLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetStockSummaryLogic) GetStockSummary() (resp *types.StockSummaryResp, err error) { + rpcResp, err := l.svcCtx.InventoryRpc.GetStockSummary(l.ctx, &pb.StockSummaryReq{}) + if err != nil { + return nil, err + } + + return &types.StockSummaryResp{ + ProductCount: rpcResp.ProductCount, + TotalPieces: rpcResp.TotalPieces, + TotalRolls: rpcResp.TotalRolls, + TotalCostValue: rpcResp.TotalCostValue, + TotalSalesValue: rpcResp.TotalSalesValue, + }, nil +} diff --git a/gateway/internal/logic/inventory/stock/listStockLogic.go b/gateway/internal/logic/inventory/stock/listStockLogic.go new file mode 100644 index 0000000..5c46fde --- /dev/null +++ b/gateway/internal/logic/inventory/stock/listStockLogic.go @@ -0,0 +1,66 @@ +package stock + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ListStockLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewListStockLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListStockLogic { + return &ListStockLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ListStockLogic) ListStock(req *types.ListProductReq) (resp *types.ListProductResp, err error) { + rpcResp, err := l.svcCtx.InventoryRpc.ListProduct(l.ctx, &pb.ListProductReq{ + Page: req.Page, + PageSize: req.PageSize, + ProductName: req.ProductName, + Spec: req.Spec, + Color: req.Color, + Location: req.Location, + Status: req.Status, + }) + if err != nil { + return nil, err + } + + list := make([]types.ProductInfo, 0, len(rpcResp.List)) + for _, p := range rpcResp.List { + list = append(list, types.ProductInfo{ + ProductId: p.ProductId, + ProductName: p.ProductName, + ImageUrl: p.ImageUrl, + Spec: p.Spec, + Color: p.Color, + UnitPieces: p.UnitPieces, + UnitRolls: p.UnitRolls, + StockQuantity: p.StockQuantity, + Location: p.Location, + CostPrice: p.CostPrice, + SalesPrice: p.SalesPrice, + Remark: p.Remark, + Status: p.Status, + CreatedAt: p.CreatedAt, + UpdatedAt: p.UpdatedAt, + }) + } + + return &types.ListProductResp{ + Total: rpcResp.Total, + List: list, + }, nil +} diff --git a/gateway/internal/logic/system/config/listConfigLogic.go b/gateway/internal/logic/system/config/listConfigLogic.go new file mode 100644 index 0000000..6f6dc27 --- /dev/null +++ b/gateway/internal/logic/system/config/listConfigLogic.go @@ -0,0 +1,49 @@ +package config + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ListConfigLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewListConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListConfigLogic { + return &ListConfigLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ListConfigLogic) ListConfig() (resp *types.ListConfigResp, err error) { + rpcResp, err := l.svcCtx.SystemRpc.ListConfig(l.ctx, &pb.ListConfigReq{}) + if err != nil { + return nil, err + } + + list := make([]types.ConfigInfo, 0, len(rpcResp.List)) + for _, c := range rpcResp.List { + list = append(list, types.ConfigInfo{ + ConfigId: c.ConfigId, + ConfigKey: c.ConfigKey, + ConfigValue: c.ConfigValue, + ConfigName: c.ConfigName, + ConfigGroup: c.ConfigGroup, + Remark: c.Remark, + UpdatedAt: c.UpdatedAt, + }) + } + + return &types.ListConfigResp{ + List: list, + }, nil +} diff --git a/gateway/internal/logic/system/config/updateConfigLogic.go b/gateway/internal/logic/system/config/updateConfigLogic.go new file mode 100644 index 0000000..489a9f5 --- /dev/null +++ b/gateway/internal/logic/system/config/updateConfigLogic.go @@ -0,0 +1,40 @@ +package config + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateConfigLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewUpdateConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateConfigLogic { + return &UpdateConfigLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *UpdateConfigLogic) UpdateConfig(req *types.UpdateConfigReq) (resp *types.IdResp, err error) { + key := ctxdata.GetPathKey(l.ctx) + + _, err = l.svcCtx.SystemRpc.UpdateConfig(l.ctx, &pb.UpdateConfigReq{ + ConfigKey: key, + ConfigValue: req.ConfigValue, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: key}, nil +} diff --git a/gateway/internal/logic/system/log/listLogLogic.go b/gateway/internal/logic/system/log/listLogLogic.go new file mode 100644 index 0000000..c2eed48 --- /dev/null +++ b/gateway/internal/logic/system/log/listLogLogic.go @@ -0,0 +1,62 @@ +package log + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ListLogLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewListLogLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListLogLogic { + return &ListLogLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ListLogLogic) ListLog(req *types.ListLogReq) (resp *types.ListLogResp, err error) { + rpcResp, err := l.svcCtx.SystemRpc.ListOperationLog(l.ctx, &pb.ListLogReq{ + Page: req.Page, + PageSize: req.PageSize, + Username: req.Username, + Module: req.Module, + Operation: req.Operation, + StartTime: req.StartTime, + EndTime: req.EndTime, + }) + if err != nil { + return nil, err + } + + list := make([]types.OperationLogInfo, 0, len(rpcResp.List)) + for _, item := range rpcResp.List { + list = append(list, types.OperationLogInfo{ + LogId: item.LogId, + UserId: item.UserId, + Username: item.Username, + Module: item.Module, + Operation: item.Operation, + Method: item.Method, + Path: item.Path, + Ip: item.Ip, + Duration: item.Duration, + Status: item.Status, + CreatedAt: item.CreatedAt, + }) + } + + return &types.ListLogResp{ + Total: rpcResp.Total, + List: list, + }, nil +} diff --git a/gateway/internal/logic/system/menu/createMenuLogic.go b/gateway/internal/logic/system/menu/createMenuLogic.go new file mode 100644 index 0000000..0df1079 --- /dev/null +++ b/gateway/internal/logic/system/menu/createMenuLogic.go @@ -0,0 +1,43 @@ +package menu + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateMenuLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewCreateMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateMenuLogic { + return &CreateMenuLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CreateMenuLogic) CreateMenu(req *types.CreateMenuReq) (resp *types.IdResp, err error) { + rpcResp, err := l.svcCtx.SystemRpc.CreateMenu(l.ctx, &pb.CreateMenuReq{ + ParentId: req.ParentId, + MenuName: req.MenuName, + MenuType: req.MenuType, + Path: req.Path, + Component: req.Component, + Permission: req.Permission, + Icon: req.Icon, + SortOrder: req.SortOrder, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: rpcResp.Id}, nil +} diff --git a/gateway/internal/logic/system/menu/deleteMenuLogic.go b/gateway/internal/logic/system/menu/deleteMenuLogic.go new file mode 100644 index 0000000..90cd1ac --- /dev/null +++ b/gateway/internal/logic/system/menu/deleteMenuLogic.go @@ -0,0 +1,39 @@ +package menu + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeleteMenuLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewDeleteMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteMenuLogic { + return &DeleteMenuLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *DeleteMenuLogic) DeleteMenu() (resp *types.IdResp, err error) { + id := ctxdata.GetPathId(l.ctx) + + _, err = l.svcCtx.SystemRpc.DeleteMenu(l.ctx, &pb.DeleteMenuReq{ + MenuId: id, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: id}, nil +} diff --git a/gateway/internal/logic/system/menu/getMenuLogic.go b/gateway/internal/logic/system/menu/getMenuLogic.go new file mode 100644 index 0000000..0afe5cc --- /dev/null +++ b/gateway/internal/logic/system/menu/getMenuLogic.go @@ -0,0 +1,69 @@ +package menu + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetMenuLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMenuLogic { + return &GetMenuLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetMenuLogic) GetMenu() (resp *types.MenuInfo, err error) { + id := ctxdata.GetPathId(l.ctx) + + rpcResp, err := l.svcCtx.SystemRpc.GetMenu(l.ctx, &pb.GetMenuReq{ + MenuId: id, + }) + if err != nil { + return nil, err + } + + return convertMenuInfo(rpcResp), nil +} + +func convertMenuInfo(m *pb.MenuInfo) *types.MenuInfo { + if m == nil { + return nil + } + + children := make([]types.MenuInfo, 0, len(m.Children)) + for _, c := range m.Children { + if c != nil { + children = append(children, *convertMenuInfo(c)) + } + } + + return &types.MenuInfo{ + MenuId: m.MenuId, + ParentId: m.ParentId, + MenuName: m.MenuName, + MenuType: m.MenuType, + Path: m.Path, + Component: m.Component, + Permission: m.Permission, + Icon: m.Icon, + SortOrder: m.SortOrder, + Visible: m.Visible, + Status: m.Status, + Children: children, + CreatedAt: m.CreatedAt, + UpdatedAt: m.UpdatedAt, + } +} diff --git a/gateway/internal/logic/system/menu/listMenuLogic.go b/gateway/internal/logic/system/menu/listMenuLogic.go new file mode 100644 index 0000000..f639b5c --- /dev/null +++ b/gateway/internal/logic/system/menu/listMenuLogic.go @@ -0,0 +1,43 @@ +package menu + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ListMenuLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewListMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListMenuLogic { + return &ListMenuLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ListMenuLogic) ListMenu() (resp *types.ListMenuResp, err error) { + rpcResp, err := l.svcCtx.SystemRpc.ListMenu(l.ctx, &pb.ListMenuReq{}) + if err != nil { + return nil, err + } + + list := make([]types.MenuInfo, 0, len(rpcResp.List)) + for _, m := range rpcResp.List { + if m != nil { + list = append(list, *convertMenuInfo(m)) + } + } + + return &types.ListMenuResp{ + List: list, + }, nil +} diff --git a/gateway/internal/logic/system/menu/updateMenuLogic.go b/gateway/internal/logic/system/menu/updateMenuLogic.go new file mode 100644 index 0000000..3d9a7f7 --- /dev/null +++ b/gateway/internal/logic/system/menu/updateMenuLogic.go @@ -0,0 +1,48 @@ +package menu + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateMenuLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewUpdateMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateMenuLogic { + return &UpdateMenuLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *UpdateMenuLogic) UpdateMenu(req *types.UpdateMenuReq) (resp *types.IdResp, err error) { + id := ctxdata.GetPathId(l.ctx) + + _, err = l.svcCtx.SystemRpc.UpdateMenu(l.ctx, &pb.UpdateMenuReq{ + MenuId: id, + ParentId: req.ParentId, + MenuName: req.MenuName, + MenuType: req.MenuType, + Path: req.Path, + Component: req.Component, + Permission: req.Permission, + Icon: req.Icon, + SortOrder: req.SortOrder, + Visible: req.Visible, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: id}, nil +} diff --git a/gateway/internal/logic/system/role/createRoleLogic.go b/gateway/internal/logic/system/role/createRoleLogic.go new file mode 100644 index 0000000..b853cb2 --- /dev/null +++ b/gateway/internal/logic/system/role/createRoleLogic.go @@ -0,0 +1,39 @@ +package role + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateRoleLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewCreateRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateRoleLogic { + return &CreateRoleLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CreateRoleLogic) CreateRole(req *types.CreateRoleReq) (resp *types.IdResp, err error) { + rpcResp, err := l.svcCtx.SystemRpc.CreateRole(l.ctx, &pb.CreateRoleReq{ + RoleName: req.RoleName, + RoleKey: req.RoleKey, + RoleDesc: req.RoleDesc, + SortOrder: req.SortOrder, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: rpcResp.Id}, nil +} diff --git a/gateway/internal/logic/system/role/deleteRoleLogic.go b/gateway/internal/logic/system/role/deleteRoleLogic.go new file mode 100644 index 0000000..2a94c8b --- /dev/null +++ b/gateway/internal/logic/system/role/deleteRoleLogic.go @@ -0,0 +1,39 @@ +package role + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeleteRoleLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewDeleteRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteRoleLogic { + return &DeleteRoleLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *DeleteRoleLogic) DeleteRole() (resp *types.IdResp, err error) { + id := ctxdata.GetPathId(l.ctx) + + _, err = l.svcCtx.SystemRpc.DeleteRole(l.ctx, &pb.DeleteRoleReq{ + RoleId: id, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: id}, nil +} diff --git a/gateway/internal/logic/system/role/getRoleLogic.go b/gateway/internal/logic/system/role/getRoleLogic.go new file mode 100644 index 0000000..902f7bd --- /dev/null +++ b/gateway/internal/logic/system/role/getRoleLogic.go @@ -0,0 +1,49 @@ +package role + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetRoleLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetRoleLogic { + return &GetRoleLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetRoleLogic) GetRole() (resp *types.RoleInfo, err error) { + id := ctxdata.GetPathId(l.ctx) + + rpcResp, err := l.svcCtx.SystemRpc.GetRole(l.ctx, &pb.GetRoleReq{ + RoleId: id, + }) + if err != nil { + return nil, err + } + + return &types.RoleInfo{ + RoleId: rpcResp.RoleId, + RoleName: rpcResp.RoleName, + RoleKey: rpcResp.RoleKey, + RoleDesc: rpcResp.RoleDesc, + SortOrder: rpcResp.SortOrder, + Status: rpcResp.Status, + MenuIds: rpcResp.MenuIds, + CreatedAt: rpcResp.CreatedAt, + UpdatedAt: rpcResp.UpdatedAt, + }, nil +} diff --git a/gateway/internal/logic/system/role/listRoleLogic.go b/gateway/internal/logic/system/role/listRoleLogic.go new file mode 100644 index 0000000..686de67 --- /dev/null +++ b/gateway/internal/logic/system/role/listRoleLogic.go @@ -0,0 +1,57 @@ +package role + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ListRoleLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewListRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListRoleLogic { + return &ListRoleLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ListRoleLogic) ListRole(req *types.ListRoleReq) (resp *types.ListRoleResp, err error) { + rpcResp, err := l.svcCtx.SystemRpc.ListRole(l.ctx, &pb.ListRoleReq{ + Page: req.Page, + PageSize: req.PageSize, + RoleName: req.RoleName, + Status: req.Status, + }) + if err != nil { + return nil, err + } + + list := make([]types.RoleInfo, 0, len(rpcResp.List)) + for _, r := range rpcResp.List { + list = append(list, types.RoleInfo{ + RoleId: r.RoleId, + RoleName: r.RoleName, + RoleKey: r.RoleKey, + RoleDesc: r.RoleDesc, + SortOrder: r.SortOrder, + Status: r.Status, + MenuIds: r.MenuIds, + CreatedAt: r.CreatedAt, + UpdatedAt: r.UpdatedAt, + }) + } + + return &types.ListRoleResp{ + Total: rpcResp.Total, + List: list, + }, nil +} diff --git a/gateway/internal/logic/system/role/setRolePermissionsLogic.go b/gateway/internal/logic/system/role/setRolePermissionsLogic.go new file mode 100644 index 0000000..eba6255 --- /dev/null +++ b/gateway/internal/logic/system/role/setRolePermissionsLogic.go @@ -0,0 +1,40 @@ +package role + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type SetRolePermissionsLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewSetRolePermissionsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SetRolePermissionsLogic { + return &SetRolePermissionsLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *SetRolePermissionsLogic) SetRolePermissions(req *types.SetRolePermissionsReq) (resp *types.IdResp, err error) { + id := ctxdata.GetPathId(l.ctx) + + _, err = l.svcCtx.SystemRpc.SetRolePermissions(l.ctx, &pb.SetRolePermissionsReq{ + RoleId: id, + MenuIds: req.MenuIds, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: id}, nil +} diff --git a/gateway/internal/logic/system/role/updateRoleLogic.go b/gateway/internal/logic/system/role/updateRoleLogic.go new file mode 100644 index 0000000..44f7bed --- /dev/null +++ b/gateway/internal/logic/system/role/updateRoleLogic.go @@ -0,0 +1,43 @@ +package role + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateRoleLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewUpdateRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateRoleLogic { + return &UpdateRoleLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *UpdateRoleLogic) UpdateRole(req *types.UpdateRoleReq) (resp *types.IdResp, err error) { + id := ctxdata.GetPathId(l.ctx) + + _, err = l.svcCtx.SystemRpc.UpdateRole(l.ctx, &pb.UpdateRoleReq{ + RoleId: id, + RoleName: req.RoleName, + RoleKey: req.RoleKey, + RoleDesc: req.RoleDesc, + SortOrder: req.SortOrder, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: id}, nil +} diff --git a/gateway/internal/logic/system/user/createUserLogic.go b/gateway/internal/logic/system/user/createUserLogic.go new file mode 100644 index 0000000..ec1d6b8 --- /dev/null +++ b/gateway/internal/logic/system/user/createUserLogic.go @@ -0,0 +1,41 @@ +package user + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateUserLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewCreateUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateUserLogic { + return &CreateUserLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CreateUserLogic) CreateUser(req *types.CreateUserReq) (resp *types.IdResp, err error) { + rpcResp, err := l.svcCtx.SystemRpc.CreateUser(l.ctx, &pb.CreateUserReq{ + Username: req.Username, + Password: req.Password, + RealName: req.RealName, + Phone: req.Phone, + Email: req.Email, + RoleId: req.RoleId, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: rpcResp.Id}, nil +} diff --git a/gateway/internal/logic/system/user/deleteUserLogic.go b/gateway/internal/logic/system/user/deleteUserLogic.go new file mode 100644 index 0000000..3cb8cae --- /dev/null +++ b/gateway/internal/logic/system/user/deleteUserLogic.go @@ -0,0 +1,39 @@ +package user + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeleteUserLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewDeleteUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteUserLogic { + return &DeleteUserLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *DeleteUserLogic) DeleteUser() (resp *types.IdResp, err error) { + id := ctxdata.GetPathId(l.ctx) + + _, err = l.svcCtx.SystemRpc.DeleteUser(l.ctx, &pb.DeleteUserReq{ + UserId: id, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: id}, nil +} diff --git a/gateway/internal/logic/system/user/getUserLogic.go b/gateway/internal/logic/system/user/getUserLogic.go new file mode 100644 index 0000000..2c2909b --- /dev/null +++ b/gateway/internal/logic/system/user/getUserLogic.go @@ -0,0 +1,52 @@ +package user + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetUserLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserLogic { + return &GetUserLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetUserLogic) GetUser() (resp *types.UserInfo, err error) { + id := ctxdata.GetPathId(l.ctx) + + rpcResp, err := l.svcCtx.SystemRpc.GetUser(l.ctx, &pb.GetUserReq{ + UserId: id, + }) + if err != nil { + return nil, err + } + + return &types.UserInfo{ + UserId: rpcResp.UserId, + Username: rpcResp.Username, + RealName: rpcResp.RealName, + Phone: rpcResp.Phone, + Email: rpcResp.Email, + Avatar: rpcResp.Avatar, + Status: rpcResp.Status, + RoleId: rpcResp.RoleId, + RoleName: rpcResp.RoleName, + LastLoginTime: rpcResp.LastLoginTime, + CreatedAt: rpcResp.CreatedAt, + UpdatedAt: rpcResp.UpdatedAt, + }, nil +} diff --git a/gateway/internal/logic/system/user/listUserLogic.go b/gateway/internal/logic/system/user/listUserLogic.go new file mode 100644 index 0000000..b4c65f9 --- /dev/null +++ b/gateway/internal/logic/system/user/listUserLogic.go @@ -0,0 +1,62 @@ +package user + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ListUserLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewListUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListUserLogic { + return &ListUserLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ListUserLogic) ListUser(req *types.ListUserReq) (resp *types.ListUserResp, err error) { + rpcResp, err := l.svcCtx.SystemRpc.ListUser(l.ctx, &pb.ListUserReq{ + Page: req.Page, + PageSize: req.PageSize, + Username: req.Username, + RealName: req.RealName, + Phone: req.Phone, + Status: req.Status, + }) + if err != nil { + return nil, err + } + + list := make([]types.UserInfo, 0, len(rpcResp.List)) + for _, u := range rpcResp.List { + list = append(list, types.UserInfo{ + UserId: u.UserId, + Username: u.Username, + RealName: u.RealName, + Phone: u.Phone, + Email: u.Email, + Avatar: u.Avatar, + Status: u.Status, + RoleId: u.RoleId, + RoleName: u.RoleName, + LastLoginTime: u.LastLoginTime, + CreatedAt: u.CreatedAt, + UpdatedAt: u.UpdatedAt, + }) + } + + return &types.ListUserResp{ + Total: rpcResp.Total, + List: list, + }, nil +} diff --git a/gateway/internal/logic/system/user/updateUserLogic.go b/gateway/internal/logic/system/user/updateUserLogic.go new file mode 100644 index 0000000..74288f8 --- /dev/null +++ b/gateway/internal/logic/system/user/updateUserLogic.go @@ -0,0 +1,44 @@ +package user + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateUserLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewUpdateUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateUserLogic { + return &UpdateUserLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *UpdateUserLogic) UpdateUser(req *types.UpdateUserReq) (resp *types.IdResp, err error) { + id := ctxdata.GetPathId(l.ctx) + + _, err = l.svcCtx.SystemRpc.UpdateUser(l.ctx, &pb.UpdateUserReq{ + UserId: id, + RealName: req.RealName, + Phone: req.Phone, + Email: req.Email, + RoleId: req.RoleId, + Avatar: req.Avatar, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: id}, nil +} diff --git a/gateway/internal/logic/system/user/updateUserStatusLogic.go b/gateway/internal/logic/system/user/updateUserStatusLogic.go new file mode 100644 index 0000000..6a0f670 --- /dev/null +++ b/gateway/internal/logic/system/user/updateUserStatusLogic.go @@ -0,0 +1,40 @@ +package user + +import ( + "context" + + "muyu-apiserver/gateway/internal/svc" + "muyu-apiserver/gateway/internal/types" + "muyu-apiserver/pkg/ctxdata" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateUserStatusLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewUpdateUserStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateUserStatusLogic { + return &UpdateUserStatusLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *UpdateUserStatusLogic) UpdateUserStatus(req *types.UpdateUserStatusReq) (resp *types.IdResp, err error) { + id := ctxdata.GetPathId(l.ctx) + + _, err = l.svcCtx.SystemRpc.UpdateUserStatus(l.ctx, &pb.UpdateUserStatusReq{ + UserId: id, + Status: req.Status, + }) + if err != nil { + return nil, err + } + + return &types.IdResp{Id: id}, nil +} diff --git a/gateway/internal/middleware/authorityMiddleware.go b/gateway/internal/middleware/authorityMiddleware.go new file mode 100644 index 0000000..15f5306 --- /dev/null +++ b/gateway/internal/middleware/authorityMiddleware.go @@ -0,0 +1,19 @@ +package middleware + +import ( + "net/http" +) + +type AuthorityMiddleware struct{} + +func NewAuthorityMiddleware() *AuthorityMiddleware { + return &AuthorityMiddleware{} +} + +func (m *AuthorityMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + // go-zero JWT middleware puts claims into context + // Casbin enforcement will be added later + next(w, r) + } +} diff --git a/gateway/internal/svc/serviceContext.go b/gateway/internal/svc/serviceContext.go new file mode 100644 index 0000000..942b8b6 --- /dev/null +++ b/gateway/internal/svc/serviceContext.go @@ -0,0 +1,26 @@ +package svc + +import ( + "github.com/zeromicro/go-zero/rest" + "github.com/zeromicro/go-zero/zrpc" + "muyu-apiserver/gateway/internal/config" + "muyu-apiserver/gateway/internal/middleware" + "muyu-apiserver/rpc/inventory/inventoryservice" + "muyu-apiserver/rpc/system/systemservice" +) + +type ServiceContext struct { + Config config.Config + AuthorityMiddleware rest.Middleware + SystemRpc systemservice.SystemService + InventoryRpc inventoryservice.InventoryService +} + +func NewServiceContext(c config.Config) *ServiceContext { + return &ServiceContext{ + Config: c, + AuthorityMiddleware: middleware.NewAuthorityMiddleware().Handle, + SystemRpc: systemservice.NewSystemService(zrpc.MustNewClient(c.SystemRpc)), + InventoryRpc: inventoryservice.NewInventoryService(zrpc.MustNewClient(c.InventoryRpc)), + } +} diff --git a/gateway/internal/types/types.go b/gateway/internal/types/types.go new file mode 100644 index 0000000..3eb33f5 --- /dev/null +++ b/gateway/internal/types/types.go @@ -0,0 +1,411 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.9.2 + +package types + +type ApproveStockAdjustReq struct { + Action int64 `json:"action"` +} + +type ChangePasswordReq struct { + OldPassword string `json:"oldPassword"` + NewPassword string `json:"newPassword"` +} + +type ConfigInfo struct { + ConfigId string `json:"configId"` + ConfigKey string `json:"configKey"` + ConfigValue string `json:"configValue"` + ConfigName string `json:"configName"` + ConfigGroup string `json:"configGroup"` + Remark string `json:"remark"` + UpdatedAt string `json:"updatedAt"` +} + +type CreateMenuReq struct { + ParentId string `json:"parentId,optional"` + MenuName string `json:"menuName"` + MenuType int64 `json:"menuType"` + Path string `json:"path,optional"` + Component string `json:"component,optional"` + Permission string `json:"permission,optional"` + Icon string `json:"icon,optional"` + SortOrder int64 `json:"sortOrder,optional"` +} + +type CreateProductReq struct { + ProductName string `json:"productName"` + ImageUrl string `json:"imageUrl,optional"` + Spec string `json:"spec,optional"` + Color string `json:"color,optional"` + UnitPieces int64 `json:"unitPieces,optional"` + UnitRolls int64 `json:"unitRolls,optional"` + StockQuantity string `json:"stockQuantity,optional"` + Location string `json:"location,optional"` + CostPrice string `json:"costPrice,optional"` + SalesPrice string `json:"salesPrice,optional"` + Remark string `json:"remark,optional"` +} + +type CreateRoleReq struct { + RoleName string `json:"roleName"` + RoleKey string `json:"roleKey"` + RoleDesc string `json:"roleDesc,optional"` + SortOrder int64 `json:"sortOrder,optional"` +} + +type CreateStockAdjustReq struct { + AdjustDate string `json:"adjustDate"` + AdjustReason string `json:"adjustReason"` + Remark string `json:"remark,optional"` + Details []StockAdjustDetailReq `json:"details"` +} + +type CreateStockCheckReq struct { + CheckDate string `json:"checkDate"` + Checker string `json:"checker"` + Remark string `json:"remark,optional"` + Details []StockCheckDetailReq `json:"details"` +} + +type CreateUserReq struct { + Username string `json:"username"` + Password string `json:"password"` + RealName string `json:"realName"` + Phone string `json:"phone,optional"` + Email string `json:"email,optional"` + RoleId string `json:"roleId"` +} + +type IdResp struct { + Id string `json:"id"` +} + +type ImportProductResp struct { + TotalCount int64 `json:"totalCount"` + SuccessCount int64 `json:"successCount"` + FailCount int64 `json:"failCount"` + ErrorMsg string `json:"errorMsg"` + ImportId string `json:"importId"` +} + +type ListConfigResp struct { + List []ConfigInfo `json:"list"` +} + +type ListLogReq struct { + Page int64 `form:"page,default=1"` + PageSize int64 `form:"pageSize,default=20"` + Username string `form:"username,optional"` + Module string `form:"module,optional"` + Operation string `form:"operation,optional"` + StartTime string `form:"startTime,optional"` + EndTime string `form:"endTime,optional"` +} + +type ListLogResp struct { + Total int64 `json:"total"` + List []OperationLogInfo `json:"list"` +} + +type ListMenuResp struct { + List []MenuInfo `json:"list"` +} + +type ListProductReq struct { + Page int64 `form:"page,default=1"` + PageSize int64 `form:"pageSize,default=20"` + ProductName string `form:"productName,optional"` + Spec string `form:"spec,optional"` + Color string `form:"color,optional"` + Location string `form:"location,optional"` + Status int64 `form:"status,optional,default=-1"` +} + +type ListProductResp struct { + Total int64 `json:"total"` + List []ProductInfo `json:"list"` +} + +type ListRoleReq struct { + Page int64 `form:"page,default=1"` + PageSize int64 `form:"pageSize,default=20"` + RoleName string `form:"roleName,optional"` + Status int64 `form:"status,optional,default=-1"` +} + +type ListRoleResp struct { + Total int64 `json:"total"` + List []RoleInfo `json:"list"` +} + +type ListStockAdjustReq struct { + Page int64 `form:"page,default=1"` + PageSize int64 `form:"pageSize,default=20"` + AdjustNo string `form:"adjustNo,optional"` + AdjustReason string `form:"adjustReason,optional"` + Status int64 `form:"status,optional,default=-1"` + StartDate string `form:"startDate,optional"` + EndDate string `form:"endDate,optional"` +} + +type ListStockAdjustResp struct { + Total int64 `json:"total"` + List []StockAdjustInfo `json:"list"` +} + +type ListStockCheckReq struct { + Page int64 `form:"page,default=1"` + PageSize int64 `form:"pageSize,default=20"` + CheckNo string `form:"checkNo,optional"` + Status int64 `form:"status,optional,default=-1"` + StartDate string `form:"startDate,optional"` + EndDate string `form:"endDate,optional"` +} + +type ListStockCheckResp struct { + Total int64 `json:"total"` + List []StockCheckInfo `json:"list"` +} + +type ListUserReq struct { + Page int64 `form:"page,default=1"` + PageSize int64 `form:"pageSize,default=20"` + Username string `form:"username,optional"` + RealName string `form:"realName,optional"` + Phone string `form:"phone,optional"` + Status int64 `form:"status,optional,default=-1"` +} + +type ListUserResp struct { + Total int64 `json:"total"` + List []UserInfo `json:"list"` +} + +type LoginReq struct { + Username string `json:"username"` + Password string `json:"password"` +} + +type LoginResp struct { + Token string `json:"token"` + UserInfo UserInfo `json:"userInfo"` +} + +type MenuInfo struct { + MenuId string `json:"menuId"` + ParentId string `json:"parentId"` + MenuName string `json:"menuName"` + MenuType int64 `json:"menuType"` + Path string `json:"path"` + Component string `json:"component"` + Permission string `json:"permission"` + Icon string `json:"icon"` + SortOrder int64 `json:"sortOrder"` + Visible int64 `json:"visible"` + Status int64 `json:"status"` + Children []MenuInfo `json:"children"` + CreatedAt string `json:"createdAt"` + UpdatedAt string `json:"updatedAt"` +} + +type OperationLogInfo struct { + LogId string `json:"logId"` + UserId string `json:"userId"` + Username string `json:"username"` + Module string `json:"module"` + Operation string `json:"operation"` + Method string `json:"method"` + Path string `json:"path"` + Ip string `json:"ip"` + Duration int64 `json:"duration"` + Status int64 `json:"status"` + CreatedAt string `json:"createdAt"` +} + +type PageReq struct { + Page int64 `form:"page,default=1"` + PageSize int64 `form:"pageSize,default=20"` +} + +type ProductInfo struct { + ProductId string `json:"productId"` + ProductName string `json:"productName"` + ImageUrl string `json:"imageUrl"` + Spec string `json:"spec"` + Color string `json:"color"` + UnitPieces int64 `json:"unitPieces"` + UnitRolls int64 `json:"unitRolls"` + StockQuantity string `json:"stockQuantity"` + Location string `json:"location"` + CostPrice string `json:"costPrice"` + SalesPrice string `json:"salesPrice"` + Remark string `json:"remark"` + Status int64 `json:"status"` + CreatedAt string `json:"createdAt"` + UpdatedAt string `json:"updatedAt"` +} + +type RoleInfo struct { + RoleId string `json:"roleId"` + RoleName string `json:"roleName"` + RoleKey string `json:"roleKey"` + RoleDesc string `json:"roleDesc"` + SortOrder int64 `json:"sortOrder"` + Status int64 `json:"status"` + MenuIds []string `json:"menuIds"` + CreatedAt string `json:"createdAt"` + UpdatedAt string `json:"updatedAt"` +} + +type SetRolePermissionsReq struct { + MenuIds []string `json:"menuIds"` +} + +type StockAdjustDetailInfo struct { + DetailId string `json:"detailId"` + AdjustId string `json:"adjustId"` + ProductId string `json:"productId"` + ProductName string `json:"productName"` + BeforeQuantity string `json:"beforeQuantity"` + AdjustQuantity string `json:"adjustQuantity"` + AfterQuantity string `json:"afterQuantity"` + Remark string `json:"remark"` +} + +type StockAdjustDetailReq struct { + ProductId string `json:"productId"` + AdjustQuantity string `json:"adjustQuantity"` + Remark string `json:"remark,optional"` +} + +type StockAdjustInfo struct { + AdjustId string `json:"adjustId"` + AdjustNo string `json:"adjustNo"` + AdjustDate string `json:"adjustDate"` + AdjustReason string `json:"adjustReason"` + Operator string `json:"operator"` + Approver string `json:"approver"` + Status int64 `json:"status"` + Remark string `json:"remark"` + CreatedAt string `json:"createdAt"` + UpdatedAt string `json:"updatedAt"` + Details []StockAdjustDetailInfo `json:"details"` +} + +type StockCheckDetailInfo struct { + DetailId string `json:"detailId"` + CheckId string `json:"checkId"` + ProductId string `json:"productId"` + ProductName string `json:"productName"` + SystemQuantity string `json:"systemQuantity"` + ActualQuantity string `json:"actualQuantity"` + DiffQuantity string `json:"diffQuantity"` + DiffAmount string `json:"diffAmount"` + Remark string `json:"remark"` +} + +type StockCheckDetailReq struct { + ProductId string `json:"productId"` + ActualQuantity string `json:"actualQuantity"` + Remark string `json:"remark,optional"` +} + +type StockCheckInfo struct { + CheckId string `json:"checkId"` + CheckNo string `json:"checkNo"` + CheckDate string `json:"checkDate"` + Checker string `json:"checker"` + Status int64 `json:"status"` + Remark string `json:"remark"` + CreatedAt string `json:"createdAt"` + UpdatedAt string `json:"updatedAt"` + Details []StockCheckDetailInfo `json:"details"` +} + +type StockGroupItem struct { + Name string `json:"name"` + Count int64 `json:"count"` + Quantity string `json:"quantity"` +} + +type StockGroupResp struct { + List []StockGroupItem `json:"list"` +} + +type StockSummaryResp struct { + ProductCount int64 `json:"productCount"` + TotalPieces int64 `json:"totalPieces"` + TotalRolls int64 `json:"totalRolls"` + TotalCostValue string `json:"totalCostValue"` + TotalSalesValue string `json:"totalSalesValue"` +} + +type UpdateConfigReq struct { + ConfigValue string `json:"configValue"` +} + +type UpdateMenuReq struct { + ParentId string `json:"parentId,optional"` + MenuName string `json:"menuName,optional"` + MenuType int64 `json:"menuType,optional"` + Path string `json:"path,optional"` + Component string `json:"component,optional"` + Permission string `json:"permission,optional"` + Icon string `json:"icon,optional"` + SortOrder int64 `json:"sortOrder,optional"` + Visible int64 `json:"visible,optional"` +} + +type UpdateProductReq struct { + ProductName string `json:"productName,optional"` + ImageUrl string `json:"imageUrl,optional"` + Spec string `json:"spec,optional"` + Color string `json:"color,optional"` + UnitPieces int64 `json:"unitPieces,optional"` + UnitRolls int64 `json:"unitRolls,optional"` + StockQuantity string `json:"stockQuantity,optional"` + Location string `json:"location,optional"` + CostPrice string `json:"costPrice,optional"` + SalesPrice string `json:"salesPrice,optional"` + Remark string `json:"remark,optional"` +} + +type UpdateRoleReq struct { + RoleName string `json:"roleName,optional"` + RoleKey string `json:"roleKey,optional"` + RoleDesc string `json:"roleDesc,optional"` + SortOrder int64 `json:"sortOrder,optional"` +} + +type UpdateStockCheckReq struct { + Remark string `json:"remark,optional"` + Details []StockCheckDetailReq `json:"details"` +} + +type UpdateUserReq struct { + RealName string `json:"realName,optional"` + Phone string `json:"phone,optional"` + Email string `json:"email,optional"` + RoleId string `json:"roleId,optional"` + Avatar string `json:"avatar,optional"` +} + +type UpdateUserStatusReq struct { + Status int64 `json:"status"` +} + +type UserInfo struct { + UserId string `json:"userId"` + Username string `json:"username"` + RealName string `json:"realName"` + Phone string `json:"phone"` + Email string `json:"email"` + Avatar string `json:"avatar"` + Status int64 `json:"status"` + RoleId string `json:"roleId"` + RoleName string `json:"roleName"` + LastLoginTime string `json:"lastLoginTime"` + CreatedAt string `json:"createdAt"` + UpdatedAt string `json:"updatedAt"` +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..6e06cf8 --- /dev/null +++ b/go.mod @@ -0,0 +1,129 @@ +module muyu-apiserver + +go 1.24.4 + +require ( + github.com/casbin/casbin/v2 v2.135.0 + github.com/casbin/gorm-adapter/v3 v3.41.0 + github.com/golang-jwt/jwt/v5 v5.3.1 + github.com/zeromicro/go-zero v1.10.0 + golang.org/x/crypto v0.48.0 + google.golang.org/grpc v1.79.1 + google.golang.org/protobuf v1.36.11 + gorm.io/driver/mysql v1.6.0 + gorm.io/gorm v1.31.1 +) + +require ( + filippo.io/edwards25519 v1.1.0 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/bmatcuk/doublestar/v4 v4.9.1 // indirect + github.com/casbin/casbin/v3 v3.8.1 // indirect + github.com/casbin/govaluate v1.10.0 // indirect + github.com/cenkalti/backoff/v4 v4.3.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/coreos/go-semver v0.3.1 // indirect + github.com/coreos/go-systemd/v22 v22.5.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/dustin/go-humanize v1.0.1 // indirect + github.com/emicklei/go-restful/v3 v3.11.0 // indirect + github.com/fatih/color v1.18.0 // indirect + github.com/glebarez/go-sqlite v1.22.0 // indirect + github.com/glebarez/sqlite v1.11.0 // indirect + github.com/go-logr/logr v1.4.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-openapi/jsonpointer v0.19.6 // indirect + github.com/go-openapi/jsonreference v0.20.2 // indirect + github.com/go-openapi/swag v0.22.4 // indirect + github.com/go-sql-driver/mysql v1.9.3 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang-jwt/jwt/v4 v4.5.2 // indirect + github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect + github.com/golang-sql/sqlexp v0.1.0 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/google/gnostic-models v0.6.8 // indirect + github.com/google/go-cmp v0.7.0 // indirect + github.com/google/gofuzz v1.2.0 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/grafana/pyroscope-go v1.2.7 // indirect + github.com/grafana/pyroscope-go/godeltaprof v0.1.9 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect + github.com/jackc/pgx/v5 v5.8.0 // indirect + github.com/jackc/puddle/v2 v2.2.2 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.18.0 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/microsoft/go-mssqldb v1.9.5 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/ncruces/go-strftime v1.0.0 // indirect + github.com/openzipkin/zipkin-go v0.4.3 // indirect + github.com/pelletier/go-toml/v2 v2.2.4 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/prometheus/client_golang v1.23.2 // indirect + github.com/prometheus/client_model v0.6.2 // indirect + github.com/prometheus/common v0.66.1 // indirect + github.com/prometheus/procfs v0.16.1 // indirect + github.com/redis/go-redis/v9 v9.17.3 // indirect + github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect + github.com/shopspring/decimal v1.4.0 // indirect + github.com/spaolacci/murmur3 v1.1.0 // indirect + go.etcd.io/etcd/api/v3 v3.5.15 // indirect + go.etcd.io/etcd/client/pkg/v3 v3.5.15 // indirect + go.etcd.io/etcd/client/v3 v3.5.15 // indirect + go.opentelemetry.io/auto/sdk v1.2.1 // indirect + go.opentelemetry.io/otel v1.39.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0 // indirect + go.opentelemetry.io/otel/exporters/zipkin v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.39.0 // indirect + go.opentelemetry.io/otel/sdk v1.39.0 // indirect + go.opentelemetry.io/otel/trace v1.39.0 // indirect + go.opentelemetry.io/proto/otlp v1.3.1 // indirect + go.uber.org/atomic v1.10.0 // indirect + go.uber.org/automaxprocs v1.6.0 // indirect + go.uber.org/mock v0.6.0 // indirect + go.uber.org/multierr v1.9.0 // indirect + go.uber.org/zap v1.24.0 // indirect + go.yaml.in/yaml/v2 v2.4.2 // indirect + golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 // indirect + golang.org/x/net v0.49.0 // indirect + golang.org/x/oauth2 v0.34.0 // indirect + golang.org/x/sync v0.19.0 // indirect + golang.org/x/sys v0.41.0 // indirect + golang.org/x/term v0.40.0 // indirect + golang.org/x/text v0.34.0 // indirect + golang.org/x/time v0.10.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + gorm.io/driver/postgres v1.6.0 // indirect + gorm.io/driver/sqlserver v1.6.3 // indirect + gorm.io/plugin/dbresolver v1.6.2 // indirect + k8s.io/api v0.29.3 // indirect + k8s.io/apimachinery v0.29.4 // indirect + k8s.io/client-go v0.29.3 // indirect + k8s.io/klog/v2 v2.110.1 // indirect + k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect + k8s.io/utils v0.0.0-20251222233032-718f0e51e6d2 // indirect + modernc.org/libc v1.67.4 // indirect + modernc.org/mathutil v1.7.1 // indirect + modernc.org/memory v1.11.0 // indirect + modernc.org/sqlite v1.42.2 // indirect + sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect + sigs.k8s.io/yaml v1.3.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..0e49ad0 --- /dev/null +++ b/go.sum @@ -0,0 +1,522 @@ +filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= +filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1/go.mod h1:a6xsAQUZg+VsS3TJ05SRp524Hs4pZ/AeFSr5ENf0Yjo= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.18.0 h1:Gt0j3wceWMwPmiazCa8MzMA0MfhmPIz0Qp0FJ6qcM0U= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.18.0/go.mod h1:Ot/6aikWnKWi4l9QB7qVSwa8iMphQNqkWALMoNT3rzM= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1/go.mod h1:uE9zaUfEQT/nbQjVi2IblCG9iaLtZsuYZ8ne+PuQ02M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.6.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.10.1 h1:B+blDbyVIG3WaikNxPnhPiJ1MThR03b3vKGtER95TP4= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.10.1/go.mod h1:JdM5psgjfBf5fo2uWOZhflPWyDBZ/O/CNAH9CtsuZE4= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.8.0/go.mod h1:4OG6tQ9EOP/MT0NMjDlRzWoVFxfu9rN9B2X+tlSVktg= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1 h1:FPKJS1T+clwv+OLGt13a8UjqeRuh0O4SJ3lUriThc+4= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1/go.mod h1:j2chePtV91HrC22tGoRX3sGY42uF13WzmmV80/OdVAA= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.0.1/go.mod h1:GpPjLhVR9dnUoJMyHWSPy71xY9/lcmpzIPZXmF0FCVY= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.3.1 h1:Wgf5rZba3YZqeTNJPtvqZoBu1sBN/L4sry+u2U3Y75w= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.3.1/go.mod h1:xxCBG/f/4Vbmh2XQJBsOmNdxWUY5j/s27jujKPbQf14= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.0.0/go.mod h1:bTSOgj05NGRuHHhQwAdPnYr9TOdNmKlZTgGLL6nyAdI= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.1.1 h1:bFWuoEKg+gImo7pvkiQEFAc8ocibADgXeiLAxWhWmkI= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.1.1/go.mod h1:Vih/3yc6yac2JzU4hzpaDupBJP0Flaia9rXXrU8xyww= +github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs= +github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU= +github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= +github.com/alicebob/miniredis/v2 v2.36.1 h1:Dvc5oAnNOr7BIfPn7tF269U8DvRW1dBG2D5n0WrfYMI= +github.com/alicebob/miniredis/v2 v2.36.1/go.mod h1:TcL7YfarKPGDAthEtl5NBeHZfeUQj6OXMm/+iu5cLMM= +github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= +github.com/bmatcuk/doublestar/v4 v4.9.1 h1:X8jg9rRZmJd4yRy7ZeNDRnM+T3ZfHv15JiBJ/avrEXE= +github.com/bmatcuk/doublestar/v4 v4.9.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= +github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= +github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= +github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= +github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= +github.com/casbin/casbin/v2 v2.135.0 h1:6BLkMQiGotYyS5yYeWgW19vxqugUlvHFkFiLnLR/bxk= +github.com/casbin/casbin/v2 v2.135.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= +github.com/casbin/casbin/v3 v3.8.1 h1:D4dEY4knePPR4YgNP5WZtWNaOxD0UK0LpPy9+zxtBwo= +github.com/casbin/casbin/v3 v3.8.1/go.mod h1:5rJbQr2e6AuuDDNxnPc5lQlC9nIgg6nS1zYwKXhpHC8= +github.com/casbin/gorm-adapter/v3 v3.41.0 h1:Xhpi0tfRP9aKPDWDf6dgBxHZ9UM6IophxxPIEGWqCNM= +github.com/casbin/gorm-adapter/v3 v3.41.0/go.mod h1:BQZRJhwUnwMpI+pT2m7/cUJwXxrHfzpBpPcNTyMGeGA= +github.com/casbin/govaluate v1.3.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= +github.com/casbin/govaluate v1.10.0 h1:ffGw51/hYH3w3rZcxO/KcaUIDOLP84w7nsidMVgaDG0= +github.com/casbin/govaluate v1.10.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= +github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= +github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= +github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= +github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= +github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= +github.com/glebarez/go-sqlite v1.22.0 h1:uAcMJhaA6r3LHMTFgP0SifzgXg46yJkgxqyuyec+ruQ= +github.com/glebarez/go-sqlite v1.22.0/go.mod h1:PlBIdHe0+aUEFn+r2/uthrWq4FxbzugL0L8Li6yQJbc= +github.com/glebarez/sqlite v1.11.0 h1:wSG0irqzP6VurnMEpFGer5Li19RpIRi2qvQz++w0GMw= +github.com/glebarez/sqlite v1.11.0/go.mod h1:h8/o8j5wiAsqSPoWELDUdJXhjAhsVliSn7bWZjOhrgQ= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= +github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= +github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo= +github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI= +github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= +github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= +github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= +github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= +github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs= +github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= +github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= +github.com/grafana/pyroscope-go v1.2.7 h1:VWBBlqxjyR0Cwk2W6UrE8CdcdD80GOFNutj0Kb1T8ac= +github.com/grafana/pyroscope-go v1.2.7/go.mod h1:o/bpSLiJYYP6HQtvcoVKiE9s5RiNgjYTj1DhiddP2Pc= +github.com/grafana/pyroscope-go/godeltaprof v0.1.9 h1:c1Us8i6eSmkW+Ez05d3co8kasnuOY813tbMN8i/a3Og= +github.com/grafana/pyroscope-go/godeltaprof v0.1.9/go.mod h1:2+l7K7twW49Ct4wFluZD3tZ6e0SjanjcUUBPVD/UuGU= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= +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.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgx/v5 v5.8.0 h1:TYPDoleBBme0xGSAX3/+NujXXtpZn9HBONkQC7IEZSo= +github.com/jackc/pgx/v5 v5.8.0/go.mod h1:QVeDInX2m9VyzvNeiCJVjCkNFqzsNb43204HshNSZKw= +github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= +github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= +github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= +github.com/jcmturner/gofork v1.7.6/go.mod h1:1622LH6i/EZqLloHfE7IeZ0uEJwMSUyQ/nDd82IeqRo= +github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= +github.com/jcmturner/gokrb5/v8 v8.4.4/go.mod h1:1btQEpgT6k+unzCwX1KdWMEwPPkkgBtP+F6aCACiMrs= +github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= +github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= +github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/microsoft/go-mssqldb v1.8.2/go.mod h1:vp38dT33FGfVotRiTmDo3bFyaHq+p3LektQrjTULowo= +github.com/microsoft/go-mssqldb v1.9.5 h1:orwya0X/5bsL1o+KasupTkk2eNTNFkTQG0BEe/HxCn0= +github.com/microsoft/go-mssqldb v1.9.5/go.mod h1:VCP2a0KEZZtGLRHd1PsLavLFYy/3xX2yJUPycv3Sr2Q= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= +github.com/montanaflynn/stats v0.7.0/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w= +github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= +github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= +github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= +github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= +github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg= +github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c= +github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= +github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= +github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= +github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= +github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= +github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= +github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= +github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= +github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= +github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= +github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= +github.com/redis/go-redis/v9 v9.17.3 h1:fN29NdNrE17KttK5Ndf20buqfDZwGNgoUr9qjl1DQx4= +github.com/redis/go-redis/v9 v9.17.3/go.mod h1:u410H11HMLoB+TP67dz8rL9s6QW2j76l0//kSOd3370= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= +github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +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/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M= +github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= +github.com/zeromicro/go-zero v1.10.0 h1:+qfAqj+BGt0qjW1PQk2VO5WLwIQBh60CA3OTLsBosS8= +github.com/zeromicro/go-zero v1.10.0/go.mod h1:qAModWGsfkrBl0JP9oS7K7k6dgucExOuQdpzHyXVKLg= +go.etcd.io/etcd/api/v3 v3.5.15 h1:3KpLJir1ZEBrYuV2v+Twaa/e2MdDCEZ/70H+lzEiwsk= +go.etcd.io/etcd/api/v3 v3.5.15/go.mod h1:N9EhGzXq58WuMllgH9ZvnEr7SI9pS0k0+DHZezGp7jM= +go.etcd.io/etcd/client/pkg/v3 v3.5.15 h1:fo0HpWz/KlHGMCC+YejpiCmyWDEuIpnTDzpJLB5fWlA= +go.etcd.io/etcd/client/pkg/v3 v3.5.15/go.mod h1:mXDI4NAOwEiszrHCb0aqfAYNCrZP4e9hRca3d1YK8EU= +go.etcd.io/etcd/client/v3 v3.5.15 h1:23M0eY4Fd/inNv1ZfU3AxrbbOdW79r9V9Rl62Nm6ip4= +go.etcd.io/etcd/client/v3 v3.5.15/go.mod h1:CLSJxrYjvLtHsrPKsy7LmZEE+DK2ktfd2bN4RhBMwlU= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48= +go.opentelemetry.io/otel v1.39.0/go.mod h1:kLlFTywNWrFyEdH0oj2xK0bFYZtHRYUdv1NklR/tgc8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 h1:t6wl9SPayj+c7lEIFgm4ooDBZVb01IhLB4InpomhRw8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0/go.mod h1:iSDOcsnSA5INXzZtwaBPrKp/lWu/V14Dd+llD0oI2EA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 h1:Mw5xcxMwlqoJd97vwPxA8isEaIoxsta9/Q51+TTJLGE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0/go.mod h1:CQNu9bj7o7mC6U7+CA/schKEYakYXWr79ucDHTMGhCM= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 h1:Xw8U6u2f8DK2XAkGRFV7BBLENgnTGX9i4rQRxJf+/vs= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0/go.mod h1:6KW1Fm6R/s6Z3PGXwSJN2K4eT6wQB3vXX6CVnYX9NmM= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0 h1:s0PHtIkN+3xrbDOpt2M8OTG92cWqUESvzh2MxiR5xY8= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0/go.mod h1:hZlFbDbRt++MMPCCfSJfmhkGIWnX1h3XjkfxZUjLrIA= +go.opentelemetry.io/otel/exporters/zipkin v1.24.0 h1:3evrL5poBuh1KF51D9gO/S+N/1msnm4DaBqs/rpXUqY= +go.opentelemetry.io/otel/exporters/zipkin v1.24.0/go.mod h1:0EHgD8R0+8yRhUYJOGR8Hfg2dpiJQxDOszd5smVO9wM= +go.opentelemetry.io/otel/metric v1.39.0 h1:d1UzonvEZriVfpNKEVmHXbdf909uGTOQjA0HF0Ls5Q0= +go.opentelemetry.io/otel/metric v1.39.0/go.mod h1:jrZSWL33sD7bBxg1xjrqyDjnuzTUB0x1nBERXd7Ftcs= +go.opentelemetry.io/otel/sdk v1.39.0 h1:nMLYcjVsvdui1B/4FRkwjzoRVsMK8uL/cj0OyhKzt18= +go.opentelemetry.io/otel/sdk v1.39.0/go.mod h1:vDojkC4/jsTJsE+kh+LXYQlbL8CgrEcwmt1ENZszdJE= +go.opentelemetry.io/otel/sdk/metric v1.39.0 h1:cXMVVFVgsIf2YL6QkRF4Urbr/aMInf+2WKg+sEJTtB8= +go.opentelemetry.io/otel/sdk/metric v1.39.0/go.mod h1:xq9HEVH7qeX69/JnwEfp6fVq5wosJsY1mt4lLfYdVew= +go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6/qCJI= +go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA= +go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= +go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= +go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= +go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs= +go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y= +go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= +go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= +go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= +go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +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-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts= +golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos= +golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 h1:fQsdNF2N+/YewlRZiricy4P1iimyPKZ/xwniHj8Q2a0= +golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93/go.mod h1:EPRbTFwzwjXj9NpYyyrvenVh9Y+GFeEvMNh7Xuz7xgU= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c= +golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= +golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= +golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw= +golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= +golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= +golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= +golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= +golang.org/x/term v0.40.0 h1:36e4zGLqU4yhjlmxEaagx2KuYbJq3EwY8K943ZsHcvg= +golang.org/x/term v0.40.0/go.mod h1:w2P8uVp06p2iyKKuvXIm7N/y0UCRt3UfJTfZ7oOpglM= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= +golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= +golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= +golang.org/x/time v0.10.0 h1:3usCWA8tQn0L8+hFJQNgzpWbd89begxN66o1Ojdn5L4= +golang.org/x/time v0.10.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.41.0 h1:a9b8iMweWG+S0OBnlU36rzLp20z1Rp10w+IY2czHTQc= +golang.org/x/tools v0.41.0/go.mod h1:XSY6eDqxVNiYgezAVqqCeihT4j1U2CCsqvH3WhQpnlg= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= +gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= +google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 h1:fCvbg86sFXwdrl5LgVcTEvNC+2txB5mgROGmRL5mrls= +google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:+rXWjjaukWZun3mLfjmVnQi18E1AsFbDN9QdJ5YXLto= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/grpc v1.79.1 h1:zGhSi45ODB9/p3VAawt9a+O/MULLl9dpizzNNpq7flY= +google.golang.org/grpc v1.79.1/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY= +gopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaDva0= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/driver/mysql v1.6.0 h1:eNbLmNTpPpTOVZi8MMxCi2aaIm0ZpInbORNXDwyLGvg= +gorm.io/driver/mysql v1.6.0/go.mod h1:D/oCC2GWK3M/dqoLxnOlaNKmXz8WNTfcS9y5ovaSqKo= +gorm.io/driver/postgres v1.6.0 h1:2dxzU8xJ+ivvqTRph34QX+WrRaJlmfyPqXmoGVjMBa4= +gorm.io/driver/postgres v1.6.0/go.mod h1:vUw0mrGgrTK+uPHEhAdV4sfFELrByKVGnaVRkXDhtWo= +gorm.io/driver/sqlserver v1.6.3 h1:UR+nWCuphPnq7UxnL57PSrlYjuvs+sf1N59GgFX7uAI= +gorm.io/driver/sqlserver v1.6.3/go.mod h1:VZeNn7hqX1aXoN5TPAFGWvxWG90xtA8erGn2gQmpc6U= +gorm.io/gorm v1.30.0/go.mod h1:8Z33v652h4//uMA76KjeDH8mJXPm1QNCYrMeatR0DOE= +gorm.io/gorm v1.31.1 h1:7CA8FTFz/gRfgqgpeKIBcervUn3xSyPUmr6B2WXJ7kg= +gorm.io/gorm v1.31.1/go.mod h1:XyQVbO2k6YkOis7C2437jSit3SsDK72s7n7rsSHd+Gs= +gorm.io/plugin/dbresolver v1.6.2 h1:F4b85TenghUeITqe3+epPSUtHH7RIk3fXr5l83DF8Pc= +gorm.io/plugin/dbresolver v1.6.2/go.mod h1:tctw63jdrOezFR9HmrKnPkmig3m5Edem9fdxk9bQSzM= +k8s.io/api v0.29.3 h1:2ORfZ7+bGC3YJqGpV0KSDDEVf8hdGQ6A03/50vj8pmw= +k8s.io/api v0.29.3/go.mod h1:y2yg2NTyHUUkIoTC+phinTnEa3KFM6RZ3szxt014a80= +k8s.io/apimachinery v0.29.4 h1:RaFdJiDmuKs/8cm1M6Dh1Kvyh59YQFDcFuFTSmXes6Q= +k8s.io/apimachinery v0.29.4/go.mod h1:i3FJVwhvSp/6n8Fl4K97PJEP8C+MM+aoDq4+ZJBf70Y= +k8s.io/client-go v0.29.3 h1:R/zaZbEAxqComZ9FHeQwOh3Y1ZUs7FaHKZdQtIc2WZg= +k8s.io/client-go v0.29.3/go.mod h1:tkDisCvgPfiRpxGnOORfkljmS+UrW+WtXAy2fTvXJB0= +k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= +k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= +k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= +k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= +k8s.io/utils v0.0.0-20251222233032-718f0e51e6d2 h1:OfgiEo21hGiwx1oJUU5MpEaeOEg6coWndBkZF/lkFuE= +k8s.io/utils v0.0.0-20251222233032-718f0e51e6d2/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= +modernc.org/cc/v4 v4.27.1 h1:9W30zRlYrefrDV2JE2O8VDtJ1yPGownxciz5rrbQZis= +modernc.org/cc/v4 v4.27.1/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0= +modernc.org/ccgo/v4 v4.30.1 h1:4r4U1J6Fhj98NKfSjnPUN7Ze2c6MnAdL0hWw6+LrJpc= +modernc.org/ccgo/v4 v4.30.1/go.mod h1:bIOeI1JL54Utlxn+LwrFyjCx2n2RDiYEaJVSrgdrRfM= +modernc.org/fileutil v1.3.40 h1:ZGMswMNc9JOCrcrakF1HrvmergNLAmxOPjizirpfqBA= +modernc.org/fileutil v1.3.40/go.mod h1:HxmghZSZVAz/LXcMNwZPA/DRrQZEVP9VX0V4LQGQFOc= +modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI= +modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito= +modernc.org/gc/v3 v3.1.1 h1:k8T3gkXWY9sEiytKhcgyiZ2L0DTyCQ/nvX+LoCljoRE= +modernc.org/gc/v3 v3.1.1/go.mod h1:HFK/6AGESC7Ex+EZJhJ2Gni6cTaYpSMmU/cT9RmlfYY= +modernc.org/goabi0 v0.2.0 h1:HvEowk7LxcPd0eq6mVOAEMai46V+i7Jrj13t4AzuNks= +modernc.org/goabi0 v0.2.0/go.mod h1:CEFRnnJhKvWT1c1JTI3Avm+tgOWbkOu5oPA8eH8LnMI= +modernc.org/libc v1.67.4 h1:zZGmCMUVPORtKv95c2ReQN5VDjvkoRm9GWPTEPuvlWg= +modernc.org/libc v1.67.4/go.mod h1:QvvnnJ5P7aitu0ReNpVIEyesuhmDLQ8kaEoyMjIFZJA= +modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU= +modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg= +modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI= +modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw= +modernc.org/opt v0.1.4 h1:2kNGMRiUjrp4LcaPuLY2PzUfqM/w9N23quVwhKt5Qm8= +modernc.org/opt v0.1.4/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns= +modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w= +modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE= +modernc.org/sqlite v1.42.2 h1:7hkZUNJvJFN2PgfUdjni9Kbvd4ef4mNLOu0B9FGxM74= +modernc.org/sqlite v1.42.2/go.mod h1:+VkC6v3pLOAE0A0uVucQEcbVW0I5nHCeDaBf+DpsQT8= +modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0= +modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A= +modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= +modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= +sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/model/casbinrulemodel.go b/model/casbinrulemodel.go new file mode 100755 index 0000000..3e8ae4e --- /dev/null +++ b/model/casbinrulemodel.go @@ -0,0 +1,27 @@ +package model + +import ( + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlx" +) + +var _ CasbinRuleModel = (*customCasbinRuleModel)(nil) + +type ( + // CasbinRuleModel is an interface to be customized, add more methods here, + // and implement the added methods in customCasbinRuleModel. + CasbinRuleModel interface { + casbinRuleModel + } + + customCasbinRuleModel struct { + *defaultCasbinRuleModel + } +) + +// NewCasbinRuleModel returns a model for the database table. +func NewCasbinRuleModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) CasbinRuleModel { + return &customCasbinRuleModel{ + defaultCasbinRuleModel: newCasbinRuleModel(conn, c, opts...), + } +} diff --git a/model/casbinrulemodel_gen.go b/model/casbinrulemodel_gen.go new file mode 100755 index 0000000..1e21fe3 --- /dev/null +++ b/model/casbinrulemodel_gen.go @@ -0,0 +1,151 @@ +// Code generated by goctl. DO NOT EDIT. +// versions: +// goctl version: 1.9.2 + +package model + +import ( + "context" + "database/sql" + "fmt" + "strings" + + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlc" + "github.com/zeromicro/go-zero/core/stores/sqlx" + "github.com/zeromicro/go-zero/core/stringx" +) + +var ( + casbinRuleFieldNames = builder.RawFieldNames(&CasbinRule{}) + casbinRuleRows = strings.Join(casbinRuleFieldNames, ",") + casbinRuleRowsExpectAutoSet = strings.Join(stringx.Remove(casbinRuleFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") + casbinRuleRowsWithPlaceHolder = strings.Join(stringx.Remove(casbinRuleFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" + + cacheCasbinRuleIdPrefix = "cache:casbinRule:id:" + cacheCasbinRulePtypeV0V1V2V3V4V5Prefix = "cache:casbinRule:ptype:v0:v1:v2:v3:v4:v5:" +) + +type ( + casbinRuleModel interface { + Insert(ctx context.Context, data *CasbinRule) (sql.Result, error) + FindOne(ctx context.Context, id int64) (*CasbinRule, error) + FindOneByPtypeV0V1V2V3V4V5(ctx context.Context, ptype string, v0 string, v1 string, v2 string, v3 string, v4 string, v5 string) (*CasbinRule, error) + Update(ctx context.Context, data *CasbinRule) error + Delete(ctx context.Context, id int64) error + } + + defaultCasbinRuleModel struct { + sqlc.CachedConn + table string + } + + CasbinRule struct { + Id int64 `db:"id"` + Ptype string `db:"ptype"` + V0 string `db:"v0"` + V1 string `db:"v1"` + V2 string `db:"v2"` + V3 string `db:"v3"` + V4 string `db:"v4"` + V5 string `db:"v5"` + } +) + +func newCasbinRuleModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultCasbinRuleModel { + return &defaultCasbinRuleModel{ + CachedConn: sqlc.NewConn(conn, c, opts...), + table: "`casbin_rule`", + } +} + +func (m *defaultCasbinRuleModel) Delete(ctx context.Context, id int64) error { + data, err := m.FindOne(ctx, id) + if err != nil { + return err + } + + casbinRuleIdKey := fmt.Sprintf("%s%v", cacheCasbinRuleIdPrefix, id) + casbinRulePtypeV0V1V2V3V4V5Key := fmt.Sprintf("%s%v:%v:%v:%v:%v:%v:%v", cacheCasbinRulePtypeV0V1V2V3V4V5Prefix, data.Ptype, data.V0, data.V1, data.V2, data.V3, data.V4, data.V5) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("delete from %s where `id` = ?", m.table) + return conn.ExecCtx(ctx, query, id) + }, casbinRuleIdKey, casbinRulePtypeV0V1V2V3V4V5Key) + return err +} + +func (m *defaultCasbinRuleModel) FindOne(ctx context.Context, id int64) (*CasbinRule, error) { + casbinRuleIdKey := fmt.Sprintf("%s%v", cacheCasbinRuleIdPrefix, id) + var resp CasbinRule + err := m.QueryRowCtx(ctx, &resp, casbinRuleIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", casbinRuleRows, m.table) + return conn.QueryRowCtx(ctx, v, query, id) + }) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultCasbinRuleModel) FindOneByPtypeV0V1V2V3V4V5(ctx context.Context, ptype string, v0 string, v1 string, v2 string, v3 string, v4 string, v5 string) (*CasbinRule, error) { + casbinRulePtypeV0V1V2V3V4V5Key := fmt.Sprintf("%s%v:%v:%v:%v:%v:%v:%v", cacheCasbinRulePtypeV0V1V2V3V4V5Prefix, ptype, v0, v1, v2, v3, v4, v5) + var resp CasbinRule + err := m.QueryRowIndexCtx(ctx, &resp, casbinRulePtypeV0V1V2V3V4V5Key, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `ptype` = ? and `v0` = ? and `v1` = ? and `v2` = ? and `v3` = ? and `v4` = ? and `v5` = ? limit 1", casbinRuleRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, ptype, v0, v1, v2, v3, v4, v5); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultCasbinRuleModel) Insert(ctx context.Context, data *CasbinRule) (sql.Result, error) { + casbinRuleIdKey := fmt.Sprintf("%s%v", cacheCasbinRuleIdPrefix, data.Id) + casbinRulePtypeV0V1V2V3V4V5Key := fmt.Sprintf("%s%v:%v:%v:%v:%v:%v:%v", cacheCasbinRulePtypeV0V1V2V3V4V5Prefix, data.Ptype, data.V0, data.V1, data.V2, data.V3, data.V4, data.V5) + ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?)", m.table, casbinRuleRowsExpectAutoSet) + return conn.ExecCtx(ctx, query, data.Ptype, data.V0, data.V1, data.V2, data.V3, data.V4, data.V5) + }, casbinRuleIdKey, casbinRulePtypeV0V1V2V3V4V5Key) + return ret, err +} + +func (m *defaultCasbinRuleModel) Update(ctx context.Context, newData *CasbinRule) error { + data, err := m.FindOne(ctx, newData.Id) + if err != nil { + return err + } + + casbinRuleIdKey := fmt.Sprintf("%s%v", cacheCasbinRuleIdPrefix, data.Id) + casbinRulePtypeV0V1V2V3V4V5Key := fmt.Sprintf("%s%v:%v:%v:%v:%v:%v:%v", cacheCasbinRulePtypeV0V1V2V3V4V5Prefix, data.Ptype, data.V0, data.V1, data.V2, data.V3, data.V4, data.V5) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, casbinRuleRowsWithPlaceHolder) + return conn.ExecCtx(ctx, query, newData.Ptype, newData.V0, newData.V1, newData.V2, newData.V3, newData.V4, newData.V5, newData.Id) + }, casbinRuleIdKey, casbinRulePtypeV0V1V2V3V4V5Key) + return err +} + +func (m *defaultCasbinRuleModel) formatPrimary(primary any) string { + return fmt.Sprintf("%s%v", cacheCasbinRuleIdPrefix, primary) +} + +func (m *defaultCasbinRuleModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", casbinRuleRows, m.table) + return conn.QueryRowCtx(ctx, v, query, primary) +} + +func (m *defaultCasbinRuleModel) tableName() string { + return m.table +} diff --git a/model/invproductmodel.go b/model/invproductmodel.go new file mode 100755 index 0000000..0000cc1 --- /dev/null +++ b/model/invproductmodel.go @@ -0,0 +1,116 @@ +package model + +import ( + "context" + "fmt" + + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlx" +) + +var _ InvProductModel = (*customInvProductModel)(nil) + +type StockGroupResult struct { + Name string `db:"name"` + Count int64 `db:"count"` + Quantity float64 `db:"quantity"` +} + +type ( + InvProductModel interface { + invProductModel + FindList(ctx context.Context, page, pageSize int64, productName, spec, color, location string, status int64) ([]*InvProduct, int64, error) + FindStockSummary(ctx context.Context) (productCount, totalPieces, totalRolls int64, totalCostValue, totalSalesValue float64, err error) + FindGroupByColor(ctx context.Context) ([]StockGroupResult, error) + FindGroupByLocation(ctx context.Context) ([]StockGroupResult, error) + } + + customInvProductModel struct { + *defaultInvProductModel + } +) + +func NewInvProductModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) InvProductModel { + return &customInvProductModel{ + defaultInvProductModel: newInvProductModel(conn, c, opts...), + } +} + +func (m *customInvProductModel) FindList(ctx context.Context, page, pageSize int64, productName, spec, color, location string, status int64) ([]*InvProduct, int64, error) { + where := "WHERE deleted_at IS NULL" + args := make([]interface{}, 0) + + if productName != "" { + where += " AND product_name LIKE ?" + args = append(args, "%"+productName+"%") + } + if spec != "" { + where += " AND spec LIKE ?" + args = append(args, "%"+spec+"%") + } + if color != "" { + where += " AND color = ?" + args = append(args, color) + } + if location != "" { + where += " AND location = ?" + args = append(args, location) + } + if status >= 0 { + where += " AND status = ?" + args = append(args, status) + } + + var total int64 + countQuery := fmt.Sprintf("SELECT COUNT(*) FROM %s %s", m.table, where) + err := m.QueryRowNoCacheCtx(ctx, &total, countQuery, args...) + if err != nil { + return nil, 0, err + } + + var list []*InvProduct + query := fmt.Sprintf("SELECT %s FROM %s %s ORDER BY created_at DESC LIMIT ? OFFSET ?", invProductRows, m.table, where) + args = append(args, pageSize, (page-1)*pageSize) + err = m.QueryRowsNoCacheCtx(ctx, &list, query, args...) + if err != nil { + return nil, 0, err + } + + return list, total, nil +} + +func (m *customInvProductModel) FindStockSummary(ctx context.Context) (productCount, totalPieces, totalRolls int64, totalCostValue, totalSalesValue float64, err error) { + var summary struct { + ProductCount int64 `db:"product_count"` + TotalPieces int64 `db:"total_pieces"` + TotalRolls int64 `db:"total_rolls"` + TotalCostValue float64 `db:"total_cost_value"` + TotalSalesValue float64 `db:"total_sales_value"` + } + query := fmt.Sprintf("SELECT COUNT(*) AS product_count, COALESCE(SUM(unit_pieces), 0) AS total_pieces, COALESCE(SUM(unit_rolls), 0) AS total_rolls, COALESCE(SUM(stock_quantity * cost_price), 0) AS total_cost_value, COALESCE(SUM(stock_quantity * sales_price), 0) AS total_sales_value FROM %s WHERE deleted_at IS NULL", m.table) + err = m.QueryRowNoCacheCtx(ctx, &summary, query) + if err != nil { + return 0, 0, 0, 0, 0, err + } + return summary.ProductCount, summary.TotalPieces, summary.TotalRolls, summary.TotalCostValue, summary.TotalSalesValue, nil +} + +func (m *customInvProductModel) FindGroupByColor(ctx context.Context) ([]StockGroupResult, error) { + var list []StockGroupResult + query := fmt.Sprintf("SELECT color AS name, COUNT(*) AS count, COALESCE(SUM(stock_quantity), 0) AS quantity FROM %s WHERE deleted_at IS NULL GROUP BY color ORDER BY count DESC", m.table) + err := m.QueryRowsNoCacheCtx(ctx, &list, query) + if err != nil { + return nil, err + } + return list, nil +} + +func (m *customInvProductModel) FindGroupByLocation(ctx context.Context) ([]StockGroupResult, error) { + var list []StockGroupResult + query := fmt.Sprintf("SELECT location AS name, COUNT(*) AS count, COALESCE(SUM(stock_quantity), 0) AS quantity FROM %s WHERE deleted_at IS NULL GROUP BY location ORDER BY count DESC", m.table) + err := m.QueryRowsNoCacheCtx(ctx, &list, query) + if err != nil { + return nil, err + } + return list, nil +} diff --git a/model/invproductmodel_gen.go b/model/invproductmodel_gen.go new file mode 100755 index 0000000..f2e2a28 --- /dev/null +++ b/model/invproductmodel_gen.go @@ -0,0 +1,186 @@ +// Code generated by goctl. DO NOT EDIT. +// versions: +// goctl version: 1.9.2 + +package model + +import ( + "context" + "database/sql" + "fmt" + "strings" + "time" + + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlc" + "github.com/zeromicro/go-zero/core/stores/sqlx" + "github.com/zeromicro/go-zero/core/stringx" +) + +var ( + invProductFieldNames = builder.RawFieldNames(&InvProduct{}) + invProductRows = strings.Join(invProductFieldNames, ",") + invProductRowsExpectAutoSet = strings.Join(stringx.Remove(invProductFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") + invProductRowsWithPlaceHolder = strings.Join(stringx.Remove(invProductFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" + + cacheInvProductIdPrefix = "cache:invProduct:id:" + cacheInvProductProductIdPrefix = "cache:invProduct:productId:" + cacheInvProductProductNamePrefix = "cache:invProduct:productName:" +) + +type ( + invProductModel interface { + Insert(ctx context.Context, data *InvProduct) (sql.Result, error) + FindOne(ctx context.Context, id int64) (*InvProduct, error) + FindOneByProductId(ctx context.Context, productId string) (*InvProduct, error) + FindOneByProductName(ctx context.Context, productName string) (*InvProduct, error) + Update(ctx context.Context, data *InvProduct) error + Delete(ctx context.Context, id int64) error + } + + defaultInvProductModel struct { + sqlc.CachedConn + table string + } + + InvProduct struct { + Id int64 `db:"id"` + ProductId string `db:"product_id"` + ProductName string `db:"product_name"` + ImageUrl string `db:"image_url"` + Spec string `db:"spec"` + Color string `db:"color"` + UnitPieces int64 `db:"unit_pieces"` + UnitRolls int64 `db:"unit_rolls"` + StockQuantity float64 `db:"stock_quantity"` + Location string `db:"location"` + CostPrice float64 `db:"cost_price"` + SalesPrice float64 `db:"sales_price"` + Remark sql.NullString `db:"remark"` + Status int64 `db:"status"` // 1:enabled 0:disabled + CreatedAt time.Time `db:"created_at"` + UpdatedAt time.Time `db:"updated_at"` + DeletedAt sql.NullTime `db:"deleted_at"` + } +) + +func newInvProductModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultInvProductModel { + return &defaultInvProductModel{ + CachedConn: sqlc.NewConn(conn, c, opts...), + table: "`inv_product`", + } +} + +func (m *defaultInvProductModel) Delete(ctx context.Context, id int64) error { + data, err := m.FindOne(ctx, id) + if err != nil { + return err + } + + invProductIdKey := fmt.Sprintf("%s%v", cacheInvProductIdPrefix, id) + invProductProductIdKey := fmt.Sprintf("%s%v", cacheInvProductProductIdPrefix, data.ProductId) + invProductProductNameKey := fmt.Sprintf("%s%v", cacheInvProductProductNamePrefix, data.ProductName) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("delete from %s where `id` = ?", m.table) + return conn.ExecCtx(ctx, query, id) + }, invProductIdKey, invProductProductIdKey, invProductProductNameKey) + return err +} + +func (m *defaultInvProductModel) FindOne(ctx context.Context, id int64) (*InvProduct, error) { + invProductIdKey := fmt.Sprintf("%s%v", cacheInvProductIdPrefix, id) + var resp InvProduct + err := m.QueryRowCtx(ctx, &resp, invProductIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", invProductRows, m.table) + return conn.QueryRowCtx(ctx, v, query, id) + }) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultInvProductModel) FindOneByProductId(ctx context.Context, productId string) (*InvProduct, error) { + invProductProductIdKey := fmt.Sprintf("%s%v", cacheInvProductProductIdPrefix, productId) + var resp InvProduct + err := m.QueryRowIndexCtx(ctx, &resp, invProductProductIdKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `product_id` = ? limit 1", invProductRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, productId); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultInvProductModel) FindOneByProductName(ctx context.Context, productName string) (*InvProduct, error) { + invProductProductNameKey := fmt.Sprintf("%s%v", cacheInvProductProductNamePrefix, productName) + var resp InvProduct + err := m.QueryRowIndexCtx(ctx, &resp, invProductProductNameKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `product_name` = ? limit 1", invProductRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, productName); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultInvProductModel) Insert(ctx context.Context, data *InvProduct) (sql.Result, error) { + invProductIdKey := fmt.Sprintf("%s%v", cacheInvProductIdPrefix, data.Id) + invProductProductIdKey := fmt.Sprintf("%s%v", cacheInvProductProductIdPrefix, data.ProductId) + invProductProductNameKey := fmt.Sprintf("%s%v", cacheInvProductProductNamePrefix, data.ProductName) + ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, invProductRowsExpectAutoSet) + return conn.ExecCtx(ctx, query, data.ProductId, data.ProductName, data.ImageUrl, data.Spec, data.Color, data.UnitPieces, data.UnitRolls, data.StockQuantity, data.Location, data.CostPrice, data.SalesPrice, data.Remark, data.Status, data.DeletedAt) + }, invProductIdKey, invProductProductIdKey, invProductProductNameKey) + return ret, err +} + +func (m *defaultInvProductModel) Update(ctx context.Context, newData *InvProduct) error { + data, err := m.FindOne(ctx, newData.Id) + if err != nil { + return err + } + + invProductIdKey := fmt.Sprintf("%s%v", cacheInvProductIdPrefix, data.Id) + invProductProductIdKey := fmt.Sprintf("%s%v", cacheInvProductProductIdPrefix, data.ProductId) + invProductProductNameKey := fmt.Sprintf("%s%v", cacheInvProductProductNamePrefix, data.ProductName) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, invProductRowsWithPlaceHolder) + return conn.ExecCtx(ctx, query, newData.ProductId, newData.ProductName, newData.ImageUrl, newData.Spec, newData.Color, newData.UnitPieces, newData.UnitRolls, newData.StockQuantity, newData.Location, newData.CostPrice, newData.SalesPrice, newData.Remark, newData.Status, newData.DeletedAt, newData.Id) + }, invProductIdKey, invProductProductIdKey, invProductProductNameKey) + return err +} + +func (m *defaultInvProductModel) formatPrimary(primary any) string { + return fmt.Sprintf("%s%v", cacheInvProductIdPrefix, primary) +} + +func (m *defaultInvProductModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", invProductRows, m.table) + return conn.QueryRowCtx(ctx, v, query, primary) +} + +func (m *defaultInvProductModel) tableName() string { + return m.table +} diff --git a/model/invstockadjustdetailmodel.go b/model/invstockadjustdetailmodel.go new file mode 100755 index 0000000..c01b052 --- /dev/null +++ b/model/invstockadjustdetailmodel.go @@ -0,0 +1,55 @@ +package model + +import ( + "context" + "fmt" + "strings" + + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlx" +) + +var _ InvStockAdjustDetailModel = (*customInvStockAdjustDetailModel)(nil) + +type ( + InvStockAdjustDetailModel interface { + invStockAdjustDetailModel + FindByAdjustId(ctx context.Context, adjustId string) ([]*InvStockAdjustDetail, error) + BatchInsert(ctx context.Context, details []*InvStockAdjustDetail) error + } + + customInvStockAdjustDetailModel struct { + *defaultInvStockAdjustDetailModel + } +) + +func NewInvStockAdjustDetailModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) InvStockAdjustDetailModel { + return &customInvStockAdjustDetailModel{ + defaultInvStockAdjustDetailModel: newInvStockAdjustDetailModel(conn, c, opts...), + } +} + +func (m *customInvStockAdjustDetailModel) FindByAdjustId(ctx context.Context, adjustId string) ([]*InvStockAdjustDetail, error) { + var list []*InvStockAdjustDetail + query := fmt.Sprintf("SELECT %s FROM %s WHERE adjust_id = ?", invStockAdjustDetailRows, m.table) + err := m.QueryRowsNoCacheCtx(ctx, &list, query, adjustId) + if err != nil { + return nil, err + } + return list, nil +} + +func (m *customInvStockAdjustDetailModel) BatchInsert(ctx context.Context, details []*InvStockAdjustDetail) error { + if len(details) == 0 { + return nil + } + values := make([]string, 0, len(details)) + args := make([]interface{}, 0, len(details)*7) + for _, d := range details { + values = append(values, "(?, ?, ?, ?, ?, ?, ?)") + args = append(args, d.DetailId, d.AdjustId, d.ProductId, d.BeforeQuantity, d.AdjustQuantity, d.AfterQuantity, d.Remark) + } + query := fmt.Sprintf("INSERT INTO %s (%s) VALUES %s", m.table, invStockAdjustDetailRowsExpectAutoSet, strings.Join(values, ",")) + _, err := m.ExecNoCacheCtx(ctx, query, args...) + return err +} diff --git a/model/invstockadjustdetailmodel_gen.go b/model/invstockadjustdetailmodel_gen.go new file mode 100755 index 0000000..df9d7b6 --- /dev/null +++ b/model/invstockadjustdetailmodel_gen.go @@ -0,0 +1,151 @@ +// Code generated by goctl. DO NOT EDIT. +// versions: +// goctl version: 1.9.2 + +package model + +import ( + "context" + "database/sql" + "fmt" + "strings" + + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlc" + "github.com/zeromicro/go-zero/core/stores/sqlx" + "github.com/zeromicro/go-zero/core/stringx" +) + +var ( + invStockAdjustDetailFieldNames = builder.RawFieldNames(&InvStockAdjustDetail{}) + invStockAdjustDetailRows = strings.Join(invStockAdjustDetailFieldNames, ",") + invStockAdjustDetailRowsExpectAutoSet = strings.Join(stringx.Remove(invStockAdjustDetailFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") + invStockAdjustDetailRowsWithPlaceHolder = strings.Join(stringx.Remove(invStockAdjustDetailFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" + + cacheInvStockAdjustDetailIdPrefix = "cache:invStockAdjustDetail:id:" + cacheInvStockAdjustDetailDetailIdPrefix = "cache:invStockAdjustDetail:detailId:" +) + +type ( + invStockAdjustDetailModel interface { + Insert(ctx context.Context, data *InvStockAdjustDetail) (sql.Result, error) + FindOne(ctx context.Context, id int64) (*InvStockAdjustDetail, error) + FindOneByDetailId(ctx context.Context, detailId string) (*InvStockAdjustDetail, error) + Update(ctx context.Context, data *InvStockAdjustDetail) error + Delete(ctx context.Context, id int64) error + } + + defaultInvStockAdjustDetailModel struct { + sqlc.CachedConn + table string + } + + InvStockAdjustDetail struct { + Id int64 `db:"id"` + DetailId string `db:"detail_id"` + AdjustId string `db:"adjust_id"` + ProductId string `db:"product_id"` + BeforeQuantity float64 `db:"before_quantity"` + AdjustQuantity float64 `db:"adjust_quantity"` + AfterQuantity float64 `db:"after_quantity"` + Remark sql.NullString `db:"remark"` + } +) + +func newInvStockAdjustDetailModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultInvStockAdjustDetailModel { + return &defaultInvStockAdjustDetailModel{ + CachedConn: sqlc.NewConn(conn, c, opts...), + table: "`inv_stock_adjust_detail`", + } +} + +func (m *defaultInvStockAdjustDetailModel) Delete(ctx context.Context, id int64) error { + data, err := m.FindOne(ctx, id) + if err != nil { + return err + } + + invStockAdjustDetailDetailIdKey := fmt.Sprintf("%s%v", cacheInvStockAdjustDetailDetailIdPrefix, data.DetailId) + invStockAdjustDetailIdKey := fmt.Sprintf("%s%v", cacheInvStockAdjustDetailIdPrefix, id) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("delete from %s where `id` = ?", m.table) + return conn.ExecCtx(ctx, query, id) + }, invStockAdjustDetailDetailIdKey, invStockAdjustDetailIdKey) + return err +} + +func (m *defaultInvStockAdjustDetailModel) FindOne(ctx context.Context, id int64) (*InvStockAdjustDetail, error) { + invStockAdjustDetailIdKey := fmt.Sprintf("%s%v", cacheInvStockAdjustDetailIdPrefix, id) + var resp InvStockAdjustDetail + err := m.QueryRowCtx(ctx, &resp, invStockAdjustDetailIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", invStockAdjustDetailRows, m.table) + return conn.QueryRowCtx(ctx, v, query, id) + }) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultInvStockAdjustDetailModel) FindOneByDetailId(ctx context.Context, detailId string) (*InvStockAdjustDetail, error) { + invStockAdjustDetailDetailIdKey := fmt.Sprintf("%s%v", cacheInvStockAdjustDetailDetailIdPrefix, detailId) + var resp InvStockAdjustDetail + err := m.QueryRowIndexCtx(ctx, &resp, invStockAdjustDetailDetailIdKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `detail_id` = ? limit 1", invStockAdjustDetailRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, detailId); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultInvStockAdjustDetailModel) Insert(ctx context.Context, data *InvStockAdjustDetail) (sql.Result, error) { + invStockAdjustDetailDetailIdKey := fmt.Sprintf("%s%v", cacheInvStockAdjustDetailDetailIdPrefix, data.DetailId) + invStockAdjustDetailIdKey := fmt.Sprintf("%s%v", cacheInvStockAdjustDetailIdPrefix, data.Id) + ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?)", m.table, invStockAdjustDetailRowsExpectAutoSet) + return conn.ExecCtx(ctx, query, data.DetailId, data.AdjustId, data.ProductId, data.BeforeQuantity, data.AdjustQuantity, data.AfterQuantity, data.Remark) + }, invStockAdjustDetailDetailIdKey, invStockAdjustDetailIdKey) + return ret, err +} + +func (m *defaultInvStockAdjustDetailModel) Update(ctx context.Context, newData *InvStockAdjustDetail) error { + data, err := m.FindOne(ctx, newData.Id) + if err != nil { + return err + } + + invStockAdjustDetailDetailIdKey := fmt.Sprintf("%s%v", cacheInvStockAdjustDetailDetailIdPrefix, data.DetailId) + invStockAdjustDetailIdKey := fmt.Sprintf("%s%v", cacheInvStockAdjustDetailIdPrefix, data.Id) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, invStockAdjustDetailRowsWithPlaceHolder) + return conn.ExecCtx(ctx, query, newData.DetailId, newData.AdjustId, newData.ProductId, newData.BeforeQuantity, newData.AdjustQuantity, newData.AfterQuantity, newData.Remark, newData.Id) + }, invStockAdjustDetailDetailIdKey, invStockAdjustDetailIdKey) + return err +} + +func (m *defaultInvStockAdjustDetailModel) formatPrimary(primary any) string { + return fmt.Sprintf("%s%v", cacheInvStockAdjustDetailIdPrefix, primary) +} + +func (m *defaultInvStockAdjustDetailModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", invStockAdjustDetailRows, m.table) + return conn.QueryRowCtx(ctx, v, query, primary) +} + +func (m *defaultInvStockAdjustDetailModel) tableName() string { + return m.table +} diff --git a/model/invstockadjustmodel.go b/model/invstockadjustmodel.go new file mode 100755 index 0000000..901993f --- /dev/null +++ b/model/invstockadjustmodel.go @@ -0,0 +1,71 @@ +package model + +import ( + "context" + "fmt" + + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlx" +) + +var _ InvStockAdjustModel = (*customInvStockAdjustModel)(nil) + +type ( + InvStockAdjustModel interface { + invStockAdjustModel + FindList(ctx context.Context, page, pageSize int64, adjustNo, adjustReason string, status int64, startDate, endDate string) ([]*InvStockAdjust, int64, error) + } + + customInvStockAdjustModel struct { + *defaultInvStockAdjustModel + } +) + +func NewInvStockAdjustModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) InvStockAdjustModel { + return &customInvStockAdjustModel{ + defaultInvStockAdjustModel: newInvStockAdjustModel(conn, c, opts...), + } +} + +func (m *customInvStockAdjustModel) FindList(ctx context.Context, page, pageSize int64, adjustNo, adjustReason string, status int64, startDate, endDate string) ([]*InvStockAdjust, int64, error) { + where := "WHERE 1=1" + args := make([]interface{}, 0) + + if adjustNo != "" { + where += " AND adjust_no LIKE ?" + args = append(args, "%"+adjustNo+"%") + } + if adjustReason != "" { + where += " AND adjust_reason LIKE ?" + args = append(args, "%"+adjustReason+"%") + } + if status != -1 { + where += " AND status = ?" + args = append(args, status) + } + if startDate != "" { + where += " AND adjust_date >= ?" + args = append(args, startDate) + } + if endDate != "" { + where += " AND adjust_date <= ?" + args = append(args, endDate) + } + + var total int64 + countQuery := fmt.Sprintf("SELECT COUNT(*) FROM %s %s", m.table, where) + err := m.QueryRowNoCacheCtx(ctx, &total, countQuery, args...) + if err != nil { + return nil, 0, err + } + + var list []*InvStockAdjust + query := fmt.Sprintf("SELECT %s FROM %s %s ORDER BY created_at DESC LIMIT ? OFFSET ?", invStockAdjustRows, m.table, where) + args = append(args, pageSize, (page-1)*pageSize) + err = m.QueryRowsNoCacheCtx(ctx, &list, query, args...) + if err != nil { + return nil, 0, err + } + + return list, total, nil +} diff --git a/model/invstockadjustmodel_gen.go b/model/invstockadjustmodel_gen.go new file mode 100755 index 0000000..849fa53 --- /dev/null +++ b/model/invstockadjustmodel_gen.go @@ -0,0 +1,180 @@ +// Code generated by goctl. DO NOT EDIT. +// versions: +// goctl version: 1.9.2 + +package model + +import ( + "context" + "database/sql" + "fmt" + "strings" + "time" + + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlc" + "github.com/zeromicro/go-zero/core/stores/sqlx" + "github.com/zeromicro/go-zero/core/stringx" +) + +var ( + invStockAdjustFieldNames = builder.RawFieldNames(&InvStockAdjust{}) + invStockAdjustRows = strings.Join(invStockAdjustFieldNames, ",") + invStockAdjustRowsExpectAutoSet = strings.Join(stringx.Remove(invStockAdjustFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") + invStockAdjustRowsWithPlaceHolder = strings.Join(stringx.Remove(invStockAdjustFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" + + cacheInvStockAdjustIdPrefix = "cache:invStockAdjust:id:" + cacheInvStockAdjustAdjustIdPrefix = "cache:invStockAdjust:adjustId:" + cacheInvStockAdjustAdjustNoPrefix = "cache:invStockAdjust:adjustNo:" +) + +type ( + invStockAdjustModel interface { + Insert(ctx context.Context, data *InvStockAdjust) (sql.Result, error) + FindOne(ctx context.Context, id int64) (*InvStockAdjust, error) + FindOneByAdjustId(ctx context.Context, adjustId string) (*InvStockAdjust, error) + FindOneByAdjustNo(ctx context.Context, adjustNo string) (*InvStockAdjust, error) + Update(ctx context.Context, data *InvStockAdjust) error + Delete(ctx context.Context, id int64) error + } + + defaultInvStockAdjustModel struct { + sqlc.CachedConn + table string + } + + InvStockAdjust struct { + Id int64 `db:"id"` + AdjustId string `db:"adjust_id"` + AdjustNo string `db:"adjust_no"` + AdjustDate time.Time `db:"adjust_date"` + AdjustReason string `db:"adjust_reason"` + Operator string `db:"operator"` + Approver string `db:"approver"` + Status int64 `db:"status"` // 0:pending 1:approved 2:rejected + Remark sql.NullString `db:"remark"` + CreatedAt time.Time `db:"created_at"` + UpdatedAt time.Time `db:"updated_at"` + } +) + +func newInvStockAdjustModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultInvStockAdjustModel { + return &defaultInvStockAdjustModel{ + CachedConn: sqlc.NewConn(conn, c, opts...), + table: "`inv_stock_adjust`", + } +} + +func (m *defaultInvStockAdjustModel) Delete(ctx context.Context, id int64) error { + data, err := m.FindOne(ctx, id) + if err != nil { + return err + } + + invStockAdjustAdjustIdKey := fmt.Sprintf("%s%v", cacheInvStockAdjustAdjustIdPrefix, data.AdjustId) + invStockAdjustAdjustNoKey := fmt.Sprintf("%s%v", cacheInvStockAdjustAdjustNoPrefix, data.AdjustNo) + invStockAdjustIdKey := fmt.Sprintf("%s%v", cacheInvStockAdjustIdPrefix, id) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("delete from %s where `id` = ?", m.table) + return conn.ExecCtx(ctx, query, id) + }, invStockAdjustAdjustIdKey, invStockAdjustAdjustNoKey, invStockAdjustIdKey) + return err +} + +func (m *defaultInvStockAdjustModel) FindOne(ctx context.Context, id int64) (*InvStockAdjust, error) { + invStockAdjustIdKey := fmt.Sprintf("%s%v", cacheInvStockAdjustIdPrefix, id) + var resp InvStockAdjust + err := m.QueryRowCtx(ctx, &resp, invStockAdjustIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", invStockAdjustRows, m.table) + return conn.QueryRowCtx(ctx, v, query, id) + }) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultInvStockAdjustModel) FindOneByAdjustId(ctx context.Context, adjustId string) (*InvStockAdjust, error) { + invStockAdjustAdjustIdKey := fmt.Sprintf("%s%v", cacheInvStockAdjustAdjustIdPrefix, adjustId) + var resp InvStockAdjust + err := m.QueryRowIndexCtx(ctx, &resp, invStockAdjustAdjustIdKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `adjust_id` = ? limit 1", invStockAdjustRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, adjustId); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultInvStockAdjustModel) FindOneByAdjustNo(ctx context.Context, adjustNo string) (*InvStockAdjust, error) { + invStockAdjustAdjustNoKey := fmt.Sprintf("%s%v", cacheInvStockAdjustAdjustNoPrefix, adjustNo) + var resp InvStockAdjust + err := m.QueryRowIndexCtx(ctx, &resp, invStockAdjustAdjustNoKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `adjust_no` = ? limit 1", invStockAdjustRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, adjustNo); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultInvStockAdjustModel) Insert(ctx context.Context, data *InvStockAdjust) (sql.Result, error) { + invStockAdjustAdjustIdKey := fmt.Sprintf("%s%v", cacheInvStockAdjustAdjustIdPrefix, data.AdjustId) + invStockAdjustAdjustNoKey := fmt.Sprintf("%s%v", cacheInvStockAdjustAdjustNoPrefix, data.AdjustNo) + invStockAdjustIdKey := fmt.Sprintf("%s%v", cacheInvStockAdjustIdPrefix, data.Id) + ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?)", m.table, invStockAdjustRowsExpectAutoSet) + return conn.ExecCtx(ctx, query, data.AdjustId, data.AdjustNo, data.AdjustDate, data.AdjustReason, data.Operator, data.Approver, data.Status, data.Remark) + }, invStockAdjustAdjustIdKey, invStockAdjustAdjustNoKey, invStockAdjustIdKey) + return ret, err +} + +func (m *defaultInvStockAdjustModel) Update(ctx context.Context, newData *InvStockAdjust) error { + data, err := m.FindOne(ctx, newData.Id) + if err != nil { + return err + } + + invStockAdjustAdjustIdKey := fmt.Sprintf("%s%v", cacheInvStockAdjustAdjustIdPrefix, data.AdjustId) + invStockAdjustAdjustNoKey := fmt.Sprintf("%s%v", cacheInvStockAdjustAdjustNoPrefix, data.AdjustNo) + invStockAdjustIdKey := fmt.Sprintf("%s%v", cacheInvStockAdjustIdPrefix, data.Id) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, invStockAdjustRowsWithPlaceHolder) + return conn.ExecCtx(ctx, query, newData.AdjustId, newData.AdjustNo, newData.AdjustDate, newData.AdjustReason, newData.Operator, newData.Approver, newData.Status, newData.Remark, newData.Id) + }, invStockAdjustAdjustIdKey, invStockAdjustAdjustNoKey, invStockAdjustIdKey) + return err +} + +func (m *defaultInvStockAdjustModel) formatPrimary(primary any) string { + return fmt.Sprintf("%s%v", cacheInvStockAdjustIdPrefix, primary) +} + +func (m *defaultInvStockAdjustModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", invStockAdjustRows, m.table) + return conn.QueryRowCtx(ctx, v, query, primary) +} + +func (m *defaultInvStockAdjustModel) tableName() string { + return m.table +} diff --git a/model/invstockcheckdetailmodel.go b/model/invstockcheckdetailmodel.go new file mode 100755 index 0000000..b4102ea --- /dev/null +++ b/model/invstockcheckdetailmodel.go @@ -0,0 +1,62 @@ +package model + +import ( + "context" + "fmt" + "strings" + + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlx" +) + +var _ InvStockCheckDetailModel = (*customInvStockCheckDetailModel)(nil) + +type ( + InvStockCheckDetailModel interface { + invStockCheckDetailModel + FindByCheckId(ctx context.Context, checkId string) ([]*InvStockCheckDetail, error) + DeleteByCheckId(ctx context.Context, checkId string) error + BatchInsert(ctx context.Context, details []*InvStockCheckDetail) error + } + + customInvStockCheckDetailModel struct { + *defaultInvStockCheckDetailModel + } +) + +func NewInvStockCheckDetailModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) InvStockCheckDetailModel { + return &customInvStockCheckDetailModel{ + defaultInvStockCheckDetailModel: newInvStockCheckDetailModel(conn, c, opts...), + } +} + +func (m *customInvStockCheckDetailModel) FindByCheckId(ctx context.Context, checkId string) ([]*InvStockCheckDetail, error) { + var list []*InvStockCheckDetail + query := fmt.Sprintf("SELECT %s FROM %s WHERE check_id = ?", invStockCheckDetailRows, m.table) + err := m.QueryRowsNoCacheCtx(ctx, &list, query, checkId) + if err != nil { + return nil, err + } + return list, nil +} + +func (m *customInvStockCheckDetailModel) DeleteByCheckId(ctx context.Context, checkId string) error { + query := fmt.Sprintf("DELETE FROM %s WHERE check_id = ?", m.table) + _, err := m.ExecNoCacheCtx(ctx, query, checkId) + return err +} + +func (m *customInvStockCheckDetailModel) BatchInsert(ctx context.Context, details []*InvStockCheckDetail) error { + if len(details) == 0 { + return nil + } + values := make([]string, 0, len(details)) + args := make([]interface{}, 0, len(details)*8) + for _, d := range details { + values = append(values, "(?, ?, ?, ?, ?, ?, ?, ?)") + args = append(args, d.DetailId, d.CheckId, d.ProductId, d.SystemQuantity, d.ActualQuantity, d.DiffQuantity, d.DiffAmount, d.Remark) + } + query := fmt.Sprintf("INSERT INTO %s (%s) VALUES %s", m.table, invStockCheckDetailRowsExpectAutoSet, strings.Join(values, ",")) + _, err := m.ExecNoCacheCtx(ctx, query, args...) + return err +} diff --git a/model/invstockcheckdetailmodel_gen.go b/model/invstockcheckdetailmodel_gen.go new file mode 100755 index 0000000..7031864 --- /dev/null +++ b/model/invstockcheckdetailmodel_gen.go @@ -0,0 +1,152 @@ +// Code generated by goctl. DO NOT EDIT. +// versions: +// goctl version: 1.9.2 + +package model + +import ( + "context" + "database/sql" + "fmt" + "strings" + + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlc" + "github.com/zeromicro/go-zero/core/stores/sqlx" + "github.com/zeromicro/go-zero/core/stringx" +) + +var ( + invStockCheckDetailFieldNames = builder.RawFieldNames(&InvStockCheckDetail{}) + invStockCheckDetailRows = strings.Join(invStockCheckDetailFieldNames, ",") + invStockCheckDetailRowsExpectAutoSet = strings.Join(stringx.Remove(invStockCheckDetailFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") + invStockCheckDetailRowsWithPlaceHolder = strings.Join(stringx.Remove(invStockCheckDetailFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" + + cacheInvStockCheckDetailIdPrefix = "cache:invStockCheckDetail:id:" + cacheInvStockCheckDetailDetailIdPrefix = "cache:invStockCheckDetail:detailId:" +) + +type ( + invStockCheckDetailModel interface { + Insert(ctx context.Context, data *InvStockCheckDetail) (sql.Result, error) + FindOne(ctx context.Context, id int64) (*InvStockCheckDetail, error) + FindOneByDetailId(ctx context.Context, detailId string) (*InvStockCheckDetail, error) + Update(ctx context.Context, data *InvStockCheckDetail) error + Delete(ctx context.Context, id int64) error + } + + defaultInvStockCheckDetailModel struct { + sqlc.CachedConn + table string + } + + InvStockCheckDetail struct { + Id int64 `db:"id"` + DetailId string `db:"detail_id"` + CheckId string `db:"check_id"` + ProductId string `db:"product_id"` + SystemQuantity float64 `db:"system_quantity"` + ActualQuantity float64 `db:"actual_quantity"` + DiffQuantity float64 `db:"diff_quantity"` + DiffAmount float64 `db:"diff_amount"` + Remark sql.NullString `db:"remark"` + } +) + +func newInvStockCheckDetailModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultInvStockCheckDetailModel { + return &defaultInvStockCheckDetailModel{ + CachedConn: sqlc.NewConn(conn, c, opts...), + table: "`inv_stock_check_detail`", + } +} + +func (m *defaultInvStockCheckDetailModel) Delete(ctx context.Context, id int64) error { + data, err := m.FindOne(ctx, id) + if err != nil { + return err + } + + invStockCheckDetailDetailIdKey := fmt.Sprintf("%s%v", cacheInvStockCheckDetailDetailIdPrefix, data.DetailId) + invStockCheckDetailIdKey := fmt.Sprintf("%s%v", cacheInvStockCheckDetailIdPrefix, id) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("delete from %s where `id` = ?", m.table) + return conn.ExecCtx(ctx, query, id) + }, invStockCheckDetailDetailIdKey, invStockCheckDetailIdKey) + return err +} + +func (m *defaultInvStockCheckDetailModel) FindOne(ctx context.Context, id int64) (*InvStockCheckDetail, error) { + invStockCheckDetailIdKey := fmt.Sprintf("%s%v", cacheInvStockCheckDetailIdPrefix, id) + var resp InvStockCheckDetail + err := m.QueryRowCtx(ctx, &resp, invStockCheckDetailIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", invStockCheckDetailRows, m.table) + return conn.QueryRowCtx(ctx, v, query, id) + }) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultInvStockCheckDetailModel) FindOneByDetailId(ctx context.Context, detailId string) (*InvStockCheckDetail, error) { + invStockCheckDetailDetailIdKey := fmt.Sprintf("%s%v", cacheInvStockCheckDetailDetailIdPrefix, detailId) + var resp InvStockCheckDetail + err := m.QueryRowIndexCtx(ctx, &resp, invStockCheckDetailDetailIdKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `detail_id` = ? limit 1", invStockCheckDetailRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, detailId); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultInvStockCheckDetailModel) Insert(ctx context.Context, data *InvStockCheckDetail) (sql.Result, error) { + invStockCheckDetailDetailIdKey := fmt.Sprintf("%s%v", cacheInvStockCheckDetailDetailIdPrefix, data.DetailId) + invStockCheckDetailIdKey := fmt.Sprintf("%s%v", cacheInvStockCheckDetailIdPrefix, data.Id) + ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?)", m.table, invStockCheckDetailRowsExpectAutoSet) + return conn.ExecCtx(ctx, query, data.DetailId, data.CheckId, data.ProductId, data.SystemQuantity, data.ActualQuantity, data.DiffQuantity, data.DiffAmount, data.Remark) + }, invStockCheckDetailDetailIdKey, invStockCheckDetailIdKey) + return ret, err +} + +func (m *defaultInvStockCheckDetailModel) Update(ctx context.Context, newData *InvStockCheckDetail) error { + data, err := m.FindOne(ctx, newData.Id) + if err != nil { + return err + } + + invStockCheckDetailDetailIdKey := fmt.Sprintf("%s%v", cacheInvStockCheckDetailDetailIdPrefix, data.DetailId) + invStockCheckDetailIdKey := fmt.Sprintf("%s%v", cacheInvStockCheckDetailIdPrefix, data.Id) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, invStockCheckDetailRowsWithPlaceHolder) + return conn.ExecCtx(ctx, query, newData.DetailId, newData.CheckId, newData.ProductId, newData.SystemQuantity, newData.ActualQuantity, newData.DiffQuantity, newData.DiffAmount, newData.Remark, newData.Id) + }, invStockCheckDetailDetailIdKey, invStockCheckDetailIdKey) + return err +} + +func (m *defaultInvStockCheckDetailModel) formatPrimary(primary any) string { + return fmt.Sprintf("%s%v", cacheInvStockCheckDetailIdPrefix, primary) +} + +func (m *defaultInvStockCheckDetailModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", invStockCheckDetailRows, m.table) + return conn.QueryRowCtx(ctx, v, query, primary) +} + +func (m *defaultInvStockCheckDetailModel) tableName() string { + return m.table +} diff --git a/model/invstockcheckmodel.go b/model/invstockcheckmodel.go new file mode 100755 index 0000000..c36f1e2 --- /dev/null +++ b/model/invstockcheckmodel.go @@ -0,0 +1,67 @@ +package model + +import ( + "context" + "fmt" + + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlx" +) + +var _ InvStockCheckModel = (*customInvStockCheckModel)(nil) + +type ( + InvStockCheckModel interface { + invStockCheckModel + FindList(ctx context.Context, page, pageSize int64, checkNo string, status int64, startDate, endDate string) ([]*InvStockCheck, int64, error) + } + + customInvStockCheckModel struct { + *defaultInvStockCheckModel + } +) + +func NewInvStockCheckModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) InvStockCheckModel { + return &customInvStockCheckModel{ + defaultInvStockCheckModel: newInvStockCheckModel(conn, c, opts...), + } +} + +func (m *customInvStockCheckModel) FindList(ctx context.Context, page, pageSize int64, checkNo string, status int64, startDate, endDate string) ([]*InvStockCheck, int64, error) { + where := "WHERE 1=1" + args := make([]interface{}, 0) + + if checkNo != "" { + where += " AND check_no LIKE ?" + args = append(args, "%"+checkNo+"%") + } + if status != -1 { + where += " AND status = ?" + args = append(args, status) + } + if startDate != "" { + where += " AND check_date >= ?" + args = append(args, startDate) + } + if endDate != "" { + where += " AND check_date <= ?" + args = append(args, endDate) + } + + var total int64 + countQuery := fmt.Sprintf("SELECT COUNT(*) FROM %s %s", m.table, where) + err := m.QueryRowNoCacheCtx(ctx, &total, countQuery, args...) + if err != nil { + return nil, 0, err + } + + var list []*InvStockCheck + query := fmt.Sprintf("SELECT %s FROM %s %s ORDER BY created_at DESC LIMIT ? OFFSET ?", invStockCheckRows, m.table, where) + args = append(args, pageSize, (page-1)*pageSize) + err = m.QueryRowsNoCacheCtx(ctx, &list, query, args...) + if err != nil { + return nil, 0, err + } + + return list, total, nil +} diff --git a/model/invstockcheckmodel_gen.go b/model/invstockcheckmodel_gen.go new file mode 100755 index 0000000..a855b0c --- /dev/null +++ b/model/invstockcheckmodel_gen.go @@ -0,0 +1,178 @@ +// Code generated by goctl. DO NOT EDIT. +// versions: +// goctl version: 1.9.2 + +package model + +import ( + "context" + "database/sql" + "fmt" + "strings" + "time" + + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlc" + "github.com/zeromicro/go-zero/core/stores/sqlx" + "github.com/zeromicro/go-zero/core/stringx" +) + +var ( + invStockCheckFieldNames = builder.RawFieldNames(&InvStockCheck{}) + invStockCheckRows = strings.Join(invStockCheckFieldNames, ",") + invStockCheckRowsExpectAutoSet = strings.Join(stringx.Remove(invStockCheckFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") + invStockCheckRowsWithPlaceHolder = strings.Join(stringx.Remove(invStockCheckFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" + + cacheInvStockCheckIdPrefix = "cache:invStockCheck:id:" + cacheInvStockCheckCheckIdPrefix = "cache:invStockCheck:checkId:" + cacheInvStockCheckCheckNoPrefix = "cache:invStockCheck:checkNo:" +) + +type ( + invStockCheckModel interface { + Insert(ctx context.Context, data *InvStockCheck) (sql.Result, error) + FindOne(ctx context.Context, id int64) (*InvStockCheck, error) + FindOneByCheckId(ctx context.Context, checkId string) (*InvStockCheck, error) + FindOneByCheckNo(ctx context.Context, checkNo string) (*InvStockCheck, error) + Update(ctx context.Context, data *InvStockCheck) error + Delete(ctx context.Context, id int64) error + } + + defaultInvStockCheckModel struct { + sqlc.CachedConn + table string + } + + InvStockCheck struct { + Id int64 `db:"id"` + CheckId string `db:"check_id"` + CheckNo string `db:"check_no"` + CheckDate time.Time `db:"check_date"` + Checker string `db:"checker"` + Status int64 `db:"status"` // 0:draft 1:in_progress 2:completed + Remark sql.NullString `db:"remark"` + CreatedAt time.Time `db:"created_at"` + UpdatedAt time.Time `db:"updated_at"` + } +) + +func newInvStockCheckModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultInvStockCheckModel { + return &defaultInvStockCheckModel{ + CachedConn: sqlc.NewConn(conn, c, opts...), + table: "`inv_stock_check`", + } +} + +func (m *defaultInvStockCheckModel) Delete(ctx context.Context, id int64) error { + data, err := m.FindOne(ctx, id) + if err != nil { + return err + } + + invStockCheckCheckIdKey := fmt.Sprintf("%s%v", cacheInvStockCheckCheckIdPrefix, data.CheckId) + invStockCheckCheckNoKey := fmt.Sprintf("%s%v", cacheInvStockCheckCheckNoPrefix, data.CheckNo) + invStockCheckIdKey := fmt.Sprintf("%s%v", cacheInvStockCheckIdPrefix, id) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("delete from %s where `id` = ?", m.table) + return conn.ExecCtx(ctx, query, id) + }, invStockCheckCheckIdKey, invStockCheckCheckNoKey, invStockCheckIdKey) + return err +} + +func (m *defaultInvStockCheckModel) FindOne(ctx context.Context, id int64) (*InvStockCheck, error) { + invStockCheckIdKey := fmt.Sprintf("%s%v", cacheInvStockCheckIdPrefix, id) + var resp InvStockCheck + err := m.QueryRowCtx(ctx, &resp, invStockCheckIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", invStockCheckRows, m.table) + return conn.QueryRowCtx(ctx, v, query, id) + }) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultInvStockCheckModel) FindOneByCheckId(ctx context.Context, checkId string) (*InvStockCheck, error) { + invStockCheckCheckIdKey := fmt.Sprintf("%s%v", cacheInvStockCheckCheckIdPrefix, checkId) + var resp InvStockCheck + err := m.QueryRowIndexCtx(ctx, &resp, invStockCheckCheckIdKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `check_id` = ? limit 1", invStockCheckRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, checkId); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultInvStockCheckModel) FindOneByCheckNo(ctx context.Context, checkNo string) (*InvStockCheck, error) { + invStockCheckCheckNoKey := fmt.Sprintf("%s%v", cacheInvStockCheckCheckNoPrefix, checkNo) + var resp InvStockCheck + err := m.QueryRowIndexCtx(ctx, &resp, invStockCheckCheckNoKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `check_no` = ? limit 1", invStockCheckRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, checkNo); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultInvStockCheckModel) Insert(ctx context.Context, data *InvStockCheck) (sql.Result, error) { + invStockCheckCheckIdKey := fmt.Sprintf("%s%v", cacheInvStockCheckCheckIdPrefix, data.CheckId) + invStockCheckCheckNoKey := fmt.Sprintf("%s%v", cacheInvStockCheckCheckNoPrefix, data.CheckNo) + invStockCheckIdKey := fmt.Sprintf("%s%v", cacheInvStockCheckIdPrefix, data.Id) + ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?)", m.table, invStockCheckRowsExpectAutoSet) + return conn.ExecCtx(ctx, query, data.CheckId, data.CheckNo, data.CheckDate, data.Checker, data.Status, data.Remark) + }, invStockCheckCheckIdKey, invStockCheckCheckNoKey, invStockCheckIdKey) + return ret, err +} + +func (m *defaultInvStockCheckModel) Update(ctx context.Context, newData *InvStockCheck) error { + data, err := m.FindOne(ctx, newData.Id) + if err != nil { + return err + } + + invStockCheckCheckIdKey := fmt.Sprintf("%s%v", cacheInvStockCheckCheckIdPrefix, data.CheckId) + invStockCheckCheckNoKey := fmt.Sprintf("%s%v", cacheInvStockCheckCheckNoPrefix, data.CheckNo) + invStockCheckIdKey := fmt.Sprintf("%s%v", cacheInvStockCheckIdPrefix, data.Id) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, invStockCheckRowsWithPlaceHolder) + return conn.ExecCtx(ctx, query, newData.CheckId, newData.CheckNo, newData.CheckDate, newData.Checker, newData.Status, newData.Remark, newData.Id) + }, invStockCheckCheckIdKey, invStockCheckCheckNoKey, invStockCheckIdKey) + return err +} + +func (m *defaultInvStockCheckModel) formatPrimary(primary any) string { + return fmt.Sprintf("%s%v", cacheInvStockCheckIdPrefix, primary) +} + +func (m *defaultInvStockCheckModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", invStockCheckRows, m.table) + return conn.QueryRowCtx(ctx, v, query, primary) +} + +func (m *defaultInvStockCheckModel) tableName() string { + return m.table +} diff --git a/model/invstockimportlogmodel.go b/model/invstockimportlogmodel.go new file mode 100755 index 0000000..157be54 --- /dev/null +++ b/model/invstockimportlogmodel.go @@ -0,0 +1,46 @@ +package model + +import ( + "context" + "fmt" + + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlx" +) + +var _ InvStockImportLogModel = (*customInvStockImportLogModel)(nil) + +type ( + InvStockImportLogModel interface { + invStockImportLogModel + FindList(ctx context.Context, page, pageSize int64) ([]*InvStockImportLog, int64, error) + } + + customInvStockImportLogModel struct { + *defaultInvStockImportLogModel + } +) + +func NewInvStockImportLogModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) InvStockImportLogModel { + return &customInvStockImportLogModel{ + defaultInvStockImportLogModel: newInvStockImportLogModel(conn, c, opts...), + } +} + +func (m *customInvStockImportLogModel) FindList(ctx context.Context, page, pageSize int64) ([]*InvStockImportLog, int64, error) { + var total int64 + countQuery := fmt.Sprintf("SELECT COUNT(*) FROM %s", m.table) + err := m.QueryRowNoCacheCtx(ctx, &total, countQuery) + if err != nil { + return nil, 0, err + } + + var list []*InvStockImportLog + query := fmt.Sprintf("SELECT %s FROM %s ORDER BY created_at DESC LIMIT ? OFFSET ?", invStockImportLogRows, m.table) + err = m.QueryRowsNoCacheCtx(ctx, &list, query, pageSize, (page-1)*pageSize) + if err != nil { + return nil, 0, err + } + + return list, total, nil +} diff --git a/model/invstockimportlogmodel_gen.go b/model/invstockimportlogmodel_gen.go new file mode 100755 index 0000000..af58943 --- /dev/null +++ b/model/invstockimportlogmodel_gen.go @@ -0,0 +1,153 @@ +// Code generated by goctl. DO NOT EDIT. +// versions: +// goctl version: 1.9.2 + +package model + +import ( + "context" + "database/sql" + "fmt" + "strings" + "time" + + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlc" + "github.com/zeromicro/go-zero/core/stores/sqlx" + "github.com/zeromicro/go-zero/core/stringx" +) + +var ( + invStockImportLogFieldNames = builder.RawFieldNames(&InvStockImportLog{}) + invStockImportLogRows = strings.Join(invStockImportLogFieldNames, ",") + invStockImportLogRowsExpectAutoSet = strings.Join(stringx.Remove(invStockImportLogFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") + invStockImportLogRowsWithPlaceHolder = strings.Join(stringx.Remove(invStockImportLogFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" + + cacheInvStockImportLogIdPrefix = "cache:invStockImportLog:id:" + cacheInvStockImportLogImportIdPrefix = "cache:invStockImportLog:importId:" +) + +type ( + invStockImportLogModel interface { + Insert(ctx context.Context, data *InvStockImportLog) (sql.Result, error) + FindOne(ctx context.Context, id int64) (*InvStockImportLog, error) + FindOneByImportId(ctx context.Context, importId string) (*InvStockImportLog, error) + Update(ctx context.Context, data *InvStockImportLog) error + Delete(ctx context.Context, id int64) error + } + + defaultInvStockImportLogModel struct { + sqlc.CachedConn + table string + } + + InvStockImportLog struct { + Id int64 `db:"id"` + ImportId string `db:"import_id"` + FileName string `db:"file_name"` + TotalCount int64 `db:"total_count"` + SuccessCount int64 `db:"success_count"` + FailCount int64 `db:"fail_count"` + ErrorMsg sql.NullString `db:"error_msg"` + Operator string `db:"operator"` + CreatedAt time.Time `db:"created_at"` + } +) + +func newInvStockImportLogModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultInvStockImportLogModel { + return &defaultInvStockImportLogModel{ + CachedConn: sqlc.NewConn(conn, c, opts...), + table: "`inv_stock_import_log`", + } +} + +func (m *defaultInvStockImportLogModel) Delete(ctx context.Context, id int64) error { + data, err := m.FindOne(ctx, id) + if err != nil { + return err + } + + invStockImportLogIdKey := fmt.Sprintf("%s%v", cacheInvStockImportLogIdPrefix, id) + invStockImportLogImportIdKey := fmt.Sprintf("%s%v", cacheInvStockImportLogImportIdPrefix, data.ImportId) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("delete from %s where `id` = ?", m.table) + return conn.ExecCtx(ctx, query, id) + }, invStockImportLogIdKey, invStockImportLogImportIdKey) + return err +} + +func (m *defaultInvStockImportLogModel) FindOne(ctx context.Context, id int64) (*InvStockImportLog, error) { + invStockImportLogIdKey := fmt.Sprintf("%s%v", cacheInvStockImportLogIdPrefix, id) + var resp InvStockImportLog + err := m.QueryRowCtx(ctx, &resp, invStockImportLogIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", invStockImportLogRows, m.table) + return conn.QueryRowCtx(ctx, v, query, id) + }) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultInvStockImportLogModel) FindOneByImportId(ctx context.Context, importId string) (*InvStockImportLog, error) { + invStockImportLogImportIdKey := fmt.Sprintf("%s%v", cacheInvStockImportLogImportIdPrefix, importId) + var resp InvStockImportLog + err := m.QueryRowIndexCtx(ctx, &resp, invStockImportLogImportIdKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `import_id` = ? limit 1", invStockImportLogRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, importId); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultInvStockImportLogModel) Insert(ctx context.Context, data *InvStockImportLog) (sql.Result, error) { + invStockImportLogIdKey := fmt.Sprintf("%s%v", cacheInvStockImportLogIdPrefix, data.Id) + invStockImportLogImportIdKey := fmt.Sprintf("%s%v", cacheInvStockImportLogImportIdPrefix, data.ImportId) + ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?)", m.table, invStockImportLogRowsExpectAutoSet) + return conn.ExecCtx(ctx, query, data.ImportId, data.FileName, data.TotalCount, data.SuccessCount, data.FailCount, data.ErrorMsg, data.Operator) + }, invStockImportLogIdKey, invStockImportLogImportIdKey) + return ret, err +} + +func (m *defaultInvStockImportLogModel) Update(ctx context.Context, newData *InvStockImportLog) error { + data, err := m.FindOne(ctx, newData.Id) + if err != nil { + return err + } + + invStockImportLogIdKey := fmt.Sprintf("%s%v", cacheInvStockImportLogIdPrefix, data.Id) + invStockImportLogImportIdKey := fmt.Sprintf("%s%v", cacheInvStockImportLogImportIdPrefix, data.ImportId) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, invStockImportLogRowsWithPlaceHolder) + return conn.ExecCtx(ctx, query, newData.ImportId, newData.FileName, newData.TotalCount, newData.SuccessCount, newData.FailCount, newData.ErrorMsg, newData.Operator, newData.Id) + }, invStockImportLogIdKey, invStockImportLogImportIdKey) + return err +} + +func (m *defaultInvStockImportLogModel) formatPrimary(primary any) string { + return fmt.Sprintf("%s%v", cacheInvStockImportLogIdPrefix, primary) +} + +func (m *defaultInvStockImportLogModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", invStockImportLogRows, m.table) + return conn.QueryRowCtx(ctx, v, query, primary) +} + +func (m *defaultInvStockImportLogModel) tableName() string { + return m.table +} diff --git a/model/sysconfigmodel.go b/model/sysconfigmodel.go new file mode 100755 index 0000000..f2f6dbb --- /dev/null +++ b/model/sysconfigmodel.go @@ -0,0 +1,56 @@ +package model + +import ( + "context" + "fmt" + + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlx" +) + +var _ SysConfigModel = (*customSysConfigModel)(nil) + +type ( + SysConfigModel interface { + sysConfigModel + FindByGroup(ctx context.Context, group string) ([]*SysConfig, error) + FindAll(ctx context.Context) ([]*SysConfig, error) + UpdateByKey(ctx context.Context, key, value string) error + } + + customSysConfigModel struct { + *defaultSysConfigModel + } +) + +func NewSysConfigModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) SysConfigModel { + return &customSysConfigModel{ + defaultSysConfigModel: newSysConfigModel(conn, c, opts...), + } +} + +func (m *customSysConfigModel) FindByGroup(ctx context.Context, group string) ([]*SysConfig, error) { + var list []*SysConfig + query := fmt.Sprintf("SELECT %s FROM %s WHERE `config_group` = ?", sysConfigRows, m.table) + err := m.QueryRowsNoCacheCtx(ctx, &list, query, group) + if err != nil { + return nil, err + } + return list, nil +} + +func (m *customSysConfigModel) FindAll(ctx context.Context) ([]*SysConfig, error) { + var list []*SysConfig + query := fmt.Sprintf("SELECT %s FROM %s", sysConfigRows, m.table) + err := m.QueryRowsNoCacheCtx(ctx, &list, query) + if err != nil { + return nil, err + } + return list, nil +} + +func (m *customSysConfigModel) UpdateByKey(ctx context.Context, key, value string) error { + query := fmt.Sprintf("UPDATE %s SET `config_value` = ? WHERE `config_key` = ?", m.table) + _, err := m.ExecNoCacheCtx(ctx, query, value, key) + return err +} diff --git a/model/sysconfigmodel_gen.go b/model/sysconfigmodel_gen.go new file mode 100755 index 0000000..490a69f --- /dev/null +++ b/model/sysconfigmodel_gen.go @@ -0,0 +1,178 @@ +// Code generated by goctl. DO NOT EDIT. +// versions: +// goctl version: 1.9.2 + +package model + +import ( + "context" + "database/sql" + "fmt" + "strings" + "time" + + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlc" + "github.com/zeromicro/go-zero/core/stores/sqlx" + "github.com/zeromicro/go-zero/core/stringx" +) + +var ( + sysConfigFieldNames = builder.RawFieldNames(&SysConfig{}) + sysConfigRows = strings.Join(sysConfigFieldNames, ",") + sysConfigRowsExpectAutoSet = strings.Join(stringx.Remove(sysConfigFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") + sysConfigRowsWithPlaceHolder = strings.Join(stringx.Remove(sysConfigFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" + + cacheSysConfigIdPrefix = "cache:sysConfig:id:" + cacheSysConfigConfigIdPrefix = "cache:sysConfig:configId:" + cacheSysConfigConfigKeyPrefix = "cache:sysConfig:configKey:" +) + +type ( + sysConfigModel interface { + Insert(ctx context.Context, data *SysConfig) (sql.Result, error) + FindOne(ctx context.Context, id int64) (*SysConfig, error) + FindOneByConfigId(ctx context.Context, configId string) (*SysConfig, error) + FindOneByConfigKey(ctx context.Context, configKey string) (*SysConfig, error) + Update(ctx context.Context, data *SysConfig) error + Delete(ctx context.Context, id int64) error + } + + defaultSysConfigModel struct { + sqlc.CachedConn + table string + } + + SysConfig struct { + Id int64 `db:"id"` + ConfigId string `db:"config_id"` + ConfigKey string `db:"config_key"` + ConfigValue sql.NullString `db:"config_value"` + ConfigName string `db:"config_name"` + ConfigGroup string `db:"config_group"` + Remark sql.NullString `db:"remark"` + CreatedAt time.Time `db:"created_at"` + UpdatedAt time.Time `db:"updated_at"` + } +) + +func newSysConfigModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultSysConfigModel { + return &defaultSysConfigModel{ + CachedConn: sqlc.NewConn(conn, c, opts...), + table: "`sys_config`", + } +} + +func (m *defaultSysConfigModel) Delete(ctx context.Context, id int64) error { + data, err := m.FindOne(ctx, id) + if err != nil { + return err + } + + sysConfigConfigIdKey := fmt.Sprintf("%s%v", cacheSysConfigConfigIdPrefix, data.ConfigId) + sysConfigConfigKeyKey := fmt.Sprintf("%s%v", cacheSysConfigConfigKeyPrefix, data.ConfigKey) + sysConfigIdKey := fmt.Sprintf("%s%v", cacheSysConfigIdPrefix, id) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("delete from %s where `id` = ?", m.table) + return conn.ExecCtx(ctx, query, id) + }, sysConfigConfigIdKey, sysConfigConfigKeyKey, sysConfigIdKey) + return err +} + +func (m *defaultSysConfigModel) FindOne(ctx context.Context, id int64) (*SysConfig, error) { + sysConfigIdKey := fmt.Sprintf("%s%v", cacheSysConfigIdPrefix, id) + var resp SysConfig + err := m.QueryRowCtx(ctx, &resp, sysConfigIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", sysConfigRows, m.table) + return conn.QueryRowCtx(ctx, v, query, id) + }) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultSysConfigModel) FindOneByConfigId(ctx context.Context, configId string) (*SysConfig, error) { + sysConfigConfigIdKey := fmt.Sprintf("%s%v", cacheSysConfigConfigIdPrefix, configId) + var resp SysConfig + err := m.QueryRowIndexCtx(ctx, &resp, sysConfigConfigIdKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `config_id` = ? limit 1", sysConfigRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, configId); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultSysConfigModel) FindOneByConfigKey(ctx context.Context, configKey string) (*SysConfig, error) { + sysConfigConfigKeyKey := fmt.Sprintf("%s%v", cacheSysConfigConfigKeyPrefix, configKey) + var resp SysConfig + err := m.QueryRowIndexCtx(ctx, &resp, sysConfigConfigKeyKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `config_key` = ? limit 1", sysConfigRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, configKey); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultSysConfigModel) Insert(ctx context.Context, data *SysConfig) (sql.Result, error) { + sysConfigConfigIdKey := fmt.Sprintf("%s%v", cacheSysConfigConfigIdPrefix, data.ConfigId) + sysConfigConfigKeyKey := fmt.Sprintf("%s%v", cacheSysConfigConfigKeyPrefix, data.ConfigKey) + sysConfigIdKey := fmt.Sprintf("%s%v", cacheSysConfigIdPrefix, data.Id) + ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?)", m.table, sysConfigRowsExpectAutoSet) + return conn.ExecCtx(ctx, query, data.ConfigId, data.ConfigKey, data.ConfigValue, data.ConfigName, data.ConfigGroup, data.Remark) + }, sysConfigConfigIdKey, sysConfigConfigKeyKey, sysConfigIdKey) + return ret, err +} + +func (m *defaultSysConfigModel) Update(ctx context.Context, newData *SysConfig) error { + data, err := m.FindOne(ctx, newData.Id) + if err != nil { + return err + } + + sysConfigConfigIdKey := fmt.Sprintf("%s%v", cacheSysConfigConfigIdPrefix, data.ConfigId) + sysConfigConfigKeyKey := fmt.Sprintf("%s%v", cacheSysConfigConfigKeyPrefix, data.ConfigKey) + sysConfigIdKey := fmt.Sprintf("%s%v", cacheSysConfigIdPrefix, data.Id) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, sysConfigRowsWithPlaceHolder) + return conn.ExecCtx(ctx, query, newData.ConfigId, newData.ConfigKey, newData.ConfigValue, newData.ConfigName, newData.ConfigGroup, newData.Remark, newData.Id) + }, sysConfigConfigIdKey, sysConfigConfigKeyKey, sysConfigIdKey) + return err +} + +func (m *defaultSysConfigModel) formatPrimary(primary any) string { + return fmt.Sprintf("%s%v", cacheSysConfigIdPrefix, primary) +} + +func (m *defaultSysConfigModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", sysConfigRows, m.table) + return conn.QueryRowCtx(ctx, v, query, primary) +} + +func (m *defaultSysConfigModel) tableName() string { + return m.table +} diff --git a/model/sysmenumodel.go b/model/sysmenumodel.go new file mode 100755 index 0000000..c50635f --- /dev/null +++ b/model/sysmenumodel.go @@ -0,0 +1,38 @@ +package model + +import ( + "context" + "fmt" + + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlx" +) + +var _ SysMenuModel = (*customSysMenuModel)(nil) + +type ( + SysMenuModel interface { + sysMenuModel + FindAll(ctx context.Context) ([]*SysMenu, error) + } + + customSysMenuModel struct { + *defaultSysMenuModel + } +) + +func NewSysMenuModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) SysMenuModel { + return &customSysMenuModel{ + defaultSysMenuModel: newSysMenuModel(conn, c, opts...), + } +} + +func (m *customSysMenuModel) FindAll(ctx context.Context) ([]*SysMenu, error) { + var list []*SysMenu + query := fmt.Sprintf("SELECT %s FROM %s ORDER BY sort_order ASC", sysMenuRows, m.table) + err := m.QueryRowsNoCacheCtx(ctx, &list, query) + if err != nil { + return nil, err + } + return list, nil +} diff --git a/model/sysmenumodel_gen.go b/model/sysmenumodel_gen.go new file mode 100755 index 0000000..934242a --- /dev/null +++ b/model/sysmenumodel_gen.go @@ -0,0 +1,158 @@ +// Code generated by goctl. DO NOT EDIT. +// versions: +// goctl version: 1.9.2 + +package model + +import ( + "context" + "database/sql" + "fmt" + "strings" + "time" + + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlc" + "github.com/zeromicro/go-zero/core/stores/sqlx" + "github.com/zeromicro/go-zero/core/stringx" +) + +var ( + sysMenuFieldNames = builder.RawFieldNames(&SysMenu{}) + sysMenuRows = strings.Join(sysMenuFieldNames, ",") + sysMenuRowsExpectAutoSet = strings.Join(stringx.Remove(sysMenuFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") + sysMenuRowsWithPlaceHolder = strings.Join(stringx.Remove(sysMenuFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" + + cacheSysMenuIdPrefix = "cache:sysMenu:id:" + cacheSysMenuMenuIdPrefix = "cache:sysMenu:menuId:" +) + +type ( + sysMenuModel interface { + Insert(ctx context.Context, data *SysMenu) (sql.Result, error) + FindOne(ctx context.Context, id int64) (*SysMenu, error) + FindOneByMenuId(ctx context.Context, menuId string) (*SysMenu, error) + Update(ctx context.Context, data *SysMenu) error + Delete(ctx context.Context, id int64) error + } + + defaultSysMenuModel struct { + sqlc.CachedConn + table string + } + + SysMenu struct { + Id int64 `db:"id"` + MenuId string `db:"menu_id"` + ParentId string `db:"parent_id"` + MenuName string `db:"menu_name"` + MenuType int64 `db:"menu_type"` // 1:directory 2:menu 3:button + Path string `db:"path"` + Component string `db:"component"` + Permission string `db:"permission"` + Icon string `db:"icon"` + SortOrder int64 `db:"sort_order"` + Visible int64 `db:"visible"` // 1:visible 0:hidden + Status int64 `db:"status"` // 1:enabled 0:disabled + CreatedAt time.Time `db:"created_at"` + UpdatedAt time.Time `db:"updated_at"` + } +) + +func newSysMenuModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultSysMenuModel { + return &defaultSysMenuModel{ + CachedConn: sqlc.NewConn(conn, c, opts...), + table: "`sys_menu`", + } +} + +func (m *defaultSysMenuModel) Delete(ctx context.Context, id int64) error { + data, err := m.FindOne(ctx, id) + if err != nil { + return err + } + + sysMenuIdKey := fmt.Sprintf("%s%v", cacheSysMenuIdPrefix, id) + sysMenuMenuIdKey := fmt.Sprintf("%s%v", cacheSysMenuMenuIdPrefix, data.MenuId) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("delete from %s where `id` = ?", m.table) + return conn.ExecCtx(ctx, query, id) + }, sysMenuIdKey, sysMenuMenuIdKey) + return err +} + +func (m *defaultSysMenuModel) FindOne(ctx context.Context, id int64) (*SysMenu, error) { + sysMenuIdKey := fmt.Sprintf("%s%v", cacheSysMenuIdPrefix, id) + var resp SysMenu + err := m.QueryRowCtx(ctx, &resp, sysMenuIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", sysMenuRows, m.table) + return conn.QueryRowCtx(ctx, v, query, id) + }) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultSysMenuModel) FindOneByMenuId(ctx context.Context, menuId string) (*SysMenu, error) { + sysMenuMenuIdKey := fmt.Sprintf("%s%v", cacheSysMenuMenuIdPrefix, menuId) + var resp SysMenu + err := m.QueryRowIndexCtx(ctx, &resp, sysMenuMenuIdKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `menu_id` = ? limit 1", sysMenuRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, menuId); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultSysMenuModel) Insert(ctx context.Context, data *SysMenu) (sql.Result, error) { + sysMenuIdKey := fmt.Sprintf("%s%v", cacheSysMenuIdPrefix, data.Id) + sysMenuMenuIdKey := fmt.Sprintf("%s%v", cacheSysMenuMenuIdPrefix, data.MenuId) + ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, sysMenuRowsExpectAutoSet) + return conn.ExecCtx(ctx, query, data.MenuId, data.ParentId, data.MenuName, data.MenuType, data.Path, data.Component, data.Permission, data.Icon, data.SortOrder, data.Visible, data.Status) + }, sysMenuIdKey, sysMenuMenuIdKey) + return ret, err +} + +func (m *defaultSysMenuModel) Update(ctx context.Context, newData *SysMenu) error { + data, err := m.FindOne(ctx, newData.Id) + if err != nil { + return err + } + + sysMenuIdKey := fmt.Sprintf("%s%v", cacheSysMenuIdPrefix, data.Id) + sysMenuMenuIdKey := fmt.Sprintf("%s%v", cacheSysMenuMenuIdPrefix, data.MenuId) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, sysMenuRowsWithPlaceHolder) + return conn.ExecCtx(ctx, query, newData.MenuId, newData.ParentId, newData.MenuName, newData.MenuType, newData.Path, newData.Component, newData.Permission, newData.Icon, newData.SortOrder, newData.Visible, newData.Status, newData.Id) + }, sysMenuIdKey, sysMenuMenuIdKey) + return err +} + +func (m *defaultSysMenuModel) formatPrimary(primary any) string { + return fmt.Sprintf("%s%v", cacheSysMenuIdPrefix, primary) +} + +func (m *defaultSysMenuModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", sysMenuRows, m.table) + return conn.QueryRowCtx(ctx, v, query, primary) +} + +func (m *defaultSysMenuModel) tableName() string { + return m.table +} diff --git a/model/sysoperationlogmodel.go b/model/sysoperationlogmodel.go new file mode 100755 index 0000000..3c85fa1 --- /dev/null +++ b/model/sysoperationlogmodel.go @@ -0,0 +1,71 @@ +package model + +import ( + "context" + "fmt" + + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlx" +) + +var _ SysOperationLogModel = (*customSysOperationLogModel)(nil) + +type ( + SysOperationLogModel interface { + sysOperationLogModel + FindList(ctx context.Context, page, pageSize int64, username, module, operation, startTime, endTime string) ([]*SysOperationLog, int64, error) + } + + customSysOperationLogModel struct { + *defaultSysOperationLogModel + } +) + +func NewSysOperationLogModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) SysOperationLogModel { + return &customSysOperationLogModel{ + defaultSysOperationLogModel: newSysOperationLogModel(conn, c, opts...), + } +} + +func (m *customSysOperationLogModel) FindList(ctx context.Context, page, pageSize int64, username, module, operation, startTime, endTime string) ([]*SysOperationLog, int64, error) { + where := "WHERE 1=1" + args := make([]interface{}, 0) + + if username != "" { + where += " AND username LIKE ?" + args = append(args, "%"+username+"%") + } + if module != "" { + where += " AND module = ?" + args = append(args, module) + } + if operation != "" { + where += " AND operation LIKE ?" + args = append(args, "%"+operation+"%") + } + if startTime != "" { + where += " AND created_at >= ?" + args = append(args, startTime) + } + if endTime != "" { + where += " AND created_at <= ?" + args = append(args, endTime) + } + + var total int64 + countQuery := fmt.Sprintf("SELECT COUNT(*) FROM %s %s", m.table, where) + err := m.QueryRowNoCacheCtx(ctx, &total, countQuery, args...) + if err != nil { + return nil, 0, err + } + + var list []*SysOperationLog + query := fmt.Sprintf("SELECT %s FROM %s %s ORDER BY created_at DESC LIMIT ? OFFSET ?", sysOperationLogRows, m.table, where) + args = append(args, pageSize, (page-1)*pageSize) + err = m.QueryRowsNoCacheCtx(ctx, &list, query, args...) + if err != nil { + return nil, 0, err + } + + return list, total, nil +} diff --git a/model/sysoperationlogmodel_gen.go b/model/sysoperationlogmodel_gen.go new file mode 100755 index 0000000..e95db86 --- /dev/null +++ b/model/sysoperationlogmodel_gen.go @@ -0,0 +1,159 @@ +// Code generated by goctl. DO NOT EDIT. +// versions: +// goctl version: 1.9.2 + +package model + +import ( + "context" + "database/sql" + "fmt" + "strings" + "time" + + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlc" + "github.com/zeromicro/go-zero/core/stores/sqlx" + "github.com/zeromicro/go-zero/core/stringx" +) + +var ( + sysOperationLogFieldNames = builder.RawFieldNames(&SysOperationLog{}) + sysOperationLogRows = strings.Join(sysOperationLogFieldNames, ",") + sysOperationLogRowsExpectAutoSet = strings.Join(stringx.Remove(sysOperationLogFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") + sysOperationLogRowsWithPlaceHolder = strings.Join(stringx.Remove(sysOperationLogFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" + + cacheSysOperationLogIdPrefix = "cache:sysOperationLog:id:" + cacheSysOperationLogLogIdPrefix = "cache:sysOperationLog:logId:" +) + +type ( + sysOperationLogModel interface { + Insert(ctx context.Context, data *SysOperationLog) (sql.Result, error) + FindOne(ctx context.Context, id int64) (*SysOperationLog, error) + FindOneByLogId(ctx context.Context, logId string) (*SysOperationLog, error) + Update(ctx context.Context, data *SysOperationLog) error + Delete(ctx context.Context, id int64) error + } + + defaultSysOperationLogModel struct { + sqlc.CachedConn + table string + } + + SysOperationLog struct { + Id int64 `db:"id"` + LogId string `db:"log_id"` + UserId string `db:"user_id"` + Username string `db:"username"` + Module string `db:"module"` + Operation string `db:"operation"` + Method string `db:"method"` + Path string `db:"path"` + RequestBody sql.NullString `db:"request_body"` + ResponseBody sql.NullString `db:"response_body"` + Ip string `db:"ip"` + UserAgent string `db:"user_agent"` + Duration int64 `db:"duration"` // milliseconds + Status int64 `db:"status"` // 1:success 0:fail + CreatedAt time.Time `db:"created_at"` + } +) + +func newSysOperationLogModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultSysOperationLogModel { + return &defaultSysOperationLogModel{ + CachedConn: sqlc.NewConn(conn, c, opts...), + table: "`sys_operation_log`", + } +} + +func (m *defaultSysOperationLogModel) Delete(ctx context.Context, id int64) error { + data, err := m.FindOne(ctx, id) + if err != nil { + return err + } + + sysOperationLogIdKey := fmt.Sprintf("%s%v", cacheSysOperationLogIdPrefix, id) + sysOperationLogLogIdKey := fmt.Sprintf("%s%v", cacheSysOperationLogLogIdPrefix, data.LogId) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("delete from %s where `id` = ?", m.table) + return conn.ExecCtx(ctx, query, id) + }, sysOperationLogIdKey, sysOperationLogLogIdKey) + return err +} + +func (m *defaultSysOperationLogModel) FindOne(ctx context.Context, id int64) (*SysOperationLog, error) { + sysOperationLogIdKey := fmt.Sprintf("%s%v", cacheSysOperationLogIdPrefix, id) + var resp SysOperationLog + err := m.QueryRowCtx(ctx, &resp, sysOperationLogIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", sysOperationLogRows, m.table) + return conn.QueryRowCtx(ctx, v, query, id) + }) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultSysOperationLogModel) FindOneByLogId(ctx context.Context, logId string) (*SysOperationLog, error) { + sysOperationLogLogIdKey := fmt.Sprintf("%s%v", cacheSysOperationLogLogIdPrefix, logId) + var resp SysOperationLog + err := m.QueryRowIndexCtx(ctx, &resp, sysOperationLogLogIdKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `log_id` = ? limit 1", sysOperationLogRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, logId); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultSysOperationLogModel) Insert(ctx context.Context, data *SysOperationLog) (sql.Result, error) { + sysOperationLogIdKey := fmt.Sprintf("%s%v", cacheSysOperationLogIdPrefix, data.Id) + sysOperationLogLogIdKey := fmt.Sprintf("%s%v", cacheSysOperationLogLogIdPrefix, data.LogId) + ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, sysOperationLogRowsExpectAutoSet) + return conn.ExecCtx(ctx, query, data.LogId, data.UserId, data.Username, data.Module, data.Operation, data.Method, data.Path, data.RequestBody, data.ResponseBody, data.Ip, data.UserAgent, data.Duration, data.Status) + }, sysOperationLogIdKey, sysOperationLogLogIdKey) + return ret, err +} + +func (m *defaultSysOperationLogModel) Update(ctx context.Context, newData *SysOperationLog) error { + data, err := m.FindOne(ctx, newData.Id) + if err != nil { + return err + } + + sysOperationLogIdKey := fmt.Sprintf("%s%v", cacheSysOperationLogIdPrefix, data.Id) + sysOperationLogLogIdKey := fmt.Sprintf("%s%v", cacheSysOperationLogLogIdPrefix, data.LogId) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, sysOperationLogRowsWithPlaceHolder) + return conn.ExecCtx(ctx, query, newData.LogId, newData.UserId, newData.Username, newData.Module, newData.Operation, newData.Method, newData.Path, newData.RequestBody, newData.ResponseBody, newData.Ip, newData.UserAgent, newData.Duration, newData.Status, newData.Id) + }, sysOperationLogIdKey, sysOperationLogLogIdKey) + return err +} + +func (m *defaultSysOperationLogModel) formatPrimary(primary any) string { + return fmt.Sprintf("%s%v", cacheSysOperationLogIdPrefix, primary) +} + +func (m *defaultSysOperationLogModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", sysOperationLogRows, m.table) + return conn.QueryRowCtx(ctx, v, query, primary) +} + +func (m *defaultSysOperationLogModel) tableName() string { + return m.table +} diff --git a/model/sysrolemenumodel.go b/model/sysrolemenumodel.go new file mode 100755 index 0000000..ad21f0b --- /dev/null +++ b/model/sysrolemenumodel.go @@ -0,0 +1,64 @@ +package model + +import ( + "context" + "fmt" + "strings" + + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlx" +) + +var _ SysRoleMenuModel = (*customSysRoleMenuModel)(nil) + +type ( + SysRoleMenuModel interface { + sysRoleMenuModel + FindByRoleId(ctx context.Context, roleId string) ([]*SysRoleMenu, error) + DeleteByRoleId(ctx context.Context, roleId string) error + BatchInsert(ctx context.Context, roleId string, menuIds []string) error + } + + customSysRoleMenuModel struct { + *defaultSysRoleMenuModel + } +) + +func NewSysRoleMenuModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) SysRoleMenuModel { + return &customSysRoleMenuModel{ + defaultSysRoleMenuModel: newSysRoleMenuModel(conn, c, opts...), + } +} + +func (m *customSysRoleMenuModel) FindByRoleId(ctx context.Context, roleId string) ([]*SysRoleMenu, error) { + var list []*SysRoleMenu + query := fmt.Sprintf("SELECT %s FROM %s WHERE `role_id` = ?", sysRoleMenuRows, m.table) + err := m.QueryRowsNoCacheCtx(ctx, &list, query, roleId) + if err != nil { + return nil, err + } + return list, nil +} + +func (m *customSysRoleMenuModel) DeleteByRoleId(ctx context.Context, roleId string) error { + query := fmt.Sprintf("DELETE FROM %s WHERE `role_id` = ?", m.table) + _, err := m.ExecNoCacheCtx(ctx, query, roleId) + return err +} + +func (m *customSysRoleMenuModel) BatchInsert(ctx context.Context, roleId string, menuIds []string) error { + if len(menuIds) == 0 { + return nil + } + + values := make([]string, 0, len(menuIds)) + args := make([]interface{}, 0, len(menuIds)*2) + for _, menuId := range menuIds { + values = append(values, "(?, ?)") + args = append(args, roleId, menuId) + } + + query := fmt.Sprintf("INSERT INTO %s (`role_id`, `menu_id`) VALUES %s", m.table, strings.Join(values, ",")) + _, err := m.ExecNoCacheCtx(ctx, query, args...) + return err +} diff --git a/model/sysrolemenumodel_gen.go b/model/sysrolemenumodel_gen.go new file mode 100755 index 0000000..ae66ba5 --- /dev/null +++ b/model/sysrolemenumodel_gen.go @@ -0,0 +1,146 @@ +// Code generated by goctl. DO NOT EDIT. +// versions: +// goctl version: 1.9.2 + +package model + +import ( + "context" + "database/sql" + "fmt" + "strings" + + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlc" + "github.com/zeromicro/go-zero/core/stores/sqlx" + "github.com/zeromicro/go-zero/core/stringx" +) + +var ( + sysRoleMenuFieldNames = builder.RawFieldNames(&SysRoleMenu{}) + sysRoleMenuRows = strings.Join(sysRoleMenuFieldNames, ",") + sysRoleMenuRowsExpectAutoSet = strings.Join(stringx.Remove(sysRoleMenuFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") + sysRoleMenuRowsWithPlaceHolder = strings.Join(stringx.Remove(sysRoleMenuFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" + + cacheSysRoleMenuIdPrefix = "cache:sysRoleMenu:id:" + cacheSysRoleMenuRoleIdMenuIdPrefix = "cache:sysRoleMenu:roleId:menuId:" +) + +type ( + sysRoleMenuModel interface { + Insert(ctx context.Context, data *SysRoleMenu) (sql.Result, error) + FindOne(ctx context.Context, id int64) (*SysRoleMenu, error) + FindOneByRoleIdMenuId(ctx context.Context, roleId string, menuId string) (*SysRoleMenu, error) + Update(ctx context.Context, data *SysRoleMenu) error + Delete(ctx context.Context, id int64) error + } + + defaultSysRoleMenuModel struct { + sqlc.CachedConn + table string + } + + SysRoleMenu struct { + Id int64 `db:"id"` + RoleId string `db:"role_id"` + MenuId string `db:"menu_id"` + } +) + +func newSysRoleMenuModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultSysRoleMenuModel { + return &defaultSysRoleMenuModel{ + CachedConn: sqlc.NewConn(conn, c, opts...), + table: "`sys_role_menu`", + } +} + +func (m *defaultSysRoleMenuModel) Delete(ctx context.Context, id int64) error { + data, err := m.FindOne(ctx, id) + if err != nil { + return err + } + + sysRoleMenuIdKey := fmt.Sprintf("%s%v", cacheSysRoleMenuIdPrefix, id) + sysRoleMenuRoleIdMenuIdKey := fmt.Sprintf("%s%v:%v", cacheSysRoleMenuRoleIdMenuIdPrefix, data.RoleId, data.MenuId) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("delete from %s where `id` = ?", m.table) + return conn.ExecCtx(ctx, query, id) + }, sysRoleMenuIdKey, sysRoleMenuRoleIdMenuIdKey) + return err +} + +func (m *defaultSysRoleMenuModel) FindOne(ctx context.Context, id int64) (*SysRoleMenu, error) { + sysRoleMenuIdKey := fmt.Sprintf("%s%v", cacheSysRoleMenuIdPrefix, id) + var resp SysRoleMenu + err := m.QueryRowCtx(ctx, &resp, sysRoleMenuIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", sysRoleMenuRows, m.table) + return conn.QueryRowCtx(ctx, v, query, id) + }) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultSysRoleMenuModel) FindOneByRoleIdMenuId(ctx context.Context, roleId string, menuId string) (*SysRoleMenu, error) { + sysRoleMenuRoleIdMenuIdKey := fmt.Sprintf("%s%v:%v", cacheSysRoleMenuRoleIdMenuIdPrefix, roleId, menuId) + var resp SysRoleMenu + err := m.QueryRowIndexCtx(ctx, &resp, sysRoleMenuRoleIdMenuIdKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `role_id` = ? and `menu_id` = ? limit 1", sysRoleMenuRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, roleId, menuId); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultSysRoleMenuModel) Insert(ctx context.Context, data *SysRoleMenu) (sql.Result, error) { + sysRoleMenuIdKey := fmt.Sprintf("%s%v", cacheSysRoleMenuIdPrefix, data.Id) + sysRoleMenuRoleIdMenuIdKey := fmt.Sprintf("%s%v:%v", cacheSysRoleMenuRoleIdMenuIdPrefix, data.RoleId, data.MenuId) + ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("insert into %s (%s) values (?, ?)", m.table, sysRoleMenuRowsExpectAutoSet) + return conn.ExecCtx(ctx, query, data.RoleId, data.MenuId) + }, sysRoleMenuIdKey, sysRoleMenuRoleIdMenuIdKey) + return ret, err +} + +func (m *defaultSysRoleMenuModel) Update(ctx context.Context, newData *SysRoleMenu) error { + data, err := m.FindOne(ctx, newData.Id) + if err != nil { + return err + } + + sysRoleMenuIdKey := fmt.Sprintf("%s%v", cacheSysRoleMenuIdPrefix, data.Id) + sysRoleMenuRoleIdMenuIdKey := fmt.Sprintf("%s%v:%v", cacheSysRoleMenuRoleIdMenuIdPrefix, data.RoleId, data.MenuId) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, sysRoleMenuRowsWithPlaceHolder) + return conn.ExecCtx(ctx, query, newData.RoleId, newData.MenuId, newData.Id) + }, sysRoleMenuIdKey, sysRoleMenuRoleIdMenuIdKey) + return err +} + +func (m *defaultSysRoleMenuModel) formatPrimary(primary any) string { + return fmt.Sprintf("%s%v", cacheSysRoleMenuIdPrefix, primary) +} + +func (m *defaultSysRoleMenuModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", sysRoleMenuRows, m.table) + return conn.QueryRowCtx(ctx, v, query, primary) +} + +func (m *defaultSysRoleMenuModel) tableName() string { + return m.table +} diff --git a/model/sysrolemodel.go b/model/sysrolemodel.go new file mode 100755 index 0000000..c2af91b --- /dev/null +++ b/model/sysrolemodel.go @@ -0,0 +1,70 @@ +package model + +import ( + "context" + "fmt" + + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlx" +) + +var _ SysRoleModel = (*customSysRoleModel)(nil) + +type ( + SysRoleModel interface { + sysRoleModel + FindList(ctx context.Context, page, pageSize int64, roleName string, status int64) ([]*SysRole, int64, error) + FindAll(ctx context.Context) ([]*SysRole, error) + } + + customSysRoleModel struct { + *defaultSysRoleModel + } +) + +func NewSysRoleModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) SysRoleModel { + return &customSysRoleModel{ + defaultSysRoleModel: newSysRoleModel(conn, c, opts...), + } +} + +func (m *customSysRoleModel) FindList(ctx context.Context, page, pageSize int64, roleName string, status int64) ([]*SysRole, int64, error) { + where := "WHERE 1=1" + args := make([]interface{}, 0) + + if roleName != "" { + where += " AND role_name LIKE ?" + args = append(args, "%"+roleName+"%") + } + if status >= 0 { + where += " AND status = ?" + args = append(args, status) + } + + var total int64 + countQuery := fmt.Sprintf("SELECT COUNT(*) FROM %s %s", m.table, where) + err := m.QueryRowNoCacheCtx(ctx, &total, countQuery, args...) + if err != nil { + return nil, 0, err + } + + var list []*SysRole + query := fmt.Sprintf("SELECT %s FROM %s %s ORDER BY sort_order ASC, created_at DESC LIMIT ? OFFSET ?", sysRoleRows, m.table, where) + args = append(args, pageSize, (page-1)*pageSize) + err = m.QueryRowsNoCacheCtx(ctx, &list, query, args...) + if err != nil { + return nil, 0, err + } + + return list, total, nil +} + +func (m *customSysRoleModel) FindAll(ctx context.Context) ([]*SysRole, error) { + var list []*SysRole + query := fmt.Sprintf("SELECT %s FROM %s ORDER BY sort_order ASC", sysRoleRows, m.table) + err := m.QueryRowsNoCacheCtx(ctx, &list, query) + if err != nil { + return nil, err + } + return list, nil +} diff --git a/model/sysrolemodel_gen.go b/model/sysrolemodel_gen.go new file mode 100755 index 0000000..d14a374 --- /dev/null +++ b/model/sysrolemodel_gen.go @@ -0,0 +1,178 @@ +// Code generated by goctl. DO NOT EDIT. +// versions: +// goctl version: 1.9.2 + +package model + +import ( + "context" + "database/sql" + "fmt" + "strings" + "time" + + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlc" + "github.com/zeromicro/go-zero/core/stores/sqlx" + "github.com/zeromicro/go-zero/core/stringx" +) + +var ( + sysRoleFieldNames = builder.RawFieldNames(&SysRole{}) + sysRoleRows = strings.Join(sysRoleFieldNames, ",") + sysRoleRowsExpectAutoSet = strings.Join(stringx.Remove(sysRoleFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") + sysRoleRowsWithPlaceHolder = strings.Join(stringx.Remove(sysRoleFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" + + cacheSysRoleIdPrefix = "cache:sysRole:id:" + cacheSysRoleRoleIdPrefix = "cache:sysRole:roleId:" + cacheSysRoleRoleKeyPrefix = "cache:sysRole:roleKey:" +) + +type ( + sysRoleModel interface { + Insert(ctx context.Context, data *SysRole) (sql.Result, error) + FindOne(ctx context.Context, id int64) (*SysRole, error) + FindOneByRoleId(ctx context.Context, roleId string) (*SysRole, error) + FindOneByRoleKey(ctx context.Context, roleKey string) (*SysRole, error) + Update(ctx context.Context, data *SysRole) error + Delete(ctx context.Context, id int64) error + } + + defaultSysRoleModel struct { + sqlc.CachedConn + table string + } + + SysRole struct { + Id int64 `db:"id"` + RoleId string `db:"role_id"` + RoleName string `db:"role_name"` + RoleKey string `db:"role_key"` + RoleDesc string `db:"role_desc"` + SortOrder int64 `db:"sort_order"` + Status int64 `db:"status"` // 1:enabled 0:disabled + CreatedAt time.Time `db:"created_at"` + UpdatedAt time.Time `db:"updated_at"` + } +) + +func newSysRoleModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultSysRoleModel { + return &defaultSysRoleModel{ + CachedConn: sqlc.NewConn(conn, c, opts...), + table: "`sys_role`", + } +} + +func (m *defaultSysRoleModel) Delete(ctx context.Context, id int64) error { + data, err := m.FindOne(ctx, id) + if err != nil { + return err + } + + sysRoleIdKey := fmt.Sprintf("%s%v", cacheSysRoleIdPrefix, id) + sysRoleRoleIdKey := fmt.Sprintf("%s%v", cacheSysRoleRoleIdPrefix, data.RoleId) + sysRoleRoleKeyKey := fmt.Sprintf("%s%v", cacheSysRoleRoleKeyPrefix, data.RoleKey) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("delete from %s where `id` = ?", m.table) + return conn.ExecCtx(ctx, query, id) + }, sysRoleIdKey, sysRoleRoleIdKey, sysRoleRoleKeyKey) + return err +} + +func (m *defaultSysRoleModel) FindOne(ctx context.Context, id int64) (*SysRole, error) { + sysRoleIdKey := fmt.Sprintf("%s%v", cacheSysRoleIdPrefix, id) + var resp SysRole + err := m.QueryRowCtx(ctx, &resp, sysRoleIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", sysRoleRows, m.table) + return conn.QueryRowCtx(ctx, v, query, id) + }) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultSysRoleModel) FindOneByRoleId(ctx context.Context, roleId string) (*SysRole, error) { + sysRoleRoleIdKey := fmt.Sprintf("%s%v", cacheSysRoleRoleIdPrefix, roleId) + var resp SysRole + err := m.QueryRowIndexCtx(ctx, &resp, sysRoleRoleIdKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `role_id` = ? limit 1", sysRoleRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, roleId); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultSysRoleModel) FindOneByRoleKey(ctx context.Context, roleKey string) (*SysRole, error) { + sysRoleRoleKeyKey := fmt.Sprintf("%s%v", cacheSysRoleRoleKeyPrefix, roleKey) + var resp SysRole + err := m.QueryRowIndexCtx(ctx, &resp, sysRoleRoleKeyKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `role_key` = ? limit 1", sysRoleRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, roleKey); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultSysRoleModel) Insert(ctx context.Context, data *SysRole) (sql.Result, error) { + sysRoleIdKey := fmt.Sprintf("%s%v", cacheSysRoleIdPrefix, data.Id) + sysRoleRoleIdKey := fmt.Sprintf("%s%v", cacheSysRoleRoleIdPrefix, data.RoleId) + sysRoleRoleKeyKey := fmt.Sprintf("%s%v", cacheSysRoleRoleKeyPrefix, data.RoleKey) + ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?)", m.table, sysRoleRowsExpectAutoSet) + return conn.ExecCtx(ctx, query, data.RoleId, data.RoleName, data.RoleKey, data.RoleDesc, data.SortOrder, data.Status) + }, sysRoleIdKey, sysRoleRoleIdKey, sysRoleRoleKeyKey) + return ret, err +} + +func (m *defaultSysRoleModel) Update(ctx context.Context, newData *SysRole) error { + data, err := m.FindOne(ctx, newData.Id) + if err != nil { + return err + } + + sysRoleIdKey := fmt.Sprintf("%s%v", cacheSysRoleIdPrefix, data.Id) + sysRoleRoleIdKey := fmt.Sprintf("%s%v", cacheSysRoleRoleIdPrefix, data.RoleId) + sysRoleRoleKeyKey := fmt.Sprintf("%s%v", cacheSysRoleRoleKeyPrefix, data.RoleKey) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, sysRoleRowsWithPlaceHolder) + return conn.ExecCtx(ctx, query, newData.RoleId, newData.RoleName, newData.RoleKey, newData.RoleDesc, newData.SortOrder, newData.Status, newData.Id) + }, sysRoleIdKey, sysRoleRoleIdKey, sysRoleRoleKeyKey) + return err +} + +func (m *defaultSysRoleModel) formatPrimary(primary any) string { + return fmt.Sprintf("%s%v", cacheSysRoleIdPrefix, primary) +} + +func (m *defaultSysRoleModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", sysRoleRows, m.table) + return conn.QueryRowCtx(ctx, v, query, primary) +} + +func (m *defaultSysRoleModel) tableName() string { + return m.table +} diff --git a/model/sysusermodel.go b/model/sysusermodel.go new file mode 100755 index 0000000..22a74c1 --- /dev/null +++ b/model/sysusermodel.go @@ -0,0 +1,67 @@ +package model + +import ( + "context" + "fmt" + + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlx" +) + +var _ SysUserModel = (*customSysUserModel)(nil) + +type ( + SysUserModel interface { + sysUserModel + FindList(ctx context.Context, page, pageSize int64, username, realName, phone string, status int64) ([]*SysUser, int64, error) + } + + customSysUserModel struct { + *defaultSysUserModel + } +) + +func NewSysUserModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) SysUserModel { + return &customSysUserModel{ + defaultSysUserModel: newSysUserModel(conn, c, opts...), + } +} + +func (m *customSysUserModel) FindList(ctx context.Context, page, pageSize int64, username, realName, phone string, status int64) ([]*SysUser, int64, error) { + where := "WHERE deleted_at IS NULL" + args := make([]interface{}, 0) + + if username != "" { + where += " AND username LIKE ?" + args = append(args, "%"+username+"%") + } + if realName != "" { + where += " AND real_name LIKE ?" + args = append(args, "%"+realName+"%") + } + if phone != "" { + where += " AND phone LIKE ?" + args = append(args, "%"+phone+"%") + } + if status >= 0 { + where += " AND status = ?" + args = append(args, status) + } + + var total int64 + countQuery := fmt.Sprintf("SELECT COUNT(*) FROM %s %s", m.table, where) + err := m.QueryRowNoCacheCtx(ctx, &total, countQuery, args...) + if err != nil { + return nil, 0, err + } + + var list []*SysUser + query := fmt.Sprintf("SELECT %s FROM %s %s ORDER BY created_at DESC LIMIT ? OFFSET ?", sysUserRows, m.table, where) + args = append(args, pageSize, (page-1)*pageSize) + err = m.QueryRowsNoCacheCtx(ctx, &list, query, args...) + if err != nil { + return nil, 0, err + } + + return list, total, nil +} diff --git a/model/sysusermodel_gen.go b/model/sysusermodel_gen.go new file mode 100755 index 0000000..ae836de --- /dev/null +++ b/model/sysusermodel_gen.go @@ -0,0 +1,184 @@ +// Code generated by goctl. DO NOT EDIT. +// versions: +// goctl version: 1.9.2 + +package model + +import ( + "context" + "database/sql" + "fmt" + "strings" + "time" + + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlc" + "github.com/zeromicro/go-zero/core/stores/sqlx" + "github.com/zeromicro/go-zero/core/stringx" +) + +var ( + sysUserFieldNames = builder.RawFieldNames(&SysUser{}) + sysUserRows = strings.Join(sysUserFieldNames, ",") + sysUserRowsExpectAutoSet = strings.Join(stringx.Remove(sysUserFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") + sysUserRowsWithPlaceHolder = strings.Join(stringx.Remove(sysUserFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" + + cacheSysUserIdPrefix = "cache:sysUser:id:" + cacheSysUserUserIdPrefix = "cache:sysUser:userId:" + cacheSysUserUsernamePrefix = "cache:sysUser:username:" +) + +type ( + sysUserModel interface { + Insert(ctx context.Context, data *SysUser) (sql.Result, error) + FindOne(ctx context.Context, id int64) (*SysUser, error) + FindOneByUserId(ctx context.Context, userId string) (*SysUser, error) + FindOneByUsername(ctx context.Context, username string) (*SysUser, error) + Update(ctx context.Context, data *SysUser) error + Delete(ctx context.Context, id int64) error + } + + defaultSysUserModel struct { + sqlc.CachedConn + table string + } + + SysUser struct { + Id int64 `db:"id"` + UserId string `db:"user_id"` + Username string `db:"username"` + Password string `db:"password"` + Salt string `db:"salt"` + RealName string `db:"real_name"` + Phone string `db:"phone"` + Email string `db:"email"` + Avatar string `db:"avatar"` + Status int64 `db:"status"` // 1:enabled 0:disabled + LastLoginTime sql.NullTime `db:"last_login_time"` + LastLoginIp string `db:"last_login_ip"` + CreatedAt time.Time `db:"created_at"` + UpdatedAt time.Time `db:"updated_at"` + DeletedAt sql.NullTime `db:"deleted_at"` + } +) + +func newSysUserModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultSysUserModel { + return &defaultSysUserModel{ + CachedConn: sqlc.NewConn(conn, c, opts...), + table: "`sys_user`", + } +} + +func (m *defaultSysUserModel) Delete(ctx context.Context, id int64) error { + data, err := m.FindOne(ctx, id) + if err != nil { + return err + } + + sysUserIdKey := fmt.Sprintf("%s%v", cacheSysUserIdPrefix, id) + sysUserUserIdKey := fmt.Sprintf("%s%v", cacheSysUserUserIdPrefix, data.UserId) + sysUserUsernameKey := fmt.Sprintf("%s%v", cacheSysUserUsernamePrefix, data.Username) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("delete from %s where `id` = ?", m.table) + return conn.ExecCtx(ctx, query, id) + }, sysUserIdKey, sysUserUserIdKey, sysUserUsernameKey) + return err +} + +func (m *defaultSysUserModel) FindOne(ctx context.Context, id int64) (*SysUser, error) { + sysUserIdKey := fmt.Sprintf("%s%v", cacheSysUserIdPrefix, id) + var resp SysUser + err := m.QueryRowCtx(ctx, &resp, sysUserIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", sysUserRows, m.table) + return conn.QueryRowCtx(ctx, v, query, id) + }) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultSysUserModel) FindOneByUserId(ctx context.Context, userId string) (*SysUser, error) { + sysUserUserIdKey := fmt.Sprintf("%s%v", cacheSysUserUserIdPrefix, userId) + var resp SysUser + err := m.QueryRowIndexCtx(ctx, &resp, sysUserUserIdKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `user_id` = ? limit 1", sysUserRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, userId); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultSysUserModel) FindOneByUsername(ctx context.Context, username string) (*SysUser, error) { + sysUserUsernameKey := fmt.Sprintf("%s%v", cacheSysUserUsernamePrefix, username) + var resp SysUser + err := m.QueryRowIndexCtx(ctx, &resp, sysUserUsernameKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `username` = ? limit 1", sysUserRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, username); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultSysUserModel) Insert(ctx context.Context, data *SysUser) (sql.Result, error) { + sysUserIdKey := fmt.Sprintf("%s%v", cacheSysUserIdPrefix, data.Id) + sysUserUserIdKey := fmt.Sprintf("%s%v", cacheSysUserUserIdPrefix, data.UserId) + sysUserUsernameKey := fmt.Sprintf("%s%v", cacheSysUserUsernamePrefix, data.Username) + ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, sysUserRowsExpectAutoSet) + return conn.ExecCtx(ctx, query, data.UserId, data.Username, data.Password, data.Salt, data.RealName, data.Phone, data.Email, data.Avatar, data.Status, data.LastLoginTime, data.LastLoginIp, data.DeletedAt) + }, sysUserIdKey, sysUserUserIdKey, sysUserUsernameKey) + return ret, err +} + +func (m *defaultSysUserModel) Update(ctx context.Context, newData *SysUser) error { + data, err := m.FindOne(ctx, newData.Id) + if err != nil { + return err + } + + sysUserIdKey := fmt.Sprintf("%s%v", cacheSysUserIdPrefix, data.Id) + sysUserUserIdKey := fmt.Sprintf("%s%v", cacheSysUserUserIdPrefix, data.UserId) + sysUserUsernameKey := fmt.Sprintf("%s%v", cacheSysUserUsernamePrefix, data.Username) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, sysUserRowsWithPlaceHolder) + return conn.ExecCtx(ctx, query, newData.UserId, newData.Username, newData.Password, newData.Salt, newData.RealName, newData.Phone, newData.Email, newData.Avatar, newData.Status, newData.LastLoginTime, newData.LastLoginIp, newData.DeletedAt, newData.Id) + }, sysUserIdKey, sysUserUserIdKey, sysUserUsernameKey) + return err +} + +func (m *defaultSysUserModel) formatPrimary(primary any) string { + return fmt.Sprintf("%s%v", cacheSysUserIdPrefix, primary) +} + +func (m *defaultSysUserModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", sysUserRows, m.table) + return conn.QueryRowCtx(ctx, v, query, primary) +} + +func (m *defaultSysUserModel) tableName() string { + return m.table +} diff --git a/model/sysuserrolemodel.go b/model/sysuserrolemodel.go new file mode 100755 index 0000000..eda941f --- /dev/null +++ b/model/sysuserrolemodel.go @@ -0,0 +1,47 @@ +package model + +import ( + "context" + "fmt" + + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlx" +) + +var _ SysUserRoleModel = (*customSysUserRoleModel)(nil) + +type ( + SysUserRoleModel interface { + sysUserRoleModel + FindByUserId(ctx context.Context, userId string) (*SysUserRole, error) + DeleteByUserId(ctx context.Context, userId string) error + } + + customSysUserRoleModel struct { + *defaultSysUserRoleModel + } +) + +func NewSysUserRoleModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) SysUserRoleModel { + return &customSysUserRoleModel{ + defaultSysUserRoleModel: newSysUserRoleModel(conn, c, opts...), + } +} + +func (m *customSysUserRoleModel) FindByUserId(ctx context.Context, userId string) (*SysUserRole, error) { + var resp SysUserRole + query := fmt.Sprintf("SELECT %s FROM %s WHERE `user_id` = ? LIMIT 1", sysUserRoleRows, m.table) + err := m.QueryRowNoCacheCtx(ctx, &resp, query, userId) + switch err { + case nil: + return &resp, nil + default: + return nil, err + } +} + +func (m *customSysUserRoleModel) DeleteByUserId(ctx context.Context, userId string) error { + query := fmt.Sprintf("DELETE FROM %s WHERE `user_id` = ?", m.table) + _, err := m.ExecNoCacheCtx(ctx, query, userId) + return err +} diff --git a/model/sysuserrolemodel_gen.go b/model/sysuserrolemodel_gen.go new file mode 100755 index 0000000..4cbd5ee --- /dev/null +++ b/model/sysuserrolemodel_gen.go @@ -0,0 +1,146 @@ +// Code generated by goctl. DO NOT EDIT. +// versions: +// goctl version: 1.9.2 + +package model + +import ( + "context" + "database/sql" + "fmt" + "strings" + + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlc" + "github.com/zeromicro/go-zero/core/stores/sqlx" + "github.com/zeromicro/go-zero/core/stringx" +) + +var ( + sysUserRoleFieldNames = builder.RawFieldNames(&SysUserRole{}) + sysUserRoleRows = strings.Join(sysUserRoleFieldNames, ",") + sysUserRoleRowsExpectAutoSet = strings.Join(stringx.Remove(sysUserRoleFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") + sysUserRoleRowsWithPlaceHolder = strings.Join(stringx.Remove(sysUserRoleFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" + + cacheSysUserRoleIdPrefix = "cache:sysUserRole:id:" + cacheSysUserRoleUserIdRoleIdPrefix = "cache:sysUserRole:userId:roleId:" +) + +type ( + sysUserRoleModel interface { + Insert(ctx context.Context, data *SysUserRole) (sql.Result, error) + FindOne(ctx context.Context, id int64) (*SysUserRole, error) + FindOneByUserIdRoleId(ctx context.Context, userId string, roleId string) (*SysUserRole, error) + Update(ctx context.Context, data *SysUserRole) error + Delete(ctx context.Context, id int64) error + } + + defaultSysUserRoleModel struct { + sqlc.CachedConn + table string + } + + SysUserRole struct { + Id int64 `db:"id"` + UserId string `db:"user_id"` + RoleId string `db:"role_id"` + } +) + +func newSysUserRoleModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultSysUserRoleModel { + return &defaultSysUserRoleModel{ + CachedConn: sqlc.NewConn(conn, c, opts...), + table: "`sys_user_role`", + } +} + +func (m *defaultSysUserRoleModel) Delete(ctx context.Context, id int64) error { + data, err := m.FindOne(ctx, id) + if err != nil { + return err + } + + sysUserRoleIdKey := fmt.Sprintf("%s%v", cacheSysUserRoleIdPrefix, id) + sysUserRoleUserIdRoleIdKey := fmt.Sprintf("%s%v:%v", cacheSysUserRoleUserIdRoleIdPrefix, data.UserId, data.RoleId) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("delete from %s where `id` = ?", m.table) + return conn.ExecCtx(ctx, query, id) + }, sysUserRoleIdKey, sysUserRoleUserIdRoleIdKey) + return err +} + +func (m *defaultSysUserRoleModel) FindOne(ctx context.Context, id int64) (*SysUserRole, error) { + sysUserRoleIdKey := fmt.Sprintf("%s%v", cacheSysUserRoleIdPrefix, id) + var resp SysUserRole + err := m.QueryRowCtx(ctx, &resp, sysUserRoleIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", sysUserRoleRows, m.table) + return conn.QueryRowCtx(ctx, v, query, id) + }) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultSysUserRoleModel) FindOneByUserIdRoleId(ctx context.Context, userId string, roleId string) (*SysUserRole, error) { + sysUserRoleUserIdRoleIdKey := fmt.Sprintf("%s%v:%v", cacheSysUserRoleUserIdRoleIdPrefix, userId, roleId) + var resp SysUserRole + err := m.QueryRowIndexCtx(ctx, &resp, sysUserRoleUserIdRoleIdKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `user_id` = ? and `role_id` = ? limit 1", sysUserRoleRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, userId, roleId); err != nil { + return nil, err + } + return resp.Id, nil + }, m.queryPrimary) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultSysUserRoleModel) Insert(ctx context.Context, data *SysUserRole) (sql.Result, error) { + sysUserRoleIdKey := fmt.Sprintf("%s%v", cacheSysUserRoleIdPrefix, data.Id) + sysUserRoleUserIdRoleIdKey := fmt.Sprintf("%s%v:%v", cacheSysUserRoleUserIdRoleIdPrefix, data.UserId, data.RoleId) + ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("insert into %s (%s) values (?, ?)", m.table, sysUserRoleRowsExpectAutoSet) + return conn.ExecCtx(ctx, query, data.UserId, data.RoleId) + }, sysUserRoleIdKey, sysUserRoleUserIdRoleIdKey) + return ret, err +} + +func (m *defaultSysUserRoleModel) Update(ctx context.Context, newData *SysUserRole) error { + data, err := m.FindOne(ctx, newData.Id) + if err != nil { + return err + } + + sysUserRoleIdKey := fmt.Sprintf("%s%v", cacheSysUserRoleIdPrefix, data.Id) + sysUserRoleUserIdRoleIdKey := fmt.Sprintf("%s%v:%v", cacheSysUserRoleUserIdRoleIdPrefix, data.UserId, data.RoleId) + _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { + query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, sysUserRoleRowsWithPlaceHolder) + return conn.ExecCtx(ctx, query, newData.UserId, newData.RoleId, newData.Id) + }, sysUserRoleIdKey, sysUserRoleUserIdRoleIdKey) + return err +} + +func (m *defaultSysUserRoleModel) formatPrimary(primary any) string { + return fmt.Sprintf("%s%v", cacheSysUserRoleIdPrefix, primary) +} + +func (m *defaultSysUserRoleModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", sysUserRoleRows, m.table) + return conn.QueryRowCtx(ctx, v, query, primary) +} + +func (m *defaultSysUserRoleModel) tableName() string { + return m.table +} diff --git a/model/vars.go b/model/vars.go new file mode 100644 index 0000000..69ca814 --- /dev/null +++ b/model/vars.go @@ -0,0 +1,5 @@ +package model + +import "github.com/zeromicro/go-zero/core/stores/sqlx" + +var ErrNotFound = sqlx.ErrNotFound diff --git a/pkg/casbin/casbin.go b/pkg/casbin/casbin.go new file mode 100644 index 0000000..91e77a9 --- /dev/null +++ b/pkg/casbin/casbin.go @@ -0,0 +1,65 @@ +package casbin + +import ( + "strings" + + "github.com/casbin/casbin/v2" + "github.com/casbin/casbin/v2/model" + gormadapter "github.com/casbin/gorm-adapter/v3" + "gorm.io/driver/mysql" + "gorm.io/gorm" +) + +const modelText = ` +[request_definition] +r = sub, obj, act + +[policy_definition] +p = sub, obj, act + +[role_definition] +g = _, _ + +[policy_effect] +e = some(where (p.eft == allow)) + +[matchers] +m = g(r.sub, p.sub) && keyMatch2(r.obj, p.obj) && (r.act == p.act || p.act == "*") +` + +func NewEnforcer(dsn string) (*casbin.Enforcer, error) { + db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{}) + if err != nil { + return nil, err + } + + adapter, err := gormadapter.NewAdapterByDB(db) + if err != nil { + return nil, err + } + + m, err := model.NewModelFromString(modelText) + if err != nil { + return nil, err + } + + enforcer, err := casbin.NewEnforcer(m, adapter) + if err != nil { + return nil, err + } + + if err := enforcer.LoadPolicy(); err != nil { + return nil, err + } + + return enforcer, nil +} + +func CheckPermission(enforcer *casbin.Enforcer, roleKey, path, method string) bool { + method = strings.ToUpper(method) + ok, err := enforcer.Enforce(roleKey, path, method) + if err != nil { + return false + } + return ok +} diff --git a/pkg/ctxdata/ctxdata.go b/pkg/ctxdata/ctxdata.go new file mode 100644 index 0000000..eab89b6 --- /dev/null +++ b/pkg/ctxdata/ctxdata.go @@ -0,0 +1,31 @@ +package ctxdata + +import "context" + +func GetUserId(ctx context.Context) string { + if v, ok := ctx.Value("userId").(string); ok { + return v + } + return "" +} + +func GetRoleKey(ctx context.Context) string { + if v, ok := ctx.Value("roleKey").(string); ok { + return v + } + return "" +} + +func GetPathId(ctx context.Context) string { + if v, ok := ctx.Value("pathId").(string); ok { + return v + } + return "" +} + +func GetPathKey(ctx context.Context) string { + if v, ok := ctx.Value("pathKey").(string); ok { + return v + } + return "" +} diff --git a/pkg/jwt/jwt.go b/pkg/jwt/jwt.go new file mode 100644 index 0000000..3b00e3f --- /dev/null +++ b/pkg/jwt/jwt.go @@ -0,0 +1,41 @@ +package jwt + +import ( + "time" + + "github.com/golang-jwt/jwt/v5" +) + +type Claims struct { + UserId string `json:"userId"` + RoleKey string `json:"roleKey"` + jwt.RegisteredClaims +} + +func GenerateToken(secret string, expire int64, userId, roleKey string) (string, error) { + now := time.Now() + claims := Claims{ + UserId: userId, + RoleKey: roleKey, + RegisteredClaims: jwt.RegisteredClaims{ + ExpiresAt: jwt.NewNumericDate(now.Add(time.Duration(expire) * time.Second)), + IssuedAt: jwt.NewNumericDate(now), + NotBefore: jwt.NewNumericDate(now), + }, + } + token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims) + return token.SignedString([]byte(secret)) +} + +func ParseToken(tokenStr, secret string) (*Claims, error) { + token, err := jwt.ParseWithClaims(tokenStr, &Claims{}, func(t *jwt.Token) (interface{}, error) { + return []byte(secret), nil + }) + if err != nil { + return nil, err + } + if claims, ok := token.Claims.(*Claims); ok && token.Valid { + return claims, nil + } + return nil, jwt.ErrTokenInvalidClaims +} diff --git a/pkg/result/response.go b/pkg/result/response.go new file mode 100644 index 0000000..58c8592 --- /dev/null +++ b/pkg/result/response.go @@ -0,0 +1,44 @@ +package result + +import ( + "context" + "net/http" + + "muyu-apiserver/pkg/xerr" + + "github.com/zeromicro/go-zero/rest/httpx" +) + +type Response struct { + Code int `json:"code"` + Msg string `json:"msg"` + Data interface{} `json:"data,omitempty"` +} + +func Success(ctx context.Context, w http.ResponseWriter, data interface{}) { + httpx.OkJsonCtx(ctx, w, &Response{ + Code: xerr.OK, + Msg: "success", + Data: data, + }) +} + +func Fail(ctx context.Context, w http.ResponseWriter, err error) { + var resp Response + switch e := err.(type) { + case *xerr.BizError: + resp.Code = e.Code + resp.Msg = e.Msg + default: + resp.Code = xerr.ServerError + resp.Msg = err.Error() + } + httpx.OkJsonCtx(ctx, w, &resp) +} + +func ParamError(ctx context.Context, w http.ResponseWriter, err error) { + httpx.OkJsonCtx(ctx, w, &Response{ + Code: xerr.ParamError, + Msg: err.Error(), + }) +} diff --git a/pkg/uid/uid.go b/pkg/uid/uid.go new file mode 100644 index 0000000..e12be7c --- /dev/null +++ b/pkg/uid/uid.go @@ -0,0 +1,12 @@ +package uid + +import ( + "crypto/rand" + "encoding/hex" +) + +func Generate() string { + b := make([]byte, 16) + _, _ = rand.Read(b) + return hex.EncodeToString(b) +} diff --git a/pkg/xerr/errcode.go b/pkg/xerr/errcode.go new file mode 100644 index 0000000..c3fd100 --- /dev/null +++ b/pkg/xerr/errcode.go @@ -0,0 +1,38 @@ +package xerr + +const ( + OK = 0 + ServerError = 1001 + ParamError = 1002 + TokenExpired = 1003 + TokenInvalid = 1004 + Unauthorized = 1005 + Forbidden = 1006 + RecordNotFound = 1007 + RecordDuplicate = 1008 + PasswordError = 1009 + ImportError = 1010 + OperationForbidden = 1011 +) + +var codeText = map[int]string{ + OK: "success", + ServerError: "internal server error", + ParamError: "invalid parameters", + TokenExpired: "token expired", + TokenInvalid: "invalid token", + Unauthorized: "unauthorized", + Forbidden: "access denied", + RecordNotFound: "record not found", + RecordDuplicate: "record already exists", + PasswordError: "incorrect password", + ImportError: "import failed", + OperationForbidden: "operation not allowed", +} + +func ErrMsg(code int) string { + if msg, ok := codeText[code]; ok { + return msg + } + return "unknown error" +} diff --git a/pkg/xerr/errors.go b/pkg/xerr/errors.go new file mode 100644 index 0000000..ade0535 --- /dev/null +++ b/pkg/xerr/errors.go @@ -0,0 +1,24 @@ +package xerr + +import "fmt" + +type BizError struct { + Code int `json:"code"` + Msg string `json:"msg"` +} + +func (e *BizError) Error() string { + return fmt.Sprintf("code: %d, msg: %s", e.Code, e.Msg) +} + +func New(code int) *BizError { + return &BizError{Code: code, Msg: ErrMsg(code)} +} + +func NewMsg(code int, msg string) *BizError { + return &BizError{Code: code, Msg: msg} +} + +func NewServerError(msg string) *BizError { + return &BizError{Code: ServerError, Msg: msg} +} diff --git a/rpc/inventory/etc/inventory.yaml b/rpc/inventory/etc/inventory.yaml new file mode 100644 index 0000000..21038af --- /dev/null +++ b/rpc/inventory/etc/inventory.yaml @@ -0,0 +1,17 @@ +Name: inventory.rpc +ListenOn: 0.0.0.0:9002 + +Etcd: + Hosts: + - 127.0.0.1:2379 + Key: inventory.rpc + +DataSource: root:muyu2026@tcp(127.0.0.1:3306)/muyu_wms?charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai + +Cache: + - Host: 127.0.0.1:6379 + +Log: + ServiceName: inventory-rpc + Mode: console + Level: info diff --git a/rpc/inventory/internal/config/config.go b/rpc/inventory/internal/config/config.go new file mode 100755 index 0000000..fe94d71 --- /dev/null +++ b/rpc/inventory/internal/config/config.go @@ -0,0 +1,12 @@ +package config + +import ( + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/zrpc" +) + +type Config struct { + zrpc.RpcServerConf + DataSource string + Cache cache.CacheConf +} diff --git a/rpc/inventory/internal/logic/approvestockadjustlogic.go b/rpc/inventory/internal/logic/approvestockadjustlogic.go new file mode 100644 index 0000000..32eac3f --- /dev/null +++ b/rpc/inventory/internal/logic/approvestockadjustlogic.go @@ -0,0 +1,75 @@ +package logic + +import ( + "context" + + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type ApproveStockAdjustLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewApproveStockAdjustLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ApproveStockAdjustLogic { + return &ApproveStockAdjustLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ApproveStockAdjustLogic) ApproveStockAdjust(in *pb.ApproveStockAdjustReq) (*pb.Empty, error) { + adjust, err := l.svcCtx.StockAdjustModel.FindOneByAdjustId(l.ctx, in.AdjustId) + if err != nil { + return nil, status.Error(codes.NotFound, "stock adjust not found") + } + + if adjust.Status != 0 { + return nil, status.Error(codes.FailedPrecondition, "stock adjust is not in pending status") + } + + adjust.Approver = in.Approver + + switch in.Action { + case 1: // approve + details, err := l.svcCtx.AdjustDetailModel.FindByAdjustId(l.ctx, in.AdjustId) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + for _, d := range details { + product, err := l.svcCtx.ProductModel.FindOneByProductId(l.ctx, d.ProductId) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to find product %s: %v", d.ProductId, err) + } + + product.StockQuantity = d.AfterQuantity + err = l.svcCtx.ProductModel.Update(l.ctx, product) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to update product %s stock: %v", d.ProductId, err) + } + } + + adjust.Status = 1 + + case 2: // reject + adjust.Status = 2 + + default: + return nil, status.Errorf(codes.InvalidArgument, "unsupported action: %d", in.Action) + } + + err = l.svcCtx.StockAdjustModel.Update(l.ctx, adjust) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.Empty{}, nil +} diff --git a/rpc/inventory/internal/logic/confirmstockchecklogic.go b/rpc/inventory/internal/logic/confirmstockchecklogic.go new file mode 100644 index 0000000..5ecdc8b --- /dev/null +++ b/rpc/inventory/internal/logic/confirmstockchecklogic.go @@ -0,0 +1,63 @@ +package logic + +import ( + "context" + + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type ConfirmStockCheckLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewConfirmStockCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ConfirmStockCheckLogic { + return &ConfirmStockCheckLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ConfirmStockCheckLogic) ConfirmStockCheck(in *pb.ConfirmStockCheckReq) (*pb.Empty, error) { + check, err := l.svcCtx.StockCheckModel.FindOneByCheckId(l.ctx, in.CheckId) + if err != nil { + return nil, status.Error(codes.NotFound, "stock check not found") + } + + if check.Status != 0 && check.Status != 1 { + return nil, status.Error(codes.FailedPrecondition, "stock check cannot be confirmed in current status") + } + + details, err := l.svcCtx.CheckDetailModel.FindByCheckId(l.ctx, in.CheckId) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + for _, d := range details { + product, err := l.svcCtx.ProductModel.FindOneByProductId(l.ctx, d.ProductId) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to find product %s: %v", d.ProductId, err) + } + + product.StockQuantity = d.ActualQuantity + err = l.svcCtx.ProductModel.Update(l.ctx, product) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to update product %s stock: %v", d.ProductId, err) + } + } + + check.Status = 2 + err = l.svcCtx.StockCheckModel.Update(l.ctx, check) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.Empty{}, nil +} diff --git a/rpc/inventory/internal/logic/createproductlogic.go b/rpc/inventory/internal/logic/createproductlogic.go new file mode 100644 index 0000000..3ca370f --- /dev/null +++ b/rpc/inventory/internal/logic/createproductlogic.go @@ -0,0 +1,61 @@ +package logic + +import ( + "context" + "database/sql" + "strconv" + + "muyu-apiserver/model" + "muyu-apiserver/pkg/uid" + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type CreateProductLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreateProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateProductLogic { + return &CreateProductLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *CreateProductLogic) CreateProduct(in *pb.CreateProductReq) (*pb.IdResp, error) { + productId := uid.Generate() + + stockQuantity, _ := strconv.ParseFloat(in.StockQuantity, 64) + costPrice, _ := strconv.ParseFloat(in.CostPrice, 64) + salesPrice, _ := strconv.ParseFloat(in.SalesPrice, 64) + + product := &model.InvProduct{ + ProductId: productId, + ProductName: in.ProductName, + ImageUrl: in.ImageUrl, + Spec: in.Spec, + Color: in.Color, + UnitPieces: in.UnitPieces, + UnitRolls: in.UnitRolls, + StockQuantity: stockQuantity, + Location: in.Location, + CostPrice: costPrice, + SalesPrice: salesPrice, + Remark: sql.NullString{String: in.Remark, Valid: in.Remark != ""}, + Status: 1, + } + + _, err := l.svcCtx.ProductModel.Insert(l.ctx, product) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.IdResp{Id: productId}, nil +} diff --git a/rpc/inventory/internal/logic/createstockadjustlogic.go b/rpc/inventory/internal/logic/createstockadjustlogic.go new file mode 100644 index 0000000..7805a84 --- /dev/null +++ b/rpc/inventory/internal/logic/createstockadjustlogic.go @@ -0,0 +1,84 @@ +package logic + +import ( + "context" + "database/sql" + "strconv" + "time" + + "muyu-apiserver/model" + "muyu-apiserver/pkg/uid" + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type CreateStockAdjustLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreateStockAdjustLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateStockAdjustLogic { + return &CreateStockAdjustLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *CreateStockAdjustLogic) CreateStockAdjust(in *pb.CreateStockAdjustReq) (*pb.IdResp, error) { + adjustId := uid.Generate() + adjustNo := generateNo("TZ") + + adjustDate, err := time.Parse("2006-01-02", in.AdjustDate) + if err != nil { + return nil, status.Error(codes.InvalidArgument, "invalid adjust_date format, expected YYYY-MM-DD") + } + + adjust := &model.InvStockAdjust{ + AdjustId: adjustId, + AdjustNo: adjustNo, + AdjustDate: adjustDate, + AdjustReason: in.AdjustReason, + Operator: in.Operator, + Status: 0, + Remark: sql.NullString{String: in.Remark, Valid: in.Remark != ""}, + } + + _, err = l.svcCtx.StockAdjustModel.Insert(l.ctx, adjust) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + details := make([]*model.InvStockAdjustDetail, 0, len(in.Details)) + for _, d := range in.Details { + product, err := l.svcCtx.ProductModel.FindOneByProductId(l.ctx, d.ProductId) + if err != nil { + return nil, status.Errorf(codes.NotFound, "product %s not found", d.ProductId) + } + + adjustQty, _ := strconv.ParseFloat(d.AdjustQuantity, 64) + afterQty := product.StockQuantity + adjustQty + + details = append(details, &model.InvStockAdjustDetail{ + DetailId: uid.Generate(), + AdjustId: adjustId, + ProductId: d.ProductId, + BeforeQuantity: product.StockQuantity, + AdjustQuantity: adjustQty, + AfterQuantity: afterQty, + Remark: sql.NullString{String: d.Remark, Valid: d.Remark != ""}, + }) + } + + err = l.svcCtx.AdjustDetailModel.BatchInsert(l.ctx, details) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.IdResp{Id: adjustId}, nil +} diff --git a/rpc/inventory/internal/logic/createstockchecklogic.go b/rpc/inventory/internal/logic/createstockchecklogic.go new file mode 100644 index 0000000..83c4e3a --- /dev/null +++ b/rpc/inventory/internal/logic/createstockchecklogic.go @@ -0,0 +1,91 @@ +package logic + +import ( + "context" + "database/sql" + "fmt" + "strconv" + "time" + + "muyu-apiserver/model" + "muyu-apiserver/pkg/uid" + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type CreateStockCheckLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreateStockCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateStockCheckLogic { + return &CreateStockCheckLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func generateNo(prefix string) string { + now := time.Now() + return fmt.Sprintf("%s%s%04d", prefix, now.Format("20060102"), now.UnixNano()%10000) +} + +func (l *CreateStockCheckLogic) CreateStockCheck(in *pb.CreateStockCheckReq) (*pb.IdResp, error) { + checkId := uid.Generate() + checkNo := generateNo("PD") + + checkDate, err := time.Parse("2006-01-02", in.CheckDate) + if err != nil { + return nil, status.Error(codes.InvalidArgument, "invalid check_date format, expected YYYY-MM-DD") + } + + check := &model.InvStockCheck{ + CheckId: checkId, + CheckNo: checkNo, + CheckDate: checkDate, + Checker: in.Checker, + Status: 0, + Remark: sql.NullString{String: in.Remark, Valid: in.Remark != ""}, + } + + _, err = l.svcCtx.StockCheckModel.Insert(l.ctx, check) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + details := make([]*model.InvStockCheckDetail, 0, len(in.Details)) + for _, d := range in.Details { + product, err := l.svcCtx.ProductModel.FindOneByProductId(l.ctx, d.ProductId) + if err != nil { + return nil, status.Errorf(codes.NotFound, "product %s not found", d.ProductId) + } + + actualQty, _ := strconv.ParseFloat(d.ActualQuantity, 64) + diffQty := actualQty - product.StockQuantity + diffAmount := diffQty * product.CostPrice + + details = append(details, &model.InvStockCheckDetail{ + DetailId: uid.Generate(), + CheckId: checkId, + ProductId: d.ProductId, + SystemQuantity: product.StockQuantity, + ActualQuantity: actualQty, + DiffQuantity: diffQty, + DiffAmount: diffAmount, + Remark: sql.NullString{String: d.Remark, Valid: d.Remark != ""}, + }) + } + + err = l.svcCtx.CheckDetailModel.BatchInsert(l.ctx, details) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.IdResp{Id: checkId}, nil +} diff --git a/rpc/inventory/internal/logic/deleteproductlogic.go b/rpc/inventory/internal/logic/deleteproductlogic.go new file mode 100644 index 0000000..908bf55 --- /dev/null +++ b/rpc/inventory/internal/logic/deleteproductlogic.go @@ -0,0 +1,45 @@ +package logic + +import ( + "context" + "database/sql" + "time" + + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type DeleteProductLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewDeleteProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteProductLogic { + return &DeleteProductLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *DeleteProductLogic) DeleteProduct(in *pb.DeleteProductReq) (*pb.Empty, error) { + product, err := l.svcCtx.ProductModel.FindOneByProductId(l.ctx, in.ProductId) + if err != nil { + return nil, status.Error(codes.NotFound, "product not found") + } + + now := time.Now() + product.DeletedAt = sql.NullTime{Time: now, Valid: true} + + err = l.svcCtx.ProductModel.Update(l.ctx, product) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.Empty{}, nil +} diff --git a/rpc/inventory/internal/logic/getproductlogic.go b/rpc/inventory/internal/logic/getproductlogic.go new file mode 100644 index 0000000..9eb2439 --- /dev/null +++ b/rpc/inventory/internal/logic/getproductlogic.go @@ -0,0 +1,52 @@ +package logic + +import ( + "context" + "fmt" + + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type GetProductLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProductLogic { + return &GetProductLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetProductLogic) GetProduct(in *pb.GetProductReq) (*pb.ProductInfo, error) { + product, err := l.svcCtx.ProductModel.FindOneByProductId(l.ctx, in.ProductId) + if err != nil { + return nil, status.Error(codes.NotFound, "product not found") + } + + return &pb.ProductInfo{ + ProductId: product.ProductId, + ProductName: product.ProductName, + ImageUrl: product.ImageUrl, + Spec: product.Spec, + Color: product.Color, + UnitPieces: product.UnitPieces, + UnitRolls: product.UnitRolls, + StockQuantity: fmt.Sprintf("%.2f", product.StockQuantity), + Location: product.Location, + CostPrice: fmt.Sprintf("%.2f", product.CostPrice), + SalesPrice: fmt.Sprintf("%.2f", product.SalesPrice), + Remark: product.Remark.String, + Status: product.Status, + CreatedAt: product.CreatedAt.Format("2006-01-02 15:04:05"), + UpdatedAt: product.UpdatedAt.Format("2006-01-02 15:04:05"), + }, nil +} diff --git a/rpc/inventory/internal/logic/getstockadjustlogic.go b/rpc/inventory/internal/logic/getstockadjustlogic.go new file mode 100644 index 0000000..194b19f --- /dev/null +++ b/rpc/inventory/internal/logic/getstockadjustlogic.go @@ -0,0 +1,73 @@ +package logic + +import ( + "context" + "fmt" + + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type GetStockAdjustLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetStockAdjustLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetStockAdjustLogic { + return &GetStockAdjustLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetStockAdjustLogic) GetStockAdjust(in *pb.GetStockAdjustReq) (*pb.StockAdjustInfo, error) { + adjust, err := l.svcCtx.StockAdjustModel.FindOneByAdjustId(l.ctx, in.AdjustId) + if err != nil { + return nil, status.Error(codes.NotFound, "stock adjust not found") + } + + details, err := l.svcCtx.AdjustDetailModel.FindByAdjustId(l.ctx, in.AdjustId) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + pbDetails := make([]*pb.StockAdjustDetailInfo, 0, len(details)) + for _, d := range details { + productName := "" + product, err := l.svcCtx.ProductModel.FindOneByProductId(l.ctx, d.ProductId) + if err == nil { + productName = product.ProductName + } + + pbDetails = append(pbDetails, &pb.StockAdjustDetailInfo{ + DetailId: d.DetailId, + AdjustId: d.AdjustId, + ProductId: d.ProductId, + ProductName: productName, + BeforeQuantity: fmt.Sprintf("%.2f", d.BeforeQuantity), + AdjustQuantity: fmt.Sprintf("%.2f", d.AdjustQuantity), + AfterQuantity: fmt.Sprintf("%.2f", d.AfterQuantity), + Remark: d.Remark.String, + }) + } + + return &pb.StockAdjustInfo{ + AdjustId: adjust.AdjustId, + AdjustNo: adjust.AdjustNo, + AdjustDate: adjust.AdjustDate.Format("2006-01-02"), + AdjustReason: adjust.AdjustReason, + Operator: adjust.Operator, + Approver: adjust.Approver, + Status: adjust.Status, + Remark: adjust.Remark.String, + CreatedAt: adjust.CreatedAt.Format("2006-01-02 15:04:05"), + UpdatedAt: adjust.UpdatedAt.Format("2006-01-02 15:04:05"), + Details: pbDetails, + }, nil +} diff --git a/rpc/inventory/internal/logic/getstockchecklogic.go b/rpc/inventory/internal/logic/getstockchecklogic.go new file mode 100644 index 0000000..a17b147 --- /dev/null +++ b/rpc/inventory/internal/logic/getstockchecklogic.go @@ -0,0 +1,72 @@ +package logic + +import ( + "context" + "fmt" + + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type GetStockCheckLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetStockCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetStockCheckLogic { + return &GetStockCheckLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetStockCheckLogic) GetStockCheck(in *pb.GetStockCheckReq) (*pb.StockCheckInfo, error) { + check, err := l.svcCtx.StockCheckModel.FindOneByCheckId(l.ctx, in.CheckId) + if err != nil { + return nil, status.Error(codes.NotFound, "stock check not found") + } + + details, err := l.svcCtx.CheckDetailModel.FindByCheckId(l.ctx, in.CheckId) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + pbDetails := make([]*pb.StockCheckDetailInfo, 0, len(details)) + for _, d := range details { + productName := "" + product, err := l.svcCtx.ProductModel.FindOneByProductId(l.ctx, d.ProductId) + if err == nil { + productName = product.ProductName + } + + pbDetails = append(pbDetails, &pb.StockCheckDetailInfo{ + DetailId: d.DetailId, + CheckId: d.CheckId, + ProductId: d.ProductId, + ProductName: productName, + SystemQuantity: fmt.Sprintf("%.2f", d.SystemQuantity), + ActualQuantity: fmt.Sprintf("%.2f", d.ActualQuantity), + DiffQuantity: fmt.Sprintf("%.2f", d.DiffQuantity), + DiffAmount: fmt.Sprintf("%.2f", d.DiffAmount), + Remark: d.Remark.String, + }) + } + + return &pb.StockCheckInfo{ + CheckId: check.CheckId, + CheckNo: check.CheckNo, + CheckDate: check.CheckDate.Format("2006-01-02"), + Checker: check.Checker, + Status: check.Status, + Remark: check.Remark.String, + CreatedAt: check.CreatedAt.Format("2006-01-02 15:04:05"), + UpdatedAt: check.UpdatedAt.Format("2006-01-02 15:04:05"), + Details: pbDetails, + }, nil +} diff --git a/rpc/inventory/internal/logic/getstockgrouplogic.go b/rpc/inventory/internal/logic/getstockgrouplogic.go new file mode 100644 index 0000000..cc7cd63 --- /dev/null +++ b/rpc/inventory/internal/logic/getstockgrouplogic.go @@ -0,0 +1,56 @@ +package logic + +import ( + "context" + "fmt" + + "muyu-apiserver/model" + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type GetStockGroupLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetStockGroupLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetStockGroupLogic { + return &GetStockGroupLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetStockGroupLogic) GetStockGroup(in *pb.StockGroupReq) (*pb.StockGroupResp, error) { + var list []model.StockGroupResult + var err error + + switch in.GroupBy { + case "color": + list, err = l.svcCtx.ProductModel.FindGroupByColor(l.ctx) + case "location": + list, err = l.svcCtx.ProductModel.FindGroupByLocation(l.ctx) + default: + return nil, status.Errorf(codes.InvalidArgument, "unsupported group_by: %s", in.GroupBy) + } + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + pbList := make([]*pb.StockGroupItem, 0, len(list)) + for _, item := range list { + pbList = append(pbList, &pb.StockGroupItem{ + Name: item.Name, + Count: item.Count, + Quantity: fmt.Sprintf("%.2f", item.Quantity), + }) + } + + return &pb.StockGroupResp{List: pbList}, nil +} diff --git a/rpc/inventory/internal/logic/getstocksummarylogic.go b/rpc/inventory/internal/logic/getstocksummarylogic.go new file mode 100644 index 0000000..0f2ee05 --- /dev/null +++ b/rpc/inventory/internal/logic/getstocksummarylogic.go @@ -0,0 +1,42 @@ +package logic + +import ( + "context" + "fmt" + + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type GetStockSummaryLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetStockSummaryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetStockSummaryLogic { + return &GetStockSummaryLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetStockSummaryLogic) GetStockSummary(in *pb.StockSummaryReq) (*pb.StockSummaryResp, error) { + productCount, totalPieces, totalRolls, totalCostValue, totalSalesValue, err := l.svcCtx.ProductModel.FindStockSummary(l.ctx) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.StockSummaryResp{ + ProductCount: productCount, + TotalPieces: totalPieces, + TotalRolls: totalRolls, + TotalCostValue: fmt.Sprintf("%.2f", totalCostValue), + TotalSalesValue: fmt.Sprintf("%.2f", totalSalesValue), + }, nil +} diff --git a/rpc/inventory/internal/logic/importproductslogic.go b/rpc/inventory/internal/logic/importproductslogic.go new file mode 100644 index 0000000..acbf5ee --- /dev/null +++ b/rpc/inventory/internal/logic/importproductslogic.go @@ -0,0 +1,95 @@ +package logic + +import ( + "context" + "database/sql" + "fmt" + "strconv" + "strings" + + "muyu-apiserver/model" + "muyu-apiserver/pkg/uid" + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type ImportProductsLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewImportProductsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ImportProductsLogic { + return &ImportProductsLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ImportProductsLogic) ImportProducts(in *pb.ImportProductReq) (*pb.ImportProductResp, error) { + var successCount, failCount int64 + var errMsgs []string + + for i, p := range in.Products { + productId := uid.Generate() + stockQuantity, _ := strconv.ParseFloat(p.StockQuantity, 64) + costPrice, _ := strconv.ParseFloat(p.CostPrice, 64) + salesPrice, _ := strconv.ParseFloat(p.SalesPrice, 64) + + product := &model.InvProduct{ + ProductId: productId, + ProductName: p.ProductName, + ImageUrl: p.ImageUrl, + Spec: p.Spec, + Color: p.Color, + UnitPieces: p.UnitPieces, + UnitRolls: p.UnitRolls, + StockQuantity: stockQuantity, + Location: p.Location, + CostPrice: costPrice, + SalesPrice: salesPrice, + Remark: sql.NullString{String: p.Remark, Valid: p.Remark != ""}, + Status: 1, + } + + _, err := l.svcCtx.ProductModel.Insert(l.ctx, product) + if err != nil { + failCount++ + errMsgs = append(errMsgs, fmt.Sprintf("row %d: %s", i+1, err.Error())) + } else { + successCount++ + } + } + + totalCount := int64(len(in.Products)) + importId := uid.Generate() + errorMsg := strings.Join(errMsgs, "; ") + + importLog := &model.InvStockImportLog{ + ImportId: importId, + FileName: in.FileName, + TotalCount: totalCount, + SuccessCount: successCount, + FailCount: failCount, + ErrorMsg: sql.NullString{String: errorMsg, Valid: errorMsg != ""}, + Operator: in.Operator, + } + + _, err := l.svcCtx.ImportLogModel.Insert(l.ctx, importLog) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.ImportProductResp{ + TotalCount: totalCount, + SuccessCount: successCount, + FailCount: failCount, + ErrorMsg: errorMsg, + ImportId: importId, + }, nil +} diff --git a/rpc/inventory/internal/logic/listimportloglogic.go b/rpc/inventory/internal/logic/listimportloglogic.go new file mode 100644 index 0000000..f07786b --- /dev/null +++ b/rpc/inventory/internal/logic/listimportloglogic.go @@ -0,0 +1,52 @@ +package logic + +import ( + "context" + + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type ListImportLogLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewListImportLogLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListImportLogLogic { + return &ListImportLogLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ListImportLogLogic) ListImportLog(in *pb.ListImportLogReq) (*pb.ListImportLogResp, error) { + list, total, err := l.svcCtx.ImportLogModel.FindList(l.ctx, in.Page, in.PageSize) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + pbList := make([]*pb.ImportLogInfo, 0, len(list)) + for _, log := range list { + pbList = append(pbList, &pb.ImportLogInfo{ + ImportId: log.ImportId, + FileName: log.FileName, + TotalCount: log.TotalCount, + SuccessCount: log.SuccessCount, + FailCount: log.FailCount, + ErrorMsg: log.ErrorMsg.String, + Operator: log.Operator, + CreatedAt: log.CreatedAt.Format("2006-01-02 15:04:05"), + }) + } + + return &pb.ListImportLogResp{ + Total: total, + List: pbList, + }, nil +} diff --git a/rpc/inventory/internal/logic/listproductlogic.go b/rpc/inventory/internal/logic/listproductlogic.go new file mode 100644 index 0000000..06d1202 --- /dev/null +++ b/rpc/inventory/internal/logic/listproductlogic.go @@ -0,0 +1,60 @@ +package logic + +import ( + "context" + "fmt" + + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type ListProductLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewListProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListProductLogic { + return &ListProductLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ListProductLogic) ListProduct(in *pb.ListProductReq) (*pb.ListProductResp, error) { + list, total, err := l.svcCtx.ProductModel.FindList(l.ctx, in.Page, in.PageSize, in.ProductName, in.Spec, in.Color, in.Location, in.Status) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + pbList := make([]*pb.ProductInfo, 0, len(list)) + for _, p := range list { + pbList = append(pbList, &pb.ProductInfo{ + ProductId: p.ProductId, + ProductName: p.ProductName, + ImageUrl: p.ImageUrl, + Spec: p.Spec, + Color: p.Color, + UnitPieces: p.UnitPieces, + UnitRolls: p.UnitRolls, + StockQuantity: fmt.Sprintf("%.2f", p.StockQuantity), + Location: p.Location, + CostPrice: fmt.Sprintf("%.2f", p.CostPrice), + SalesPrice: fmt.Sprintf("%.2f", p.SalesPrice), + Remark: p.Remark.String, + Status: p.Status, + CreatedAt: p.CreatedAt.Format("2006-01-02 15:04:05"), + UpdatedAt: p.UpdatedAt.Format("2006-01-02 15:04:05"), + }) + } + + return &pb.ListProductResp{ + Total: total, + List: pbList, + }, nil +} diff --git a/rpc/inventory/internal/logic/liststockadjustlogic.go b/rpc/inventory/internal/logic/liststockadjustlogic.go new file mode 100644 index 0000000..224252c --- /dev/null +++ b/rpc/inventory/internal/logic/liststockadjustlogic.go @@ -0,0 +1,54 @@ +package logic + +import ( + "context" + + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type ListStockAdjustLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewListStockAdjustLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListStockAdjustLogic { + return &ListStockAdjustLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ListStockAdjustLogic) ListStockAdjust(in *pb.ListStockAdjustReq) (*pb.ListStockAdjustResp, error) { + list, total, err := l.svcCtx.StockAdjustModel.FindList(l.ctx, in.Page, in.PageSize, in.AdjustNo, in.AdjustReason, in.Status, in.StartDate, in.EndDate) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + pbList := make([]*pb.StockAdjustInfo, 0, len(list)) + for _, a := range list { + pbList = append(pbList, &pb.StockAdjustInfo{ + AdjustId: a.AdjustId, + AdjustNo: a.AdjustNo, + AdjustDate: a.AdjustDate.Format("2006-01-02"), + AdjustReason: a.AdjustReason, + Operator: a.Operator, + Approver: a.Approver, + Status: a.Status, + Remark: a.Remark.String, + CreatedAt: a.CreatedAt.Format("2006-01-02 15:04:05"), + UpdatedAt: a.UpdatedAt.Format("2006-01-02 15:04:05"), + }) + } + + return &pb.ListStockAdjustResp{ + Total: total, + List: pbList, + }, nil +} diff --git a/rpc/inventory/internal/logic/liststockchecklogic.go b/rpc/inventory/internal/logic/liststockchecklogic.go new file mode 100644 index 0000000..a8102de --- /dev/null +++ b/rpc/inventory/internal/logic/liststockchecklogic.go @@ -0,0 +1,52 @@ +package logic + +import ( + "context" + + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type ListStockCheckLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewListStockCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListStockCheckLogic { + return &ListStockCheckLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ListStockCheckLogic) ListStockCheck(in *pb.ListStockCheckReq) (*pb.ListStockCheckResp, error) { + list, total, err := l.svcCtx.StockCheckModel.FindList(l.ctx, in.Page, in.PageSize, in.CheckNo, in.Status, in.StartDate, in.EndDate) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + pbList := make([]*pb.StockCheckInfo, 0, len(list)) + for _, c := range list { + pbList = append(pbList, &pb.StockCheckInfo{ + CheckId: c.CheckId, + CheckNo: c.CheckNo, + CheckDate: c.CheckDate.Format("2006-01-02"), + Checker: c.Checker, + Status: c.Status, + Remark: c.Remark.String, + CreatedAt: c.CreatedAt.Format("2006-01-02 15:04:05"), + UpdatedAt: c.UpdatedAt.Format("2006-01-02 15:04:05"), + }) + } + + return &pb.ListStockCheckResp{ + Total: total, + List: pbList, + }, nil +} diff --git a/rpc/inventory/internal/logic/updateproductlogic.go b/rpc/inventory/internal/logic/updateproductlogic.go new file mode 100644 index 0000000..0cbbad9 --- /dev/null +++ b/rpc/inventory/internal/logic/updateproductlogic.go @@ -0,0 +1,58 @@ +package logic + +import ( + "context" + "database/sql" + "strconv" + + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type UpdateProductLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewUpdateProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateProductLogic { + return &UpdateProductLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *UpdateProductLogic) UpdateProduct(in *pb.UpdateProductReq) (*pb.Empty, error) { + product, err := l.svcCtx.ProductModel.FindOneByProductId(l.ctx, in.ProductId) + if err != nil { + return nil, status.Error(codes.NotFound, "product not found") + } + + stockQuantity, _ := strconv.ParseFloat(in.StockQuantity, 64) + costPrice, _ := strconv.ParseFloat(in.CostPrice, 64) + salesPrice, _ := strconv.ParseFloat(in.SalesPrice, 64) + + product.ProductName = in.ProductName + product.ImageUrl = in.ImageUrl + product.Spec = in.Spec + product.Color = in.Color + product.UnitPieces = in.UnitPieces + product.UnitRolls = in.UnitRolls + product.StockQuantity = stockQuantity + product.Location = in.Location + product.CostPrice = costPrice + product.SalesPrice = salesPrice + product.Remark = sql.NullString{String: in.Remark, Valid: in.Remark != ""} + + err = l.svcCtx.ProductModel.Update(l.ctx, product) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.Empty{}, nil +} diff --git a/rpc/inventory/internal/logic/updatestockchecklogic.go b/rpc/inventory/internal/logic/updatestockchecklogic.go new file mode 100644 index 0000000..e2cc6bc --- /dev/null +++ b/rpc/inventory/internal/logic/updatestockchecklogic.go @@ -0,0 +1,84 @@ +package logic + +import ( + "context" + "database/sql" + "strconv" + + "muyu-apiserver/model" + "muyu-apiserver/pkg/uid" + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type UpdateStockCheckLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewUpdateStockCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateStockCheckLogic { + return &UpdateStockCheckLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *UpdateStockCheckLogic) UpdateStockCheck(in *pb.UpdateStockCheckReq) (*pb.Empty, error) { + check, err := l.svcCtx.StockCheckModel.FindOneByCheckId(l.ctx, in.CheckId) + if err != nil { + return nil, status.Error(codes.NotFound, "stock check not found") + } + + if check.Status == 2 { + return nil, status.Error(codes.FailedPrecondition, "completed stock check cannot be modified") + } + + check.Remark = sql.NullString{String: in.Remark, Valid: in.Remark != ""} + check.Status = 1 + + err = l.svcCtx.StockCheckModel.Update(l.ctx, check) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + err = l.svcCtx.CheckDetailModel.DeleteByCheckId(l.ctx, in.CheckId) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + details := make([]*model.InvStockCheckDetail, 0, len(in.Details)) + for _, d := range in.Details { + product, err := l.svcCtx.ProductModel.FindOneByProductId(l.ctx, d.ProductId) + if err != nil { + return nil, status.Errorf(codes.NotFound, "product %s not found", d.ProductId) + } + + actualQty, _ := strconv.ParseFloat(d.ActualQuantity, 64) + diffQty := actualQty - product.StockQuantity + diffAmount := diffQty * product.CostPrice + + details = append(details, &model.InvStockCheckDetail{ + DetailId: uid.Generate(), + CheckId: in.CheckId, + ProductId: d.ProductId, + SystemQuantity: product.StockQuantity, + ActualQuantity: actualQty, + DiffQuantity: diffQty, + DiffAmount: diffAmount, + Remark: sql.NullString{String: d.Remark, Valid: d.Remark != ""}, + }) + } + + err = l.svcCtx.CheckDetailModel.BatchInsert(l.ctx, details) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.Empty{}, nil +} diff --git a/rpc/inventory/internal/server/inventoryserviceserver.go b/rpc/inventory/internal/server/inventoryserviceserver.go new file mode 100644 index 0000000..276bb60 --- /dev/null +++ b/rpc/inventory/internal/server/inventoryserviceserver.go @@ -0,0 +1,119 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.9.2 +// Source: inventory.proto + +package server + +import ( + "context" + + "muyu-apiserver/rpc/inventory/internal/logic" + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" +) + +type InventoryServiceServer struct { + svcCtx *svc.ServiceContext + pb.UnimplementedInventoryServiceServer +} + +func NewInventoryServiceServer(svcCtx *svc.ServiceContext) *InventoryServiceServer { + return &InventoryServiceServer{ + svcCtx: svcCtx, + } +} + +// Product +func (s *InventoryServiceServer) CreateProduct(ctx context.Context, in *pb.CreateProductReq) (*pb.IdResp, error) { + l := logic.NewCreateProductLogic(ctx, s.svcCtx) + return l.CreateProduct(in) +} + +func (s *InventoryServiceServer) UpdateProduct(ctx context.Context, in *pb.UpdateProductReq) (*pb.Empty, error) { + l := logic.NewUpdateProductLogic(ctx, s.svcCtx) + return l.UpdateProduct(in) +} + +func (s *InventoryServiceServer) DeleteProduct(ctx context.Context, in *pb.DeleteProductReq) (*pb.Empty, error) { + l := logic.NewDeleteProductLogic(ctx, s.svcCtx) + return l.DeleteProduct(in) +} + +func (s *InventoryServiceServer) GetProduct(ctx context.Context, in *pb.GetProductReq) (*pb.ProductInfo, error) { + l := logic.NewGetProductLogic(ctx, s.svcCtx) + return l.GetProduct(in) +} + +func (s *InventoryServiceServer) ListProduct(ctx context.Context, in *pb.ListProductReq) (*pb.ListProductResp, error) { + l := logic.NewListProductLogic(ctx, s.svcCtx) + return l.ListProduct(in) +} + +// Import +func (s *InventoryServiceServer) ImportProducts(ctx context.Context, in *pb.ImportProductReq) (*pb.ImportProductResp, error) { + l := logic.NewImportProductsLogic(ctx, s.svcCtx) + return l.ImportProducts(in) +} + +func (s *InventoryServiceServer) ListImportLog(ctx context.Context, in *pb.ListImportLogReq) (*pb.ListImportLogResp, error) { + l := logic.NewListImportLogLogic(ctx, s.svcCtx) + return l.ListImportLog(in) +} + +// Stock Statistics +func (s *InventoryServiceServer) GetStockSummary(ctx context.Context, in *pb.StockSummaryReq) (*pb.StockSummaryResp, error) { + l := logic.NewGetStockSummaryLogic(ctx, s.svcCtx) + return l.GetStockSummary(in) +} + +func (s *InventoryServiceServer) GetStockGroup(ctx context.Context, in *pb.StockGroupReq) (*pb.StockGroupResp, error) { + l := logic.NewGetStockGroupLogic(ctx, s.svcCtx) + return l.GetStockGroup(in) +} + +// Stock Check +func (s *InventoryServiceServer) CreateStockCheck(ctx context.Context, in *pb.CreateStockCheckReq) (*pb.IdResp, error) { + l := logic.NewCreateStockCheckLogic(ctx, s.svcCtx) + return l.CreateStockCheck(in) +} + +func (s *InventoryServiceServer) UpdateStockCheck(ctx context.Context, in *pb.UpdateStockCheckReq) (*pb.Empty, error) { + l := logic.NewUpdateStockCheckLogic(ctx, s.svcCtx) + return l.UpdateStockCheck(in) +} + +func (s *InventoryServiceServer) ConfirmStockCheck(ctx context.Context, in *pb.ConfirmStockCheckReq) (*pb.Empty, error) { + l := logic.NewConfirmStockCheckLogic(ctx, s.svcCtx) + return l.ConfirmStockCheck(in) +} + +func (s *InventoryServiceServer) GetStockCheck(ctx context.Context, in *pb.GetStockCheckReq) (*pb.StockCheckInfo, error) { + l := logic.NewGetStockCheckLogic(ctx, s.svcCtx) + return l.GetStockCheck(in) +} + +func (s *InventoryServiceServer) ListStockCheck(ctx context.Context, in *pb.ListStockCheckReq) (*pb.ListStockCheckResp, error) { + l := logic.NewListStockCheckLogic(ctx, s.svcCtx) + return l.ListStockCheck(in) +} + +// Stock Adjust +func (s *InventoryServiceServer) CreateStockAdjust(ctx context.Context, in *pb.CreateStockAdjustReq) (*pb.IdResp, error) { + l := logic.NewCreateStockAdjustLogic(ctx, s.svcCtx) + return l.CreateStockAdjust(in) +} + +func (s *InventoryServiceServer) ApproveStockAdjust(ctx context.Context, in *pb.ApproveStockAdjustReq) (*pb.Empty, error) { + l := logic.NewApproveStockAdjustLogic(ctx, s.svcCtx) + return l.ApproveStockAdjust(in) +} + +func (s *InventoryServiceServer) GetStockAdjust(ctx context.Context, in *pb.GetStockAdjustReq) (*pb.StockAdjustInfo, error) { + l := logic.NewGetStockAdjustLogic(ctx, s.svcCtx) + return l.GetStockAdjust(in) +} + +func (s *InventoryServiceServer) ListStockAdjust(ctx context.Context, in *pb.ListStockAdjustReq) (*pb.ListStockAdjustResp, error) { + l := logic.NewListStockAdjustLogic(ctx, s.svcCtx) + return l.ListStockAdjust(in) +} diff --git a/rpc/inventory/internal/svc/servicecontext.go b/rpc/inventory/internal/svc/servicecontext.go new file mode 100644 index 0000000..1073605 --- /dev/null +++ b/rpc/inventory/internal/svc/servicecontext.go @@ -0,0 +1,31 @@ +package svc + +import ( + "muyu-apiserver/model" + "muyu-apiserver/rpc/inventory/internal/config" + + "github.com/zeromicro/go-zero/core/stores/sqlx" +) + +type ServiceContext struct { + Config config.Config + ProductModel model.InvProductModel + ImportLogModel model.InvStockImportLogModel + StockCheckModel model.InvStockCheckModel + CheckDetailModel model.InvStockCheckDetailModel + StockAdjustModel model.InvStockAdjustModel + AdjustDetailModel model.InvStockAdjustDetailModel +} + +func NewServiceContext(c config.Config) *ServiceContext { + conn := sqlx.NewMysql(c.DataSource) + return &ServiceContext{ + Config: c, + ProductModel: model.NewInvProductModel(conn, c.Cache), + ImportLogModel: model.NewInvStockImportLogModel(conn, c.Cache), + StockCheckModel: model.NewInvStockCheckModel(conn, c.Cache), + CheckDetailModel: model.NewInvStockCheckDetailModel(conn, c.Cache), + StockAdjustModel: model.NewInvStockAdjustModel(conn, c.Cache), + AdjustDetailModel: model.NewInvStockAdjustDetailModel(conn, c.Cache), + } +} diff --git a/rpc/inventory/inventory.go b/rpc/inventory/inventory.go new file mode 100644 index 0000000..160eaec --- /dev/null +++ b/rpc/inventory/inventory.go @@ -0,0 +1,39 @@ +package main + +import ( + "flag" + "fmt" + + "muyu-apiserver/rpc/inventory/internal/config" + "muyu-apiserver/rpc/inventory/internal/server" + "muyu-apiserver/rpc/inventory/internal/svc" + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/core/service" + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" +) + +var configFile = flag.String("f", "etc/inventory.yaml", "the config file") + +func main() { + flag.Parse() + + var c config.Config + conf.MustLoad(*configFile, &c) + ctx := svc.NewServiceContext(c) + + s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { + pb.RegisterInventoryServiceServer(grpcServer, server.NewInventoryServiceServer(ctx)) + + if c.Mode == service.DevMode || c.Mode == service.TestMode { + reflection.Register(grpcServer) + } + }) + defer s.Stop() + + fmt.Printf("Starting rpc server at %s...\n", c.ListenOn) + s.Start() +} diff --git a/rpc/inventory/inventory.proto b/rpc/inventory/inventory.proto new file mode 100644 index 0000000..3061201 --- /dev/null +++ b/rpc/inventory/inventory.proto @@ -0,0 +1,314 @@ +syntax = "proto3"; + +package inventory; + +option go_package = "./pb"; + +// ==================== Product ==================== + +message ProductInfo { + string product_id = 1; + string product_name = 2; + string image_url = 3; + string spec = 4; + string color = 5; + int64 unit_pieces = 6; + int64 unit_rolls = 7; + string stock_quantity = 8; + string location = 9; + string cost_price = 10; + string sales_price = 11; + string remark = 12; + int64 status = 13; + string created_at = 14; + string updated_at = 15; +} + +message CreateProductReq { + string product_name = 1; + string image_url = 2; + string spec = 3; + string color = 4; + int64 unit_pieces = 5; + int64 unit_rolls = 6; + string stock_quantity = 7; + string location = 8; + string cost_price = 9; + string sales_price = 10; + string remark = 11; +} + +message UpdateProductReq { + string product_id = 1; + string product_name = 2; + string image_url = 3; + string spec = 4; + string color = 5; + int64 unit_pieces = 6; + int64 unit_rolls = 7; + string stock_quantity = 8; + string location = 9; + string cost_price = 10; + string sales_price = 11; + string remark = 12; +} + +message DeleteProductReq { + string product_id = 1; +} + +message GetProductReq { + string product_id = 1; +} + +message ListProductReq { + int64 page = 1; + int64 page_size = 2; + string product_name = 3; + string spec = 4; + string color = 5; + string location = 6; + int64 status = 7; +} + +message ListProductResp { + int64 total = 1; + repeated ProductInfo list = 2; +} + +// ==================== Stock Import ==================== + +message ImportProductReq { + repeated CreateProductReq products = 1; + string file_name = 2; + string operator = 3; +} + +message ImportProductResp { + int64 total_count = 1; + int64 success_count = 2; + int64 fail_count = 3; + string error_msg = 4; + string import_id = 5; +} + +message ListImportLogReq { + int64 page = 1; + int64 page_size = 2; +} + +message ListImportLogResp { + int64 total = 1; + repeated ImportLogInfo list = 2; +} + +message ImportLogInfo { + string import_id = 1; + string file_name = 2; + int64 total_count = 3; + int64 success_count = 4; + int64 fail_count = 5; + string error_msg = 6; + string operator = 7; + string created_at = 8; +} + +// ==================== Stock Statistics ==================== + +message StockSummaryReq {} + +message StockSummaryResp { + int64 product_count = 1; + int64 total_pieces = 2; + int64 total_rolls = 3; + string total_cost_value = 4; + string total_sales_value = 5; +} + +message StockGroupReq { + string group_by = 1; +} + +message StockGroupItem { + string name = 1; + int64 count = 2; + string quantity = 3; +} + +message StockGroupResp { + repeated StockGroupItem list = 1; +} + +// ==================== Stock Check ==================== + +message StockCheckInfo { + string check_id = 1; + string check_no = 2; + string check_date = 3; + string checker = 4; + int64 status = 5; + string remark = 6; + string created_at = 7; + string updated_at = 8; + repeated StockCheckDetailInfo details = 9; +} + +message StockCheckDetailInfo { + string detail_id = 1; + string check_id = 2; + string product_id = 3; + string product_name = 4; + string system_quantity = 5; + string actual_quantity = 6; + string diff_quantity = 7; + string diff_amount = 8; + string remark = 9; +} + +message CreateStockCheckReq { + string check_date = 1; + string checker = 2; + string remark = 3; + repeated StockCheckDetailReq details = 4; +} + +message StockCheckDetailReq { + string product_id = 1; + string actual_quantity = 2; + string remark = 3; +} + +message UpdateStockCheckReq { + string check_id = 1; + string remark = 2; + repeated StockCheckDetailReq details = 3; +} + +message ConfirmStockCheckReq { + string check_id = 1; + string operator = 2; +} + +message GetStockCheckReq { + string check_id = 1; +} + +message ListStockCheckReq { + int64 page = 1; + int64 page_size = 2; + string check_no = 3; + int64 status = 4; + string start_date = 5; + string end_date = 6; +} + +message ListStockCheckResp { + int64 total = 1; + repeated StockCheckInfo list = 2; +} + +// ==================== Stock Adjust ==================== + +message StockAdjustInfo { + string adjust_id = 1; + string adjust_no = 2; + string adjust_date = 3; + string adjust_reason = 4; + string operator = 5; + string approver = 6; + int64 status = 7; + string remark = 8; + string created_at = 9; + string updated_at = 10; + repeated StockAdjustDetailInfo details = 11; +} + +message StockAdjustDetailInfo { + string detail_id = 1; + string adjust_id = 2; + string product_id = 3; + string product_name = 4; + string before_quantity = 5; + string adjust_quantity = 6; + string after_quantity = 7; + string remark = 8; +} + +message CreateStockAdjustReq { + string adjust_date = 1; + string adjust_reason = 2; + string operator = 3; + string remark = 4; + repeated StockAdjustDetailReq details = 5; +} + +message StockAdjustDetailReq { + string product_id = 1; + string adjust_quantity = 2; + string remark = 3; +} + +message ApproveStockAdjustReq { + string adjust_id = 1; + string approver = 2; + int64 action = 3; +} + +message GetStockAdjustReq { + string adjust_id = 1; +} + +message ListStockAdjustReq { + int64 page = 1; + int64 page_size = 2; + string adjust_no = 3; + string adjust_reason = 4; + int64 status = 5; + string start_date = 6; + string end_date = 7; +} + +message ListStockAdjustResp { + int64 total = 1; + repeated StockAdjustInfo list = 2; +} + +// ==================== Common ==================== + +message IdResp { + string id = 1; +} + +message Empty {} + +// ==================== Service ==================== + +service InventoryService { + // Product + rpc CreateProduct(CreateProductReq) returns (IdResp); + rpc UpdateProduct(UpdateProductReq) returns (Empty); + rpc DeleteProduct(DeleteProductReq) returns (Empty); + rpc GetProduct(GetProductReq) returns (ProductInfo); + rpc ListProduct(ListProductReq) returns (ListProductResp); + + // Import + rpc ImportProducts(ImportProductReq) returns (ImportProductResp); + rpc ListImportLog(ListImportLogReq) returns (ListImportLogResp); + + // Stock Statistics + rpc GetStockSummary(StockSummaryReq) returns (StockSummaryResp); + rpc GetStockGroup(StockGroupReq) returns (StockGroupResp); + + // Stock Check + rpc CreateStockCheck(CreateStockCheckReq) returns (IdResp); + rpc UpdateStockCheck(UpdateStockCheckReq) returns (Empty); + rpc ConfirmStockCheck(ConfirmStockCheckReq) returns (Empty); + rpc GetStockCheck(GetStockCheckReq) returns (StockCheckInfo); + rpc ListStockCheck(ListStockCheckReq) returns (ListStockCheckResp); + + // Stock Adjust + rpc CreateStockAdjust(CreateStockAdjustReq) returns (IdResp); + rpc ApproveStockAdjust(ApproveStockAdjustReq) returns (Empty); + rpc GetStockAdjust(GetStockAdjustReq) returns (StockAdjustInfo); + rpc ListStockAdjust(ListStockAdjustReq) returns (ListStockAdjustResp); +} diff --git a/rpc/inventory/inventoryservice/inventoryservice.go b/rpc/inventory/inventoryservice/inventoryservice.go new file mode 100644 index 0000000..7150d99 --- /dev/null +++ b/rpc/inventory/inventoryservice/inventoryservice.go @@ -0,0 +1,184 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.9.2 +// Source: inventory.proto + +package inventoryservice + +import ( + "context" + + "muyu-apiserver/rpc/inventory/pb" + + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" +) + +type ( + ApproveStockAdjustReq = pb.ApproveStockAdjustReq + ConfirmStockCheckReq = pb.ConfirmStockCheckReq + CreateProductReq = pb.CreateProductReq + CreateStockAdjustReq = pb.CreateStockAdjustReq + CreateStockCheckReq = pb.CreateStockCheckReq + DeleteProductReq = pb.DeleteProductReq + Empty = pb.Empty + GetProductReq = pb.GetProductReq + GetStockAdjustReq = pb.GetStockAdjustReq + GetStockCheckReq = pb.GetStockCheckReq + IdResp = pb.IdResp + ImportLogInfo = pb.ImportLogInfo + ImportProductReq = pb.ImportProductReq + ImportProductResp = pb.ImportProductResp + ListImportLogReq = pb.ListImportLogReq + ListImportLogResp = pb.ListImportLogResp + ListProductReq = pb.ListProductReq + ListProductResp = pb.ListProductResp + ListStockAdjustReq = pb.ListStockAdjustReq + ListStockAdjustResp = pb.ListStockAdjustResp + ListStockCheckReq = pb.ListStockCheckReq + ListStockCheckResp = pb.ListStockCheckResp + ProductInfo = pb.ProductInfo + StockAdjustDetailInfo = pb.StockAdjustDetailInfo + StockAdjustDetailReq = pb.StockAdjustDetailReq + StockAdjustInfo = pb.StockAdjustInfo + StockCheckDetailInfo = pb.StockCheckDetailInfo + StockCheckDetailReq = pb.StockCheckDetailReq + StockCheckInfo = pb.StockCheckInfo + StockGroupItem = pb.StockGroupItem + StockGroupReq = pb.StockGroupReq + StockGroupResp = pb.StockGroupResp + StockSummaryReq = pb.StockSummaryReq + StockSummaryResp = pb.StockSummaryResp + UpdateProductReq = pb.UpdateProductReq + UpdateStockCheckReq = pb.UpdateStockCheckReq + + InventoryService interface { + // Product + CreateProduct(ctx context.Context, in *CreateProductReq, opts ...grpc.CallOption) (*IdResp, error) + UpdateProduct(ctx context.Context, in *UpdateProductReq, opts ...grpc.CallOption) (*Empty, error) + DeleteProduct(ctx context.Context, in *DeleteProductReq, opts ...grpc.CallOption) (*Empty, error) + GetProduct(ctx context.Context, in *GetProductReq, opts ...grpc.CallOption) (*ProductInfo, error) + ListProduct(ctx context.Context, in *ListProductReq, opts ...grpc.CallOption) (*ListProductResp, error) + // Import + ImportProducts(ctx context.Context, in *ImportProductReq, opts ...grpc.CallOption) (*ImportProductResp, error) + ListImportLog(ctx context.Context, in *ListImportLogReq, opts ...grpc.CallOption) (*ListImportLogResp, error) + // Stock Statistics + GetStockSummary(ctx context.Context, in *StockSummaryReq, opts ...grpc.CallOption) (*StockSummaryResp, error) + GetStockGroup(ctx context.Context, in *StockGroupReq, opts ...grpc.CallOption) (*StockGroupResp, error) + // Stock Check + CreateStockCheck(ctx context.Context, in *CreateStockCheckReq, opts ...grpc.CallOption) (*IdResp, error) + UpdateStockCheck(ctx context.Context, in *UpdateStockCheckReq, opts ...grpc.CallOption) (*Empty, error) + ConfirmStockCheck(ctx context.Context, in *ConfirmStockCheckReq, opts ...grpc.CallOption) (*Empty, error) + GetStockCheck(ctx context.Context, in *GetStockCheckReq, opts ...grpc.CallOption) (*StockCheckInfo, error) + ListStockCheck(ctx context.Context, in *ListStockCheckReq, opts ...grpc.CallOption) (*ListStockCheckResp, error) + // Stock Adjust + CreateStockAdjust(ctx context.Context, in *CreateStockAdjustReq, opts ...grpc.CallOption) (*IdResp, error) + ApproveStockAdjust(ctx context.Context, in *ApproveStockAdjustReq, opts ...grpc.CallOption) (*Empty, error) + GetStockAdjust(ctx context.Context, in *GetStockAdjustReq, opts ...grpc.CallOption) (*StockAdjustInfo, error) + ListStockAdjust(ctx context.Context, in *ListStockAdjustReq, opts ...grpc.CallOption) (*ListStockAdjustResp, error) + } + + defaultInventoryService struct { + cli zrpc.Client + } +) + +func NewInventoryService(cli zrpc.Client) InventoryService { + return &defaultInventoryService{ + cli: cli, + } +} + +// Product +func (m *defaultInventoryService) CreateProduct(ctx context.Context, in *CreateProductReq, opts ...grpc.CallOption) (*IdResp, error) { + client := pb.NewInventoryServiceClient(m.cli.Conn()) + return client.CreateProduct(ctx, in, opts...) +} + +func (m *defaultInventoryService) UpdateProduct(ctx context.Context, in *UpdateProductReq, opts ...grpc.CallOption) (*Empty, error) { + client := pb.NewInventoryServiceClient(m.cli.Conn()) + return client.UpdateProduct(ctx, in, opts...) +} + +func (m *defaultInventoryService) DeleteProduct(ctx context.Context, in *DeleteProductReq, opts ...grpc.CallOption) (*Empty, error) { + client := pb.NewInventoryServiceClient(m.cli.Conn()) + return client.DeleteProduct(ctx, in, opts...) +} + +func (m *defaultInventoryService) GetProduct(ctx context.Context, in *GetProductReq, opts ...grpc.CallOption) (*ProductInfo, error) { + client := pb.NewInventoryServiceClient(m.cli.Conn()) + return client.GetProduct(ctx, in, opts...) +} + +func (m *defaultInventoryService) ListProduct(ctx context.Context, in *ListProductReq, opts ...grpc.CallOption) (*ListProductResp, error) { + client := pb.NewInventoryServiceClient(m.cli.Conn()) + return client.ListProduct(ctx, in, opts...) +} + +// Import +func (m *defaultInventoryService) ImportProducts(ctx context.Context, in *ImportProductReq, opts ...grpc.CallOption) (*ImportProductResp, error) { + client := pb.NewInventoryServiceClient(m.cli.Conn()) + return client.ImportProducts(ctx, in, opts...) +} + +func (m *defaultInventoryService) ListImportLog(ctx context.Context, in *ListImportLogReq, opts ...grpc.CallOption) (*ListImportLogResp, error) { + client := pb.NewInventoryServiceClient(m.cli.Conn()) + return client.ListImportLog(ctx, in, opts...) +} + +// Stock Statistics +func (m *defaultInventoryService) GetStockSummary(ctx context.Context, in *StockSummaryReq, opts ...grpc.CallOption) (*StockSummaryResp, error) { + client := pb.NewInventoryServiceClient(m.cli.Conn()) + return client.GetStockSummary(ctx, in, opts...) +} + +func (m *defaultInventoryService) GetStockGroup(ctx context.Context, in *StockGroupReq, opts ...grpc.CallOption) (*StockGroupResp, error) { + client := pb.NewInventoryServiceClient(m.cli.Conn()) + return client.GetStockGroup(ctx, in, opts...) +} + +// Stock Check +func (m *defaultInventoryService) CreateStockCheck(ctx context.Context, in *CreateStockCheckReq, opts ...grpc.CallOption) (*IdResp, error) { + client := pb.NewInventoryServiceClient(m.cli.Conn()) + return client.CreateStockCheck(ctx, in, opts...) +} + +func (m *defaultInventoryService) UpdateStockCheck(ctx context.Context, in *UpdateStockCheckReq, opts ...grpc.CallOption) (*Empty, error) { + client := pb.NewInventoryServiceClient(m.cli.Conn()) + return client.UpdateStockCheck(ctx, in, opts...) +} + +func (m *defaultInventoryService) ConfirmStockCheck(ctx context.Context, in *ConfirmStockCheckReq, opts ...grpc.CallOption) (*Empty, error) { + client := pb.NewInventoryServiceClient(m.cli.Conn()) + return client.ConfirmStockCheck(ctx, in, opts...) +} + +func (m *defaultInventoryService) GetStockCheck(ctx context.Context, in *GetStockCheckReq, opts ...grpc.CallOption) (*StockCheckInfo, error) { + client := pb.NewInventoryServiceClient(m.cli.Conn()) + return client.GetStockCheck(ctx, in, opts...) +} + +func (m *defaultInventoryService) ListStockCheck(ctx context.Context, in *ListStockCheckReq, opts ...grpc.CallOption) (*ListStockCheckResp, error) { + client := pb.NewInventoryServiceClient(m.cli.Conn()) + return client.ListStockCheck(ctx, in, opts...) +} + +// Stock Adjust +func (m *defaultInventoryService) CreateStockAdjust(ctx context.Context, in *CreateStockAdjustReq, opts ...grpc.CallOption) (*IdResp, error) { + client := pb.NewInventoryServiceClient(m.cli.Conn()) + return client.CreateStockAdjust(ctx, in, opts...) +} + +func (m *defaultInventoryService) ApproveStockAdjust(ctx context.Context, in *ApproveStockAdjustReq, opts ...grpc.CallOption) (*Empty, error) { + client := pb.NewInventoryServiceClient(m.cli.Conn()) + return client.ApproveStockAdjust(ctx, in, opts...) +} + +func (m *defaultInventoryService) GetStockAdjust(ctx context.Context, in *GetStockAdjustReq, opts ...grpc.CallOption) (*StockAdjustInfo, error) { + client := pb.NewInventoryServiceClient(m.cli.Conn()) + return client.GetStockAdjust(ctx, in, opts...) +} + +func (m *defaultInventoryService) ListStockAdjust(ctx context.Context, in *ListStockAdjustReq, opts ...grpc.CallOption) (*ListStockAdjustResp, error) { + client := pb.NewInventoryServiceClient(m.cli.Conn()) + return client.ListStockAdjust(ctx, in, opts...) +} diff --git a/rpc/inventory/pb/inventory.pb.go b/rpc/inventory/pb/inventory.pb.go new file mode 100644 index 0000000..b1eeed8 --- /dev/null +++ b/rpc/inventory/pb/inventory.pb.go @@ -0,0 +1,3705 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.20.3 +// source: rpc/inventory/inventory.proto + +package pb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ProductInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"` + ProductName string `protobuf:"bytes,2,opt,name=product_name,json=productName,proto3" json:"product_name,omitempty"` + ImageUrl string `protobuf:"bytes,3,opt,name=image_url,json=imageUrl,proto3" json:"image_url,omitempty"` + Spec string `protobuf:"bytes,4,opt,name=spec,proto3" json:"spec,omitempty"` + Color string `protobuf:"bytes,5,opt,name=color,proto3" json:"color,omitempty"` + UnitPieces int64 `protobuf:"varint,6,opt,name=unit_pieces,json=unitPieces,proto3" json:"unit_pieces,omitempty"` + UnitRolls int64 `protobuf:"varint,7,opt,name=unit_rolls,json=unitRolls,proto3" json:"unit_rolls,omitempty"` + StockQuantity string `protobuf:"bytes,8,opt,name=stock_quantity,json=stockQuantity,proto3" json:"stock_quantity,omitempty"` + Location string `protobuf:"bytes,9,opt,name=location,proto3" json:"location,omitempty"` + CostPrice string `protobuf:"bytes,10,opt,name=cost_price,json=costPrice,proto3" json:"cost_price,omitempty"` + SalesPrice string `protobuf:"bytes,11,opt,name=sales_price,json=salesPrice,proto3" json:"sales_price,omitempty"` + Remark string `protobuf:"bytes,12,opt,name=remark,proto3" json:"remark,omitempty"` + Status int64 `protobuf:"varint,13,opt,name=status,proto3" json:"status,omitempty"` + CreatedAt string `protobuf:"bytes,14,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt string `protobuf:"bytes,15,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` +} + +func (x *ProductInfo) Reset() { + *x = ProductInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProductInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProductInfo) ProtoMessage() {} + +func (x *ProductInfo) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProductInfo.ProtoReflect.Descriptor instead. +func (*ProductInfo) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{0} +} + +func (x *ProductInfo) GetProductId() string { + if x != nil { + return x.ProductId + } + return "" +} + +func (x *ProductInfo) GetProductName() string { + if x != nil { + return x.ProductName + } + return "" +} + +func (x *ProductInfo) GetImageUrl() string { + if x != nil { + return x.ImageUrl + } + return "" +} + +func (x *ProductInfo) GetSpec() string { + if x != nil { + return x.Spec + } + return "" +} + +func (x *ProductInfo) GetColor() string { + if x != nil { + return x.Color + } + return "" +} + +func (x *ProductInfo) GetUnitPieces() int64 { + if x != nil { + return x.UnitPieces + } + return 0 +} + +func (x *ProductInfo) GetUnitRolls() int64 { + if x != nil { + return x.UnitRolls + } + return 0 +} + +func (x *ProductInfo) GetStockQuantity() string { + if x != nil { + return x.StockQuantity + } + return "" +} + +func (x *ProductInfo) GetLocation() string { + if x != nil { + return x.Location + } + return "" +} + +func (x *ProductInfo) GetCostPrice() string { + if x != nil { + return x.CostPrice + } + return "" +} + +func (x *ProductInfo) GetSalesPrice() string { + if x != nil { + return x.SalesPrice + } + return "" +} + +func (x *ProductInfo) GetRemark() string { + if x != nil { + return x.Remark + } + return "" +} + +func (x *ProductInfo) GetStatus() int64 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *ProductInfo) GetCreatedAt() string { + if x != nil { + return x.CreatedAt + } + return "" +} + +func (x *ProductInfo) GetUpdatedAt() string { + if x != nil { + return x.UpdatedAt + } + return "" +} + +type CreateProductReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProductName string `protobuf:"bytes,1,opt,name=product_name,json=productName,proto3" json:"product_name,omitempty"` + ImageUrl string `protobuf:"bytes,2,opt,name=image_url,json=imageUrl,proto3" json:"image_url,omitempty"` + Spec string `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec,omitempty"` + Color string `protobuf:"bytes,4,opt,name=color,proto3" json:"color,omitempty"` + UnitPieces int64 `protobuf:"varint,5,opt,name=unit_pieces,json=unitPieces,proto3" json:"unit_pieces,omitempty"` + UnitRolls int64 `protobuf:"varint,6,opt,name=unit_rolls,json=unitRolls,proto3" json:"unit_rolls,omitempty"` + StockQuantity string `protobuf:"bytes,7,opt,name=stock_quantity,json=stockQuantity,proto3" json:"stock_quantity,omitempty"` + Location string `protobuf:"bytes,8,opt,name=location,proto3" json:"location,omitempty"` + CostPrice string `protobuf:"bytes,9,opt,name=cost_price,json=costPrice,proto3" json:"cost_price,omitempty"` + SalesPrice string `protobuf:"bytes,10,opt,name=sales_price,json=salesPrice,proto3" json:"sales_price,omitempty"` + Remark string `protobuf:"bytes,11,opt,name=remark,proto3" json:"remark,omitempty"` +} + +func (x *CreateProductReq) Reset() { + *x = CreateProductReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateProductReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateProductReq) ProtoMessage() {} + +func (x *CreateProductReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateProductReq.ProtoReflect.Descriptor instead. +func (*CreateProductReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateProductReq) GetProductName() string { + if x != nil { + return x.ProductName + } + return "" +} + +func (x *CreateProductReq) GetImageUrl() string { + if x != nil { + return x.ImageUrl + } + return "" +} + +func (x *CreateProductReq) GetSpec() string { + if x != nil { + return x.Spec + } + return "" +} + +func (x *CreateProductReq) GetColor() string { + if x != nil { + return x.Color + } + return "" +} + +func (x *CreateProductReq) GetUnitPieces() int64 { + if x != nil { + return x.UnitPieces + } + return 0 +} + +func (x *CreateProductReq) GetUnitRolls() int64 { + if x != nil { + return x.UnitRolls + } + return 0 +} + +func (x *CreateProductReq) GetStockQuantity() string { + if x != nil { + return x.StockQuantity + } + return "" +} + +func (x *CreateProductReq) GetLocation() string { + if x != nil { + return x.Location + } + return "" +} + +func (x *CreateProductReq) GetCostPrice() string { + if x != nil { + return x.CostPrice + } + return "" +} + +func (x *CreateProductReq) GetSalesPrice() string { + if x != nil { + return x.SalesPrice + } + return "" +} + +func (x *CreateProductReq) GetRemark() string { + if x != nil { + return x.Remark + } + return "" +} + +type UpdateProductReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"` + ProductName string `protobuf:"bytes,2,opt,name=product_name,json=productName,proto3" json:"product_name,omitempty"` + ImageUrl string `protobuf:"bytes,3,opt,name=image_url,json=imageUrl,proto3" json:"image_url,omitempty"` + Spec string `protobuf:"bytes,4,opt,name=spec,proto3" json:"spec,omitempty"` + Color string `protobuf:"bytes,5,opt,name=color,proto3" json:"color,omitempty"` + UnitPieces int64 `protobuf:"varint,6,opt,name=unit_pieces,json=unitPieces,proto3" json:"unit_pieces,omitempty"` + UnitRolls int64 `protobuf:"varint,7,opt,name=unit_rolls,json=unitRolls,proto3" json:"unit_rolls,omitempty"` + StockQuantity string `protobuf:"bytes,8,opt,name=stock_quantity,json=stockQuantity,proto3" json:"stock_quantity,omitempty"` + Location string `protobuf:"bytes,9,opt,name=location,proto3" json:"location,omitempty"` + CostPrice string `protobuf:"bytes,10,opt,name=cost_price,json=costPrice,proto3" json:"cost_price,omitempty"` + SalesPrice string `protobuf:"bytes,11,opt,name=sales_price,json=salesPrice,proto3" json:"sales_price,omitempty"` + Remark string `protobuf:"bytes,12,opt,name=remark,proto3" json:"remark,omitempty"` +} + +func (x *UpdateProductReq) Reset() { + *x = UpdateProductReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateProductReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateProductReq) ProtoMessage() {} + +func (x *UpdateProductReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateProductReq.ProtoReflect.Descriptor instead. +func (*UpdateProductReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{2} +} + +func (x *UpdateProductReq) GetProductId() string { + if x != nil { + return x.ProductId + } + return "" +} + +func (x *UpdateProductReq) GetProductName() string { + if x != nil { + return x.ProductName + } + return "" +} + +func (x *UpdateProductReq) GetImageUrl() string { + if x != nil { + return x.ImageUrl + } + return "" +} + +func (x *UpdateProductReq) GetSpec() string { + if x != nil { + return x.Spec + } + return "" +} + +func (x *UpdateProductReq) GetColor() string { + if x != nil { + return x.Color + } + return "" +} + +func (x *UpdateProductReq) GetUnitPieces() int64 { + if x != nil { + return x.UnitPieces + } + return 0 +} + +func (x *UpdateProductReq) GetUnitRolls() int64 { + if x != nil { + return x.UnitRolls + } + return 0 +} + +func (x *UpdateProductReq) GetStockQuantity() string { + if x != nil { + return x.StockQuantity + } + return "" +} + +func (x *UpdateProductReq) GetLocation() string { + if x != nil { + return x.Location + } + return "" +} + +func (x *UpdateProductReq) GetCostPrice() string { + if x != nil { + return x.CostPrice + } + return "" +} + +func (x *UpdateProductReq) GetSalesPrice() string { + if x != nil { + return x.SalesPrice + } + return "" +} + +func (x *UpdateProductReq) GetRemark() string { + if x != nil { + return x.Remark + } + return "" +} + +type DeleteProductReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"` +} + +func (x *DeleteProductReq) Reset() { + *x = DeleteProductReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteProductReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteProductReq) ProtoMessage() {} + +func (x *DeleteProductReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteProductReq.ProtoReflect.Descriptor instead. +func (*DeleteProductReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{3} +} + +func (x *DeleteProductReq) GetProductId() string { + if x != nil { + return x.ProductId + } + return "" +} + +type GetProductReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"` +} + +func (x *GetProductReq) Reset() { + *x = GetProductReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetProductReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetProductReq) ProtoMessage() {} + +func (x *GetProductReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetProductReq.ProtoReflect.Descriptor instead. +func (*GetProductReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{4} +} + +func (x *GetProductReq) GetProductId() string { + if x != nil { + return x.ProductId + } + return "" +} + +type ListProductReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` + PageSize int64 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + ProductName string `protobuf:"bytes,3,opt,name=product_name,json=productName,proto3" json:"product_name,omitempty"` + Spec string `protobuf:"bytes,4,opt,name=spec,proto3" json:"spec,omitempty"` + Color string `protobuf:"bytes,5,opt,name=color,proto3" json:"color,omitempty"` + Location string `protobuf:"bytes,6,opt,name=location,proto3" json:"location,omitempty"` + Status int64 `protobuf:"varint,7,opt,name=status,proto3" json:"status,omitempty"` +} + +func (x *ListProductReq) Reset() { + *x = ListProductReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListProductReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListProductReq) ProtoMessage() {} + +func (x *ListProductReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListProductReq.ProtoReflect.Descriptor instead. +func (*ListProductReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{5} +} + +func (x *ListProductReq) GetPage() int64 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *ListProductReq) GetPageSize() int64 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListProductReq) GetProductName() string { + if x != nil { + return x.ProductName + } + return "" +} + +func (x *ListProductReq) GetSpec() string { + if x != nil { + return x.Spec + } + return "" +} + +func (x *ListProductReq) GetColor() string { + if x != nil { + return x.Color + } + return "" +} + +func (x *ListProductReq) GetLocation() string { + if x != nil { + return x.Location + } + return "" +} + +func (x *ListProductReq) GetStatus() int64 { + if x != nil { + return x.Status + } + return 0 +} + +type ListProductResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + List []*ProductInfo `protobuf:"bytes,2,rep,name=list,proto3" json:"list,omitempty"` +} + +func (x *ListProductResp) Reset() { + *x = ListProductResp{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListProductResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListProductResp) ProtoMessage() {} + +func (x *ListProductResp) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListProductResp.ProtoReflect.Descriptor instead. +func (*ListProductResp) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{6} +} + +func (x *ListProductResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *ListProductResp) GetList() []*ProductInfo { + if x != nil { + return x.List + } + return nil +} + +type ImportProductReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Products []*CreateProductReq `protobuf:"bytes,1,rep,name=products,proto3" json:"products,omitempty"` + FileName string `protobuf:"bytes,2,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty"` + Operator string `protobuf:"bytes,3,opt,name=operator,proto3" json:"operator,omitempty"` +} + +func (x *ImportProductReq) Reset() { + *x = ImportProductReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImportProductReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImportProductReq) ProtoMessage() {} + +func (x *ImportProductReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImportProductReq.ProtoReflect.Descriptor instead. +func (*ImportProductReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{7} +} + +func (x *ImportProductReq) GetProducts() []*CreateProductReq { + if x != nil { + return x.Products + } + return nil +} + +func (x *ImportProductReq) GetFileName() string { + if x != nil { + return x.FileName + } + return "" +} + +func (x *ImportProductReq) GetOperator() string { + if x != nil { + return x.Operator + } + return "" +} + +type ImportProductResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TotalCount int64 `protobuf:"varint,1,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"` + SuccessCount int64 `protobuf:"varint,2,opt,name=success_count,json=successCount,proto3" json:"success_count,omitempty"` + FailCount int64 `protobuf:"varint,3,opt,name=fail_count,json=failCount,proto3" json:"fail_count,omitempty"` + ErrorMsg string `protobuf:"bytes,4,opt,name=error_msg,json=errorMsg,proto3" json:"error_msg,omitempty"` + ImportId string `protobuf:"bytes,5,opt,name=import_id,json=importId,proto3" json:"import_id,omitempty"` +} + +func (x *ImportProductResp) Reset() { + *x = ImportProductResp{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImportProductResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImportProductResp) ProtoMessage() {} + +func (x *ImportProductResp) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImportProductResp.ProtoReflect.Descriptor instead. +func (*ImportProductResp) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{8} +} + +func (x *ImportProductResp) GetTotalCount() int64 { + if x != nil { + return x.TotalCount + } + return 0 +} + +func (x *ImportProductResp) GetSuccessCount() int64 { + if x != nil { + return x.SuccessCount + } + return 0 +} + +func (x *ImportProductResp) GetFailCount() int64 { + if x != nil { + return x.FailCount + } + return 0 +} + +func (x *ImportProductResp) GetErrorMsg() string { + if x != nil { + return x.ErrorMsg + } + return "" +} + +func (x *ImportProductResp) GetImportId() string { + if x != nil { + return x.ImportId + } + return "" +} + +type ListImportLogReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` + PageSize int64 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` +} + +func (x *ListImportLogReq) Reset() { + *x = ListImportLogReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListImportLogReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListImportLogReq) ProtoMessage() {} + +func (x *ListImportLogReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListImportLogReq.ProtoReflect.Descriptor instead. +func (*ListImportLogReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{9} +} + +func (x *ListImportLogReq) GetPage() int64 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *ListImportLogReq) GetPageSize() int64 { + if x != nil { + return x.PageSize + } + return 0 +} + +type ListImportLogResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + List []*ImportLogInfo `protobuf:"bytes,2,rep,name=list,proto3" json:"list,omitempty"` +} + +func (x *ListImportLogResp) Reset() { + *x = ListImportLogResp{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListImportLogResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListImportLogResp) ProtoMessage() {} + +func (x *ListImportLogResp) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListImportLogResp.ProtoReflect.Descriptor instead. +func (*ListImportLogResp) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{10} +} + +func (x *ListImportLogResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *ListImportLogResp) GetList() []*ImportLogInfo { + if x != nil { + return x.List + } + return nil +} + +type ImportLogInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ImportId string `protobuf:"bytes,1,opt,name=import_id,json=importId,proto3" json:"import_id,omitempty"` + FileName string `protobuf:"bytes,2,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty"` + TotalCount int64 `protobuf:"varint,3,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"` + SuccessCount int64 `protobuf:"varint,4,opt,name=success_count,json=successCount,proto3" json:"success_count,omitempty"` + FailCount int64 `protobuf:"varint,5,opt,name=fail_count,json=failCount,proto3" json:"fail_count,omitempty"` + ErrorMsg string `protobuf:"bytes,6,opt,name=error_msg,json=errorMsg,proto3" json:"error_msg,omitempty"` + Operator string `protobuf:"bytes,7,opt,name=operator,proto3" json:"operator,omitempty"` + CreatedAt string `protobuf:"bytes,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` +} + +func (x *ImportLogInfo) Reset() { + *x = ImportLogInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImportLogInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImportLogInfo) ProtoMessage() {} + +func (x *ImportLogInfo) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImportLogInfo.ProtoReflect.Descriptor instead. +func (*ImportLogInfo) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{11} +} + +func (x *ImportLogInfo) GetImportId() string { + if x != nil { + return x.ImportId + } + return "" +} + +func (x *ImportLogInfo) GetFileName() string { + if x != nil { + return x.FileName + } + return "" +} + +func (x *ImportLogInfo) GetTotalCount() int64 { + if x != nil { + return x.TotalCount + } + return 0 +} + +func (x *ImportLogInfo) GetSuccessCount() int64 { + if x != nil { + return x.SuccessCount + } + return 0 +} + +func (x *ImportLogInfo) GetFailCount() int64 { + if x != nil { + return x.FailCount + } + return 0 +} + +func (x *ImportLogInfo) GetErrorMsg() string { + if x != nil { + return x.ErrorMsg + } + return "" +} + +func (x *ImportLogInfo) GetOperator() string { + if x != nil { + return x.Operator + } + return "" +} + +func (x *ImportLogInfo) GetCreatedAt() string { + if x != nil { + return x.CreatedAt + } + return "" +} + +type StockSummaryReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *StockSummaryReq) Reset() { + *x = StockSummaryReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StockSummaryReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StockSummaryReq) ProtoMessage() {} + +func (x *StockSummaryReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StockSummaryReq.ProtoReflect.Descriptor instead. +func (*StockSummaryReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{12} +} + +type StockSummaryResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProductCount int64 `protobuf:"varint,1,opt,name=product_count,json=productCount,proto3" json:"product_count,omitempty"` + TotalPieces int64 `protobuf:"varint,2,opt,name=total_pieces,json=totalPieces,proto3" json:"total_pieces,omitempty"` + TotalRolls int64 `protobuf:"varint,3,opt,name=total_rolls,json=totalRolls,proto3" json:"total_rolls,omitempty"` + TotalCostValue string `protobuf:"bytes,4,opt,name=total_cost_value,json=totalCostValue,proto3" json:"total_cost_value,omitempty"` + TotalSalesValue string `protobuf:"bytes,5,opt,name=total_sales_value,json=totalSalesValue,proto3" json:"total_sales_value,omitempty"` +} + +func (x *StockSummaryResp) Reset() { + *x = StockSummaryResp{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StockSummaryResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StockSummaryResp) ProtoMessage() {} + +func (x *StockSummaryResp) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StockSummaryResp.ProtoReflect.Descriptor instead. +func (*StockSummaryResp) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{13} +} + +func (x *StockSummaryResp) GetProductCount() int64 { + if x != nil { + return x.ProductCount + } + return 0 +} + +func (x *StockSummaryResp) GetTotalPieces() int64 { + if x != nil { + return x.TotalPieces + } + return 0 +} + +func (x *StockSummaryResp) GetTotalRolls() int64 { + if x != nil { + return x.TotalRolls + } + return 0 +} + +func (x *StockSummaryResp) GetTotalCostValue() string { + if x != nil { + return x.TotalCostValue + } + return "" +} + +func (x *StockSummaryResp) GetTotalSalesValue() string { + if x != nil { + return x.TotalSalesValue + } + return "" +} + +type StockGroupReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + GroupBy string `protobuf:"bytes,1,opt,name=group_by,json=groupBy,proto3" json:"group_by,omitempty"` +} + +func (x *StockGroupReq) Reset() { + *x = StockGroupReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StockGroupReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StockGroupReq) ProtoMessage() {} + +func (x *StockGroupReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StockGroupReq.ProtoReflect.Descriptor instead. +func (*StockGroupReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{14} +} + +func (x *StockGroupReq) GetGroupBy() string { + if x != nil { + return x.GroupBy + } + return "" +} + +type StockGroupItem struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Count int64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` + Quantity string `protobuf:"bytes,3,opt,name=quantity,proto3" json:"quantity,omitempty"` +} + +func (x *StockGroupItem) Reset() { + *x = StockGroupItem{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StockGroupItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StockGroupItem) ProtoMessage() {} + +func (x *StockGroupItem) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StockGroupItem.ProtoReflect.Descriptor instead. +func (*StockGroupItem) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{15} +} + +func (x *StockGroupItem) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *StockGroupItem) GetCount() int64 { + if x != nil { + return x.Count + } + return 0 +} + +func (x *StockGroupItem) GetQuantity() string { + if x != nil { + return x.Quantity + } + return "" +} + +type StockGroupResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + List []*StockGroupItem `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` +} + +func (x *StockGroupResp) Reset() { + *x = StockGroupResp{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StockGroupResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StockGroupResp) ProtoMessage() {} + +func (x *StockGroupResp) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StockGroupResp.ProtoReflect.Descriptor instead. +func (*StockGroupResp) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{16} +} + +func (x *StockGroupResp) GetList() []*StockGroupItem { + if x != nil { + return x.List + } + return nil +} + +type StockCheckInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CheckId string `protobuf:"bytes,1,opt,name=check_id,json=checkId,proto3" json:"check_id,omitempty"` + CheckNo string `protobuf:"bytes,2,opt,name=check_no,json=checkNo,proto3" json:"check_no,omitempty"` + CheckDate string `protobuf:"bytes,3,opt,name=check_date,json=checkDate,proto3" json:"check_date,omitempty"` + Checker string `protobuf:"bytes,4,opt,name=checker,proto3" json:"checker,omitempty"` + Status int64 `protobuf:"varint,5,opt,name=status,proto3" json:"status,omitempty"` + Remark string `protobuf:"bytes,6,opt,name=remark,proto3" json:"remark,omitempty"` + CreatedAt string `protobuf:"bytes,7,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt string `protobuf:"bytes,8,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` + Details []*StockCheckDetailInfo `protobuf:"bytes,9,rep,name=details,proto3" json:"details,omitempty"` +} + +func (x *StockCheckInfo) Reset() { + *x = StockCheckInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StockCheckInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StockCheckInfo) ProtoMessage() {} + +func (x *StockCheckInfo) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StockCheckInfo.ProtoReflect.Descriptor instead. +func (*StockCheckInfo) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{17} +} + +func (x *StockCheckInfo) GetCheckId() string { + if x != nil { + return x.CheckId + } + return "" +} + +func (x *StockCheckInfo) GetCheckNo() string { + if x != nil { + return x.CheckNo + } + return "" +} + +func (x *StockCheckInfo) GetCheckDate() string { + if x != nil { + return x.CheckDate + } + return "" +} + +func (x *StockCheckInfo) GetChecker() string { + if x != nil { + return x.Checker + } + return "" +} + +func (x *StockCheckInfo) GetStatus() int64 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *StockCheckInfo) GetRemark() string { + if x != nil { + return x.Remark + } + return "" +} + +func (x *StockCheckInfo) GetCreatedAt() string { + if x != nil { + return x.CreatedAt + } + return "" +} + +func (x *StockCheckInfo) GetUpdatedAt() string { + if x != nil { + return x.UpdatedAt + } + return "" +} + +func (x *StockCheckInfo) GetDetails() []*StockCheckDetailInfo { + if x != nil { + return x.Details + } + return nil +} + +type StockCheckDetailInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DetailId string `protobuf:"bytes,1,opt,name=detail_id,json=detailId,proto3" json:"detail_id,omitempty"` + CheckId string `protobuf:"bytes,2,opt,name=check_id,json=checkId,proto3" json:"check_id,omitempty"` + ProductId string `protobuf:"bytes,3,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"` + ProductName string `protobuf:"bytes,4,opt,name=product_name,json=productName,proto3" json:"product_name,omitempty"` + SystemQuantity string `protobuf:"bytes,5,opt,name=system_quantity,json=systemQuantity,proto3" json:"system_quantity,omitempty"` + ActualQuantity string `protobuf:"bytes,6,opt,name=actual_quantity,json=actualQuantity,proto3" json:"actual_quantity,omitempty"` + DiffQuantity string `protobuf:"bytes,7,opt,name=diff_quantity,json=diffQuantity,proto3" json:"diff_quantity,omitempty"` + DiffAmount string `protobuf:"bytes,8,opt,name=diff_amount,json=diffAmount,proto3" json:"diff_amount,omitempty"` + Remark string `protobuf:"bytes,9,opt,name=remark,proto3" json:"remark,omitempty"` +} + +func (x *StockCheckDetailInfo) Reset() { + *x = StockCheckDetailInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StockCheckDetailInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StockCheckDetailInfo) ProtoMessage() {} + +func (x *StockCheckDetailInfo) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StockCheckDetailInfo.ProtoReflect.Descriptor instead. +func (*StockCheckDetailInfo) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{18} +} + +func (x *StockCheckDetailInfo) GetDetailId() string { + if x != nil { + return x.DetailId + } + return "" +} + +func (x *StockCheckDetailInfo) GetCheckId() string { + if x != nil { + return x.CheckId + } + return "" +} + +func (x *StockCheckDetailInfo) GetProductId() string { + if x != nil { + return x.ProductId + } + return "" +} + +func (x *StockCheckDetailInfo) GetProductName() string { + if x != nil { + return x.ProductName + } + return "" +} + +func (x *StockCheckDetailInfo) GetSystemQuantity() string { + if x != nil { + return x.SystemQuantity + } + return "" +} + +func (x *StockCheckDetailInfo) GetActualQuantity() string { + if x != nil { + return x.ActualQuantity + } + return "" +} + +func (x *StockCheckDetailInfo) GetDiffQuantity() string { + if x != nil { + return x.DiffQuantity + } + return "" +} + +func (x *StockCheckDetailInfo) GetDiffAmount() string { + if x != nil { + return x.DiffAmount + } + return "" +} + +func (x *StockCheckDetailInfo) GetRemark() string { + if x != nil { + return x.Remark + } + return "" +} + +type CreateStockCheckReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CheckDate string `protobuf:"bytes,1,opt,name=check_date,json=checkDate,proto3" json:"check_date,omitempty"` + Checker string `protobuf:"bytes,2,opt,name=checker,proto3" json:"checker,omitempty"` + Remark string `protobuf:"bytes,3,opt,name=remark,proto3" json:"remark,omitempty"` + Details []*StockCheckDetailReq `protobuf:"bytes,4,rep,name=details,proto3" json:"details,omitempty"` +} + +func (x *CreateStockCheckReq) Reset() { + *x = CreateStockCheckReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateStockCheckReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateStockCheckReq) ProtoMessage() {} + +func (x *CreateStockCheckReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateStockCheckReq.ProtoReflect.Descriptor instead. +func (*CreateStockCheckReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{19} +} + +func (x *CreateStockCheckReq) GetCheckDate() string { + if x != nil { + return x.CheckDate + } + return "" +} + +func (x *CreateStockCheckReq) GetChecker() string { + if x != nil { + return x.Checker + } + return "" +} + +func (x *CreateStockCheckReq) GetRemark() string { + if x != nil { + return x.Remark + } + return "" +} + +func (x *CreateStockCheckReq) GetDetails() []*StockCheckDetailReq { + if x != nil { + return x.Details + } + return nil +} + +type StockCheckDetailReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"` + ActualQuantity string `protobuf:"bytes,2,opt,name=actual_quantity,json=actualQuantity,proto3" json:"actual_quantity,omitempty"` + Remark string `protobuf:"bytes,3,opt,name=remark,proto3" json:"remark,omitempty"` +} + +func (x *StockCheckDetailReq) Reset() { + *x = StockCheckDetailReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StockCheckDetailReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StockCheckDetailReq) ProtoMessage() {} + +func (x *StockCheckDetailReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StockCheckDetailReq.ProtoReflect.Descriptor instead. +func (*StockCheckDetailReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{20} +} + +func (x *StockCheckDetailReq) GetProductId() string { + if x != nil { + return x.ProductId + } + return "" +} + +func (x *StockCheckDetailReq) GetActualQuantity() string { + if x != nil { + return x.ActualQuantity + } + return "" +} + +func (x *StockCheckDetailReq) GetRemark() string { + if x != nil { + return x.Remark + } + return "" +} + +type UpdateStockCheckReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CheckId string `protobuf:"bytes,1,opt,name=check_id,json=checkId,proto3" json:"check_id,omitempty"` + Remark string `protobuf:"bytes,2,opt,name=remark,proto3" json:"remark,omitempty"` + Details []*StockCheckDetailReq `protobuf:"bytes,3,rep,name=details,proto3" json:"details,omitempty"` +} + +func (x *UpdateStockCheckReq) Reset() { + *x = UpdateStockCheckReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateStockCheckReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateStockCheckReq) ProtoMessage() {} + +func (x *UpdateStockCheckReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateStockCheckReq.ProtoReflect.Descriptor instead. +func (*UpdateStockCheckReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{21} +} + +func (x *UpdateStockCheckReq) GetCheckId() string { + if x != nil { + return x.CheckId + } + return "" +} + +func (x *UpdateStockCheckReq) GetRemark() string { + if x != nil { + return x.Remark + } + return "" +} + +func (x *UpdateStockCheckReq) GetDetails() []*StockCheckDetailReq { + if x != nil { + return x.Details + } + return nil +} + +type ConfirmStockCheckReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CheckId string `protobuf:"bytes,1,opt,name=check_id,json=checkId,proto3" json:"check_id,omitempty"` + Operator string `protobuf:"bytes,2,opt,name=operator,proto3" json:"operator,omitempty"` +} + +func (x *ConfirmStockCheckReq) Reset() { + *x = ConfirmStockCheckReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConfirmStockCheckReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfirmStockCheckReq) ProtoMessage() {} + +func (x *ConfirmStockCheckReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConfirmStockCheckReq.ProtoReflect.Descriptor instead. +func (*ConfirmStockCheckReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{22} +} + +func (x *ConfirmStockCheckReq) GetCheckId() string { + if x != nil { + return x.CheckId + } + return "" +} + +func (x *ConfirmStockCheckReq) GetOperator() string { + if x != nil { + return x.Operator + } + return "" +} + +type GetStockCheckReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CheckId string `protobuf:"bytes,1,opt,name=check_id,json=checkId,proto3" json:"check_id,omitempty"` +} + +func (x *GetStockCheckReq) Reset() { + *x = GetStockCheckReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetStockCheckReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStockCheckReq) ProtoMessage() {} + +func (x *GetStockCheckReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStockCheckReq.ProtoReflect.Descriptor instead. +func (*GetStockCheckReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{23} +} + +func (x *GetStockCheckReq) GetCheckId() string { + if x != nil { + return x.CheckId + } + return "" +} + +type ListStockCheckReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` + PageSize int64 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + CheckNo string `protobuf:"bytes,3,opt,name=check_no,json=checkNo,proto3" json:"check_no,omitempty"` + Status int64 `protobuf:"varint,4,opt,name=status,proto3" json:"status,omitempty"` + StartDate string `protobuf:"bytes,5,opt,name=start_date,json=startDate,proto3" json:"start_date,omitempty"` + EndDate string `protobuf:"bytes,6,opt,name=end_date,json=endDate,proto3" json:"end_date,omitempty"` +} + +func (x *ListStockCheckReq) Reset() { + *x = ListStockCheckReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListStockCheckReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStockCheckReq) ProtoMessage() {} + +func (x *ListStockCheckReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListStockCheckReq.ProtoReflect.Descriptor instead. +func (*ListStockCheckReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{24} +} + +func (x *ListStockCheckReq) GetPage() int64 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *ListStockCheckReq) GetPageSize() int64 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListStockCheckReq) GetCheckNo() string { + if x != nil { + return x.CheckNo + } + return "" +} + +func (x *ListStockCheckReq) GetStatus() int64 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *ListStockCheckReq) GetStartDate() string { + if x != nil { + return x.StartDate + } + return "" +} + +func (x *ListStockCheckReq) GetEndDate() string { + if x != nil { + return x.EndDate + } + return "" +} + +type ListStockCheckResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + List []*StockCheckInfo `protobuf:"bytes,2,rep,name=list,proto3" json:"list,omitempty"` +} + +func (x *ListStockCheckResp) Reset() { + *x = ListStockCheckResp{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListStockCheckResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStockCheckResp) ProtoMessage() {} + +func (x *ListStockCheckResp) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListStockCheckResp.ProtoReflect.Descriptor instead. +func (*ListStockCheckResp) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{25} +} + +func (x *ListStockCheckResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *ListStockCheckResp) GetList() []*StockCheckInfo { + if x != nil { + return x.List + } + return nil +} + +type StockAdjustInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdjustId string `protobuf:"bytes,1,opt,name=adjust_id,json=adjustId,proto3" json:"adjust_id,omitempty"` + AdjustNo string `protobuf:"bytes,2,opt,name=adjust_no,json=adjustNo,proto3" json:"adjust_no,omitempty"` + AdjustDate string `protobuf:"bytes,3,opt,name=adjust_date,json=adjustDate,proto3" json:"adjust_date,omitempty"` + AdjustReason string `protobuf:"bytes,4,opt,name=adjust_reason,json=adjustReason,proto3" json:"adjust_reason,omitempty"` + Operator string `protobuf:"bytes,5,opt,name=operator,proto3" json:"operator,omitempty"` + Approver string `protobuf:"bytes,6,opt,name=approver,proto3" json:"approver,omitempty"` + Status int64 `protobuf:"varint,7,opt,name=status,proto3" json:"status,omitempty"` + Remark string `protobuf:"bytes,8,opt,name=remark,proto3" json:"remark,omitempty"` + CreatedAt string `protobuf:"bytes,9,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt string `protobuf:"bytes,10,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` + Details []*StockAdjustDetailInfo `protobuf:"bytes,11,rep,name=details,proto3" json:"details,omitempty"` +} + +func (x *StockAdjustInfo) Reset() { + *x = StockAdjustInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StockAdjustInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StockAdjustInfo) ProtoMessage() {} + +func (x *StockAdjustInfo) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StockAdjustInfo.ProtoReflect.Descriptor instead. +func (*StockAdjustInfo) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{26} +} + +func (x *StockAdjustInfo) GetAdjustId() string { + if x != nil { + return x.AdjustId + } + return "" +} + +func (x *StockAdjustInfo) GetAdjustNo() string { + if x != nil { + return x.AdjustNo + } + return "" +} + +func (x *StockAdjustInfo) GetAdjustDate() string { + if x != nil { + return x.AdjustDate + } + return "" +} + +func (x *StockAdjustInfo) GetAdjustReason() string { + if x != nil { + return x.AdjustReason + } + return "" +} + +func (x *StockAdjustInfo) GetOperator() string { + if x != nil { + return x.Operator + } + return "" +} + +func (x *StockAdjustInfo) GetApprover() string { + if x != nil { + return x.Approver + } + return "" +} + +func (x *StockAdjustInfo) GetStatus() int64 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *StockAdjustInfo) GetRemark() string { + if x != nil { + return x.Remark + } + return "" +} + +func (x *StockAdjustInfo) GetCreatedAt() string { + if x != nil { + return x.CreatedAt + } + return "" +} + +func (x *StockAdjustInfo) GetUpdatedAt() string { + if x != nil { + return x.UpdatedAt + } + return "" +} + +func (x *StockAdjustInfo) GetDetails() []*StockAdjustDetailInfo { + if x != nil { + return x.Details + } + return nil +} + +type StockAdjustDetailInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DetailId string `protobuf:"bytes,1,opt,name=detail_id,json=detailId,proto3" json:"detail_id,omitempty"` + AdjustId string `protobuf:"bytes,2,opt,name=adjust_id,json=adjustId,proto3" json:"adjust_id,omitempty"` + ProductId string `protobuf:"bytes,3,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"` + ProductName string `protobuf:"bytes,4,opt,name=product_name,json=productName,proto3" json:"product_name,omitempty"` + BeforeQuantity string `protobuf:"bytes,5,opt,name=before_quantity,json=beforeQuantity,proto3" json:"before_quantity,omitempty"` + AdjustQuantity string `protobuf:"bytes,6,opt,name=adjust_quantity,json=adjustQuantity,proto3" json:"adjust_quantity,omitempty"` + AfterQuantity string `protobuf:"bytes,7,opt,name=after_quantity,json=afterQuantity,proto3" json:"after_quantity,omitempty"` + Remark string `protobuf:"bytes,8,opt,name=remark,proto3" json:"remark,omitempty"` +} + +func (x *StockAdjustDetailInfo) Reset() { + *x = StockAdjustDetailInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StockAdjustDetailInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StockAdjustDetailInfo) ProtoMessage() {} + +func (x *StockAdjustDetailInfo) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StockAdjustDetailInfo.ProtoReflect.Descriptor instead. +func (*StockAdjustDetailInfo) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{27} +} + +func (x *StockAdjustDetailInfo) GetDetailId() string { + if x != nil { + return x.DetailId + } + return "" +} + +func (x *StockAdjustDetailInfo) GetAdjustId() string { + if x != nil { + return x.AdjustId + } + return "" +} + +func (x *StockAdjustDetailInfo) GetProductId() string { + if x != nil { + return x.ProductId + } + return "" +} + +func (x *StockAdjustDetailInfo) GetProductName() string { + if x != nil { + return x.ProductName + } + return "" +} + +func (x *StockAdjustDetailInfo) GetBeforeQuantity() string { + if x != nil { + return x.BeforeQuantity + } + return "" +} + +func (x *StockAdjustDetailInfo) GetAdjustQuantity() string { + if x != nil { + return x.AdjustQuantity + } + return "" +} + +func (x *StockAdjustDetailInfo) GetAfterQuantity() string { + if x != nil { + return x.AfterQuantity + } + return "" +} + +func (x *StockAdjustDetailInfo) GetRemark() string { + if x != nil { + return x.Remark + } + return "" +} + +type CreateStockAdjustReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdjustDate string `protobuf:"bytes,1,opt,name=adjust_date,json=adjustDate,proto3" json:"adjust_date,omitempty"` + AdjustReason string `protobuf:"bytes,2,opt,name=adjust_reason,json=adjustReason,proto3" json:"adjust_reason,omitempty"` + Operator string `protobuf:"bytes,3,opt,name=operator,proto3" json:"operator,omitempty"` + Remark string `protobuf:"bytes,4,opt,name=remark,proto3" json:"remark,omitempty"` + Details []*StockAdjustDetailReq `protobuf:"bytes,5,rep,name=details,proto3" json:"details,omitempty"` +} + +func (x *CreateStockAdjustReq) Reset() { + *x = CreateStockAdjustReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateStockAdjustReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateStockAdjustReq) ProtoMessage() {} + +func (x *CreateStockAdjustReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateStockAdjustReq.ProtoReflect.Descriptor instead. +func (*CreateStockAdjustReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{28} +} + +func (x *CreateStockAdjustReq) GetAdjustDate() string { + if x != nil { + return x.AdjustDate + } + return "" +} + +func (x *CreateStockAdjustReq) GetAdjustReason() string { + if x != nil { + return x.AdjustReason + } + return "" +} + +func (x *CreateStockAdjustReq) GetOperator() string { + if x != nil { + return x.Operator + } + return "" +} + +func (x *CreateStockAdjustReq) GetRemark() string { + if x != nil { + return x.Remark + } + return "" +} + +func (x *CreateStockAdjustReq) GetDetails() []*StockAdjustDetailReq { + if x != nil { + return x.Details + } + return nil +} + +type StockAdjustDetailReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"` + AdjustQuantity string `protobuf:"bytes,2,opt,name=adjust_quantity,json=adjustQuantity,proto3" json:"adjust_quantity,omitempty"` + Remark string `protobuf:"bytes,3,opt,name=remark,proto3" json:"remark,omitempty"` +} + +func (x *StockAdjustDetailReq) Reset() { + *x = StockAdjustDetailReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StockAdjustDetailReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StockAdjustDetailReq) ProtoMessage() {} + +func (x *StockAdjustDetailReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[29] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StockAdjustDetailReq.ProtoReflect.Descriptor instead. +func (*StockAdjustDetailReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{29} +} + +func (x *StockAdjustDetailReq) GetProductId() string { + if x != nil { + return x.ProductId + } + return "" +} + +func (x *StockAdjustDetailReq) GetAdjustQuantity() string { + if x != nil { + return x.AdjustQuantity + } + return "" +} + +func (x *StockAdjustDetailReq) GetRemark() string { + if x != nil { + return x.Remark + } + return "" +} + +type ApproveStockAdjustReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdjustId string `protobuf:"bytes,1,opt,name=adjust_id,json=adjustId,proto3" json:"adjust_id,omitempty"` + Approver string `protobuf:"bytes,2,opt,name=approver,proto3" json:"approver,omitempty"` + Action int64 `protobuf:"varint,3,opt,name=action,proto3" json:"action,omitempty"` +} + +func (x *ApproveStockAdjustReq) Reset() { + *x = ApproveStockAdjustReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ApproveStockAdjustReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApproveStockAdjustReq) ProtoMessage() {} + +func (x *ApproveStockAdjustReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[30] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApproveStockAdjustReq.ProtoReflect.Descriptor instead. +func (*ApproveStockAdjustReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{30} +} + +func (x *ApproveStockAdjustReq) GetAdjustId() string { + if x != nil { + return x.AdjustId + } + return "" +} + +func (x *ApproveStockAdjustReq) GetApprover() string { + if x != nil { + return x.Approver + } + return "" +} + +func (x *ApproveStockAdjustReq) GetAction() int64 { + if x != nil { + return x.Action + } + return 0 +} + +type GetStockAdjustReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdjustId string `protobuf:"bytes,1,opt,name=adjust_id,json=adjustId,proto3" json:"adjust_id,omitempty"` +} + +func (x *GetStockAdjustReq) Reset() { + *x = GetStockAdjustReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetStockAdjustReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStockAdjustReq) ProtoMessage() {} + +func (x *GetStockAdjustReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[31] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStockAdjustReq.ProtoReflect.Descriptor instead. +func (*GetStockAdjustReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{31} +} + +func (x *GetStockAdjustReq) GetAdjustId() string { + if x != nil { + return x.AdjustId + } + return "" +} + +type ListStockAdjustReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` + PageSize int64 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + AdjustNo string `protobuf:"bytes,3,opt,name=adjust_no,json=adjustNo,proto3" json:"adjust_no,omitempty"` + AdjustReason string `protobuf:"bytes,4,opt,name=adjust_reason,json=adjustReason,proto3" json:"adjust_reason,omitempty"` + Status int64 `protobuf:"varint,5,opt,name=status,proto3" json:"status,omitempty"` + StartDate string `protobuf:"bytes,6,opt,name=start_date,json=startDate,proto3" json:"start_date,omitempty"` + EndDate string `protobuf:"bytes,7,opt,name=end_date,json=endDate,proto3" json:"end_date,omitempty"` +} + +func (x *ListStockAdjustReq) Reset() { + *x = ListStockAdjustReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListStockAdjustReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStockAdjustReq) ProtoMessage() {} + +func (x *ListStockAdjustReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[32] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListStockAdjustReq.ProtoReflect.Descriptor instead. +func (*ListStockAdjustReq) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{32} +} + +func (x *ListStockAdjustReq) GetPage() int64 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *ListStockAdjustReq) GetPageSize() int64 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListStockAdjustReq) GetAdjustNo() string { + if x != nil { + return x.AdjustNo + } + return "" +} + +func (x *ListStockAdjustReq) GetAdjustReason() string { + if x != nil { + return x.AdjustReason + } + return "" +} + +func (x *ListStockAdjustReq) GetStatus() int64 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *ListStockAdjustReq) GetStartDate() string { + if x != nil { + return x.StartDate + } + return "" +} + +func (x *ListStockAdjustReq) GetEndDate() string { + if x != nil { + return x.EndDate + } + return "" +} + +type ListStockAdjustResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + List []*StockAdjustInfo `protobuf:"bytes,2,rep,name=list,proto3" json:"list,omitempty"` +} + +func (x *ListStockAdjustResp) Reset() { + *x = ListStockAdjustResp{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListStockAdjustResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStockAdjustResp) ProtoMessage() {} + +func (x *ListStockAdjustResp) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[33] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListStockAdjustResp.ProtoReflect.Descriptor instead. +func (*ListStockAdjustResp) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{33} +} + +func (x *ListStockAdjustResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *ListStockAdjustResp) GetList() []*StockAdjustInfo { + if x != nil { + return x.List + } + return nil +} + +type IdResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *IdResp) Reset() { + *x = IdResp{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdResp) ProtoMessage() {} + +func (x *IdResp) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[34] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IdResp.ProtoReflect.Descriptor instead. +func (*IdResp) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{34} +} + +func (x *IdResp) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type Empty struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *Empty) Reset() { + *x = Empty{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_inventory_inventory_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Empty) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Empty) ProtoMessage() {} + +func (x *Empty) ProtoReflect() protoreflect.Message { + mi := &file_rpc_inventory_inventory_proto_msgTypes[35] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Empty.ProtoReflect.Descriptor instead. +func (*Empty) Descriptor() ([]byte, []int) { + return file_rpc_inventory_inventory_proto_rawDescGZIP(), []int{35} +} + +var File_rpc_inventory_inventory_proto protoreflect.FileDescriptor + +var file_rpc_inventory_inventory_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x72, 0x70, 0x63, 0x2f, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2f, + 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x22, 0xc7, 0x03, 0x0a, 0x0b, 0x50, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f, + 0x64, 0x75, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, + 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x70, 0x65, + 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x12, 0x14, 0x0a, + 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, + 0x6c, 0x6f, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x6e, 0x69, 0x74, 0x5f, 0x70, 0x69, 0x65, 0x63, + 0x65, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x6e, 0x69, 0x74, 0x50, 0x69, + 0x65, 0x63, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x6e, 0x69, 0x74, 0x5f, 0x72, 0x6f, 0x6c, + 0x6c, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x75, 0x6e, 0x69, 0x74, 0x52, 0x6f, + 0x6c, 0x6c, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x5f, 0x71, 0x75, 0x61, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x74, 0x6f, + 0x63, 0x6b, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x73, 0x74, 0x5f, 0x70, + 0x72, 0x69, 0x63, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x73, 0x74, + 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x61, 0x6c, 0x65, 0x73, 0x5f, 0x70, + 0x72, 0x69, 0x63, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x61, 0x6c, 0x65, + 0x73, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, + 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x16, + 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, + 0x5f, 0x61, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x64, 0x41, 0x74, 0x22, 0xd7, 0x02, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f, + 0x64, 0x75, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, + 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x70, 0x65, + 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x12, 0x14, 0x0a, + 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, + 0x6c, 0x6f, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x6e, 0x69, 0x74, 0x5f, 0x70, 0x69, 0x65, 0x63, + 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x6e, 0x69, 0x74, 0x50, 0x69, + 0x65, 0x63, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x6e, 0x69, 0x74, 0x5f, 0x72, 0x6f, 0x6c, + 0x6c, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x75, 0x6e, 0x69, 0x74, 0x52, 0x6f, + 0x6c, 0x6c, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x5f, 0x71, 0x75, 0x61, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x74, 0x6f, + 0x63, 0x6b, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x73, 0x74, 0x5f, 0x70, + 0x72, 0x69, 0x63, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x73, 0x74, + 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x61, 0x6c, 0x65, 0x73, 0x5f, 0x70, + 0x72, 0x69, 0x63, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x61, 0x6c, 0x65, + 0x73, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, + 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x22, 0xf6, + 0x02, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, + 0x52, 0x65, 0x71, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, + 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, + 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x75, + 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x55, + 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x70, 0x65, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x1f, 0x0a, 0x0b, + 0x75, 0x6e, 0x69, 0x74, 0x5f, 0x70, 0x69, 0x65, 0x63, 0x65, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0a, 0x75, 0x6e, 0x69, 0x74, 0x50, 0x69, 0x65, 0x63, 0x65, 0x73, 0x12, 0x1d, 0x0a, + 0x0a, 0x75, 0x6e, 0x69, 0x74, 0x5f, 0x72, 0x6f, 0x6c, 0x6c, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x09, 0x75, 0x6e, 0x69, 0x74, 0x52, 0x6f, 0x6c, 0x6c, 0x73, 0x12, 0x25, 0x0a, 0x0e, + 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x5f, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x51, 0x75, 0x61, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x73, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1f, + 0x0a, 0x0b, 0x73, 0x61, 0x6c, 0x65, 0x73, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x0b, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x61, 0x6c, 0x65, 0x73, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, + 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x22, 0x31, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x12, 0x1d, 0x0a, 0x0a, 0x70, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x22, 0x2e, 0x0a, 0x0d, 0x47, 0x65, + 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x12, 0x1d, 0x0a, 0x0a, 0x70, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x22, 0xc2, 0x01, 0x0a, 0x0e, 0x4c, + 0x69, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, + 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x70, 0x61, 0x67, + 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x21, + 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x70, 0x65, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x73, 0x70, 0x65, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x6c, + 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, + 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, + 0x53, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x2a, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, + 0x72, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, + 0x6c, 0x69, 0x73, 0x74, 0x22, 0x84, 0x01, 0x0a, 0x10, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x50, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x12, 0x37, 0x0a, 0x08, 0x70, 0x72, 0x6f, + 0x64, 0x75, 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x69, 0x6e, + 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, + 0x74, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x1a, 0x0a, 0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x22, 0xb2, 0x01, 0x0a, 0x11, + 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x73, 0x75, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x61, 0x69, 0x6c, 0x5f, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x66, 0x61, 0x69, + 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, + 0x6d, 0x73, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x4d, 0x73, 0x67, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x69, 0x64, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x64, + 0x22, 0x43, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x4c, 0x6f, + 0x67, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, + 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, + 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x57, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6d, 0x70, + 0x6f, 0x72, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, + 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, + 0x12, 0x2c, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, + 0x74, 0x4c, 0x6f, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x86, + 0x02, 0x0a, 0x0d, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x4c, 0x6f, 0x67, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x64, 0x12, 0x1b, 0x0a, + 0x09, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, + 0x74, 0x61, 0x6c, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x73, + 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x0c, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x61, 0x69, 0x6c, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x66, 0x61, 0x69, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, + 0x1b, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x1a, 0x0a, 0x08, + 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x11, 0x0a, 0x0f, 0x53, 0x74, 0x6f, 0x63, 0x6b, + 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x22, 0xd1, 0x01, 0x0a, 0x10, 0x53, + 0x74, 0x6f, 0x63, 0x6b, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x23, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x70, 0x69, + 0x65, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x74, 0x6f, 0x74, 0x61, + 0x6c, 0x50, 0x69, 0x65, 0x63, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, + 0x5f, 0x72, 0x6f, 0x6c, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x74, 0x6f, + 0x74, 0x61, 0x6c, 0x52, 0x6f, 0x6c, 0x6c, 0x73, 0x12, 0x28, 0x0a, 0x10, 0x74, 0x6f, 0x74, 0x61, + 0x6c, 0x5f, 0x63, 0x6f, 0x73, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0e, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x73, 0x74, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x73, 0x61, 0x6c, 0x65, + 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, + 0x6f, 0x74, 0x61, 0x6c, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x2a, + 0x0a, 0x0d, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x12, + 0x19, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x62, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x42, 0x79, 0x22, 0x56, 0x0a, 0x0e, 0x53, 0x74, + 0x6f, 0x63, 0x6b, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x22, 0x3f, 0x0a, 0x0e, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x2d, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x53, + 0x74, 0x6f, 0x63, 0x6b, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x6c, + 0x69, 0x73, 0x74, 0x22, 0xa8, 0x02, 0x0a, 0x0e, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x49, + 0x64, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x6e, 0x6f, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x4e, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, + 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x44, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, + 0x68, 0x65, 0x63, 0x6b, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, + 0x65, 0x63, 0x6b, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, + 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, + 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x5f, 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, + 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x09, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, + 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x44, 0x65, 0x74, 0x61, 0x69, + 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0xc0, + 0x02, 0x0a, 0x14, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x44, 0x65, 0x74, + 0x61, 0x69, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x74, 0x61, 0x69, + 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x64, 0x12, + 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x21, + 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x71, 0x75, 0x61, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x63, + 0x74, 0x75, 0x61, 0x6c, 0x5f, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x51, 0x75, 0x61, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x69, 0x66, 0x66, 0x5f, 0x71, 0x75, 0x61, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x69, 0x66, 0x66, + 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x69, 0x66, 0x66, + 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, + 0x69, 0x66, 0x66, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6d, + 0x61, 0x72, 0x6b, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, + 0x6b, 0x22, 0xa0, 0x01, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x63, + 0x6b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x65, + 0x63, 0x6b, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, + 0x68, 0x65, 0x63, 0x6b, 0x44, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x65, 0x63, + 0x6b, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x65, 0x63, 0x6b, + 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x38, 0x0a, 0x07, 0x64, 0x65, + 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x69, 0x6e, + 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x52, 0x07, 0x64, 0x65, 0x74, + 0x61, 0x69, 0x6c, 0x73, 0x22, 0x75, 0x0a, 0x13, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x12, 0x1d, 0x0a, 0x0a, 0x70, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x63, + 0x74, 0x75, 0x61, 0x6c, 0x5f, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x51, 0x75, 0x61, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x22, 0x82, 0x01, 0x0a, 0x13, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x52, 0x65, 0x71, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x64, 0x12, 0x16, + 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x38, 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, + 0x6f, 0x72, 0x79, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x44, 0x65, + 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x52, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, + 0x22, 0x4d, 0x0a, 0x14, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x53, 0x74, 0x6f, 0x63, 0x6b, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x65, 0x63, + 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x65, 0x63, + 0x6b, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x22, + 0x2d, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x52, 0x65, 0x71, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x64, 0x22, 0xb1, + 0x01, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, + 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, + 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x6e, + 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x4e, 0x6f, + 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x44, 0x61, 0x74, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x64, + 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x44, 0x61, + 0x74, 0x65, 0x22, 0x59, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, + 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x2d, + 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x69, + 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0xf3, 0x02, + 0x0a, 0x0f, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1b, + 0x0a, 0x09, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x5f, 0x6e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x4e, 0x6f, 0x12, 0x1f, 0x0a, 0x0b, 0x61, + 0x64, 0x6a, 0x75, 0x73, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x44, 0x61, 0x74, 0x65, 0x12, 0x23, 0x0a, 0x0d, + 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x52, 0x65, 0x61, 0x73, 0x6f, + 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x1a, 0x0a, + 0x08, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x3a, 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, + 0x6c, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, + 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, + 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x07, 0x64, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x73, 0x22, 0xa4, 0x02, 0x0a, 0x15, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x41, 0x64, 0x6a, + 0x75, 0x73, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1b, 0x0a, + 0x09, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x64, + 0x6a, 0x75, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, + 0x64, 0x6a, 0x75, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, + 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, + 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, + 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x62, 0x65, 0x66, + 0x6f, 0x72, 0x65, 0x5f, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0e, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x5f, 0x71, 0x75, 0x61, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x64, 0x6a, + 0x75, 0x73, 0x74, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x61, + 0x66, 0x74, 0x65, 0x72, 0x5f, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x61, 0x66, 0x74, 0x65, 0x72, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x22, 0xcb, 0x01, 0x0a, 0x14, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, + 0x52, 0x65, 0x71, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x5f, 0x64, 0x61, + 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, + 0x44, 0x61, 0x74, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x5f, 0x72, + 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x64, 0x6a, + 0x75, 0x73, 0x74, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x70, 0x65, + 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6f, 0x70, 0x65, + 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x39, 0x0a, + 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, + 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x6b, + 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x52, + 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0x76, 0x0a, 0x14, 0x53, 0x74, 0x6f, 0x63, + 0x6b, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, + 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, + 0x27, 0x0a, 0x0f, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x5f, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, + 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x61, + 0x72, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, + 0x22, 0x68, 0x0a, 0x15, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x53, 0x74, 0x6f, 0x63, 0x6b, + 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x64, 0x6a, + 0x75, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x64, + 0x6a, 0x75, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, + 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, + 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x30, 0x0a, 0x11, 0x47, 0x65, + 0x74, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, + 0x1b, 0x0a, 0x09, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x49, 0x64, 0x22, 0xd9, 0x01, 0x0a, + 0x12, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, + 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, + 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, + 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x5f, 0x6e, + 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x4e, + 0x6f, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x61, 0x73, + 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, + 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, + 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x44, 0x61, 0x74, 0x65, 0x12, 0x19, 0x0a, + 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x65, 0x22, 0x5b, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, + 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x2e, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, + 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x18, 0x0a, 0x06, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, + 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x32, 0xa2, 0x0a, 0x0a, 0x10, 0x49, 0x6e, 0x76, + 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3f, 0x0a, + 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x1b, + 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x69, 0x6e, + 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3e, + 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, + 0x1b, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x69, + 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x3e, + 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, + 0x1b, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x69, + 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x3e, + 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x18, 0x2e, 0x69, + 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, + 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, + 0x72, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x44, + 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x19, 0x2e, + 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, + 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x4b, 0x0a, 0x0e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x12, 0x1b, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, + 0x72, 0x79, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, + 0x52, 0x65, 0x71, 0x1a, 0x1c, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, + 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x12, 0x4a, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x4c, + 0x6f, 0x67, 0x12, 0x1b, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x1a, + 0x1c, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4a, 0x0a, + 0x0f, 0x47, 0x65, 0x74, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, + 0x12, 0x1a, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x53, 0x74, 0x6f, + 0x63, 0x6b, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x69, + 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x53, 0x75, + 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x44, 0x0a, 0x0d, 0x47, 0x65, 0x74, + 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x18, 0x2e, 0x69, 0x6e, 0x76, + 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, + 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x45, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x12, 0x1e, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, + 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x44, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1e, 0x2e, 0x69, 0x6e, 0x76, + 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, + 0x63, 0x6b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x69, 0x6e, 0x76, + 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x46, 0x0a, 0x11, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x12, 0x1f, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, + 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x12, 0x47, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x53, 0x74, 0x6f, 0x63, 0x6b, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1b, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, + 0x79, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, + 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x53, + 0x74, 0x6f, 0x63, 0x6b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x4d, 0x0a, + 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, + 0x1c, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x1a, 0x1d, 0x2e, + 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, + 0x6f, 0x63, 0x6b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x47, 0x0a, 0x11, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x41, 0x64, 0x6a, 0x75, 0x73, + 0x74, 0x12, 0x1f, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x52, + 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x49, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x48, 0x0a, 0x12, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, + 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x12, 0x20, 0x2e, 0x69, 0x6e, + 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x53, + 0x74, 0x6f, 0x63, 0x6b, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, + 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, + 0x4a, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x41, 0x64, 0x6a, 0x75, 0x73, + 0x74, 0x12, 0x1c, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x47, 0x65, + 0x74, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, + 0x1a, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x53, 0x74, 0x6f, 0x63, + 0x6b, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x50, 0x0a, 0x0f, 0x4c, + 0x69, 0x73, 0x74, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x12, 0x1d, + 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, + 0x74, 0x6f, 0x63, 0x6b, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x1e, 0x2e, + 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, + 0x6f, 0x63, 0x6b, 0x41, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, + 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_rpc_inventory_inventory_proto_rawDescOnce sync.Once + file_rpc_inventory_inventory_proto_rawDescData = file_rpc_inventory_inventory_proto_rawDesc +) + +func file_rpc_inventory_inventory_proto_rawDescGZIP() []byte { + file_rpc_inventory_inventory_proto_rawDescOnce.Do(func() { + file_rpc_inventory_inventory_proto_rawDescData = protoimpl.X.CompressGZIP(file_rpc_inventory_inventory_proto_rawDescData) + }) + return file_rpc_inventory_inventory_proto_rawDescData +} + +var file_rpc_inventory_inventory_proto_msgTypes = make([]protoimpl.MessageInfo, 36) +var file_rpc_inventory_inventory_proto_goTypes = []interface{}{ + (*ProductInfo)(nil), // 0: inventory.ProductInfo + (*CreateProductReq)(nil), // 1: inventory.CreateProductReq + (*UpdateProductReq)(nil), // 2: inventory.UpdateProductReq + (*DeleteProductReq)(nil), // 3: inventory.DeleteProductReq + (*GetProductReq)(nil), // 4: inventory.GetProductReq + (*ListProductReq)(nil), // 5: inventory.ListProductReq + (*ListProductResp)(nil), // 6: inventory.ListProductResp + (*ImportProductReq)(nil), // 7: inventory.ImportProductReq + (*ImportProductResp)(nil), // 8: inventory.ImportProductResp + (*ListImportLogReq)(nil), // 9: inventory.ListImportLogReq + (*ListImportLogResp)(nil), // 10: inventory.ListImportLogResp + (*ImportLogInfo)(nil), // 11: inventory.ImportLogInfo + (*StockSummaryReq)(nil), // 12: inventory.StockSummaryReq + (*StockSummaryResp)(nil), // 13: inventory.StockSummaryResp + (*StockGroupReq)(nil), // 14: inventory.StockGroupReq + (*StockGroupItem)(nil), // 15: inventory.StockGroupItem + (*StockGroupResp)(nil), // 16: inventory.StockGroupResp + (*StockCheckInfo)(nil), // 17: inventory.StockCheckInfo + (*StockCheckDetailInfo)(nil), // 18: inventory.StockCheckDetailInfo + (*CreateStockCheckReq)(nil), // 19: inventory.CreateStockCheckReq + (*StockCheckDetailReq)(nil), // 20: inventory.StockCheckDetailReq + (*UpdateStockCheckReq)(nil), // 21: inventory.UpdateStockCheckReq + (*ConfirmStockCheckReq)(nil), // 22: inventory.ConfirmStockCheckReq + (*GetStockCheckReq)(nil), // 23: inventory.GetStockCheckReq + (*ListStockCheckReq)(nil), // 24: inventory.ListStockCheckReq + (*ListStockCheckResp)(nil), // 25: inventory.ListStockCheckResp + (*StockAdjustInfo)(nil), // 26: inventory.StockAdjustInfo + (*StockAdjustDetailInfo)(nil), // 27: inventory.StockAdjustDetailInfo + (*CreateStockAdjustReq)(nil), // 28: inventory.CreateStockAdjustReq + (*StockAdjustDetailReq)(nil), // 29: inventory.StockAdjustDetailReq + (*ApproveStockAdjustReq)(nil), // 30: inventory.ApproveStockAdjustReq + (*GetStockAdjustReq)(nil), // 31: inventory.GetStockAdjustReq + (*ListStockAdjustReq)(nil), // 32: inventory.ListStockAdjustReq + (*ListStockAdjustResp)(nil), // 33: inventory.ListStockAdjustResp + (*IdResp)(nil), // 34: inventory.IdResp + (*Empty)(nil), // 35: inventory.Empty +} +var file_rpc_inventory_inventory_proto_depIdxs = []int32{ + 0, // 0: inventory.ListProductResp.list:type_name -> inventory.ProductInfo + 1, // 1: inventory.ImportProductReq.products:type_name -> inventory.CreateProductReq + 11, // 2: inventory.ListImportLogResp.list:type_name -> inventory.ImportLogInfo + 15, // 3: inventory.StockGroupResp.list:type_name -> inventory.StockGroupItem + 18, // 4: inventory.StockCheckInfo.details:type_name -> inventory.StockCheckDetailInfo + 20, // 5: inventory.CreateStockCheckReq.details:type_name -> inventory.StockCheckDetailReq + 20, // 6: inventory.UpdateStockCheckReq.details:type_name -> inventory.StockCheckDetailReq + 17, // 7: inventory.ListStockCheckResp.list:type_name -> inventory.StockCheckInfo + 27, // 8: inventory.StockAdjustInfo.details:type_name -> inventory.StockAdjustDetailInfo + 29, // 9: inventory.CreateStockAdjustReq.details:type_name -> inventory.StockAdjustDetailReq + 26, // 10: inventory.ListStockAdjustResp.list:type_name -> inventory.StockAdjustInfo + 1, // 11: inventory.InventoryService.CreateProduct:input_type -> inventory.CreateProductReq + 2, // 12: inventory.InventoryService.UpdateProduct:input_type -> inventory.UpdateProductReq + 3, // 13: inventory.InventoryService.DeleteProduct:input_type -> inventory.DeleteProductReq + 4, // 14: inventory.InventoryService.GetProduct:input_type -> inventory.GetProductReq + 5, // 15: inventory.InventoryService.ListProduct:input_type -> inventory.ListProductReq + 7, // 16: inventory.InventoryService.ImportProducts:input_type -> inventory.ImportProductReq + 9, // 17: inventory.InventoryService.ListImportLog:input_type -> inventory.ListImportLogReq + 12, // 18: inventory.InventoryService.GetStockSummary:input_type -> inventory.StockSummaryReq + 14, // 19: inventory.InventoryService.GetStockGroup:input_type -> inventory.StockGroupReq + 19, // 20: inventory.InventoryService.CreateStockCheck:input_type -> inventory.CreateStockCheckReq + 21, // 21: inventory.InventoryService.UpdateStockCheck:input_type -> inventory.UpdateStockCheckReq + 22, // 22: inventory.InventoryService.ConfirmStockCheck:input_type -> inventory.ConfirmStockCheckReq + 23, // 23: inventory.InventoryService.GetStockCheck:input_type -> inventory.GetStockCheckReq + 24, // 24: inventory.InventoryService.ListStockCheck:input_type -> inventory.ListStockCheckReq + 28, // 25: inventory.InventoryService.CreateStockAdjust:input_type -> inventory.CreateStockAdjustReq + 30, // 26: inventory.InventoryService.ApproveStockAdjust:input_type -> inventory.ApproveStockAdjustReq + 31, // 27: inventory.InventoryService.GetStockAdjust:input_type -> inventory.GetStockAdjustReq + 32, // 28: inventory.InventoryService.ListStockAdjust:input_type -> inventory.ListStockAdjustReq + 34, // 29: inventory.InventoryService.CreateProduct:output_type -> inventory.IdResp + 35, // 30: inventory.InventoryService.UpdateProduct:output_type -> inventory.Empty + 35, // 31: inventory.InventoryService.DeleteProduct:output_type -> inventory.Empty + 0, // 32: inventory.InventoryService.GetProduct:output_type -> inventory.ProductInfo + 6, // 33: inventory.InventoryService.ListProduct:output_type -> inventory.ListProductResp + 8, // 34: inventory.InventoryService.ImportProducts:output_type -> inventory.ImportProductResp + 10, // 35: inventory.InventoryService.ListImportLog:output_type -> inventory.ListImportLogResp + 13, // 36: inventory.InventoryService.GetStockSummary:output_type -> inventory.StockSummaryResp + 16, // 37: inventory.InventoryService.GetStockGroup:output_type -> inventory.StockGroupResp + 34, // 38: inventory.InventoryService.CreateStockCheck:output_type -> inventory.IdResp + 35, // 39: inventory.InventoryService.UpdateStockCheck:output_type -> inventory.Empty + 35, // 40: inventory.InventoryService.ConfirmStockCheck:output_type -> inventory.Empty + 17, // 41: inventory.InventoryService.GetStockCheck:output_type -> inventory.StockCheckInfo + 25, // 42: inventory.InventoryService.ListStockCheck:output_type -> inventory.ListStockCheckResp + 34, // 43: inventory.InventoryService.CreateStockAdjust:output_type -> inventory.IdResp + 35, // 44: inventory.InventoryService.ApproveStockAdjust:output_type -> inventory.Empty + 26, // 45: inventory.InventoryService.GetStockAdjust:output_type -> inventory.StockAdjustInfo + 33, // 46: inventory.InventoryService.ListStockAdjust:output_type -> inventory.ListStockAdjustResp + 29, // [29:47] is the sub-list for method output_type + 11, // [11:29] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name +} + +func init() { file_rpc_inventory_inventory_proto_init() } +func file_rpc_inventory_inventory_proto_init() { + if File_rpc_inventory_inventory_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_rpc_inventory_inventory_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProductInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateProductReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateProductReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteProductReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetProductReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListProductReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListProductResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImportProductReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImportProductResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListImportLogReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListImportLogResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImportLogInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StockSummaryReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StockSummaryResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StockGroupReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StockGroupItem); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StockGroupResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StockCheckInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StockCheckDetailInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateStockCheckReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StockCheckDetailReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateStockCheckReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConfirmStockCheckReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetStockCheckReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListStockCheckReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListStockCheckResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StockAdjustInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StockAdjustDetailInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateStockAdjustReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StockAdjustDetailReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ApproveStockAdjustReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetStockAdjustReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListStockAdjustReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListStockAdjustResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_inventory_inventory_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Empty); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_rpc_inventory_inventory_proto_rawDesc, + NumEnums: 0, + NumMessages: 36, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_rpc_inventory_inventory_proto_goTypes, + DependencyIndexes: file_rpc_inventory_inventory_proto_depIdxs, + MessageInfos: file_rpc_inventory_inventory_proto_msgTypes, + }.Build() + File_rpc_inventory_inventory_proto = out.File + file_rpc_inventory_inventory_proto_rawDesc = nil + file_rpc_inventory_inventory_proto_goTypes = nil + file_rpc_inventory_inventory_proto_depIdxs = nil +} diff --git a/rpc/inventory/pb/inventory_grpc.pb.go b/rpc/inventory/pb/inventory_grpc.pb.go new file mode 100644 index 0000000..d19b950 --- /dev/null +++ b/rpc/inventory/pb/inventory_grpc.pb.go @@ -0,0 +1,727 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.20.3 +// source: rpc/inventory/inventory.proto + +package pb + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// InventoryServiceClient is the client API for InventoryService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type InventoryServiceClient interface { + // Product + CreateProduct(ctx context.Context, in *CreateProductReq, opts ...grpc.CallOption) (*IdResp, error) + UpdateProduct(ctx context.Context, in *UpdateProductReq, opts ...grpc.CallOption) (*Empty, error) + DeleteProduct(ctx context.Context, in *DeleteProductReq, opts ...grpc.CallOption) (*Empty, error) + GetProduct(ctx context.Context, in *GetProductReq, opts ...grpc.CallOption) (*ProductInfo, error) + ListProduct(ctx context.Context, in *ListProductReq, opts ...grpc.CallOption) (*ListProductResp, error) + // Import + ImportProducts(ctx context.Context, in *ImportProductReq, opts ...grpc.CallOption) (*ImportProductResp, error) + ListImportLog(ctx context.Context, in *ListImportLogReq, opts ...grpc.CallOption) (*ListImportLogResp, error) + // Stock Statistics + GetStockSummary(ctx context.Context, in *StockSummaryReq, opts ...grpc.CallOption) (*StockSummaryResp, error) + GetStockGroup(ctx context.Context, in *StockGroupReq, opts ...grpc.CallOption) (*StockGroupResp, error) + // Stock Check + CreateStockCheck(ctx context.Context, in *CreateStockCheckReq, opts ...grpc.CallOption) (*IdResp, error) + UpdateStockCheck(ctx context.Context, in *UpdateStockCheckReq, opts ...grpc.CallOption) (*Empty, error) + ConfirmStockCheck(ctx context.Context, in *ConfirmStockCheckReq, opts ...grpc.CallOption) (*Empty, error) + GetStockCheck(ctx context.Context, in *GetStockCheckReq, opts ...grpc.CallOption) (*StockCheckInfo, error) + ListStockCheck(ctx context.Context, in *ListStockCheckReq, opts ...grpc.CallOption) (*ListStockCheckResp, error) + // Stock Adjust + CreateStockAdjust(ctx context.Context, in *CreateStockAdjustReq, opts ...grpc.CallOption) (*IdResp, error) + ApproveStockAdjust(ctx context.Context, in *ApproveStockAdjustReq, opts ...grpc.CallOption) (*Empty, error) + GetStockAdjust(ctx context.Context, in *GetStockAdjustReq, opts ...grpc.CallOption) (*StockAdjustInfo, error) + ListStockAdjust(ctx context.Context, in *ListStockAdjustReq, opts ...grpc.CallOption) (*ListStockAdjustResp, error) +} + +type inventoryServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewInventoryServiceClient(cc grpc.ClientConnInterface) InventoryServiceClient { + return &inventoryServiceClient{cc} +} + +func (c *inventoryServiceClient) CreateProduct(ctx context.Context, in *CreateProductReq, opts ...grpc.CallOption) (*IdResp, error) { + out := new(IdResp) + err := c.cc.Invoke(ctx, "/inventory.InventoryService/CreateProduct", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inventoryServiceClient) UpdateProduct(ctx context.Context, in *UpdateProductReq, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, "/inventory.InventoryService/UpdateProduct", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inventoryServiceClient) DeleteProduct(ctx context.Context, in *DeleteProductReq, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, "/inventory.InventoryService/DeleteProduct", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inventoryServiceClient) GetProduct(ctx context.Context, in *GetProductReq, opts ...grpc.CallOption) (*ProductInfo, error) { + out := new(ProductInfo) + err := c.cc.Invoke(ctx, "/inventory.InventoryService/GetProduct", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inventoryServiceClient) ListProduct(ctx context.Context, in *ListProductReq, opts ...grpc.CallOption) (*ListProductResp, error) { + out := new(ListProductResp) + err := c.cc.Invoke(ctx, "/inventory.InventoryService/ListProduct", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inventoryServiceClient) ImportProducts(ctx context.Context, in *ImportProductReq, opts ...grpc.CallOption) (*ImportProductResp, error) { + out := new(ImportProductResp) + err := c.cc.Invoke(ctx, "/inventory.InventoryService/ImportProducts", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inventoryServiceClient) ListImportLog(ctx context.Context, in *ListImportLogReq, opts ...grpc.CallOption) (*ListImportLogResp, error) { + out := new(ListImportLogResp) + err := c.cc.Invoke(ctx, "/inventory.InventoryService/ListImportLog", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inventoryServiceClient) GetStockSummary(ctx context.Context, in *StockSummaryReq, opts ...grpc.CallOption) (*StockSummaryResp, error) { + out := new(StockSummaryResp) + err := c.cc.Invoke(ctx, "/inventory.InventoryService/GetStockSummary", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inventoryServiceClient) GetStockGroup(ctx context.Context, in *StockGroupReq, opts ...grpc.CallOption) (*StockGroupResp, error) { + out := new(StockGroupResp) + err := c.cc.Invoke(ctx, "/inventory.InventoryService/GetStockGroup", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inventoryServiceClient) CreateStockCheck(ctx context.Context, in *CreateStockCheckReq, opts ...grpc.CallOption) (*IdResp, error) { + out := new(IdResp) + err := c.cc.Invoke(ctx, "/inventory.InventoryService/CreateStockCheck", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inventoryServiceClient) UpdateStockCheck(ctx context.Context, in *UpdateStockCheckReq, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, "/inventory.InventoryService/UpdateStockCheck", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inventoryServiceClient) ConfirmStockCheck(ctx context.Context, in *ConfirmStockCheckReq, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, "/inventory.InventoryService/ConfirmStockCheck", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inventoryServiceClient) GetStockCheck(ctx context.Context, in *GetStockCheckReq, opts ...grpc.CallOption) (*StockCheckInfo, error) { + out := new(StockCheckInfo) + err := c.cc.Invoke(ctx, "/inventory.InventoryService/GetStockCheck", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inventoryServiceClient) ListStockCheck(ctx context.Context, in *ListStockCheckReq, opts ...grpc.CallOption) (*ListStockCheckResp, error) { + out := new(ListStockCheckResp) + err := c.cc.Invoke(ctx, "/inventory.InventoryService/ListStockCheck", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inventoryServiceClient) CreateStockAdjust(ctx context.Context, in *CreateStockAdjustReq, opts ...grpc.CallOption) (*IdResp, error) { + out := new(IdResp) + err := c.cc.Invoke(ctx, "/inventory.InventoryService/CreateStockAdjust", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inventoryServiceClient) ApproveStockAdjust(ctx context.Context, in *ApproveStockAdjustReq, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, "/inventory.InventoryService/ApproveStockAdjust", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inventoryServiceClient) GetStockAdjust(ctx context.Context, in *GetStockAdjustReq, opts ...grpc.CallOption) (*StockAdjustInfo, error) { + out := new(StockAdjustInfo) + err := c.cc.Invoke(ctx, "/inventory.InventoryService/GetStockAdjust", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inventoryServiceClient) ListStockAdjust(ctx context.Context, in *ListStockAdjustReq, opts ...grpc.CallOption) (*ListStockAdjustResp, error) { + out := new(ListStockAdjustResp) + err := c.cc.Invoke(ctx, "/inventory.InventoryService/ListStockAdjust", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// InventoryServiceServer is the server API for InventoryService service. +// All implementations must embed UnimplementedInventoryServiceServer +// for forward compatibility +type InventoryServiceServer interface { + // Product + CreateProduct(context.Context, *CreateProductReq) (*IdResp, error) + UpdateProduct(context.Context, *UpdateProductReq) (*Empty, error) + DeleteProduct(context.Context, *DeleteProductReq) (*Empty, error) + GetProduct(context.Context, *GetProductReq) (*ProductInfo, error) + ListProduct(context.Context, *ListProductReq) (*ListProductResp, error) + // Import + ImportProducts(context.Context, *ImportProductReq) (*ImportProductResp, error) + ListImportLog(context.Context, *ListImportLogReq) (*ListImportLogResp, error) + // Stock Statistics + GetStockSummary(context.Context, *StockSummaryReq) (*StockSummaryResp, error) + GetStockGroup(context.Context, *StockGroupReq) (*StockGroupResp, error) + // Stock Check + CreateStockCheck(context.Context, *CreateStockCheckReq) (*IdResp, error) + UpdateStockCheck(context.Context, *UpdateStockCheckReq) (*Empty, error) + ConfirmStockCheck(context.Context, *ConfirmStockCheckReq) (*Empty, error) + GetStockCheck(context.Context, *GetStockCheckReq) (*StockCheckInfo, error) + ListStockCheck(context.Context, *ListStockCheckReq) (*ListStockCheckResp, error) + // Stock Adjust + CreateStockAdjust(context.Context, *CreateStockAdjustReq) (*IdResp, error) + ApproveStockAdjust(context.Context, *ApproveStockAdjustReq) (*Empty, error) + GetStockAdjust(context.Context, *GetStockAdjustReq) (*StockAdjustInfo, error) + ListStockAdjust(context.Context, *ListStockAdjustReq) (*ListStockAdjustResp, error) + mustEmbedUnimplementedInventoryServiceServer() +} + +// UnimplementedInventoryServiceServer must be embedded to have forward compatible implementations. +type UnimplementedInventoryServiceServer struct { +} + +func (UnimplementedInventoryServiceServer) CreateProduct(context.Context, *CreateProductReq) (*IdResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateProduct not implemented") +} +func (UnimplementedInventoryServiceServer) UpdateProduct(context.Context, *UpdateProductReq) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateProduct not implemented") +} +func (UnimplementedInventoryServiceServer) DeleteProduct(context.Context, *DeleteProductReq) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteProduct not implemented") +} +func (UnimplementedInventoryServiceServer) GetProduct(context.Context, *GetProductReq) (*ProductInfo, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetProduct not implemented") +} +func (UnimplementedInventoryServiceServer) ListProduct(context.Context, *ListProductReq) (*ListProductResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListProduct not implemented") +} +func (UnimplementedInventoryServiceServer) ImportProducts(context.Context, *ImportProductReq) (*ImportProductResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method ImportProducts not implemented") +} +func (UnimplementedInventoryServiceServer) ListImportLog(context.Context, *ListImportLogReq) (*ListImportLogResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListImportLog not implemented") +} +func (UnimplementedInventoryServiceServer) GetStockSummary(context.Context, *StockSummaryReq) (*StockSummaryResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetStockSummary not implemented") +} +func (UnimplementedInventoryServiceServer) GetStockGroup(context.Context, *StockGroupReq) (*StockGroupResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetStockGroup not implemented") +} +func (UnimplementedInventoryServiceServer) CreateStockCheck(context.Context, *CreateStockCheckReq) (*IdResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateStockCheck not implemented") +} +func (UnimplementedInventoryServiceServer) UpdateStockCheck(context.Context, *UpdateStockCheckReq) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateStockCheck not implemented") +} +func (UnimplementedInventoryServiceServer) ConfirmStockCheck(context.Context, *ConfirmStockCheckReq) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConfirmStockCheck not implemented") +} +func (UnimplementedInventoryServiceServer) GetStockCheck(context.Context, *GetStockCheckReq) (*StockCheckInfo, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetStockCheck not implemented") +} +func (UnimplementedInventoryServiceServer) ListStockCheck(context.Context, *ListStockCheckReq) (*ListStockCheckResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListStockCheck not implemented") +} +func (UnimplementedInventoryServiceServer) CreateStockAdjust(context.Context, *CreateStockAdjustReq) (*IdResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateStockAdjust not implemented") +} +func (UnimplementedInventoryServiceServer) ApproveStockAdjust(context.Context, *ApproveStockAdjustReq) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method ApproveStockAdjust not implemented") +} +func (UnimplementedInventoryServiceServer) GetStockAdjust(context.Context, *GetStockAdjustReq) (*StockAdjustInfo, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetStockAdjust not implemented") +} +func (UnimplementedInventoryServiceServer) ListStockAdjust(context.Context, *ListStockAdjustReq) (*ListStockAdjustResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListStockAdjust not implemented") +} +func (UnimplementedInventoryServiceServer) mustEmbedUnimplementedInventoryServiceServer() {} + +// UnsafeInventoryServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to InventoryServiceServer will +// result in compilation errors. +type UnsafeInventoryServiceServer interface { + mustEmbedUnimplementedInventoryServiceServer() +} + +func RegisterInventoryServiceServer(s grpc.ServiceRegistrar, srv InventoryServiceServer) { + s.RegisterService(&InventoryService_ServiceDesc, srv) +} + +func _InventoryService_CreateProduct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateProductReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServiceServer).CreateProduct(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventory.InventoryService/CreateProduct", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServiceServer).CreateProduct(ctx, req.(*CreateProductReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _InventoryService_UpdateProduct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateProductReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServiceServer).UpdateProduct(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventory.InventoryService/UpdateProduct", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServiceServer).UpdateProduct(ctx, req.(*UpdateProductReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _InventoryService_DeleteProduct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteProductReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServiceServer).DeleteProduct(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventory.InventoryService/DeleteProduct", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServiceServer).DeleteProduct(ctx, req.(*DeleteProductReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _InventoryService_GetProduct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetProductReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServiceServer).GetProduct(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventory.InventoryService/GetProduct", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServiceServer).GetProduct(ctx, req.(*GetProductReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _InventoryService_ListProduct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListProductReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServiceServer).ListProduct(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventory.InventoryService/ListProduct", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServiceServer).ListProduct(ctx, req.(*ListProductReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _InventoryService_ImportProducts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ImportProductReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServiceServer).ImportProducts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventory.InventoryService/ImportProducts", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServiceServer).ImportProducts(ctx, req.(*ImportProductReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _InventoryService_ListImportLog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListImportLogReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServiceServer).ListImportLog(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventory.InventoryService/ListImportLog", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServiceServer).ListImportLog(ctx, req.(*ListImportLogReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _InventoryService_GetStockSummary_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StockSummaryReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServiceServer).GetStockSummary(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventory.InventoryService/GetStockSummary", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServiceServer).GetStockSummary(ctx, req.(*StockSummaryReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _InventoryService_GetStockGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StockGroupReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServiceServer).GetStockGroup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventory.InventoryService/GetStockGroup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServiceServer).GetStockGroup(ctx, req.(*StockGroupReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _InventoryService_CreateStockCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateStockCheckReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServiceServer).CreateStockCheck(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventory.InventoryService/CreateStockCheck", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServiceServer).CreateStockCheck(ctx, req.(*CreateStockCheckReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _InventoryService_UpdateStockCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateStockCheckReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServiceServer).UpdateStockCheck(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventory.InventoryService/UpdateStockCheck", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServiceServer).UpdateStockCheck(ctx, req.(*UpdateStockCheckReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _InventoryService_ConfirmStockCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ConfirmStockCheckReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServiceServer).ConfirmStockCheck(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventory.InventoryService/ConfirmStockCheck", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServiceServer).ConfirmStockCheck(ctx, req.(*ConfirmStockCheckReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _InventoryService_GetStockCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetStockCheckReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServiceServer).GetStockCheck(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventory.InventoryService/GetStockCheck", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServiceServer).GetStockCheck(ctx, req.(*GetStockCheckReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _InventoryService_ListStockCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListStockCheckReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServiceServer).ListStockCheck(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventory.InventoryService/ListStockCheck", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServiceServer).ListStockCheck(ctx, req.(*ListStockCheckReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _InventoryService_CreateStockAdjust_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateStockAdjustReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServiceServer).CreateStockAdjust(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventory.InventoryService/CreateStockAdjust", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServiceServer).CreateStockAdjust(ctx, req.(*CreateStockAdjustReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _InventoryService_ApproveStockAdjust_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ApproveStockAdjustReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServiceServer).ApproveStockAdjust(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventory.InventoryService/ApproveStockAdjust", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServiceServer).ApproveStockAdjust(ctx, req.(*ApproveStockAdjustReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _InventoryService_GetStockAdjust_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetStockAdjustReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServiceServer).GetStockAdjust(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventory.InventoryService/GetStockAdjust", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServiceServer).GetStockAdjust(ctx, req.(*GetStockAdjustReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _InventoryService_ListStockAdjust_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListStockAdjustReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServiceServer).ListStockAdjust(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventory.InventoryService/ListStockAdjust", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServiceServer).ListStockAdjust(ctx, req.(*ListStockAdjustReq)) + } + return interceptor(ctx, in, info, handler) +} + +// InventoryService_ServiceDesc is the grpc.ServiceDesc for InventoryService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var InventoryService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "inventory.InventoryService", + HandlerType: (*InventoryServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateProduct", + Handler: _InventoryService_CreateProduct_Handler, + }, + { + MethodName: "UpdateProduct", + Handler: _InventoryService_UpdateProduct_Handler, + }, + { + MethodName: "DeleteProduct", + Handler: _InventoryService_DeleteProduct_Handler, + }, + { + MethodName: "GetProduct", + Handler: _InventoryService_GetProduct_Handler, + }, + { + MethodName: "ListProduct", + Handler: _InventoryService_ListProduct_Handler, + }, + { + MethodName: "ImportProducts", + Handler: _InventoryService_ImportProducts_Handler, + }, + { + MethodName: "ListImportLog", + Handler: _InventoryService_ListImportLog_Handler, + }, + { + MethodName: "GetStockSummary", + Handler: _InventoryService_GetStockSummary_Handler, + }, + { + MethodName: "GetStockGroup", + Handler: _InventoryService_GetStockGroup_Handler, + }, + { + MethodName: "CreateStockCheck", + Handler: _InventoryService_CreateStockCheck_Handler, + }, + { + MethodName: "UpdateStockCheck", + Handler: _InventoryService_UpdateStockCheck_Handler, + }, + { + MethodName: "ConfirmStockCheck", + Handler: _InventoryService_ConfirmStockCheck_Handler, + }, + { + MethodName: "GetStockCheck", + Handler: _InventoryService_GetStockCheck_Handler, + }, + { + MethodName: "ListStockCheck", + Handler: _InventoryService_ListStockCheck_Handler, + }, + { + MethodName: "CreateStockAdjust", + Handler: _InventoryService_CreateStockAdjust_Handler, + }, + { + MethodName: "ApproveStockAdjust", + Handler: _InventoryService_ApproveStockAdjust_Handler, + }, + { + MethodName: "GetStockAdjust", + Handler: _InventoryService_GetStockAdjust_Handler, + }, + { + MethodName: "ListStockAdjust", + Handler: _InventoryService_ListStockAdjust_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "rpc/inventory/inventory.proto", +} diff --git a/rpc/system/etc/system.yaml b/rpc/system/etc/system.yaml new file mode 100644 index 0000000..9f32d80 --- /dev/null +++ b/rpc/system/etc/system.yaml @@ -0,0 +1,17 @@ +Name: system.rpc +ListenOn: 0.0.0.0:9001 + +Etcd: + Hosts: + - 127.0.0.1:2379 + Key: system.rpc + +DataSource: root:muyu2026@tcp(127.0.0.1:3306)/muyu_wms?charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai + +Cache: + - Host: 127.0.0.1:6379 + +Log: + ServiceName: system-rpc + Mode: console + Level: info diff --git a/rpc/system/internal/config/config.go b/rpc/system/internal/config/config.go new file mode 100755 index 0000000..fe94d71 --- /dev/null +++ b/rpc/system/internal/config/config.go @@ -0,0 +1,12 @@ +package config + +import ( + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/zrpc" +) + +type Config struct { + zrpc.RpcServerConf + DataSource string + Cache cache.CacheConf +} diff --git a/rpc/system/internal/logic/changepasswordlogic.go b/rpc/system/internal/logic/changepasswordlogic.go new file mode 100644 index 0000000..5cde3a8 --- /dev/null +++ b/rpc/system/internal/logic/changepasswordlogic.go @@ -0,0 +1,57 @@ +package logic + +import ( + "context" + "errors" + + "muyu-apiserver/model" + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "golang.org/x/crypto/bcrypt" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type ChangePasswordLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewChangePasswordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ChangePasswordLogic { + return &ChangePasswordLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ChangePasswordLogic) ChangePassword(in *pb.ChangePasswordReq) (*pb.Empty, error) { + user, err := l.svcCtx.UserModel.FindOneByUserId(l.ctx, in.UserId) + if err != nil { + if errors.Is(err, model.ErrNotFound) { + return nil, status.Error(codes.NotFound, "user not found") + } + return nil, status.Error(codes.Internal, err.Error()) + } + + err = bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(in.OldPassword)) + if err != nil { + return nil, status.Error(codes.Unauthenticated, "incorrect old password") + } + + hashedPw, err := bcrypt.GenerateFromPassword([]byte(in.NewPassword), bcrypt.DefaultCost) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + user.Password = string(hashedPw) + err = l.svcCtx.UserModel.Update(l.ctx, user) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.Empty{}, nil +} diff --git a/rpc/system/internal/logic/createmenulogic.go b/rpc/system/internal/logic/createmenulogic.go new file mode 100644 index 0000000..b900ca8 --- /dev/null +++ b/rpc/system/internal/logic/createmenulogic.go @@ -0,0 +1,51 @@ +package logic + +import ( + "context" + + "muyu-apiserver/model" + "muyu-apiserver/pkg/uid" + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type CreateMenuLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreateMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateMenuLogic { + return &CreateMenuLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *CreateMenuLogic) CreateMenu(in *pb.CreateMenuReq) (*pb.IdResp, error) { + menuId := uid.Generate() + + _, err := l.svcCtx.MenuModel.Insert(l.ctx, &model.SysMenu{ + MenuId: menuId, + ParentId: in.ParentId, + MenuName: in.MenuName, + MenuType: in.MenuType, + Path: in.Path, + Component: in.Component, + Permission: in.Permission, + Icon: in.Icon, + SortOrder: in.SortOrder, + Visible: 1, + Status: 1, + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.IdResp{Id: menuId}, nil +} diff --git a/rpc/system/internal/logic/createoperationloglogic.go b/rpc/system/internal/logic/createoperationloglogic.go new file mode 100644 index 0000000..a0c6454 --- /dev/null +++ b/rpc/system/internal/logic/createoperationloglogic.go @@ -0,0 +1,52 @@ +package logic + +import ( + "context" + "database/sql" + + "muyu-apiserver/model" + "muyu-apiserver/pkg/uid" + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type CreateOperationLogLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreateOperationLogLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateOperationLogLogic { + return &CreateOperationLogLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *CreateOperationLogLogic) CreateOperationLog(in *pb.CreateLogReq) (*pb.Empty, error) { + _, err := l.svcCtx.LogModel.Insert(l.ctx, &model.SysOperationLog{ + LogId: uid.Generate(), + UserId: in.UserId, + Username: in.Username, + Module: in.Module, + Operation: in.Operation, + Method: in.Method, + Path: in.Path, + RequestBody: sql.NullString{String: in.RequestBody, Valid: in.RequestBody != ""}, + ResponseBody: sql.NullString{String: in.ResponseBody, Valid: in.ResponseBody != ""}, + Ip: in.Ip, + UserAgent: in.UserAgent, + Duration: in.Duration, + Status: in.Status, + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.Empty{}, nil +} diff --git a/rpc/system/internal/logic/createrolelogic.go b/rpc/system/internal/logic/createrolelogic.go new file mode 100644 index 0000000..680ef4e --- /dev/null +++ b/rpc/system/internal/logic/createrolelogic.go @@ -0,0 +1,46 @@ +package logic + +import ( + "context" + + "muyu-apiserver/model" + "muyu-apiserver/pkg/uid" + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type CreateRoleLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreateRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateRoleLogic { + return &CreateRoleLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *CreateRoleLogic) CreateRole(in *pb.CreateRoleReq) (*pb.IdResp, error) { + roleId := uid.Generate() + + _, err := l.svcCtx.RoleModel.Insert(l.ctx, &model.SysRole{ + RoleId: roleId, + RoleName: in.RoleName, + RoleKey: in.RoleKey, + RoleDesc: in.RoleDesc, + SortOrder: in.SortOrder, + Status: 1, + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.IdResp{Id: roleId}, nil +} diff --git a/rpc/system/internal/logic/createuserlogic.go b/rpc/system/internal/logic/createuserlogic.go new file mode 100644 index 0000000..006a6b8 --- /dev/null +++ b/rpc/system/internal/logic/createuserlogic.go @@ -0,0 +1,60 @@ +package logic + +import ( + "context" + + "muyu-apiserver/model" + "muyu-apiserver/pkg/uid" + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "golang.org/x/crypto/bcrypt" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type CreateUserLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreateUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateUserLogic { + return &CreateUserLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *CreateUserLogic) CreateUser(in *pb.CreateUserReq) (*pb.IdResp, error) { + userId := uid.Generate() + hashedPw, err := bcrypt.GenerateFromPassword([]byte(in.Password), bcrypt.DefaultCost) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + _, err = l.svcCtx.UserModel.Insert(l.ctx, &model.SysUser{ + UserId: userId, + Username: in.Username, + Password: string(hashedPw), + Salt: "bcrypt", + RealName: in.RealName, + Phone: in.Phone, + Email: in.Email, + Status: 1, + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + if in.RoleId != "" { + _, _ = l.svcCtx.UserRoleModel.Insert(l.ctx, &model.SysUserRole{ + UserId: userId, + RoleId: in.RoleId, + }) + } + + return &pb.IdResp{Id: userId}, nil +} diff --git a/rpc/system/internal/logic/deletemenulogic.go b/rpc/system/internal/logic/deletemenulogic.go new file mode 100644 index 0000000..735d4aa --- /dev/null +++ b/rpc/system/internal/logic/deletemenulogic.go @@ -0,0 +1,45 @@ +package logic + +import ( + "context" + "errors" + + "muyu-apiserver/model" + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type DeleteMenuLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewDeleteMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteMenuLogic { + return &DeleteMenuLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *DeleteMenuLogic) DeleteMenu(in *pb.DeleteMenuReq) (*pb.Empty, error) { + menu, err := l.svcCtx.MenuModel.FindOneByMenuId(l.ctx, in.MenuId) + if err != nil { + if errors.Is(err, model.ErrNotFound) { + return nil, status.Error(codes.NotFound, "menu not found") + } + return nil, status.Error(codes.Internal, err.Error()) + } + + err = l.svcCtx.MenuModel.Delete(l.ctx, menu.Id) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.Empty{}, nil +} diff --git a/rpc/system/internal/logic/deleterolelogic.go b/rpc/system/internal/logic/deleterolelogic.go new file mode 100644 index 0000000..69bef75 --- /dev/null +++ b/rpc/system/internal/logic/deleterolelogic.go @@ -0,0 +1,47 @@ +package logic + +import ( + "context" + "errors" + + "muyu-apiserver/model" + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type DeleteRoleLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewDeleteRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteRoleLogic { + return &DeleteRoleLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *DeleteRoleLogic) DeleteRole(in *pb.DeleteRoleReq) (*pb.Empty, error) { + role, err := l.svcCtx.RoleModel.FindOneByRoleId(l.ctx, in.RoleId) + if err != nil { + if errors.Is(err, model.ErrNotFound) { + return nil, status.Error(codes.NotFound, "role not found") + } + return nil, status.Error(codes.Internal, err.Error()) + } + + err = l.svcCtx.RoleModel.Delete(l.ctx, role.Id) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + _ = l.svcCtx.RoleMenuModel.DeleteByRoleId(l.ctx, in.RoleId) + + return &pb.Empty{}, nil +} diff --git a/rpc/system/internal/logic/deleteuserlogic.go b/rpc/system/internal/logic/deleteuserlogic.go new file mode 100644 index 0000000..92be4bf --- /dev/null +++ b/rpc/system/internal/logic/deleteuserlogic.go @@ -0,0 +1,50 @@ +package logic + +import ( + "context" + "database/sql" + "errors" + "time" + + "muyu-apiserver/model" + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type DeleteUserLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewDeleteUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteUserLogic { + return &DeleteUserLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *DeleteUserLogic) DeleteUser(in *pb.DeleteUserReq) (*pb.Empty, error) { + user, err := l.svcCtx.UserModel.FindOneByUserId(l.ctx, in.UserId) + if err != nil { + if errors.Is(err, model.ErrNotFound) { + return nil, status.Error(codes.NotFound, "user not found") + } + return nil, status.Error(codes.Internal, err.Error()) + } + + user.DeletedAt = sql.NullTime{Time: time.Now(), Valid: true} + err = l.svcCtx.UserModel.Update(l.ctx, user) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + _ = l.svcCtx.UserRoleModel.DeleteByUserId(l.ctx, in.UserId) + + return &pb.Empty{}, nil +} diff --git a/rpc/system/internal/logic/getmenulogic.go b/rpc/system/internal/logic/getmenulogic.go new file mode 100644 index 0000000..4d41bdc --- /dev/null +++ b/rpc/system/internal/logic/getmenulogic.go @@ -0,0 +1,54 @@ +package logic + +import ( + "context" + "errors" + + "muyu-apiserver/model" + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type GetMenuLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMenuLogic { + return &GetMenuLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetMenuLogic) GetMenu(in *pb.GetMenuReq) (*pb.MenuInfo, error) { + menu, err := l.svcCtx.MenuModel.FindOneByMenuId(l.ctx, in.MenuId) + if err != nil { + if errors.Is(err, model.ErrNotFound) { + return nil, status.Error(codes.NotFound, "menu not found") + } + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.MenuInfo{ + MenuId: menu.MenuId, + ParentId: menu.ParentId, + MenuName: menu.MenuName, + MenuType: menu.MenuType, + Path: menu.Path, + Component: menu.Component, + Permission: menu.Permission, + Icon: menu.Icon, + SortOrder: menu.SortOrder, + Visible: menu.Visible, + Status: menu.Status, + CreatedAt: menu.CreatedAt.Format("2006-01-02 15:04:05"), + UpdatedAt: menu.UpdatedAt.Format("2006-01-02 15:04:05"), + }, nil +} diff --git a/rpc/system/internal/logic/getrolelogic.go b/rpc/system/internal/logic/getrolelogic.go new file mode 100644 index 0000000..7a99efd --- /dev/null +++ b/rpc/system/internal/logic/getrolelogic.go @@ -0,0 +1,56 @@ +package logic + +import ( + "context" + "errors" + + "muyu-apiserver/model" + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type GetRoleLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetRoleLogic { + return &GetRoleLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetRoleLogic) GetRole(in *pb.GetRoleReq) (*pb.RoleInfo, error) { + role, err := l.svcCtx.RoleModel.FindOneByRoleId(l.ctx, in.RoleId) + if err != nil { + if errors.Is(err, model.ErrNotFound) { + return nil, status.Error(codes.NotFound, "role not found") + } + return nil, status.Error(codes.Internal, err.Error()) + } + + menuIds := make([]string, 0) + roleMenus, _ := l.svcCtx.RoleMenuModel.FindByRoleId(l.ctx, role.RoleId) + for _, rm := range roleMenus { + menuIds = append(menuIds, rm.MenuId) + } + + return &pb.RoleInfo{ + RoleId: role.RoleId, + RoleName: role.RoleName, + RoleKey: role.RoleKey, + RoleDesc: role.RoleDesc, + SortOrder: role.SortOrder, + Status: role.Status, + MenuIds: menuIds, + CreatedAt: role.CreatedAt.Format("2006-01-02 15:04:05"), + UpdatedAt: role.UpdatedAt.Format("2006-01-02 15:04:05"), + }, nil +} diff --git a/rpc/system/internal/logic/getuserlogic.go b/rpc/system/internal/logic/getuserlogic.go new file mode 100644 index 0000000..9042192 --- /dev/null +++ b/rpc/system/internal/logic/getuserlogic.go @@ -0,0 +1,68 @@ +package logic + +import ( + "context" + "errors" + + "muyu-apiserver/model" + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type GetUserLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserLogic { + return &GetUserLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetUserLogic) GetUser(in *pb.GetUserReq) (*pb.UserInfo, error) { + user, err := l.svcCtx.UserModel.FindOneByUserId(l.ctx, in.UserId) + if err != nil { + if errors.Is(err, model.ErrNotFound) { + return nil, status.Error(codes.NotFound, "user not found") + } + return nil, status.Error(codes.Internal, err.Error()) + } + + var roleId, roleName string + userRole, _ := l.svcCtx.UserRoleModel.FindByUserId(l.ctx, user.UserId) + if userRole != nil { + roleId = userRole.RoleId + role, _ := l.svcCtx.RoleModel.FindOneByRoleId(l.ctx, userRole.RoleId) + if role != nil { + roleName = role.RoleName + } + } + + var lastLoginTime string + if user.LastLoginTime.Valid { + lastLoginTime = user.LastLoginTime.Time.Format("2006-01-02 15:04:05") + } + + return &pb.UserInfo{ + UserId: user.UserId, + Username: user.Username, + RealName: user.RealName, + Phone: user.Phone, + Email: user.Email, + Avatar: user.Avatar, + Status: user.Status, + RoleId: roleId, + RoleName: roleName, + LastLoginTime: lastLoginTime, + CreatedAt: user.CreatedAt.Format("2006-01-02 15:04:05"), + UpdatedAt: user.UpdatedAt.Format("2006-01-02 15:04:05"), + }, nil +} diff --git a/rpc/system/internal/logic/listconfiglogic.go b/rpc/system/internal/logic/listconfiglogic.go new file mode 100644 index 0000000..3c37599 --- /dev/null +++ b/rpc/system/internal/logic/listconfiglogic.go @@ -0,0 +1,64 @@ +package logic + +import ( + "context" + + "muyu-apiserver/model" + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type ListConfigLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewListConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListConfigLogic { + return &ListConfigLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ListConfigLogic) ListConfig(in *pb.ListConfigReq) (*pb.ListConfigResp, error) { + var err error + var configs []*model.SysConfig + + if in.ConfigGroup != "" { + configs, err = l.svcCtx.ConfigModel.FindByGroup(l.ctx, in.ConfigGroup) + } else { + configs, err = l.svcCtx.ConfigModel.FindAll(l.ctx) + } + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + list := make([]*pb.ConfigInfo, 0, len(configs)) + for _, cfg := range configs { + var configValue, remark string + if cfg.ConfigValue.Valid { + configValue = cfg.ConfigValue.String + } + if cfg.Remark.Valid { + remark = cfg.Remark.String + } + + list = append(list, &pb.ConfigInfo{ + ConfigId: cfg.ConfigId, + ConfigKey: cfg.ConfigKey, + ConfigValue: configValue, + ConfigName: cfg.ConfigName, + ConfigGroup: cfg.ConfigGroup, + Remark: remark, + UpdatedAt: cfg.UpdatedAt.Format("2006-01-02 15:04:05"), + }) + } + + return &pb.ListConfigResp{List: list}, nil +} diff --git a/rpc/system/internal/logic/listmenulogic.go b/rpc/system/internal/logic/listmenulogic.go new file mode 100644 index 0000000..4f63890 --- /dev/null +++ b/rpc/system/internal/logic/listmenulogic.go @@ -0,0 +1,54 @@ +package logic + +import ( + "context" + + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type ListMenuLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewListMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListMenuLogic { + return &ListMenuLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ListMenuLogic) ListMenu(in *pb.ListMenuReq) (*pb.ListMenuResp, error) { + menus, err := l.svcCtx.MenuModel.FindAll(l.ctx) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + list := make([]*pb.MenuInfo, 0, len(menus)) + for _, menu := range menus { + list = append(list, &pb.MenuInfo{ + MenuId: menu.MenuId, + ParentId: menu.ParentId, + MenuName: menu.MenuName, + MenuType: menu.MenuType, + Path: menu.Path, + Component: menu.Component, + Permission: menu.Permission, + Icon: menu.Icon, + SortOrder: menu.SortOrder, + Visible: menu.Visible, + Status: menu.Status, + CreatedAt: menu.CreatedAt.Format("2006-01-02 15:04:05"), + UpdatedAt: menu.UpdatedAt.Format("2006-01-02 15:04:05"), + }) + } + + return &pb.ListMenuResp{List: list}, nil +} diff --git a/rpc/system/internal/logic/listoperationloglogic.go b/rpc/system/internal/logic/listoperationloglogic.go new file mode 100644 index 0000000..1faff78 --- /dev/null +++ b/rpc/system/internal/logic/listoperationloglogic.go @@ -0,0 +1,55 @@ +package logic + +import ( + "context" + + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type ListOperationLogLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewListOperationLogLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListOperationLogLogic { + return &ListOperationLogLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ListOperationLogLogic) ListOperationLog(in *pb.ListLogReq) (*pb.ListLogResp, error) { + logs, total, err := l.svcCtx.LogModel.FindList(l.ctx, in.Page, in.PageSize, in.Username, in.Module, in.Operation, in.StartTime, in.EndTime) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + list := make([]*pb.OperationLogInfo, 0, len(logs)) + for _, logItem := range logs { + list = append(list, &pb.OperationLogInfo{ + LogId: logItem.LogId, + UserId: logItem.UserId, + Username: logItem.Username, + Module: logItem.Module, + Operation: logItem.Operation, + Method: logItem.Method, + Path: logItem.Path, + Ip: logItem.Ip, + Duration: logItem.Duration, + Status: logItem.Status, + CreatedAt: logItem.CreatedAt.Format("2006-01-02 15:04:05"), + }) + } + + return &pb.ListLogResp{ + Total: total, + List: list, + }, nil +} diff --git a/rpc/system/internal/logic/listrolelogic.go b/rpc/system/internal/logic/listrolelogic.go new file mode 100644 index 0000000..b1c8e7f --- /dev/null +++ b/rpc/system/internal/logic/listrolelogic.go @@ -0,0 +1,59 @@ +package logic + +import ( + "context" + + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type ListRoleLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewListRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListRoleLogic { + return &ListRoleLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ListRoleLogic) ListRole(in *pb.ListRoleReq) (*pb.ListRoleResp, error) { + roles, total, err := l.svcCtx.RoleModel.FindList(l.ctx, in.Page, in.PageSize, in.RoleName, in.Status) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + list := make([]*pb.RoleInfo, 0, len(roles)) + for _, role := range roles { + menuIds := make([]string, 0) + roleMenus, _ := l.svcCtx.RoleMenuModel.FindByRoleId(l.ctx, role.RoleId) + for _, rm := range roleMenus { + menuIds = append(menuIds, rm.MenuId) + } + + list = append(list, &pb.RoleInfo{ + RoleId: role.RoleId, + RoleName: role.RoleName, + RoleKey: role.RoleKey, + RoleDesc: role.RoleDesc, + SortOrder: role.SortOrder, + Status: role.Status, + MenuIds: menuIds, + CreatedAt: role.CreatedAt.Format("2006-01-02 15:04:05"), + UpdatedAt: role.UpdatedAt.Format("2006-01-02 15:04:05"), + }) + } + + return &pb.ListRoleResp{ + Total: total, + List: list, + }, nil +} diff --git a/rpc/system/internal/logic/listuserlogic.go b/rpc/system/internal/logic/listuserlogic.go new file mode 100644 index 0000000..1a2a7c2 --- /dev/null +++ b/rpc/system/internal/logic/listuserlogic.go @@ -0,0 +1,71 @@ +package logic + +import ( + "context" + + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type ListUserLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewListUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListUserLogic { + return &ListUserLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ListUserLogic) ListUser(in *pb.ListUserReq) (*pb.ListUserResp, error) { + users, total, err := l.svcCtx.UserModel.FindList(l.ctx, in.Page, in.PageSize, in.Username, in.RealName, in.Phone, in.Status) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + list := make([]*pb.UserInfo, 0, len(users)) + for _, user := range users { + var roleId, roleName string + userRole, _ := l.svcCtx.UserRoleModel.FindByUserId(l.ctx, user.UserId) + if userRole != nil { + roleId = userRole.RoleId + role, _ := l.svcCtx.RoleModel.FindOneByRoleId(l.ctx, userRole.RoleId) + if role != nil { + roleName = role.RoleName + } + } + + var lastLoginTime string + if user.LastLoginTime.Valid { + lastLoginTime = user.LastLoginTime.Time.Format("2006-01-02 15:04:05") + } + + list = append(list, &pb.UserInfo{ + UserId: user.UserId, + Username: user.Username, + RealName: user.RealName, + Phone: user.Phone, + Email: user.Email, + Avatar: user.Avatar, + Status: user.Status, + RoleId: roleId, + RoleName: roleName, + LastLoginTime: lastLoginTime, + CreatedAt: user.CreatedAt.Format("2006-01-02 15:04:05"), + UpdatedAt: user.UpdatedAt.Format("2006-01-02 15:04:05"), + }) + } + + return &pb.ListUserResp{ + Total: total, + List: list, + }, nil +} diff --git a/rpc/system/internal/logic/loginlogic.go b/rpc/system/internal/logic/loginlogic.go new file mode 100644 index 0000000..f4bd725 --- /dev/null +++ b/rpc/system/internal/logic/loginlogic.go @@ -0,0 +1,73 @@ +package logic + +import ( + "context" + "database/sql" + "errors" + "time" + + "muyu-apiserver/model" + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "golang.org/x/crypto/bcrypt" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type LoginLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LoginLogic { + return &LoginLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *LoginLogic) Login(in *pb.LoginReq) (*pb.LoginResp, error) { + user, err := l.svcCtx.UserModel.FindOneByUsername(l.ctx, in.Username) + if err != nil { + if errors.Is(err, model.ErrNotFound) { + return nil, status.Error(codes.NotFound, "user not found") + } + return nil, status.Error(codes.Internal, err.Error()) + } + + if user.Status != 1 { + return nil, status.Error(codes.PermissionDenied, "user disabled") + } + + err = bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(in.Password)) + if err != nil { + return nil, status.Error(codes.Unauthenticated, "incorrect password") + } + + user.LastLoginTime = sql.NullTime{Time: time.Now(), Valid: true} + user.LastLoginIp = in.Ip + _ = l.svcCtx.UserModel.Update(l.ctx, user) + + userRole, _ := l.svcCtx.UserRoleModel.FindByUserId(l.ctx, user.UserId) + var roleKey, roleName string + if userRole != nil { + role, _ := l.svcCtx.RoleModel.FindOneByRoleId(l.ctx, userRole.RoleId) + if role != nil { + roleKey = role.RoleKey + roleName = role.RoleName + } + } + + return &pb.LoginResp{ + UserId: user.UserId, + Username: user.Username, + RealName: user.RealName, + Avatar: user.Avatar, + RoleKey: roleKey, + RoleName: roleName, + }, nil +} diff --git a/rpc/system/internal/logic/setrolepermissionslogic.go b/rpc/system/internal/logic/setrolepermissionslogic.go new file mode 100644 index 0000000..81bb191 --- /dev/null +++ b/rpc/system/internal/logic/setrolepermissionslogic.go @@ -0,0 +1,40 @@ +package logic + +import ( + "context" + + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type SetRolePermissionsLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewSetRolePermissionsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SetRolePermissionsLogic { + return &SetRolePermissionsLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *SetRolePermissionsLogic) SetRolePermissions(in *pb.SetRolePermissionsReq) (*pb.Empty, error) { + err := l.svcCtx.RoleMenuModel.DeleteByRoleId(l.ctx, in.RoleId) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + err = l.svcCtx.RoleMenuModel.BatchInsert(l.ctx, in.RoleId, in.MenuIds) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.Empty{}, nil +} diff --git a/rpc/system/internal/logic/updateconfiglogic.go b/rpc/system/internal/logic/updateconfiglogic.go new file mode 100644 index 0000000..5942abb --- /dev/null +++ b/rpc/system/internal/logic/updateconfiglogic.go @@ -0,0 +1,39 @@ +package logic + +import ( + "context" + + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type UpdateConfigLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewUpdateConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateConfigLogic { + return &UpdateConfigLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *UpdateConfigLogic) UpdateConfig(in *pb.UpdateConfigReq) (*pb.Empty, error) { + if in.ConfigKey == "" { + return nil, status.Error(codes.InvalidArgument, "config_key is required") + } + + err := l.svcCtx.ConfigModel.UpdateByKey(l.ctx, in.ConfigKey, in.ConfigValue) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.Empty{}, nil +} diff --git a/rpc/system/internal/logic/updatemenulogic.go b/rpc/system/internal/logic/updatemenulogic.go new file mode 100644 index 0000000..32ffa5e --- /dev/null +++ b/rpc/system/internal/logic/updatemenulogic.go @@ -0,0 +1,55 @@ +package logic + +import ( + "context" + "errors" + + "muyu-apiserver/model" + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type UpdateMenuLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewUpdateMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateMenuLogic { + return &UpdateMenuLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *UpdateMenuLogic) UpdateMenu(in *pb.UpdateMenuReq) (*pb.Empty, error) { + menu, err := l.svcCtx.MenuModel.FindOneByMenuId(l.ctx, in.MenuId) + if err != nil { + if errors.Is(err, model.ErrNotFound) { + return nil, status.Error(codes.NotFound, "menu not found") + } + return nil, status.Error(codes.Internal, err.Error()) + } + + menu.ParentId = in.ParentId + menu.MenuName = in.MenuName + menu.MenuType = in.MenuType + menu.Path = in.Path + menu.Component = in.Component + menu.Permission = in.Permission + menu.Icon = in.Icon + menu.SortOrder = in.SortOrder + menu.Visible = in.Visible + + err = l.svcCtx.MenuModel.Update(l.ctx, menu) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.Empty{}, nil +} diff --git a/rpc/system/internal/logic/updaterolelogic.go b/rpc/system/internal/logic/updaterolelogic.go new file mode 100644 index 0000000..5bab999 --- /dev/null +++ b/rpc/system/internal/logic/updaterolelogic.go @@ -0,0 +1,50 @@ +package logic + +import ( + "context" + "errors" + + "muyu-apiserver/model" + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type UpdateRoleLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewUpdateRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateRoleLogic { + return &UpdateRoleLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *UpdateRoleLogic) UpdateRole(in *pb.UpdateRoleReq) (*pb.Empty, error) { + role, err := l.svcCtx.RoleModel.FindOneByRoleId(l.ctx, in.RoleId) + if err != nil { + if errors.Is(err, model.ErrNotFound) { + return nil, status.Error(codes.NotFound, "role not found") + } + return nil, status.Error(codes.Internal, err.Error()) + } + + role.RoleName = in.RoleName + role.RoleKey = in.RoleKey + role.RoleDesc = in.RoleDesc + role.SortOrder = in.SortOrder + + err = l.svcCtx.RoleModel.Update(l.ctx, role) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.Empty{}, nil +} diff --git a/rpc/system/internal/logic/updateuserlogic.go b/rpc/system/internal/logic/updateuserlogic.go new file mode 100644 index 0000000..b27c85c --- /dev/null +++ b/rpc/system/internal/logic/updateuserlogic.go @@ -0,0 +1,60 @@ +package logic + +import ( + "context" + "errors" + + "muyu-apiserver/model" + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type UpdateUserLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewUpdateUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateUserLogic { + return &UpdateUserLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *UpdateUserLogic) UpdateUser(in *pb.UpdateUserReq) (*pb.Empty, error) { + user, err := l.svcCtx.UserModel.FindOneByUserId(l.ctx, in.UserId) + if err != nil { + if errors.Is(err, model.ErrNotFound) { + return nil, status.Error(codes.NotFound, "user not found") + } + return nil, status.Error(codes.Internal, err.Error()) + } + + user.RealName = in.RealName + user.Phone = in.Phone + user.Email = in.Email + if in.Avatar != "" { + user.Avatar = in.Avatar + } + + err = l.svcCtx.UserModel.Update(l.ctx, user) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + if in.RoleId != "" { + _ = l.svcCtx.UserRoleModel.DeleteByUserId(l.ctx, in.UserId) + _, _ = l.svcCtx.UserRoleModel.Insert(l.ctx, &model.SysUserRole{ + UserId: in.UserId, + RoleId: in.RoleId, + }) + } + + return &pb.Empty{}, nil +} diff --git a/rpc/system/internal/logic/updateuserstatuslogic.go b/rpc/system/internal/logic/updateuserstatuslogic.go new file mode 100644 index 0000000..4d2b5b3 --- /dev/null +++ b/rpc/system/internal/logic/updateuserstatuslogic.go @@ -0,0 +1,46 @@ +package logic + +import ( + "context" + "errors" + + "muyu-apiserver/model" + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type UpdateUserStatusLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewUpdateUserStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateUserStatusLogic { + return &UpdateUserStatusLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *UpdateUserStatusLogic) UpdateUserStatus(in *pb.UpdateUserStatusReq) (*pb.Empty, error) { + user, err := l.svcCtx.UserModel.FindOneByUserId(l.ctx, in.UserId) + if err != nil { + if errors.Is(err, model.ErrNotFound) { + return nil, status.Error(codes.NotFound, "user not found") + } + return nil, status.Error(codes.Internal, err.Error()) + } + + user.Status = in.Status + err = l.svcCtx.UserModel.Update(l.ctx, user) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.Empty{}, nil +} diff --git a/rpc/system/internal/server/systemserviceserver.go b/rpc/system/internal/server/systemserviceserver.go new file mode 100644 index 0000000..a9f6df9 --- /dev/null +++ b/rpc/system/internal/server/systemserviceserver.go @@ -0,0 +1,145 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.9.2 +// Source: system.proto + +package server + +import ( + "context" + + "muyu-apiserver/rpc/system/internal/logic" + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" +) + +type SystemServiceServer struct { + svcCtx *svc.ServiceContext + pb.UnimplementedSystemServiceServer +} + +func NewSystemServiceServer(svcCtx *svc.ServiceContext) *SystemServiceServer { + return &SystemServiceServer{ + svcCtx: svcCtx, + } +} + +// Auth +func (s *SystemServiceServer) Login(ctx context.Context, in *pb.LoginReq) (*pb.LoginResp, error) { + l := logic.NewLoginLogic(ctx, s.svcCtx) + return l.Login(in) +} + +func (s *SystemServiceServer) ChangePassword(ctx context.Context, in *pb.ChangePasswordReq) (*pb.Empty, error) { + l := logic.NewChangePasswordLogic(ctx, s.svcCtx) + return l.ChangePassword(in) +} + +// User +func (s *SystemServiceServer) CreateUser(ctx context.Context, in *pb.CreateUserReq) (*pb.IdResp, error) { + l := logic.NewCreateUserLogic(ctx, s.svcCtx) + return l.CreateUser(in) +} + +func (s *SystemServiceServer) UpdateUser(ctx context.Context, in *pb.UpdateUserReq) (*pb.Empty, error) { + l := logic.NewUpdateUserLogic(ctx, s.svcCtx) + return l.UpdateUser(in) +} + +func (s *SystemServiceServer) DeleteUser(ctx context.Context, in *pb.DeleteUserReq) (*pb.Empty, error) { + l := logic.NewDeleteUserLogic(ctx, s.svcCtx) + return l.DeleteUser(in) +} + +func (s *SystemServiceServer) GetUser(ctx context.Context, in *pb.GetUserReq) (*pb.UserInfo, error) { + l := logic.NewGetUserLogic(ctx, s.svcCtx) + return l.GetUser(in) +} + +func (s *SystemServiceServer) ListUser(ctx context.Context, in *pb.ListUserReq) (*pb.ListUserResp, error) { + l := logic.NewListUserLogic(ctx, s.svcCtx) + return l.ListUser(in) +} + +func (s *SystemServiceServer) UpdateUserStatus(ctx context.Context, in *pb.UpdateUserStatusReq) (*pb.Empty, error) { + l := logic.NewUpdateUserStatusLogic(ctx, s.svcCtx) + return l.UpdateUserStatus(in) +} + +// Role +func (s *SystemServiceServer) CreateRole(ctx context.Context, in *pb.CreateRoleReq) (*pb.IdResp, error) { + l := logic.NewCreateRoleLogic(ctx, s.svcCtx) + return l.CreateRole(in) +} + +func (s *SystemServiceServer) UpdateRole(ctx context.Context, in *pb.UpdateRoleReq) (*pb.Empty, error) { + l := logic.NewUpdateRoleLogic(ctx, s.svcCtx) + return l.UpdateRole(in) +} + +func (s *SystemServiceServer) DeleteRole(ctx context.Context, in *pb.DeleteRoleReq) (*pb.Empty, error) { + l := logic.NewDeleteRoleLogic(ctx, s.svcCtx) + return l.DeleteRole(in) +} + +func (s *SystemServiceServer) GetRole(ctx context.Context, in *pb.GetRoleReq) (*pb.RoleInfo, error) { + l := logic.NewGetRoleLogic(ctx, s.svcCtx) + return l.GetRole(in) +} + +func (s *SystemServiceServer) ListRole(ctx context.Context, in *pb.ListRoleReq) (*pb.ListRoleResp, error) { + l := logic.NewListRoleLogic(ctx, s.svcCtx) + return l.ListRole(in) +} + +func (s *SystemServiceServer) SetRolePermissions(ctx context.Context, in *pb.SetRolePermissionsReq) (*pb.Empty, error) { + l := logic.NewSetRolePermissionsLogic(ctx, s.svcCtx) + return l.SetRolePermissions(in) +} + +// Menu +func (s *SystemServiceServer) CreateMenu(ctx context.Context, in *pb.CreateMenuReq) (*pb.IdResp, error) { + l := logic.NewCreateMenuLogic(ctx, s.svcCtx) + return l.CreateMenu(in) +} + +func (s *SystemServiceServer) UpdateMenu(ctx context.Context, in *pb.UpdateMenuReq) (*pb.Empty, error) { + l := logic.NewUpdateMenuLogic(ctx, s.svcCtx) + return l.UpdateMenu(in) +} + +func (s *SystemServiceServer) DeleteMenu(ctx context.Context, in *pb.DeleteMenuReq) (*pb.Empty, error) { + l := logic.NewDeleteMenuLogic(ctx, s.svcCtx) + return l.DeleteMenu(in) +} + +func (s *SystemServiceServer) GetMenu(ctx context.Context, in *pb.GetMenuReq) (*pb.MenuInfo, error) { + l := logic.NewGetMenuLogic(ctx, s.svcCtx) + return l.GetMenu(in) +} + +func (s *SystemServiceServer) ListMenu(ctx context.Context, in *pb.ListMenuReq) (*pb.ListMenuResp, error) { + l := logic.NewListMenuLogic(ctx, s.svcCtx) + return l.ListMenu(in) +} + +// Operation Log +func (s *SystemServiceServer) CreateOperationLog(ctx context.Context, in *pb.CreateLogReq) (*pb.Empty, error) { + l := logic.NewCreateOperationLogLogic(ctx, s.svcCtx) + return l.CreateOperationLog(in) +} + +func (s *SystemServiceServer) ListOperationLog(ctx context.Context, in *pb.ListLogReq) (*pb.ListLogResp, error) { + l := logic.NewListOperationLogLogic(ctx, s.svcCtx) + return l.ListOperationLog(in) +} + +// Config +func (s *SystemServiceServer) ListConfig(ctx context.Context, in *pb.ListConfigReq) (*pb.ListConfigResp, error) { + l := logic.NewListConfigLogic(ctx, s.svcCtx) + return l.ListConfig(in) +} + +func (s *SystemServiceServer) UpdateConfig(ctx context.Context, in *pb.UpdateConfigReq) (*pb.Empty, error) { + l := logic.NewUpdateConfigLogic(ctx, s.svcCtx) + return l.UpdateConfig(in) +} diff --git a/rpc/system/internal/svc/servicecontext.go b/rpc/system/internal/svc/servicecontext.go new file mode 100644 index 0000000..73352dd --- /dev/null +++ b/rpc/system/internal/svc/servicecontext.go @@ -0,0 +1,33 @@ +package svc + +import ( + "muyu-apiserver/model" + "muyu-apiserver/rpc/system/internal/config" + + "github.com/zeromicro/go-zero/core/stores/sqlx" +) + +type ServiceContext struct { + Config config.Config + UserModel model.SysUserModel + RoleModel model.SysRoleModel + UserRoleModel model.SysUserRoleModel + MenuModel model.SysMenuModel + RoleMenuModel model.SysRoleMenuModel + LogModel model.SysOperationLogModel + ConfigModel model.SysConfigModel +} + +func NewServiceContext(c config.Config) *ServiceContext { + conn := sqlx.NewMysql(c.DataSource) + return &ServiceContext{ + Config: c, + UserModel: model.NewSysUserModel(conn, c.Cache), + RoleModel: model.NewSysRoleModel(conn, c.Cache), + UserRoleModel: model.NewSysUserRoleModel(conn, c.Cache), + MenuModel: model.NewSysMenuModel(conn, c.Cache), + RoleMenuModel: model.NewSysRoleMenuModel(conn, c.Cache), + LogModel: model.NewSysOperationLogModel(conn, c.Cache), + ConfigModel: model.NewSysConfigModel(conn, c.Cache), + } +} diff --git a/rpc/system/pb/system.pb.go b/rpc/system/pb/system.pb.go new file mode 100644 index 0000000..6085a6d --- /dev/null +++ b/rpc/system/pb/system.pb.go @@ -0,0 +1,3624 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.20.3 +// source: rpc/system/system.proto + +package pb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type LoginReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + Ip string `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"` +} + +func (x *LoginReq) Reset() { + *x = LoginReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LoginReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginReq) ProtoMessage() {} + +func (x *LoginReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoginReq.ProtoReflect.Descriptor instead. +func (*LoginReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{0} +} + +func (x *LoginReq) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *LoginReq) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *LoginReq) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +type LoginResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` + RealName string `protobuf:"bytes,3,opt,name=real_name,json=realName,proto3" json:"real_name,omitempty"` + Avatar string `protobuf:"bytes,4,opt,name=avatar,proto3" json:"avatar,omitempty"` + RoleKey string `protobuf:"bytes,5,opt,name=role_key,json=roleKey,proto3" json:"role_key,omitempty"` + RoleName string `protobuf:"bytes,6,opt,name=role_name,json=roleName,proto3" json:"role_name,omitempty"` +} + +func (x *LoginResp) Reset() { + *x = LoginResp{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LoginResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginResp) ProtoMessage() {} + +func (x *LoginResp) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoginResp.ProtoReflect.Descriptor instead. +func (*LoginResp) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{1} +} + +func (x *LoginResp) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *LoginResp) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *LoginResp) GetRealName() string { + if x != nil { + return x.RealName + } + return "" +} + +func (x *LoginResp) GetAvatar() string { + if x != nil { + return x.Avatar + } + return "" +} + +func (x *LoginResp) GetRoleKey() string { + if x != nil { + return x.RoleKey + } + return "" +} + +func (x *LoginResp) GetRoleName() string { + if x != nil { + return x.RoleName + } + return "" +} + +type ChangePasswordReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + OldPassword string `protobuf:"bytes,2,opt,name=old_password,json=oldPassword,proto3" json:"old_password,omitempty"` + NewPassword string `protobuf:"bytes,3,opt,name=new_password,json=newPassword,proto3" json:"new_password,omitempty"` +} + +func (x *ChangePasswordReq) Reset() { + *x = ChangePasswordReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChangePasswordReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChangePasswordReq) ProtoMessage() {} + +func (x *ChangePasswordReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChangePasswordReq.ProtoReflect.Descriptor instead. +func (*ChangePasswordReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{2} +} + +func (x *ChangePasswordReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *ChangePasswordReq) GetOldPassword() string { + if x != nil { + return x.OldPassword + } + return "" +} + +func (x *ChangePasswordReq) GetNewPassword() string { + if x != nil { + return x.NewPassword + } + return "" +} + +type UserInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` + RealName string `protobuf:"bytes,3,opt,name=real_name,json=realName,proto3" json:"real_name,omitempty"` + Phone string `protobuf:"bytes,4,opt,name=phone,proto3" json:"phone,omitempty"` + Email string `protobuf:"bytes,5,opt,name=email,proto3" json:"email,omitempty"` + Avatar string `protobuf:"bytes,6,opt,name=avatar,proto3" json:"avatar,omitempty"` + Status int64 `protobuf:"varint,7,opt,name=status,proto3" json:"status,omitempty"` + RoleId string `protobuf:"bytes,8,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` + RoleName string `protobuf:"bytes,9,opt,name=role_name,json=roleName,proto3" json:"role_name,omitempty"` + LastLoginTime string `protobuf:"bytes,10,opt,name=last_login_time,json=lastLoginTime,proto3" json:"last_login_time,omitempty"` + CreatedAt string `protobuf:"bytes,11,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt string `protobuf:"bytes,12,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` +} + +func (x *UserInfo) Reset() { + *x = UserInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserInfo) ProtoMessage() {} + +func (x *UserInfo) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserInfo.ProtoReflect.Descriptor instead. +func (*UserInfo) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{3} +} + +func (x *UserInfo) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *UserInfo) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *UserInfo) GetRealName() string { + if x != nil { + return x.RealName + } + return "" +} + +func (x *UserInfo) GetPhone() string { + if x != nil { + return x.Phone + } + return "" +} + +func (x *UserInfo) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *UserInfo) GetAvatar() string { + if x != nil { + return x.Avatar + } + return "" +} + +func (x *UserInfo) GetStatus() int64 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *UserInfo) GetRoleId() string { + if x != nil { + return x.RoleId + } + return "" +} + +func (x *UserInfo) GetRoleName() string { + if x != nil { + return x.RoleName + } + return "" +} + +func (x *UserInfo) GetLastLoginTime() string { + if x != nil { + return x.LastLoginTime + } + return "" +} + +func (x *UserInfo) GetCreatedAt() string { + if x != nil { + return x.CreatedAt + } + return "" +} + +func (x *UserInfo) GetUpdatedAt() string { + if x != nil { + return x.UpdatedAt + } + return "" +} + +type CreateUserReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + RealName string `protobuf:"bytes,3,opt,name=real_name,json=realName,proto3" json:"real_name,omitempty"` + Phone string `protobuf:"bytes,4,opt,name=phone,proto3" json:"phone,omitempty"` + Email string `protobuf:"bytes,5,opt,name=email,proto3" json:"email,omitempty"` + RoleId string `protobuf:"bytes,6,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` +} + +func (x *CreateUserReq) Reset() { + *x = CreateUserReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateUserReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateUserReq) ProtoMessage() {} + +func (x *CreateUserReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateUserReq.ProtoReflect.Descriptor instead. +func (*CreateUserReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{4} +} + +func (x *CreateUserReq) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *CreateUserReq) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *CreateUserReq) GetRealName() string { + if x != nil { + return x.RealName + } + return "" +} + +func (x *CreateUserReq) GetPhone() string { + if x != nil { + return x.Phone + } + return "" +} + +func (x *CreateUserReq) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *CreateUserReq) GetRoleId() string { + if x != nil { + return x.RoleId + } + return "" +} + +type UpdateUserReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + RealName string `protobuf:"bytes,2,opt,name=real_name,json=realName,proto3" json:"real_name,omitempty"` + Phone string `protobuf:"bytes,3,opt,name=phone,proto3" json:"phone,omitempty"` + Email string `protobuf:"bytes,4,opt,name=email,proto3" json:"email,omitempty"` + RoleId string `protobuf:"bytes,5,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` + Avatar string `protobuf:"bytes,6,opt,name=avatar,proto3" json:"avatar,omitempty"` +} + +func (x *UpdateUserReq) Reset() { + *x = UpdateUserReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateUserReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserReq) ProtoMessage() {} + +func (x *UpdateUserReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserReq.ProtoReflect.Descriptor instead. +func (*UpdateUserReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{5} +} + +func (x *UpdateUserReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *UpdateUserReq) GetRealName() string { + if x != nil { + return x.RealName + } + return "" +} + +func (x *UpdateUserReq) GetPhone() string { + if x != nil { + return x.Phone + } + return "" +} + +func (x *UpdateUserReq) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *UpdateUserReq) GetRoleId() string { + if x != nil { + return x.RoleId + } + return "" +} + +func (x *UpdateUserReq) GetAvatar() string { + if x != nil { + return x.Avatar + } + return "" +} + +type DeleteUserReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` +} + +func (x *DeleteUserReq) Reset() { + *x = DeleteUserReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteUserReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteUserReq) ProtoMessage() {} + +func (x *DeleteUserReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteUserReq.ProtoReflect.Descriptor instead. +func (*DeleteUserReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{6} +} + +func (x *DeleteUserReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type GetUserReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` +} + +func (x *GetUserReq) Reset() { + *x = GetUserReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUserReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserReq) ProtoMessage() {} + +func (x *GetUserReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserReq.ProtoReflect.Descriptor instead. +func (*GetUserReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{7} +} + +func (x *GetUserReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type ListUserReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` + PageSize int64 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"` + RealName string `protobuf:"bytes,4,opt,name=real_name,json=realName,proto3" json:"real_name,omitempty"` + Phone string `protobuf:"bytes,5,opt,name=phone,proto3" json:"phone,omitempty"` + Status int64 `protobuf:"varint,6,opt,name=status,proto3" json:"status,omitempty"` +} + +func (x *ListUserReq) Reset() { + *x = ListUserReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListUserReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserReq) ProtoMessage() {} + +func (x *ListUserReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserReq.ProtoReflect.Descriptor instead. +func (*ListUserReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{8} +} + +func (x *ListUserReq) GetPage() int64 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *ListUserReq) GetPageSize() int64 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListUserReq) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *ListUserReq) GetRealName() string { + if x != nil { + return x.RealName + } + return "" +} + +func (x *ListUserReq) GetPhone() string { + if x != nil { + return x.Phone + } + return "" +} + +func (x *ListUserReq) GetStatus() int64 { + if x != nil { + return x.Status + } + return 0 +} + +type ListUserResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + List []*UserInfo `protobuf:"bytes,2,rep,name=list,proto3" json:"list,omitempty"` +} + +func (x *ListUserResp) Reset() { + *x = ListUserResp{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListUserResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserResp) ProtoMessage() {} + +func (x *ListUserResp) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserResp.ProtoReflect.Descriptor instead. +func (*ListUserResp) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{9} +} + +func (x *ListUserResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *ListUserResp) GetList() []*UserInfo { + if x != nil { + return x.List + } + return nil +} + +type UpdateUserStatusReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + Status int64 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` +} + +func (x *UpdateUserStatusReq) Reset() { + *x = UpdateUserStatusReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateUserStatusReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserStatusReq) ProtoMessage() {} + +func (x *UpdateUserStatusReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserStatusReq.ProtoReflect.Descriptor instead. +func (*UpdateUserStatusReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{10} +} + +func (x *UpdateUserStatusReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *UpdateUserStatusReq) GetStatus() int64 { + if x != nil { + return x.Status + } + return 0 +} + +type RoleInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RoleId string `protobuf:"bytes,1,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` + RoleName string `protobuf:"bytes,2,opt,name=role_name,json=roleName,proto3" json:"role_name,omitempty"` + RoleKey string `protobuf:"bytes,3,opt,name=role_key,json=roleKey,proto3" json:"role_key,omitempty"` + RoleDesc string `protobuf:"bytes,4,opt,name=role_desc,json=roleDesc,proto3" json:"role_desc,omitempty"` + SortOrder int64 `protobuf:"varint,5,opt,name=sort_order,json=sortOrder,proto3" json:"sort_order,omitempty"` + Status int64 `protobuf:"varint,6,opt,name=status,proto3" json:"status,omitempty"` + MenuIds []string `protobuf:"bytes,7,rep,name=menu_ids,json=menuIds,proto3" json:"menu_ids,omitempty"` + CreatedAt string `protobuf:"bytes,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt string `protobuf:"bytes,9,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` +} + +func (x *RoleInfo) Reset() { + *x = RoleInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RoleInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoleInfo) ProtoMessage() {} + +func (x *RoleInfo) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RoleInfo.ProtoReflect.Descriptor instead. +func (*RoleInfo) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{11} +} + +func (x *RoleInfo) GetRoleId() string { + if x != nil { + return x.RoleId + } + return "" +} + +func (x *RoleInfo) GetRoleName() string { + if x != nil { + return x.RoleName + } + return "" +} + +func (x *RoleInfo) GetRoleKey() string { + if x != nil { + return x.RoleKey + } + return "" +} + +func (x *RoleInfo) GetRoleDesc() string { + if x != nil { + return x.RoleDesc + } + return "" +} + +func (x *RoleInfo) GetSortOrder() int64 { + if x != nil { + return x.SortOrder + } + return 0 +} + +func (x *RoleInfo) GetStatus() int64 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *RoleInfo) GetMenuIds() []string { + if x != nil { + return x.MenuIds + } + return nil +} + +func (x *RoleInfo) GetCreatedAt() string { + if x != nil { + return x.CreatedAt + } + return "" +} + +func (x *RoleInfo) GetUpdatedAt() string { + if x != nil { + return x.UpdatedAt + } + return "" +} + +type CreateRoleReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RoleName string `protobuf:"bytes,1,opt,name=role_name,json=roleName,proto3" json:"role_name,omitempty"` + RoleKey string `protobuf:"bytes,2,opt,name=role_key,json=roleKey,proto3" json:"role_key,omitempty"` + RoleDesc string `protobuf:"bytes,3,opt,name=role_desc,json=roleDesc,proto3" json:"role_desc,omitempty"` + SortOrder int64 `protobuf:"varint,4,opt,name=sort_order,json=sortOrder,proto3" json:"sort_order,omitempty"` +} + +func (x *CreateRoleReq) Reset() { + *x = CreateRoleReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateRoleReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateRoleReq) ProtoMessage() {} + +func (x *CreateRoleReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateRoleReq.ProtoReflect.Descriptor instead. +func (*CreateRoleReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{12} +} + +func (x *CreateRoleReq) GetRoleName() string { + if x != nil { + return x.RoleName + } + return "" +} + +func (x *CreateRoleReq) GetRoleKey() string { + if x != nil { + return x.RoleKey + } + return "" +} + +func (x *CreateRoleReq) GetRoleDesc() string { + if x != nil { + return x.RoleDesc + } + return "" +} + +func (x *CreateRoleReq) GetSortOrder() int64 { + if x != nil { + return x.SortOrder + } + return 0 +} + +type UpdateRoleReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RoleId string `protobuf:"bytes,1,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` + RoleName string `protobuf:"bytes,2,opt,name=role_name,json=roleName,proto3" json:"role_name,omitempty"` + RoleKey string `protobuf:"bytes,3,opt,name=role_key,json=roleKey,proto3" json:"role_key,omitempty"` + RoleDesc string `protobuf:"bytes,4,opt,name=role_desc,json=roleDesc,proto3" json:"role_desc,omitempty"` + SortOrder int64 `protobuf:"varint,5,opt,name=sort_order,json=sortOrder,proto3" json:"sort_order,omitempty"` +} + +func (x *UpdateRoleReq) Reset() { + *x = UpdateRoleReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateRoleReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateRoleReq) ProtoMessage() {} + +func (x *UpdateRoleReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateRoleReq.ProtoReflect.Descriptor instead. +func (*UpdateRoleReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{13} +} + +func (x *UpdateRoleReq) GetRoleId() string { + if x != nil { + return x.RoleId + } + return "" +} + +func (x *UpdateRoleReq) GetRoleName() string { + if x != nil { + return x.RoleName + } + return "" +} + +func (x *UpdateRoleReq) GetRoleKey() string { + if x != nil { + return x.RoleKey + } + return "" +} + +func (x *UpdateRoleReq) GetRoleDesc() string { + if x != nil { + return x.RoleDesc + } + return "" +} + +func (x *UpdateRoleReq) GetSortOrder() int64 { + if x != nil { + return x.SortOrder + } + return 0 +} + +type DeleteRoleReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RoleId string `protobuf:"bytes,1,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` +} + +func (x *DeleteRoleReq) Reset() { + *x = DeleteRoleReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteRoleReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRoleReq) ProtoMessage() {} + +func (x *DeleteRoleReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteRoleReq.ProtoReflect.Descriptor instead. +func (*DeleteRoleReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{14} +} + +func (x *DeleteRoleReq) GetRoleId() string { + if x != nil { + return x.RoleId + } + return "" +} + +type GetRoleReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RoleId string `protobuf:"bytes,1,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` +} + +func (x *GetRoleReq) Reset() { + *x = GetRoleReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRoleReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRoleReq) ProtoMessage() {} + +func (x *GetRoleReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRoleReq.ProtoReflect.Descriptor instead. +func (*GetRoleReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{15} +} + +func (x *GetRoleReq) GetRoleId() string { + if x != nil { + return x.RoleId + } + return "" +} + +type ListRoleReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` + PageSize int64 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + RoleName string `protobuf:"bytes,3,opt,name=role_name,json=roleName,proto3" json:"role_name,omitempty"` + Status int64 `protobuf:"varint,4,opt,name=status,proto3" json:"status,omitempty"` +} + +func (x *ListRoleReq) Reset() { + *x = ListRoleReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRoleReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRoleReq) ProtoMessage() {} + +func (x *ListRoleReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRoleReq.ProtoReflect.Descriptor instead. +func (*ListRoleReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{16} +} + +func (x *ListRoleReq) GetPage() int64 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *ListRoleReq) GetPageSize() int64 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListRoleReq) GetRoleName() string { + if x != nil { + return x.RoleName + } + return "" +} + +func (x *ListRoleReq) GetStatus() int64 { + if x != nil { + return x.Status + } + return 0 +} + +type ListRoleResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + List []*RoleInfo `protobuf:"bytes,2,rep,name=list,proto3" json:"list,omitempty"` +} + +func (x *ListRoleResp) Reset() { + *x = ListRoleResp{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRoleResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRoleResp) ProtoMessage() {} + +func (x *ListRoleResp) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRoleResp.ProtoReflect.Descriptor instead. +func (*ListRoleResp) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{17} +} + +func (x *ListRoleResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *ListRoleResp) GetList() []*RoleInfo { + if x != nil { + return x.List + } + return nil +} + +type SetRolePermissionsReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RoleId string `protobuf:"bytes,1,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` + MenuIds []string `protobuf:"bytes,2,rep,name=menu_ids,json=menuIds,proto3" json:"menu_ids,omitempty"` +} + +func (x *SetRolePermissionsReq) Reset() { + *x = SetRolePermissionsReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetRolePermissionsReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetRolePermissionsReq) ProtoMessage() {} + +func (x *SetRolePermissionsReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetRolePermissionsReq.ProtoReflect.Descriptor instead. +func (*SetRolePermissionsReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{18} +} + +func (x *SetRolePermissionsReq) GetRoleId() string { + if x != nil { + return x.RoleId + } + return "" +} + +func (x *SetRolePermissionsReq) GetMenuIds() []string { + if x != nil { + return x.MenuIds + } + return nil +} + +type MenuInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MenuId string `protobuf:"bytes,1,opt,name=menu_id,json=menuId,proto3" json:"menu_id,omitempty"` + ParentId string `protobuf:"bytes,2,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` + MenuName string `protobuf:"bytes,3,opt,name=menu_name,json=menuName,proto3" json:"menu_name,omitempty"` + MenuType int64 `protobuf:"varint,4,opt,name=menu_type,json=menuType,proto3" json:"menu_type,omitempty"` + Path string `protobuf:"bytes,5,opt,name=path,proto3" json:"path,omitempty"` + Component string `protobuf:"bytes,6,opt,name=component,proto3" json:"component,omitempty"` + Permission string `protobuf:"bytes,7,opt,name=permission,proto3" json:"permission,omitempty"` + Icon string `protobuf:"bytes,8,opt,name=icon,proto3" json:"icon,omitempty"` + SortOrder int64 `protobuf:"varint,9,opt,name=sort_order,json=sortOrder,proto3" json:"sort_order,omitempty"` + Visible int64 `protobuf:"varint,10,opt,name=visible,proto3" json:"visible,omitempty"` + Status int64 `protobuf:"varint,11,opt,name=status,proto3" json:"status,omitempty"` + Children []*MenuInfo `protobuf:"bytes,12,rep,name=children,proto3" json:"children,omitempty"` + CreatedAt string `protobuf:"bytes,13,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt string `protobuf:"bytes,14,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` +} + +func (x *MenuInfo) Reset() { + *x = MenuInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MenuInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MenuInfo) ProtoMessage() {} + +func (x *MenuInfo) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MenuInfo.ProtoReflect.Descriptor instead. +func (*MenuInfo) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{19} +} + +func (x *MenuInfo) GetMenuId() string { + if x != nil { + return x.MenuId + } + return "" +} + +func (x *MenuInfo) GetParentId() string { + if x != nil { + return x.ParentId + } + return "" +} + +func (x *MenuInfo) GetMenuName() string { + if x != nil { + return x.MenuName + } + return "" +} + +func (x *MenuInfo) GetMenuType() int64 { + if x != nil { + return x.MenuType + } + return 0 +} + +func (x *MenuInfo) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *MenuInfo) GetComponent() string { + if x != nil { + return x.Component + } + return "" +} + +func (x *MenuInfo) GetPermission() string { + if x != nil { + return x.Permission + } + return "" +} + +func (x *MenuInfo) GetIcon() string { + if x != nil { + return x.Icon + } + return "" +} + +func (x *MenuInfo) GetSortOrder() int64 { + if x != nil { + return x.SortOrder + } + return 0 +} + +func (x *MenuInfo) GetVisible() int64 { + if x != nil { + return x.Visible + } + return 0 +} + +func (x *MenuInfo) GetStatus() int64 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *MenuInfo) GetChildren() []*MenuInfo { + if x != nil { + return x.Children + } + return nil +} + +func (x *MenuInfo) GetCreatedAt() string { + if x != nil { + return x.CreatedAt + } + return "" +} + +func (x *MenuInfo) GetUpdatedAt() string { + if x != nil { + return x.UpdatedAt + } + return "" +} + +type CreateMenuReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ParentId string `protobuf:"bytes,1,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` + MenuName string `protobuf:"bytes,2,opt,name=menu_name,json=menuName,proto3" json:"menu_name,omitempty"` + MenuType int64 `protobuf:"varint,3,opt,name=menu_type,json=menuType,proto3" json:"menu_type,omitempty"` + Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` + Component string `protobuf:"bytes,5,opt,name=component,proto3" json:"component,omitempty"` + Permission string `protobuf:"bytes,6,opt,name=permission,proto3" json:"permission,omitempty"` + Icon string `protobuf:"bytes,7,opt,name=icon,proto3" json:"icon,omitempty"` + SortOrder int64 `protobuf:"varint,8,opt,name=sort_order,json=sortOrder,proto3" json:"sort_order,omitempty"` +} + +func (x *CreateMenuReq) Reset() { + *x = CreateMenuReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateMenuReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateMenuReq) ProtoMessage() {} + +func (x *CreateMenuReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateMenuReq.ProtoReflect.Descriptor instead. +func (*CreateMenuReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{20} +} + +func (x *CreateMenuReq) GetParentId() string { + if x != nil { + return x.ParentId + } + return "" +} + +func (x *CreateMenuReq) GetMenuName() string { + if x != nil { + return x.MenuName + } + return "" +} + +func (x *CreateMenuReq) GetMenuType() int64 { + if x != nil { + return x.MenuType + } + return 0 +} + +func (x *CreateMenuReq) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *CreateMenuReq) GetComponent() string { + if x != nil { + return x.Component + } + return "" +} + +func (x *CreateMenuReq) GetPermission() string { + if x != nil { + return x.Permission + } + return "" +} + +func (x *CreateMenuReq) GetIcon() string { + if x != nil { + return x.Icon + } + return "" +} + +func (x *CreateMenuReq) GetSortOrder() int64 { + if x != nil { + return x.SortOrder + } + return 0 +} + +type UpdateMenuReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MenuId string `protobuf:"bytes,1,opt,name=menu_id,json=menuId,proto3" json:"menu_id,omitempty"` + ParentId string `protobuf:"bytes,2,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` + MenuName string `protobuf:"bytes,3,opt,name=menu_name,json=menuName,proto3" json:"menu_name,omitempty"` + MenuType int64 `protobuf:"varint,4,opt,name=menu_type,json=menuType,proto3" json:"menu_type,omitempty"` + Path string `protobuf:"bytes,5,opt,name=path,proto3" json:"path,omitempty"` + Component string `protobuf:"bytes,6,opt,name=component,proto3" json:"component,omitempty"` + Permission string `protobuf:"bytes,7,opt,name=permission,proto3" json:"permission,omitempty"` + Icon string `protobuf:"bytes,8,opt,name=icon,proto3" json:"icon,omitempty"` + SortOrder int64 `protobuf:"varint,9,opt,name=sort_order,json=sortOrder,proto3" json:"sort_order,omitempty"` + Visible int64 `protobuf:"varint,10,opt,name=visible,proto3" json:"visible,omitempty"` +} + +func (x *UpdateMenuReq) Reset() { + *x = UpdateMenuReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateMenuReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateMenuReq) ProtoMessage() {} + +func (x *UpdateMenuReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateMenuReq.ProtoReflect.Descriptor instead. +func (*UpdateMenuReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{21} +} + +func (x *UpdateMenuReq) GetMenuId() string { + if x != nil { + return x.MenuId + } + return "" +} + +func (x *UpdateMenuReq) GetParentId() string { + if x != nil { + return x.ParentId + } + return "" +} + +func (x *UpdateMenuReq) GetMenuName() string { + if x != nil { + return x.MenuName + } + return "" +} + +func (x *UpdateMenuReq) GetMenuType() int64 { + if x != nil { + return x.MenuType + } + return 0 +} + +func (x *UpdateMenuReq) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *UpdateMenuReq) GetComponent() string { + if x != nil { + return x.Component + } + return "" +} + +func (x *UpdateMenuReq) GetPermission() string { + if x != nil { + return x.Permission + } + return "" +} + +func (x *UpdateMenuReq) GetIcon() string { + if x != nil { + return x.Icon + } + return "" +} + +func (x *UpdateMenuReq) GetSortOrder() int64 { + if x != nil { + return x.SortOrder + } + return 0 +} + +func (x *UpdateMenuReq) GetVisible() int64 { + if x != nil { + return x.Visible + } + return 0 +} + +type DeleteMenuReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MenuId string `protobuf:"bytes,1,opt,name=menu_id,json=menuId,proto3" json:"menu_id,omitempty"` +} + +func (x *DeleteMenuReq) Reset() { + *x = DeleteMenuReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteMenuReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteMenuReq) ProtoMessage() {} + +func (x *DeleteMenuReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteMenuReq.ProtoReflect.Descriptor instead. +func (*DeleteMenuReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{22} +} + +func (x *DeleteMenuReq) GetMenuId() string { + if x != nil { + return x.MenuId + } + return "" +} + +type GetMenuReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MenuId string `protobuf:"bytes,1,opt,name=menu_id,json=menuId,proto3" json:"menu_id,omitempty"` +} + +func (x *GetMenuReq) Reset() { + *x = GetMenuReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetMenuReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMenuReq) ProtoMessage() {} + +func (x *GetMenuReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMenuReq.ProtoReflect.Descriptor instead. +func (*GetMenuReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{23} +} + +func (x *GetMenuReq) GetMenuId() string { + if x != nil { + return x.MenuId + } + return "" +} + +type ListMenuReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ListMenuReq) Reset() { + *x = ListMenuReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListMenuReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListMenuReq) ProtoMessage() {} + +func (x *ListMenuReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListMenuReq.ProtoReflect.Descriptor instead. +func (*ListMenuReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{24} +} + +type ListMenuResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + List []*MenuInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` +} + +func (x *ListMenuResp) Reset() { + *x = ListMenuResp{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListMenuResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListMenuResp) ProtoMessage() {} + +func (x *ListMenuResp) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListMenuResp.ProtoReflect.Descriptor instead. +func (*ListMenuResp) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{25} +} + +func (x *ListMenuResp) GetList() []*MenuInfo { + if x != nil { + return x.List + } + return nil +} + +type OperationLogInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LogId string `protobuf:"bytes,1,opt,name=log_id,json=logId,proto3" json:"log_id,omitempty"` + UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"` + Module string `protobuf:"bytes,4,opt,name=module,proto3" json:"module,omitempty"` + Operation string `protobuf:"bytes,5,opt,name=operation,proto3" json:"operation,omitempty"` + Method string `protobuf:"bytes,6,opt,name=method,proto3" json:"method,omitempty"` + Path string `protobuf:"bytes,7,opt,name=path,proto3" json:"path,omitempty"` + Ip string `protobuf:"bytes,8,opt,name=ip,proto3" json:"ip,omitempty"` + Duration int64 `protobuf:"varint,9,opt,name=duration,proto3" json:"duration,omitempty"` + Status int64 `protobuf:"varint,10,opt,name=status,proto3" json:"status,omitempty"` + CreatedAt string `protobuf:"bytes,11,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` +} + +func (x *OperationLogInfo) Reset() { + *x = OperationLogInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OperationLogInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OperationLogInfo) ProtoMessage() {} + +func (x *OperationLogInfo) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OperationLogInfo.ProtoReflect.Descriptor instead. +func (*OperationLogInfo) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{26} +} + +func (x *OperationLogInfo) GetLogId() string { + if x != nil { + return x.LogId + } + return "" +} + +func (x *OperationLogInfo) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *OperationLogInfo) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *OperationLogInfo) GetModule() string { + if x != nil { + return x.Module + } + return "" +} + +func (x *OperationLogInfo) GetOperation() string { + if x != nil { + return x.Operation + } + return "" +} + +func (x *OperationLogInfo) GetMethod() string { + if x != nil { + return x.Method + } + return "" +} + +func (x *OperationLogInfo) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *OperationLogInfo) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +func (x *OperationLogInfo) GetDuration() int64 { + if x != nil { + return x.Duration + } + return 0 +} + +func (x *OperationLogInfo) GetStatus() int64 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *OperationLogInfo) GetCreatedAt() string { + if x != nil { + return x.CreatedAt + } + return "" +} + +type CreateLogReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` + Module string `protobuf:"bytes,3,opt,name=module,proto3" json:"module,omitempty"` + Operation string `protobuf:"bytes,4,opt,name=operation,proto3" json:"operation,omitempty"` + Method string `protobuf:"bytes,5,opt,name=method,proto3" json:"method,omitempty"` + Path string `protobuf:"bytes,6,opt,name=path,proto3" json:"path,omitempty"` + RequestBody string `protobuf:"bytes,7,opt,name=request_body,json=requestBody,proto3" json:"request_body,omitempty"` + ResponseBody string `protobuf:"bytes,8,opt,name=response_body,json=responseBody,proto3" json:"response_body,omitempty"` + Ip string `protobuf:"bytes,9,opt,name=ip,proto3" json:"ip,omitempty"` + UserAgent string `protobuf:"bytes,10,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"` + Duration int64 `protobuf:"varint,11,opt,name=duration,proto3" json:"duration,omitempty"` + Status int64 `protobuf:"varint,12,opt,name=status,proto3" json:"status,omitempty"` +} + +func (x *CreateLogReq) Reset() { + *x = CreateLogReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateLogReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateLogReq) ProtoMessage() {} + +func (x *CreateLogReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateLogReq.ProtoReflect.Descriptor instead. +func (*CreateLogReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{27} +} + +func (x *CreateLogReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *CreateLogReq) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *CreateLogReq) GetModule() string { + if x != nil { + return x.Module + } + return "" +} + +func (x *CreateLogReq) GetOperation() string { + if x != nil { + return x.Operation + } + return "" +} + +func (x *CreateLogReq) GetMethod() string { + if x != nil { + return x.Method + } + return "" +} + +func (x *CreateLogReq) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *CreateLogReq) GetRequestBody() string { + if x != nil { + return x.RequestBody + } + return "" +} + +func (x *CreateLogReq) GetResponseBody() string { + if x != nil { + return x.ResponseBody + } + return "" +} + +func (x *CreateLogReq) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +func (x *CreateLogReq) GetUserAgent() string { + if x != nil { + return x.UserAgent + } + return "" +} + +func (x *CreateLogReq) GetDuration() int64 { + if x != nil { + return x.Duration + } + return 0 +} + +func (x *CreateLogReq) GetStatus() int64 { + if x != nil { + return x.Status + } + return 0 +} + +type ListLogReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` + PageSize int64 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"` + Module string `protobuf:"bytes,4,opt,name=module,proto3" json:"module,omitempty"` + Operation string `protobuf:"bytes,5,opt,name=operation,proto3" json:"operation,omitempty"` + StartTime string `protobuf:"bytes,6,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` + EndTime string `protobuf:"bytes,7,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` +} + +func (x *ListLogReq) Reset() { + *x = ListLogReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListLogReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListLogReq) ProtoMessage() {} + +func (x *ListLogReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListLogReq.ProtoReflect.Descriptor instead. +func (*ListLogReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{28} +} + +func (x *ListLogReq) GetPage() int64 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *ListLogReq) GetPageSize() int64 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListLogReq) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *ListLogReq) GetModule() string { + if x != nil { + return x.Module + } + return "" +} + +func (x *ListLogReq) GetOperation() string { + if x != nil { + return x.Operation + } + return "" +} + +func (x *ListLogReq) GetStartTime() string { + if x != nil { + return x.StartTime + } + return "" +} + +func (x *ListLogReq) GetEndTime() string { + if x != nil { + return x.EndTime + } + return "" +} + +type ListLogResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + List []*OperationLogInfo `protobuf:"bytes,2,rep,name=list,proto3" json:"list,omitempty"` +} + +func (x *ListLogResp) Reset() { + *x = ListLogResp{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListLogResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListLogResp) ProtoMessage() {} + +func (x *ListLogResp) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[29] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListLogResp.ProtoReflect.Descriptor instead. +func (*ListLogResp) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{29} +} + +func (x *ListLogResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *ListLogResp) GetList() []*OperationLogInfo { + if x != nil { + return x.List + } + return nil +} + +type ConfigInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ConfigId string `protobuf:"bytes,1,opt,name=config_id,json=configId,proto3" json:"config_id,omitempty"` + ConfigKey string `protobuf:"bytes,2,opt,name=config_key,json=configKey,proto3" json:"config_key,omitempty"` + ConfigValue string `protobuf:"bytes,3,opt,name=config_value,json=configValue,proto3" json:"config_value,omitempty"` + ConfigName string `protobuf:"bytes,4,opt,name=config_name,json=configName,proto3" json:"config_name,omitempty"` + ConfigGroup string `protobuf:"bytes,5,opt,name=config_group,json=configGroup,proto3" json:"config_group,omitempty"` + Remark string `protobuf:"bytes,6,opt,name=remark,proto3" json:"remark,omitempty"` + UpdatedAt string `protobuf:"bytes,7,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` +} + +func (x *ConfigInfo) Reset() { + *x = ConfigInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConfigInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigInfo) ProtoMessage() {} + +func (x *ConfigInfo) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[30] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConfigInfo.ProtoReflect.Descriptor instead. +func (*ConfigInfo) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{30} +} + +func (x *ConfigInfo) GetConfigId() string { + if x != nil { + return x.ConfigId + } + return "" +} + +func (x *ConfigInfo) GetConfigKey() string { + if x != nil { + return x.ConfigKey + } + return "" +} + +func (x *ConfigInfo) GetConfigValue() string { + if x != nil { + return x.ConfigValue + } + return "" +} + +func (x *ConfigInfo) GetConfigName() string { + if x != nil { + return x.ConfigName + } + return "" +} + +func (x *ConfigInfo) GetConfigGroup() string { + if x != nil { + return x.ConfigGroup + } + return "" +} + +func (x *ConfigInfo) GetRemark() string { + if x != nil { + return x.Remark + } + return "" +} + +func (x *ConfigInfo) GetUpdatedAt() string { + if x != nil { + return x.UpdatedAt + } + return "" +} + +type ListConfigReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ConfigGroup string `protobuf:"bytes,1,opt,name=config_group,json=configGroup,proto3" json:"config_group,omitempty"` +} + +func (x *ListConfigReq) Reset() { + *x = ListConfigReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListConfigReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListConfigReq) ProtoMessage() {} + +func (x *ListConfigReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[31] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListConfigReq.ProtoReflect.Descriptor instead. +func (*ListConfigReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{31} +} + +func (x *ListConfigReq) GetConfigGroup() string { + if x != nil { + return x.ConfigGroup + } + return "" +} + +type ListConfigResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + List []*ConfigInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` +} + +func (x *ListConfigResp) Reset() { + *x = ListConfigResp{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListConfigResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListConfigResp) ProtoMessage() {} + +func (x *ListConfigResp) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[32] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListConfigResp.ProtoReflect.Descriptor instead. +func (*ListConfigResp) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{32} +} + +func (x *ListConfigResp) GetList() []*ConfigInfo { + if x != nil { + return x.List + } + return nil +} + +type UpdateConfigReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ConfigKey string `protobuf:"bytes,1,opt,name=config_key,json=configKey,proto3" json:"config_key,omitempty"` + ConfigValue string `protobuf:"bytes,2,opt,name=config_value,json=configValue,proto3" json:"config_value,omitempty"` +} + +func (x *UpdateConfigReq) Reset() { + *x = UpdateConfigReq{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateConfigReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateConfigReq) ProtoMessage() {} + +func (x *UpdateConfigReq) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[33] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateConfigReq.ProtoReflect.Descriptor instead. +func (*UpdateConfigReq) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{33} +} + +func (x *UpdateConfigReq) GetConfigKey() string { + if x != nil { + return x.ConfigKey + } + return "" +} + +func (x *UpdateConfigReq) GetConfigValue() string { + if x != nil { + return x.ConfigValue + } + return "" +} + +type IdResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *IdResp) Reset() { + *x = IdResp{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdResp) ProtoMessage() {} + +func (x *IdResp) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[34] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IdResp.ProtoReflect.Descriptor instead. +func (*IdResp) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{34} +} + +func (x *IdResp) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type Empty struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *Empty) Reset() { + *x = Empty{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_system_system_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Empty) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Empty) ProtoMessage() {} + +func (x *Empty) ProtoReflect() protoreflect.Message { + mi := &file_rpc_system_system_proto_msgTypes[35] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Empty.ProtoReflect.Descriptor instead. +func (*Empty) Descriptor() ([]byte, []int) { + return file_rpc_system_system_proto_rawDescGZIP(), []int{35} +} + +var File_rpc_system_system_proto protoreflect.FileDescriptor + +var file_rpc_system_system_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x73, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x22, 0x52, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, + 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, + 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, + 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x70, 0x22, 0xad, 0x01, 0x0a, 0x09, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, + 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x6c, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x61, + 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x19, 0x0a, + 0x08, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x72, 0x6f, 0x6c, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x6c, 0x65, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x6f, 0x6c, + 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x72, 0x0a, 0x11, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, + 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, + 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, + 0x72, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x6c, 0x64, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, + 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x6c, 0x64, 0x50, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x6e, 0x65, 0x77, 0x5f, 0x70, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x65, + 0x77, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0xd4, 0x02, 0x0a, 0x08, 0x55, 0x73, + 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, + 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x72, + 0x65, 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x72, 0x65, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x14, + 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, + 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x16, 0x0a, 0x06, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x6f, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, + 0x09, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x72, 0x6f, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x6c, 0x61, + 0x73, 0x74, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6c, 0x61, 0x73, 0x74, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x54, 0x69, + 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, + 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, + 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, + 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, + 0x22, 0xa9, 0x01, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, + 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, + 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, + 0x65, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, + 0x61, 0x69, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x6f, 0x6c, 0x65, 0x49, 0x64, 0x22, 0xa2, 0x01, 0x0a, + 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x17, + 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x6c, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x61, 0x6c, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, + 0x61, 0x69, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, + 0x12, 0x17, 0x0a, 0x07, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x72, 0x6f, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, + 0x74, 0x61, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, + 0x72, 0x22, 0x28, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x25, 0x0a, 0x0a, 0x47, + 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, + 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, + 0x49, 0x64, 0x22, 0xa5, 0x01, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, + 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, + 0x69, 0x7a, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, + 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, + 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x4a, 0x0a, 0x0c, 0x4c, 0x69, + 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, + 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, + 0x12, 0x24, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, + 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x46, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x55, 0x73, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, + 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x88, + 0x02, 0x0a, 0x08, 0x52, 0x6f, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x0a, 0x07, 0x72, + 0x6f, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x6f, + 0x6c, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x6f, 0x6c, 0x65, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x6f, 0x6c, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x09, + 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x72, 0x6f, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x6f, 0x72, + 0x74, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, + 0x6f, 0x72, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x65, 0x6e, 0x75, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x07, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x6e, 0x75, 0x49, 0x64, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x83, 0x01, 0x0a, 0x0d, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1b, 0x0a, 0x09, 0x72, + 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x72, 0x6f, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x6f, 0x6c, 0x65, + 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x6f, 0x6c, 0x65, + 0x4b, 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x64, 0x65, 0x73, 0x63, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x6f, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, + 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x6f, 0x72, 0x74, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x6f, 0x72, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x22, + 0x9c, 0x01, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, + 0x71, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x72, 0x6f, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, + 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, + 0x6f, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x6f, 0x6c, 0x65, 0x5f, + 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x6f, 0x6c, 0x65, 0x4b, + 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x6f, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x12, + 0x1d, 0x0a, 0x0a, 0x73, 0x6f, 0x72, 0x74, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x6f, 0x72, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x28, + 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x12, + 0x17, 0x0a, 0x07, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x72, 0x6f, 0x6c, 0x65, 0x49, 0x64, 0x22, 0x25, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52, + 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x6f, 0x6c, 0x65, 0x49, 0x64, 0x22, + 0x73, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x12, 0x12, + 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x70, 0x61, + 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, + 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x72, 0x6f, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x22, 0x4a, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x6f, 0x6c, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x24, 0x0a, 0x04, 0x6c, 0x69, + 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, + 0x22, 0x4b, 0x0a, 0x15, 0x53, 0x65, 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x69, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x6f, 0x6c, + 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x6f, 0x6c, 0x65, + 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x65, 0x6e, 0x75, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x6e, 0x75, 0x49, 0x64, 0x73, 0x22, 0x9d, 0x03, + 0x0a, 0x08, 0x4d, 0x65, 0x6e, 0x75, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x0a, 0x07, 0x6d, 0x65, + 0x6e, 0x75, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x6e, + 0x75, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, + 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x65, 0x6e, 0x75, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x6e, 0x75, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, + 0x09, 0x6d, 0x65, 0x6e, 0x75, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x08, 0x6d, 0x65, 0x6e, 0x75, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, + 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1c, + 0x0a, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x0a, + 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, + 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x63, 0x6f, 0x6e, + 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x6f, 0x72, 0x74, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x6f, 0x72, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, + 0x18, 0x0a, 0x07, 0x76, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x07, 0x76, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18, 0x0c, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4d, 0x65, 0x6e, + 0x75, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x12, + 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0d, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, + 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0e, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0xeb, 0x01, + 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6e, 0x75, 0x52, 0x65, 0x71, 0x12, + 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, + 0x6d, 0x65, 0x6e, 0x75, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x6d, 0x65, 0x6e, 0x75, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x65, 0x6e, + 0x75, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x65, + 0x6e, 0x75, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, + 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, + 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x65, 0x72, 0x6d, + 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x65, + 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, 0x6e, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, + 0x73, 0x6f, 0x72, 0x74, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x09, 0x73, 0x6f, 0x72, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x9e, 0x02, 0x0a, 0x0d, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6e, 0x75, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, + 0x07, 0x6d, 0x65, 0x6e, 0x75, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x6d, 0x65, 0x6e, 0x75, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, + 0x74, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x65, 0x6e, 0x75, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x6e, 0x75, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x65, 0x6e, 0x75, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x65, 0x6e, 0x75, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, + 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, + 0x1e, 0x0a, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, + 0x63, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x6f, 0x72, 0x74, 0x5f, 0x6f, 0x72, 0x64, 0x65, + 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x6f, 0x72, 0x74, 0x4f, 0x72, 0x64, + 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x07, 0x76, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x22, 0x28, 0x0a, 0x0d, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6e, 0x75, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, + 0x07, 0x6d, 0x65, 0x6e, 0x75, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x6d, 0x65, 0x6e, 0x75, 0x49, 0x64, 0x22, 0x25, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6e, + 0x75, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x6d, 0x65, 0x6e, 0x75, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x6e, 0x75, 0x49, 0x64, 0x22, 0x0d, 0x0a, + 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6e, 0x75, 0x52, 0x65, 0x71, 0x22, 0x34, 0x0a, 0x0c, + 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6e, 0x75, 0x52, 0x65, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x04, + 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x2e, 0x4d, 0x65, 0x6e, 0x75, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x6c, 0x69, + 0x73, 0x74, 0x22, 0xa3, 0x02, 0x0a, 0x10, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x4c, 0x6f, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x15, 0x0a, 0x06, 0x6c, 0x6f, 0x67, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x6f, 0x67, 0x49, 0x64, 0x12, 0x17, + 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, + 0x68, 0x6f, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0xd0, 0x02, 0x0a, 0x0c, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, + 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, + 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x12, 0x0a, 0x04, + 0x70, 0x61, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, + 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x6f, 0x64, 0x79, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, + 0x6f, 0x64, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, + 0x62, 0x6f, 0x64, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, + 0x5f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x73, + 0x65, 0x72, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0c, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xc9, 0x01, 0x0a, 0x0a, + 0x4c, 0x69, 0x73, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, + 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1b, + 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, + 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, + 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, + 0x1c, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, + 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, + 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x51, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x4c, + 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x2c, 0x0a, 0x04, + 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x6f, 0x67, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0xe6, 0x01, 0x0a, 0x0a, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x16, 0x0a, 0x06, + 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, + 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, + 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x64, 0x41, 0x74, 0x22, 0x32, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x52, 0x65, 0x71, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x67, + 0x72, 0x6f, 0x75, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x38, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x26, 0x0a, 0x04, 0x6c, 0x69, 0x73, + 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, + 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x6c, 0x69, 0x73, + 0x74, 0x22, 0x53, 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x52, 0x65, 0x71, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x4b, 0x65, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x18, 0x0a, 0x06, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, + 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x32, 0xf9, 0x09, 0x0a, 0x0d, 0x53, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2c, 0x0a, 0x05, 0x4c, + 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x10, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x6f, + 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, + 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3a, 0x0a, 0x0e, 0x43, 0x68, 0x61, + 0x6e, 0x67, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x19, 0x2e, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, + 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x33, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, + 0x73, 0x65, 0x72, 0x12, 0x15, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x73, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x2e, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x32, 0x0a, 0x0a, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x15, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, + 0x0d, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x32, + 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x15, 0x2e, 0x73, + 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x12, 0x2f, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x12, 0x2e, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x1a, 0x10, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, + 0x6e, 0x66, 0x6f, 0x12, 0x35, 0x0a, 0x08, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, + 0x13, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3e, 0x0a, 0x10, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, + 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, + 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x33, 0x0a, 0x0a, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x15, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x1a, + 0x0e, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x32, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x15, 0x2e, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, + 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x12, 0x32, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6c, + 0x65, 0x12, 0x15, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x2f, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x52, 0x6f, + 0x6c, 0x65, 0x12, 0x12, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x52, + 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, + 0x52, 0x6f, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x35, 0x0a, 0x08, 0x4c, 0x69, 0x73, 0x74, + 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x13, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x42, 0x0a, 0x12, 0x53, 0x65, 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1d, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x53, + 0x65, 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x12, 0x33, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6e, + 0x75, 0x12, 0x15, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4d, 0x65, 0x6e, 0x75, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x2e, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x32, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x4d, 0x65, 0x6e, 0x75, 0x12, 0x15, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6e, 0x75, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x32, 0x0a, 0x0a, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6e, 0x75, 0x12, 0x15, 0x2e, 0x73, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6e, 0x75, 0x52, 0x65, + 0x71, 0x1a, 0x0d, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x12, 0x2f, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6e, 0x75, 0x12, 0x12, 0x2e, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6e, 0x75, 0x52, 0x65, 0x71, 0x1a, + 0x10, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4d, 0x65, 0x6e, 0x75, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x35, 0x0a, 0x08, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6e, 0x75, 0x12, 0x13, 0x2e, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6e, 0x75, 0x52, + 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x4d, 0x65, 0x6e, 0x75, 0x52, 0x65, 0x73, 0x70, 0x12, 0x39, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x6f, 0x67, 0x12, 0x14, + 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4c, 0x6f, + 0x67, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x12, 0x3b, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x6f, 0x67, 0x12, 0x12, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x3b, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x15, + 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x36, 0x0a, + 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x17, 0x2e, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_rpc_system_system_proto_rawDescOnce sync.Once + file_rpc_system_system_proto_rawDescData = file_rpc_system_system_proto_rawDesc +) + +func file_rpc_system_system_proto_rawDescGZIP() []byte { + file_rpc_system_system_proto_rawDescOnce.Do(func() { + file_rpc_system_system_proto_rawDescData = protoimpl.X.CompressGZIP(file_rpc_system_system_proto_rawDescData) + }) + return file_rpc_system_system_proto_rawDescData +} + +var file_rpc_system_system_proto_msgTypes = make([]protoimpl.MessageInfo, 36) +var file_rpc_system_system_proto_goTypes = []interface{}{ + (*LoginReq)(nil), // 0: system.LoginReq + (*LoginResp)(nil), // 1: system.LoginResp + (*ChangePasswordReq)(nil), // 2: system.ChangePasswordReq + (*UserInfo)(nil), // 3: system.UserInfo + (*CreateUserReq)(nil), // 4: system.CreateUserReq + (*UpdateUserReq)(nil), // 5: system.UpdateUserReq + (*DeleteUserReq)(nil), // 6: system.DeleteUserReq + (*GetUserReq)(nil), // 7: system.GetUserReq + (*ListUserReq)(nil), // 8: system.ListUserReq + (*ListUserResp)(nil), // 9: system.ListUserResp + (*UpdateUserStatusReq)(nil), // 10: system.UpdateUserStatusReq + (*RoleInfo)(nil), // 11: system.RoleInfo + (*CreateRoleReq)(nil), // 12: system.CreateRoleReq + (*UpdateRoleReq)(nil), // 13: system.UpdateRoleReq + (*DeleteRoleReq)(nil), // 14: system.DeleteRoleReq + (*GetRoleReq)(nil), // 15: system.GetRoleReq + (*ListRoleReq)(nil), // 16: system.ListRoleReq + (*ListRoleResp)(nil), // 17: system.ListRoleResp + (*SetRolePermissionsReq)(nil), // 18: system.SetRolePermissionsReq + (*MenuInfo)(nil), // 19: system.MenuInfo + (*CreateMenuReq)(nil), // 20: system.CreateMenuReq + (*UpdateMenuReq)(nil), // 21: system.UpdateMenuReq + (*DeleteMenuReq)(nil), // 22: system.DeleteMenuReq + (*GetMenuReq)(nil), // 23: system.GetMenuReq + (*ListMenuReq)(nil), // 24: system.ListMenuReq + (*ListMenuResp)(nil), // 25: system.ListMenuResp + (*OperationLogInfo)(nil), // 26: system.OperationLogInfo + (*CreateLogReq)(nil), // 27: system.CreateLogReq + (*ListLogReq)(nil), // 28: system.ListLogReq + (*ListLogResp)(nil), // 29: system.ListLogResp + (*ConfigInfo)(nil), // 30: system.ConfigInfo + (*ListConfigReq)(nil), // 31: system.ListConfigReq + (*ListConfigResp)(nil), // 32: system.ListConfigResp + (*UpdateConfigReq)(nil), // 33: system.UpdateConfigReq + (*IdResp)(nil), // 34: system.IdResp + (*Empty)(nil), // 35: system.Empty +} +var file_rpc_system_system_proto_depIdxs = []int32{ + 3, // 0: system.ListUserResp.list:type_name -> system.UserInfo + 11, // 1: system.ListRoleResp.list:type_name -> system.RoleInfo + 19, // 2: system.MenuInfo.children:type_name -> system.MenuInfo + 19, // 3: system.ListMenuResp.list:type_name -> system.MenuInfo + 26, // 4: system.ListLogResp.list:type_name -> system.OperationLogInfo + 30, // 5: system.ListConfigResp.list:type_name -> system.ConfigInfo + 0, // 6: system.SystemService.Login:input_type -> system.LoginReq + 2, // 7: system.SystemService.ChangePassword:input_type -> system.ChangePasswordReq + 4, // 8: system.SystemService.CreateUser:input_type -> system.CreateUserReq + 5, // 9: system.SystemService.UpdateUser:input_type -> system.UpdateUserReq + 6, // 10: system.SystemService.DeleteUser:input_type -> system.DeleteUserReq + 7, // 11: system.SystemService.GetUser:input_type -> system.GetUserReq + 8, // 12: system.SystemService.ListUser:input_type -> system.ListUserReq + 10, // 13: system.SystemService.UpdateUserStatus:input_type -> system.UpdateUserStatusReq + 12, // 14: system.SystemService.CreateRole:input_type -> system.CreateRoleReq + 13, // 15: system.SystemService.UpdateRole:input_type -> system.UpdateRoleReq + 14, // 16: system.SystemService.DeleteRole:input_type -> system.DeleteRoleReq + 15, // 17: system.SystemService.GetRole:input_type -> system.GetRoleReq + 16, // 18: system.SystemService.ListRole:input_type -> system.ListRoleReq + 18, // 19: system.SystemService.SetRolePermissions:input_type -> system.SetRolePermissionsReq + 20, // 20: system.SystemService.CreateMenu:input_type -> system.CreateMenuReq + 21, // 21: system.SystemService.UpdateMenu:input_type -> system.UpdateMenuReq + 22, // 22: system.SystemService.DeleteMenu:input_type -> system.DeleteMenuReq + 23, // 23: system.SystemService.GetMenu:input_type -> system.GetMenuReq + 24, // 24: system.SystemService.ListMenu:input_type -> system.ListMenuReq + 27, // 25: system.SystemService.CreateOperationLog:input_type -> system.CreateLogReq + 28, // 26: system.SystemService.ListOperationLog:input_type -> system.ListLogReq + 31, // 27: system.SystemService.ListConfig:input_type -> system.ListConfigReq + 33, // 28: system.SystemService.UpdateConfig:input_type -> system.UpdateConfigReq + 1, // 29: system.SystemService.Login:output_type -> system.LoginResp + 35, // 30: system.SystemService.ChangePassword:output_type -> system.Empty + 34, // 31: system.SystemService.CreateUser:output_type -> system.IdResp + 35, // 32: system.SystemService.UpdateUser:output_type -> system.Empty + 35, // 33: system.SystemService.DeleteUser:output_type -> system.Empty + 3, // 34: system.SystemService.GetUser:output_type -> system.UserInfo + 9, // 35: system.SystemService.ListUser:output_type -> system.ListUserResp + 35, // 36: system.SystemService.UpdateUserStatus:output_type -> system.Empty + 34, // 37: system.SystemService.CreateRole:output_type -> system.IdResp + 35, // 38: system.SystemService.UpdateRole:output_type -> system.Empty + 35, // 39: system.SystemService.DeleteRole:output_type -> system.Empty + 11, // 40: system.SystemService.GetRole:output_type -> system.RoleInfo + 17, // 41: system.SystemService.ListRole:output_type -> system.ListRoleResp + 35, // 42: system.SystemService.SetRolePermissions:output_type -> system.Empty + 34, // 43: system.SystemService.CreateMenu:output_type -> system.IdResp + 35, // 44: system.SystemService.UpdateMenu:output_type -> system.Empty + 35, // 45: system.SystemService.DeleteMenu:output_type -> system.Empty + 19, // 46: system.SystemService.GetMenu:output_type -> system.MenuInfo + 25, // 47: system.SystemService.ListMenu:output_type -> system.ListMenuResp + 35, // 48: system.SystemService.CreateOperationLog:output_type -> system.Empty + 29, // 49: system.SystemService.ListOperationLog:output_type -> system.ListLogResp + 32, // 50: system.SystemService.ListConfig:output_type -> system.ListConfigResp + 35, // 51: system.SystemService.UpdateConfig:output_type -> system.Empty + 29, // [29:52] is the sub-list for method output_type + 6, // [6:29] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_rpc_system_system_proto_init() } +func file_rpc_system_system_proto_init() { + if File_rpc_system_system_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_rpc_system_system_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LoginReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LoginResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChangePasswordReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateUserReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateUserReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteUserReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUserReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListUserReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListUserResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateUserStatusReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RoleInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateRoleReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateRoleReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRoleReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRoleReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRoleReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRoleResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetRolePermissionsReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MenuInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateMenuReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateMenuReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteMenuReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetMenuReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListMenuReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListMenuResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OperationLogInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateLogReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListLogReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListLogResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConfigInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListConfigReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListConfigResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateConfigReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_system_system_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Empty); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_rpc_system_system_proto_rawDesc, + NumEnums: 0, + NumMessages: 36, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_rpc_system_system_proto_goTypes, + DependencyIndexes: file_rpc_system_system_proto_depIdxs, + MessageInfos: file_rpc_system_system_proto_msgTypes, + }.Build() + File_rpc_system_system_proto = out.File + file_rpc_system_system_proto_rawDesc = nil + file_rpc_system_system_proto_goTypes = nil + file_rpc_system_system_proto_depIdxs = nil +} diff --git a/rpc/system/pb/system_grpc.pb.go b/rpc/system/pb/system_grpc.pb.go new file mode 100644 index 0000000..3d90ab2 --- /dev/null +++ b/rpc/system/pb/system_grpc.pb.go @@ -0,0 +1,909 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.20.3 +// source: rpc/system/system.proto + +package pb + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// SystemServiceClient is the client API for SystemService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type SystemServiceClient interface { + // Auth + Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error) + ChangePassword(ctx context.Context, in *ChangePasswordReq, opts ...grpc.CallOption) (*Empty, error) + // User + CreateUser(ctx context.Context, in *CreateUserReq, opts ...grpc.CallOption) (*IdResp, error) + UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*Empty, error) + DeleteUser(ctx context.Context, in *DeleteUserReq, opts ...grpc.CallOption) (*Empty, error) + GetUser(ctx context.Context, in *GetUserReq, opts ...grpc.CallOption) (*UserInfo, error) + ListUser(ctx context.Context, in *ListUserReq, opts ...grpc.CallOption) (*ListUserResp, error) + UpdateUserStatus(ctx context.Context, in *UpdateUserStatusReq, opts ...grpc.CallOption) (*Empty, error) + // Role + CreateRole(ctx context.Context, in *CreateRoleReq, opts ...grpc.CallOption) (*IdResp, error) + UpdateRole(ctx context.Context, in *UpdateRoleReq, opts ...grpc.CallOption) (*Empty, error) + DeleteRole(ctx context.Context, in *DeleteRoleReq, opts ...grpc.CallOption) (*Empty, error) + GetRole(ctx context.Context, in *GetRoleReq, opts ...grpc.CallOption) (*RoleInfo, error) + ListRole(ctx context.Context, in *ListRoleReq, opts ...grpc.CallOption) (*ListRoleResp, error) + SetRolePermissions(ctx context.Context, in *SetRolePermissionsReq, opts ...grpc.CallOption) (*Empty, error) + // Menu + CreateMenu(ctx context.Context, in *CreateMenuReq, opts ...grpc.CallOption) (*IdResp, error) + UpdateMenu(ctx context.Context, in *UpdateMenuReq, opts ...grpc.CallOption) (*Empty, error) + DeleteMenu(ctx context.Context, in *DeleteMenuReq, opts ...grpc.CallOption) (*Empty, error) + GetMenu(ctx context.Context, in *GetMenuReq, opts ...grpc.CallOption) (*MenuInfo, error) + ListMenu(ctx context.Context, in *ListMenuReq, opts ...grpc.CallOption) (*ListMenuResp, error) + // Operation Log + CreateOperationLog(ctx context.Context, in *CreateLogReq, opts ...grpc.CallOption) (*Empty, error) + ListOperationLog(ctx context.Context, in *ListLogReq, opts ...grpc.CallOption) (*ListLogResp, error) + // Config + ListConfig(ctx context.Context, in *ListConfigReq, opts ...grpc.CallOption) (*ListConfigResp, error) + UpdateConfig(ctx context.Context, in *UpdateConfigReq, opts ...grpc.CallOption) (*Empty, error) +} + +type systemServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewSystemServiceClient(cc grpc.ClientConnInterface) SystemServiceClient { + return &systemServiceClient{cc} +} + +func (c *systemServiceClient) Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error) { + out := new(LoginResp) + err := c.cc.Invoke(ctx, "/system.SystemService/Login", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) ChangePassword(ctx context.Context, in *ChangePasswordReq, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, "/system.SystemService/ChangePassword", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) CreateUser(ctx context.Context, in *CreateUserReq, opts ...grpc.CallOption) (*IdResp, error) { + out := new(IdResp) + err := c.cc.Invoke(ctx, "/system.SystemService/CreateUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, "/system.SystemService/UpdateUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) DeleteUser(ctx context.Context, in *DeleteUserReq, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, "/system.SystemService/DeleteUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) GetUser(ctx context.Context, in *GetUserReq, opts ...grpc.CallOption) (*UserInfo, error) { + out := new(UserInfo) + err := c.cc.Invoke(ctx, "/system.SystemService/GetUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) ListUser(ctx context.Context, in *ListUserReq, opts ...grpc.CallOption) (*ListUserResp, error) { + out := new(ListUserResp) + err := c.cc.Invoke(ctx, "/system.SystemService/ListUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) UpdateUserStatus(ctx context.Context, in *UpdateUserStatusReq, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, "/system.SystemService/UpdateUserStatus", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) CreateRole(ctx context.Context, in *CreateRoleReq, opts ...grpc.CallOption) (*IdResp, error) { + out := new(IdResp) + err := c.cc.Invoke(ctx, "/system.SystemService/CreateRole", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) UpdateRole(ctx context.Context, in *UpdateRoleReq, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, "/system.SystemService/UpdateRole", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) DeleteRole(ctx context.Context, in *DeleteRoleReq, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, "/system.SystemService/DeleteRole", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) GetRole(ctx context.Context, in *GetRoleReq, opts ...grpc.CallOption) (*RoleInfo, error) { + out := new(RoleInfo) + err := c.cc.Invoke(ctx, "/system.SystemService/GetRole", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) ListRole(ctx context.Context, in *ListRoleReq, opts ...grpc.CallOption) (*ListRoleResp, error) { + out := new(ListRoleResp) + err := c.cc.Invoke(ctx, "/system.SystemService/ListRole", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) SetRolePermissions(ctx context.Context, in *SetRolePermissionsReq, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, "/system.SystemService/SetRolePermissions", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) CreateMenu(ctx context.Context, in *CreateMenuReq, opts ...grpc.CallOption) (*IdResp, error) { + out := new(IdResp) + err := c.cc.Invoke(ctx, "/system.SystemService/CreateMenu", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) UpdateMenu(ctx context.Context, in *UpdateMenuReq, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, "/system.SystemService/UpdateMenu", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) DeleteMenu(ctx context.Context, in *DeleteMenuReq, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, "/system.SystemService/DeleteMenu", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) GetMenu(ctx context.Context, in *GetMenuReq, opts ...grpc.CallOption) (*MenuInfo, error) { + out := new(MenuInfo) + err := c.cc.Invoke(ctx, "/system.SystemService/GetMenu", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) ListMenu(ctx context.Context, in *ListMenuReq, opts ...grpc.CallOption) (*ListMenuResp, error) { + out := new(ListMenuResp) + err := c.cc.Invoke(ctx, "/system.SystemService/ListMenu", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) CreateOperationLog(ctx context.Context, in *CreateLogReq, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, "/system.SystemService/CreateOperationLog", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) ListOperationLog(ctx context.Context, in *ListLogReq, opts ...grpc.CallOption) (*ListLogResp, error) { + out := new(ListLogResp) + err := c.cc.Invoke(ctx, "/system.SystemService/ListOperationLog", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) ListConfig(ctx context.Context, in *ListConfigReq, opts ...grpc.CallOption) (*ListConfigResp, error) { + out := new(ListConfigResp) + err := c.cc.Invoke(ctx, "/system.SystemService/ListConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) UpdateConfig(ctx context.Context, in *UpdateConfigReq, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, "/system.SystemService/UpdateConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SystemServiceServer is the server API for SystemService service. +// All implementations must embed UnimplementedSystemServiceServer +// for forward compatibility +type SystemServiceServer interface { + // Auth + Login(context.Context, *LoginReq) (*LoginResp, error) + ChangePassword(context.Context, *ChangePasswordReq) (*Empty, error) + // User + CreateUser(context.Context, *CreateUserReq) (*IdResp, error) + UpdateUser(context.Context, *UpdateUserReq) (*Empty, error) + DeleteUser(context.Context, *DeleteUserReq) (*Empty, error) + GetUser(context.Context, *GetUserReq) (*UserInfo, error) + ListUser(context.Context, *ListUserReq) (*ListUserResp, error) + UpdateUserStatus(context.Context, *UpdateUserStatusReq) (*Empty, error) + // Role + CreateRole(context.Context, *CreateRoleReq) (*IdResp, error) + UpdateRole(context.Context, *UpdateRoleReq) (*Empty, error) + DeleteRole(context.Context, *DeleteRoleReq) (*Empty, error) + GetRole(context.Context, *GetRoleReq) (*RoleInfo, error) + ListRole(context.Context, *ListRoleReq) (*ListRoleResp, error) + SetRolePermissions(context.Context, *SetRolePermissionsReq) (*Empty, error) + // Menu + CreateMenu(context.Context, *CreateMenuReq) (*IdResp, error) + UpdateMenu(context.Context, *UpdateMenuReq) (*Empty, error) + DeleteMenu(context.Context, *DeleteMenuReq) (*Empty, error) + GetMenu(context.Context, *GetMenuReq) (*MenuInfo, error) + ListMenu(context.Context, *ListMenuReq) (*ListMenuResp, error) + // Operation Log + CreateOperationLog(context.Context, *CreateLogReq) (*Empty, error) + ListOperationLog(context.Context, *ListLogReq) (*ListLogResp, error) + // Config + ListConfig(context.Context, *ListConfigReq) (*ListConfigResp, error) + UpdateConfig(context.Context, *UpdateConfigReq) (*Empty, error) + mustEmbedUnimplementedSystemServiceServer() +} + +// UnimplementedSystemServiceServer must be embedded to have forward compatible implementations. +type UnimplementedSystemServiceServer struct { +} + +func (UnimplementedSystemServiceServer) Login(context.Context, *LoginReq) (*LoginResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method Login not implemented") +} +func (UnimplementedSystemServiceServer) ChangePassword(context.Context, *ChangePasswordReq) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method ChangePassword not implemented") +} +func (UnimplementedSystemServiceServer) CreateUser(context.Context, *CreateUserReq) (*IdResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateUser not implemented") +} +func (UnimplementedSystemServiceServer) UpdateUser(context.Context, *UpdateUserReq) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateUser not implemented") +} +func (UnimplementedSystemServiceServer) DeleteUser(context.Context, *DeleteUserReq) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteUser not implemented") +} +func (UnimplementedSystemServiceServer) GetUser(context.Context, *GetUserReq) (*UserInfo, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented") +} +func (UnimplementedSystemServiceServer) ListUser(context.Context, *ListUserReq) (*ListUserResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListUser not implemented") +} +func (UnimplementedSystemServiceServer) UpdateUserStatus(context.Context, *UpdateUserStatusReq) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateUserStatus not implemented") +} +func (UnimplementedSystemServiceServer) CreateRole(context.Context, *CreateRoleReq) (*IdResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateRole not implemented") +} +func (UnimplementedSystemServiceServer) UpdateRole(context.Context, *UpdateRoleReq) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateRole not implemented") +} +func (UnimplementedSystemServiceServer) DeleteRole(context.Context, *DeleteRoleReq) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteRole not implemented") +} +func (UnimplementedSystemServiceServer) GetRole(context.Context, *GetRoleReq) (*RoleInfo, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRole not implemented") +} +func (UnimplementedSystemServiceServer) ListRole(context.Context, *ListRoleReq) (*ListRoleResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListRole not implemented") +} +func (UnimplementedSystemServiceServer) SetRolePermissions(context.Context, *SetRolePermissionsReq) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetRolePermissions not implemented") +} +func (UnimplementedSystemServiceServer) CreateMenu(context.Context, *CreateMenuReq) (*IdResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateMenu not implemented") +} +func (UnimplementedSystemServiceServer) UpdateMenu(context.Context, *UpdateMenuReq) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateMenu not implemented") +} +func (UnimplementedSystemServiceServer) DeleteMenu(context.Context, *DeleteMenuReq) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteMenu not implemented") +} +func (UnimplementedSystemServiceServer) GetMenu(context.Context, *GetMenuReq) (*MenuInfo, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetMenu not implemented") +} +func (UnimplementedSystemServiceServer) ListMenu(context.Context, *ListMenuReq) (*ListMenuResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListMenu not implemented") +} +func (UnimplementedSystemServiceServer) CreateOperationLog(context.Context, *CreateLogReq) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateOperationLog not implemented") +} +func (UnimplementedSystemServiceServer) ListOperationLog(context.Context, *ListLogReq) (*ListLogResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListOperationLog not implemented") +} +func (UnimplementedSystemServiceServer) ListConfig(context.Context, *ListConfigReq) (*ListConfigResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListConfig not implemented") +} +func (UnimplementedSystemServiceServer) UpdateConfig(context.Context, *UpdateConfigReq) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateConfig not implemented") +} +func (UnimplementedSystemServiceServer) mustEmbedUnimplementedSystemServiceServer() {} + +// UnsafeSystemServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SystemServiceServer will +// result in compilation errors. +type UnsafeSystemServiceServer interface { + mustEmbedUnimplementedSystemServiceServer() +} + +func RegisterSystemServiceServer(s grpc.ServiceRegistrar, srv SystemServiceServer) { + s.RegisterService(&SystemService_ServiceDesc, srv) +} + +func _SystemService_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LoginReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).Login(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/Login", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).Login(ctx, req.(*LoginReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_ChangePassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ChangePasswordReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).ChangePassword(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/ChangePassword", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).ChangePassword(ctx, req.(*ChangePasswordReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateUserReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).CreateUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/CreateUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).CreateUser(ctx, req.(*CreateUserReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_UpdateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).UpdateUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/UpdateUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).UpdateUser(ctx, req.(*UpdateUserReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_DeleteUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteUserReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).DeleteUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/DeleteUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).DeleteUser(ctx, req.(*DeleteUserReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).GetUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/GetUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).GetUser(ctx, req.(*GetUserReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_ListUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListUserReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).ListUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/ListUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).ListUser(ctx, req.(*ListUserReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_UpdateUserStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserStatusReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).UpdateUserStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/UpdateUserStatus", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).UpdateUserStatus(ctx, req.(*UpdateUserStatusReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_CreateRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateRoleReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).CreateRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/CreateRole", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).CreateRole(ctx, req.(*CreateRoleReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_UpdateRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateRoleReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).UpdateRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/UpdateRole", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).UpdateRole(ctx, req.(*UpdateRoleReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_DeleteRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRoleReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).DeleteRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/DeleteRole", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).DeleteRole(ctx, req.(*DeleteRoleReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_GetRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRoleReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).GetRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/GetRole", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).GetRole(ctx, req.(*GetRoleReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_ListRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRoleReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).ListRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/ListRole", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).ListRole(ctx, req.(*ListRoleReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_SetRolePermissions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetRolePermissionsReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).SetRolePermissions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/SetRolePermissions", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).SetRolePermissions(ctx, req.(*SetRolePermissionsReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_CreateMenu_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateMenuReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).CreateMenu(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/CreateMenu", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).CreateMenu(ctx, req.(*CreateMenuReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_UpdateMenu_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateMenuReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).UpdateMenu(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/UpdateMenu", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).UpdateMenu(ctx, req.(*UpdateMenuReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_DeleteMenu_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteMenuReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).DeleteMenu(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/DeleteMenu", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).DeleteMenu(ctx, req.(*DeleteMenuReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_GetMenu_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetMenuReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).GetMenu(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/GetMenu", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).GetMenu(ctx, req.(*GetMenuReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_ListMenu_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListMenuReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).ListMenu(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/ListMenu", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).ListMenu(ctx, req.(*ListMenuReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_CreateOperationLog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateLogReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).CreateOperationLog(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/CreateOperationLog", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).CreateOperationLog(ctx, req.(*CreateLogReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_ListOperationLog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListLogReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).ListOperationLog(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/ListOperationLog", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).ListOperationLog(ctx, req.(*ListLogReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_ListConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListConfigReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).ListConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/ListConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).ListConfig(ctx, req.(*ListConfigReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_UpdateConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateConfigReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).UpdateConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/system.SystemService/UpdateConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).UpdateConfig(ctx, req.(*UpdateConfigReq)) + } + return interceptor(ctx, in, info, handler) +} + +// SystemService_ServiceDesc is the grpc.ServiceDesc for SystemService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SystemService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "system.SystemService", + HandlerType: (*SystemServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Login", + Handler: _SystemService_Login_Handler, + }, + { + MethodName: "ChangePassword", + Handler: _SystemService_ChangePassword_Handler, + }, + { + MethodName: "CreateUser", + Handler: _SystemService_CreateUser_Handler, + }, + { + MethodName: "UpdateUser", + Handler: _SystemService_UpdateUser_Handler, + }, + { + MethodName: "DeleteUser", + Handler: _SystemService_DeleteUser_Handler, + }, + { + MethodName: "GetUser", + Handler: _SystemService_GetUser_Handler, + }, + { + MethodName: "ListUser", + Handler: _SystemService_ListUser_Handler, + }, + { + MethodName: "UpdateUserStatus", + Handler: _SystemService_UpdateUserStatus_Handler, + }, + { + MethodName: "CreateRole", + Handler: _SystemService_CreateRole_Handler, + }, + { + MethodName: "UpdateRole", + Handler: _SystemService_UpdateRole_Handler, + }, + { + MethodName: "DeleteRole", + Handler: _SystemService_DeleteRole_Handler, + }, + { + MethodName: "GetRole", + Handler: _SystemService_GetRole_Handler, + }, + { + MethodName: "ListRole", + Handler: _SystemService_ListRole_Handler, + }, + { + MethodName: "SetRolePermissions", + Handler: _SystemService_SetRolePermissions_Handler, + }, + { + MethodName: "CreateMenu", + Handler: _SystemService_CreateMenu_Handler, + }, + { + MethodName: "UpdateMenu", + Handler: _SystemService_UpdateMenu_Handler, + }, + { + MethodName: "DeleteMenu", + Handler: _SystemService_DeleteMenu_Handler, + }, + { + MethodName: "GetMenu", + Handler: _SystemService_GetMenu_Handler, + }, + { + MethodName: "ListMenu", + Handler: _SystemService_ListMenu_Handler, + }, + { + MethodName: "CreateOperationLog", + Handler: _SystemService_CreateOperationLog_Handler, + }, + { + MethodName: "ListOperationLog", + Handler: _SystemService_ListOperationLog_Handler, + }, + { + MethodName: "ListConfig", + Handler: _SystemService_ListConfig_Handler, + }, + { + MethodName: "UpdateConfig", + Handler: _SystemService_UpdateConfig_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "rpc/system/system.proto", +} diff --git a/rpc/system/system.go b/rpc/system/system.go new file mode 100644 index 0000000..fa7679f --- /dev/null +++ b/rpc/system/system.go @@ -0,0 +1,39 @@ +package main + +import ( + "flag" + "fmt" + + "muyu-apiserver/rpc/system/internal/config" + "muyu-apiserver/rpc/system/internal/server" + "muyu-apiserver/rpc/system/internal/svc" + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/core/service" + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" +) + +var configFile = flag.String("f", "etc/system.yaml", "the config file") + +func main() { + flag.Parse() + + var c config.Config + conf.MustLoad(*configFile, &c) + ctx := svc.NewServiceContext(c) + + s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { + pb.RegisterSystemServiceServer(grpcServer, server.NewSystemServiceServer(ctx)) + + if c.Mode == service.DevMode || c.Mode == service.TestMode { + reflection.Register(grpcServer) + } + }) + defer s.Stop() + + fmt.Printf("Starting rpc server at %s...\n", c.ListenOn) + s.Start() +} diff --git a/rpc/system/system.proto b/rpc/system/system.proto new file mode 100644 index 0000000..8a7733a --- /dev/null +++ b/rpc/system/system.proto @@ -0,0 +1,319 @@ +syntax = "proto3"; + +package system; + +option go_package = "./pb"; + +// ==================== Auth ==================== + +message LoginReq { + string username = 1; + string password = 2; + string ip = 3; +} + +message LoginResp { + string user_id = 1; + string username = 2; + string real_name = 3; + string avatar = 4; + string role_key = 5; + string role_name = 6; +} + +message ChangePasswordReq { + string user_id = 1; + string old_password = 2; + string new_password = 3; +} + +// ==================== User ==================== + +message UserInfo { + string user_id = 1; + string username = 2; + string real_name = 3; + string phone = 4; + string email = 5; + string avatar = 6; + int64 status = 7; + string role_id = 8; + string role_name = 9; + string last_login_time = 10; + string created_at = 11; + string updated_at = 12; +} + +message CreateUserReq { + string username = 1; + string password = 2; + string real_name = 3; + string phone = 4; + string email = 5; + string role_id = 6; +} + +message UpdateUserReq { + string user_id = 1; + string real_name = 2; + string phone = 3; + string email = 4; + string role_id = 5; + string avatar = 6; +} + +message DeleteUserReq { + string user_id = 1; +} + +message GetUserReq { + string user_id = 1; +} + +message ListUserReq { + int64 page = 1; + int64 page_size = 2; + string username = 3; + string real_name = 4; + string phone = 5; + int64 status = 6; +} + +message ListUserResp { + int64 total = 1; + repeated UserInfo list = 2; +} + +message UpdateUserStatusReq { + string user_id = 1; + int64 status = 2; +} + +// ==================== Role ==================== + +message RoleInfo { + string role_id = 1; + string role_name = 2; + string role_key = 3; + string role_desc = 4; + int64 sort_order = 5; + int64 status = 6; + repeated string menu_ids = 7; + string created_at = 8; + string updated_at = 9; +} + +message CreateRoleReq { + string role_name = 1; + string role_key = 2; + string role_desc = 3; + int64 sort_order = 4; +} + +message UpdateRoleReq { + string role_id = 1; + string role_name = 2; + string role_key = 3; + string role_desc = 4; + int64 sort_order = 5; +} + +message DeleteRoleReq { + string role_id = 1; +} + +message GetRoleReq { + string role_id = 1; +} + +message ListRoleReq { + int64 page = 1; + int64 page_size = 2; + string role_name = 3; + int64 status = 4; +} + +message ListRoleResp { + int64 total = 1; + repeated RoleInfo list = 2; +} + +message SetRolePermissionsReq { + string role_id = 1; + repeated string menu_ids = 2; +} + +// ==================== Menu ==================== + +message MenuInfo { + string menu_id = 1; + string parent_id = 2; + string menu_name = 3; + int64 menu_type = 4; + string path = 5; + string component = 6; + string permission = 7; + string icon = 8; + int64 sort_order = 9; + int64 visible = 10; + int64 status = 11; + repeated MenuInfo children = 12; + string created_at = 13; + string updated_at = 14; +} + +message CreateMenuReq { + string parent_id = 1; + string menu_name = 2; + int64 menu_type = 3; + string path = 4; + string component = 5; + string permission = 6; + string icon = 7; + int64 sort_order = 8; +} + +message UpdateMenuReq { + string menu_id = 1; + string parent_id = 2; + string menu_name = 3; + int64 menu_type = 4; + string path = 5; + string component = 6; + string permission = 7; + string icon = 8; + int64 sort_order = 9; + int64 visible = 10; +} + +message DeleteMenuReq { + string menu_id = 1; +} + +message GetMenuReq { + string menu_id = 1; +} + +message ListMenuReq {} + +message ListMenuResp { + repeated MenuInfo list = 1; +} + +// ==================== Operation Log ==================== + +message OperationLogInfo { + string log_id = 1; + string user_id = 2; + string username = 3; + string module = 4; + string operation = 5; + string method = 6; + string path = 7; + string ip = 8; + int64 duration = 9; + int64 status = 10; + string created_at = 11; +} + +message CreateLogReq { + string user_id = 1; + string username = 2; + string module = 3; + string operation = 4; + string method = 5; + string path = 6; + string request_body = 7; + string response_body = 8; + string ip = 9; + string user_agent = 10; + int64 duration = 11; + int64 status = 12; +} + +message ListLogReq { + int64 page = 1; + int64 page_size = 2; + string username = 3; + string module = 4; + string operation = 5; + string start_time = 6; + string end_time = 7; +} + +message ListLogResp { + int64 total = 1; + repeated OperationLogInfo list = 2; +} + +// ==================== Config ==================== + +message ConfigInfo { + string config_id = 1; + string config_key = 2; + string config_value = 3; + string config_name = 4; + string config_group = 5; + string remark = 6; + string updated_at = 7; +} + +message ListConfigReq { + string config_group = 1; +} + +message ListConfigResp { + repeated ConfigInfo list = 1; +} + +message UpdateConfigReq { + string config_key = 1; + string config_value = 2; +} + +// ==================== Common ==================== + +message IdResp { + string id = 1; +} + +message Empty {} + +// ==================== Service ==================== + +service SystemService { + // Auth + rpc Login(LoginReq) returns (LoginResp); + rpc ChangePassword(ChangePasswordReq) returns (Empty); + + // User + rpc CreateUser(CreateUserReq) returns (IdResp); + rpc UpdateUser(UpdateUserReq) returns (Empty); + rpc DeleteUser(DeleteUserReq) returns (Empty); + rpc GetUser(GetUserReq) returns (UserInfo); + rpc ListUser(ListUserReq) returns (ListUserResp); + rpc UpdateUserStatus(UpdateUserStatusReq) returns (Empty); + + // Role + rpc CreateRole(CreateRoleReq) returns (IdResp); + rpc UpdateRole(UpdateRoleReq) returns (Empty); + rpc DeleteRole(DeleteRoleReq) returns (Empty); + rpc GetRole(GetRoleReq) returns (RoleInfo); + rpc ListRole(ListRoleReq) returns (ListRoleResp); + rpc SetRolePermissions(SetRolePermissionsReq) returns (Empty); + + // Menu + rpc CreateMenu(CreateMenuReq) returns (IdResp); + rpc UpdateMenu(UpdateMenuReq) returns (Empty); + rpc DeleteMenu(DeleteMenuReq) returns (Empty); + rpc GetMenu(GetMenuReq) returns (MenuInfo); + rpc ListMenu(ListMenuReq) returns (ListMenuResp); + + // Operation Log + rpc CreateOperationLog(CreateLogReq) returns (Empty); + rpc ListOperationLog(ListLogReq) returns (ListLogResp); + + // Config + rpc ListConfig(ListConfigReq) returns (ListConfigResp); + rpc UpdateConfig(UpdateConfigReq) returns (Empty); +} diff --git a/rpc/system/systemservice/systemservice.go b/rpc/system/systemservice/systemservice.go new file mode 100644 index 0000000..ead5466 --- /dev/null +++ b/rpc/system/systemservice/systemservice.go @@ -0,0 +1,216 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.9.2 +// Source: system.proto + +package systemservice + +import ( + "context" + + "muyu-apiserver/rpc/system/pb" + + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" +) + +type ( + ChangePasswordReq = pb.ChangePasswordReq + ConfigInfo = pb.ConfigInfo + CreateLogReq = pb.CreateLogReq + CreateMenuReq = pb.CreateMenuReq + CreateRoleReq = pb.CreateRoleReq + CreateUserReq = pb.CreateUserReq + DeleteMenuReq = pb.DeleteMenuReq + DeleteRoleReq = pb.DeleteRoleReq + DeleteUserReq = pb.DeleteUserReq + Empty = pb.Empty + GetMenuReq = pb.GetMenuReq + GetRoleReq = pb.GetRoleReq + GetUserReq = pb.GetUserReq + IdResp = pb.IdResp + ListConfigReq = pb.ListConfigReq + ListConfigResp = pb.ListConfigResp + ListLogReq = pb.ListLogReq + ListLogResp = pb.ListLogResp + ListMenuReq = pb.ListMenuReq + ListMenuResp = pb.ListMenuResp + ListRoleReq = pb.ListRoleReq + ListRoleResp = pb.ListRoleResp + ListUserReq = pb.ListUserReq + ListUserResp = pb.ListUserResp + LoginReq = pb.LoginReq + LoginResp = pb.LoginResp + MenuInfo = pb.MenuInfo + OperationLogInfo = pb.OperationLogInfo + RoleInfo = pb.RoleInfo + SetRolePermissionsReq = pb.SetRolePermissionsReq + UpdateConfigReq = pb.UpdateConfigReq + UpdateMenuReq = pb.UpdateMenuReq + UpdateRoleReq = pb.UpdateRoleReq + UpdateUserReq = pb.UpdateUserReq + UpdateUserStatusReq = pb.UpdateUserStatusReq + UserInfo = pb.UserInfo + + SystemService interface { + // Auth + Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error) + ChangePassword(ctx context.Context, in *ChangePasswordReq, opts ...grpc.CallOption) (*Empty, error) + // User + CreateUser(ctx context.Context, in *CreateUserReq, opts ...grpc.CallOption) (*IdResp, error) + UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*Empty, error) + DeleteUser(ctx context.Context, in *DeleteUserReq, opts ...grpc.CallOption) (*Empty, error) + GetUser(ctx context.Context, in *GetUserReq, opts ...grpc.CallOption) (*UserInfo, error) + ListUser(ctx context.Context, in *ListUserReq, opts ...grpc.CallOption) (*ListUserResp, error) + UpdateUserStatus(ctx context.Context, in *UpdateUserStatusReq, opts ...grpc.CallOption) (*Empty, error) + // Role + CreateRole(ctx context.Context, in *CreateRoleReq, opts ...grpc.CallOption) (*IdResp, error) + UpdateRole(ctx context.Context, in *UpdateRoleReq, opts ...grpc.CallOption) (*Empty, error) + DeleteRole(ctx context.Context, in *DeleteRoleReq, opts ...grpc.CallOption) (*Empty, error) + GetRole(ctx context.Context, in *GetRoleReq, opts ...grpc.CallOption) (*RoleInfo, error) + ListRole(ctx context.Context, in *ListRoleReq, opts ...grpc.CallOption) (*ListRoleResp, error) + SetRolePermissions(ctx context.Context, in *SetRolePermissionsReq, opts ...grpc.CallOption) (*Empty, error) + // Menu + CreateMenu(ctx context.Context, in *CreateMenuReq, opts ...grpc.CallOption) (*IdResp, error) + UpdateMenu(ctx context.Context, in *UpdateMenuReq, opts ...grpc.CallOption) (*Empty, error) + DeleteMenu(ctx context.Context, in *DeleteMenuReq, opts ...grpc.CallOption) (*Empty, error) + GetMenu(ctx context.Context, in *GetMenuReq, opts ...grpc.CallOption) (*MenuInfo, error) + ListMenu(ctx context.Context, in *ListMenuReq, opts ...grpc.CallOption) (*ListMenuResp, error) + // Operation Log + CreateOperationLog(ctx context.Context, in *CreateLogReq, opts ...grpc.CallOption) (*Empty, error) + ListOperationLog(ctx context.Context, in *ListLogReq, opts ...grpc.CallOption) (*ListLogResp, error) + // Config + ListConfig(ctx context.Context, in *ListConfigReq, opts ...grpc.CallOption) (*ListConfigResp, error) + UpdateConfig(ctx context.Context, in *UpdateConfigReq, opts ...grpc.CallOption) (*Empty, error) + } + + defaultSystemService struct { + cli zrpc.Client + } +) + +func NewSystemService(cli zrpc.Client) SystemService { + return &defaultSystemService{ + cli: cli, + } +} + +// Auth +func (m *defaultSystemService) Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.Login(ctx, in, opts...) +} + +func (m *defaultSystemService) ChangePassword(ctx context.Context, in *ChangePasswordReq, opts ...grpc.CallOption) (*Empty, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.ChangePassword(ctx, in, opts...) +} + +// User +func (m *defaultSystemService) CreateUser(ctx context.Context, in *CreateUserReq, opts ...grpc.CallOption) (*IdResp, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.CreateUser(ctx, in, opts...) +} + +func (m *defaultSystemService) UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*Empty, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.UpdateUser(ctx, in, opts...) +} + +func (m *defaultSystemService) DeleteUser(ctx context.Context, in *DeleteUserReq, opts ...grpc.CallOption) (*Empty, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.DeleteUser(ctx, in, opts...) +} + +func (m *defaultSystemService) GetUser(ctx context.Context, in *GetUserReq, opts ...grpc.CallOption) (*UserInfo, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.GetUser(ctx, in, opts...) +} + +func (m *defaultSystemService) ListUser(ctx context.Context, in *ListUserReq, opts ...grpc.CallOption) (*ListUserResp, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.ListUser(ctx, in, opts...) +} + +func (m *defaultSystemService) UpdateUserStatus(ctx context.Context, in *UpdateUserStatusReq, opts ...grpc.CallOption) (*Empty, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.UpdateUserStatus(ctx, in, opts...) +} + +// Role +func (m *defaultSystemService) CreateRole(ctx context.Context, in *CreateRoleReq, opts ...grpc.CallOption) (*IdResp, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.CreateRole(ctx, in, opts...) +} + +func (m *defaultSystemService) UpdateRole(ctx context.Context, in *UpdateRoleReq, opts ...grpc.CallOption) (*Empty, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.UpdateRole(ctx, in, opts...) +} + +func (m *defaultSystemService) DeleteRole(ctx context.Context, in *DeleteRoleReq, opts ...grpc.CallOption) (*Empty, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.DeleteRole(ctx, in, opts...) +} + +func (m *defaultSystemService) GetRole(ctx context.Context, in *GetRoleReq, opts ...grpc.CallOption) (*RoleInfo, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.GetRole(ctx, in, opts...) +} + +func (m *defaultSystemService) ListRole(ctx context.Context, in *ListRoleReq, opts ...grpc.CallOption) (*ListRoleResp, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.ListRole(ctx, in, opts...) +} + +func (m *defaultSystemService) SetRolePermissions(ctx context.Context, in *SetRolePermissionsReq, opts ...grpc.CallOption) (*Empty, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.SetRolePermissions(ctx, in, opts...) +} + +// Menu +func (m *defaultSystemService) CreateMenu(ctx context.Context, in *CreateMenuReq, opts ...grpc.CallOption) (*IdResp, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.CreateMenu(ctx, in, opts...) +} + +func (m *defaultSystemService) UpdateMenu(ctx context.Context, in *UpdateMenuReq, opts ...grpc.CallOption) (*Empty, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.UpdateMenu(ctx, in, opts...) +} + +func (m *defaultSystemService) DeleteMenu(ctx context.Context, in *DeleteMenuReq, opts ...grpc.CallOption) (*Empty, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.DeleteMenu(ctx, in, opts...) +} + +func (m *defaultSystemService) GetMenu(ctx context.Context, in *GetMenuReq, opts ...grpc.CallOption) (*MenuInfo, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.GetMenu(ctx, in, opts...) +} + +func (m *defaultSystemService) ListMenu(ctx context.Context, in *ListMenuReq, opts ...grpc.CallOption) (*ListMenuResp, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.ListMenu(ctx, in, opts...) +} + +// Operation Log +func (m *defaultSystemService) CreateOperationLog(ctx context.Context, in *CreateLogReq, opts ...grpc.CallOption) (*Empty, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.CreateOperationLog(ctx, in, opts...) +} + +func (m *defaultSystemService) ListOperationLog(ctx context.Context, in *ListLogReq, opts ...grpc.CallOption) (*ListLogResp, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.ListOperationLog(ctx, in, opts...) +} + +// Config +func (m *defaultSystemService) ListConfig(ctx context.Context, in *ListConfigReq, opts ...grpc.CallOption) (*ListConfigResp, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.ListConfig(ctx, in, opts...) +} + +func (m *defaultSystemService) UpdateConfig(ctx context.Context, in *UpdateConfigReq, opts ...grpc.CallOption) (*Empty, error) { + client := pb.NewSystemServiceClient(m.cli.Conn()) + return client.UpdateConfig(ctx, in, opts...) +}