作者 yangfu

模型初始化

正在显示 71 个修改的文件 包含 4770 行增加0 行删除

要显示太多修改。

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

  1 +# Compiled Object codefiles, Static and Dynamic libs (Shared Objects)
  2 +*.o
  3 +*.a
  4 +*.so
  5 +
  6 +# Folders
  7 +_obj
  8 +_test
  9 +
  10 +# Architecture specific extensions/prefixes
  11 +*.[568vq]
  12 +[568vq].out
  13 +
  14 +*.cgo1.go
  15 +*.cgo2.c
  16 +_cgo_defun.c
  17 +_cgo_gotypes.go
  18 +_cgo_export.*
  19 +
  20 +_testmain.go
  21 +
  22 +*.exe
  23 +*.test
  24 +.log
  25 +.idea
  26 +
  27 +
  28 +swagger.json
  29 +swagger.yaml
  30 +*.log
  1 +FROM 192.168.0.243:5000/mmm/allied-creation-manufacture:20210809
  2 +ENV APP_DIR $GOPATH/src/project-20211220
  3 +RUN mkdir -p $APP_DIR
  4 +WORKDIR $APP_DIR/
  5 +COPY ./pkg pkg
  6 +COPY ./config config
  7 +COPY ./go.mod go.mod
  8 +COPY ./go.sum go.sum
  9 +COPY ./main.go main.go
  10 +RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"]
  11 +ENV GO111MODULE on
  12 +ENV GOPROXY https://goproxy.cn
  13 +RUN ["go","mod","tidy"]
  14 +RUN ["go","build"]
  15 +RUN ["ls"]
  16 +ENTRYPOINT ["./allied-creation-manufacture"]
  1 +#project
  1 +-----BEGIN RSA PRIVATE KEY-----
  2 +MIIEpQIBAAKCAQEAy0OxRf+NheQG9epxbrudwnrzqVgqK5zCuRAkLUgaSMATVXEA
  3 +iDzJN39om+Q49MmtEk4pXGzKUyzkFJG96PA8tJq0E+bSDtSK3n+2mjZb6pChmgHw
  4 +KEX7T8ZVLqJBSrfrI4Z2BJDNEC+3wvVW3zpog1RlfKgft6NYUzNLUqE5Mxzq7lpD
  5 +eRsq+FhzM1sOeEb2dAmUlDDs+7HcR3Kj0ttKeg+hKqIottQ/H6Tq4c8deEQGnO0+
  6 +RN3CygyETbYmLuWttI/sUltulWJALIuU81Yr6uCOq5MSt2WsU8CTuhRwGXSvcQCO
  7 +FLYppYktoMDOGIBQffmJc/DdT1d35fvdpKbm+QIDAQABAoIBAQC8X7+qX2uI6gqJ
  8 +XPxC4x0RX2DxUAPE50KOv6bHUEsLoPZJ+K/Fko/oHuuTja47Lax3inhKb4gSDUhS
  9 +x754YivgNH8u8ns5wz/vc+yGflowyFj7oVAwAqslA2luDnD0Df6crcAx+wAQQCjN
  10 +RRF9T2QMUeq73BOI3Ji+gosLyN55vms2KadrwpPQwYN7qhdrerE7vPqCZeswzs1/
  11 +A5M9PVGBG+simNea5kv+tVJUdLi6ckGAB5KabyhpG779ckwzV/aZy3wIj4SvUvCd
  12 +bewH0xPHx5TqnMOXtzHgktClmL7hIYxy9sL14Dn0KVHbyolQ7IqmJtjXYqG84Fmx
  13 +AfyDfeABAoGBAPP820tKElrfTuZ+Z19kJBTp6I5iax2Ph10glUHLlLqJ82clI/Gl
  14 +CbMtnGmD72HfnJei82xqoVLsUkN9Sp+TSNJALh4N8rHkAtwq5kWToiAWZydwxVsp
  15 +x5OWEN3+QFIdjVW6fhg6jZSK5HHIqMdZOVvbfKP+Cv9fWWzlS7/WVTlJAoGBANVF
  16 +kol+KojM4DEASrw0s1mfPr0XvUFvKJ2TgVGR3HxAk4r0e0WwJdSfwGiB/ePcc6g5
  17 +D5dxBe8W5g3+V0DaC0f1DDNXg2MjYWoByWrurbm14FRnpMnx/UfZLo7rq8T9YrUT
  18 +Bd/y0/JasndN27bIfd60n233IYMqhV2+wBwqD3AxAoGAE2/wdHYJMk4Z9gjZ6WKL
  19 +8VKVIUq759X4XbXrzhsO1TGKP4xY6bZRKIIYtNs65dwvmHD13Yw9H+MNxqyjlkTg
  20 +h0dvpRtNW1ij1bBhOefCAbZnL2AviMyyRpKs81J/A0uxZ8P8qad4gf3ypxHqSD9W
  21 +b3fz3QivDZsl/6Pgvf6wOWkCgYEA1Cv9x5lj2WrxEu62axyG3P9nHBm055cdsf5g
  22 +JfVVg6t+3TuyM7c1O52efpnsKrdTvKTf1QrVG3INdxh0V4lUtcac16sVhBhbvml+
  23 +p0pCPMIrJe1ibKG5F7SB9B+TaEuo2nnNW2mp367JY5VqoyI8zsWk4nJ8vZAc1BGD
  24 +78EMUNECgYEAtV0pta3GuHKOLX1HMRsUsYuWjLqAbahnciF6MnjNWSonEK3VjMhI
  25 +g+krP/9sWoC3cFOG+4s96ubjDTWImvQvCrPaENdvlNwgp035bn51eFRv00QchM2H
  26 +VCS9Nhoqj5BIHl1G7Q13+tYTzjUWtteG902nWDVhgSlNLJf1rbTn34g=
  27 +-----END RSA PRIVATE KEY-----
  1 +-----BEGIN CERTIFICATE-----
  2 +MIIGazCCBVOgAwIBAgIQZBwijHoFToh2kjGwQ1E6bjANBgkqhkiG9w0BAQsFADBc
  3 +MQswCQYDVQQGEwJDTjEaMBgGA1UEChMRV29UcnVzIENBIExpbWl0ZWQxMTAvBgNV
  4 +BAMMKFdvVHJ1cyBPViBTZXJ2ZXIgQ0EgIFtSdW4gYnkgdGhlIElzc3Vlcl0wHhcN
  5 +MjEwMjA0MDAwMDAwWhcNMjIwMzA2MjM1OTU5WjCB0TELMAkGA1UEBhMCQ04xDzAN
  6 +BgNVBBETBjM1MDAxNTESMBAGA1UEBwwJ56aP5bee5biCMU8wTQYDVQQJDEbpqazl
  7 +sL7ljLrmuZbph4zot68yN+WPtzEj5qW85LqU5qW8NTEw44CBNTEx5a6k77yI6Ieq
  8 +6LS46K+V6aqM5Yy65YaF77yJMTAwLgYDVQQKDCfnpo/lu7rkubDkubDkubDkv6Hm
  9 +ga/np5HmioDmnInpmZDlhazlj7gxGjAYBgNVBAMMESouZmptYWltYWltYWkuY29t
  10 +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0OxRf+NheQG9epxbrud
  11 +wnrzqVgqK5zCuRAkLUgaSMATVXEAiDzJN39om+Q49MmtEk4pXGzKUyzkFJG96PA8
  12 +tJq0E+bSDtSK3n+2mjZb6pChmgHwKEX7T8ZVLqJBSrfrI4Z2BJDNEC+3wvVW3zpo
  13 +g1RlfKgft6NYUzNLUqE5Mxzq7lpDeRsq+FhzM1sOeEb2dAmUlDDs+7HcR3Kj0ttK
  14 +eg+hKqIottQ/H6Tq4c8deEQGnO0+RN3CygyETbYmLuWttI/sUltulWJALIuU81Yr
  15 +6uCOq5MSt2WsU8CTuhRwGXSvcQCOFLYppYktoMDOGIBQffmJc/DdT1d35fvdpKbm
  16 ++QIDAQABo4ICsTCCAq0wHwYDVR0jBBgwFoAUDUmPFTN7wE+2+zo4Cfw0Fdpg3RQw
  17 +HQYDVR0OBBYEFMGZEgzwtp+UhpTAS9nmSxlo9tIlMA4GA1UdDwEB/wQEAwIFoDAM
  18 +BgNVHRMBAf8EAjAAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjBJBgNV
  19 +HSAEQjBAMDQGCysGAQQBsjEBAgIWMCUwIwYIKwYBBQUHAgEWF2h0dHBzOi8vc2Vj
  20 +dGlnby5jb20vQ1BTMAgGBmeBDAECAjA9BgNVHR8ENjA0MDKgMKAuhixodHRwOi8v
  21 +Y3JsLmNybG9jc3AuY24vV29UcnVzT1ZTZXJ2ZXJDQV8yLmNybDBsBggrBgEFBQcB
  22 +AQRgMF4wOAYIKwYBBQUHMAKGLGh0dHA6Ly9haWEuY3Jsb2NzcC5jbi9Xb1RydXNP
  23 +VlNlcnZlckNBXzIuY3J0MCIGCCsGAQUFBzABhhZodHRwOi8vb2NzcC5jcmxvY3Nw
  24 +LmNuMIIBBQYKKwYBBAHWeQIEAgSB9gSB8wDxAHcARqVV63X6kSAwtaKJafTzfREs
  25 +QXS+/Um4havy/HD+bUcAAAF3brV9qAAABAMASDBGAiEAjrXS+1JJW9jag/XfW+kY
  26 +oL4sGGDNvcZgV35E0EcGQVACIQCjQh8k5oSFtqo7Qrbx2k3OISjfPSYRXNNsG4Ba
  27 +MyDmRwB2AN+lXqtogk8fbK3uuF9OPlrqzaISpGpejjsSwCBEXCpzAAABd261fdAA
  28 +AAQDAEcwRQIgcPQQJ3rkCFaQPKwT3rtfQkr0taPzw0KW7yqu+MtmBH0CIQChKeMk
  29 +v7Xs0z7J47lM6HTPOU+xXL2riC69LC1KCOS6GTAtBgNVHREEJjAkghEqLmZqbWFp
  30 +bWFpbWFpLmNvbYIPZmptYWltYWltYWkuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQBn
  31 ++jDy7sZS0gZzwMR4hnZHWqFYcJR3wnk77xr+5Yu2ifhlxaLHE3rEY3xTR9LsPwfW
  32 +pdg2McinPCI6vs009NYIpeTiHzVDPzKu2BaUfKj+EHLwZQGfXkNhp3cpqZMiTkr/
  33 +YNqf25GXsBa+spwzyHh9MBXXCfWRfdHX7JlH5zyoLNztTp8unxaRYldjghHDA3Q7
  34 +8Fyz6OncY3I4U4KKBSq2/TTxveDW6NxTTuJTPOg3/qSIkwdOBLuIzuhxmF4D9wpl
  35 +LMHmne2CilVeg73/GAzQt/w7FzmdvaHPAOVYWzdaTNALiXJxbi7EyO8q/uNK0GqY
  36 +hljMsnA1hApG+/2sOP/P
  37 +-----END CERTIFICATE-----
  38 +-----BEGIN CERTIFICATE-----
  39 +MIIF4TCCA8mgAwIBAgIQHQgpVDhMv3SvabmRFpvwLTANBgkqhkiG9w0BAQwFADCB
  40 +iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl
  41 +cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV
  42 +BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMjAw
  43 +MTA4MDAwMDAwWhcNMzAwMTA3MjM1OTU5WjBcMQswCQYDVQQGEwJDTjEaMBgGA1UE
  44 +ChMRV29UcnVzIENBIExpbWl0ZWQxMTAvBgNVBAMMKFdvVHJ1cyBPViBTZXJ2ZXIg
  45 +Q0EgIFtSdW4gYnkgdGhlIElzc3Vlcl0wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  46 +ggEKAoIBAQCARFLq6kqQRZ4SdFMPdd3XJTcOdVVT5bvZZx0VVDrkw3TmSAloQVFf
  47 +RhqDOSXg4CsIaa64qFSrC3a5sc8LgRhx7AUdvoUdfvdxIY1uoyxRWpoWO8oTUkSn
  48 +EXjEPf+zrcU5cWTOi32xWL9vklYds7iOQwgsKAHDzt4an8MLGvcLxAHciyiKcDEh
  49 +HZOGUHO5bKaCq+kP2rJCfVSlNvdyl1B8q+aGWXoi0gXGVL7WX4pcWj+DGuITbLB2
  50 +MzMytse4MjLJ84zaXh0UD4STlyD8tu/fakdxIwQ7K3/pP3RoGj1R9CvMWXUU+fZm
  51 +KNLW5565hd9Bh3Wkz8b4ApgMD9o3RUjTAgMBAAGjggFwMIIBbDAfBgNVHSMEGDAW
  52 +gBRTeb9aqitKz1SA4dibwJ3ysgNmyzAdBgNVHQ4EFgQUDUmPFTN7wE+2+zo4Cfw0
  53 +Fdpg3RQwDgYDVR0PAQH/BAQDAgGGMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0l
  54 +BBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMCIGA1UdIAQbMBkwDQYLKwYBBAGyMQEC
  55 +AhYwCAYGZ4EMAQICMFAGA1UdHwRJMEcwRaBDoEGGP2h0dHA6Ly9jcmwudXNlcnRy
  56 +dXN0LmNvbS9VU0VSVHJ1c3RSU0FDZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDBx
  57 +BggrBgEFBQcBAQRlMGMwOgYIKwYBBQUHMAKGLmh0dHA6Ly9jcnQudXNlcnRydXN0
  58 +LmNvbS9VU0VSVHJ1c3RSU0FBQUFDQS5jcnQwJQYIKwYBBQUHMAGGGWh0dHA6Ly9v
  59 +Y3NwLnVzZXJ0cnVzdC5jb20wDQYJKoZIhvcNAQEMBQADggIBAA5G7XA+fNKyj7Fy
  60 +uotoII38/32eZ4UrC1vGFPEtDyd0yzOrr7SvQUoO2GLxFzIQ0SsgMNXJ4UAhMkTD
  61 +yz1OA0tx0g0GjOQXBGA/yfRR7SgitRJAdbqkPfppMn+dtKXCHHx35ohTL0PklRdb
  62 +mXacvR7rXUIiJMdsvZZqYwc+DpGJ+Zv0sRJZEL7pm1oZv6EV+UzjAlOnLe6yrnyD
  63 +c99Kk1H/RFPUzduUWjiVR2aMDT1oMiwYeB2Zq60Sb201jqZPNQj5E+TkDD5BPFVc
  64 +kLeRi3LyXBUuBvXPsdLtBNlr+LExtCDd66kjeUe2/YbTHF4ai5PZPraQxgbOJJyc
  65 +gizGl/JOgrIQPUOLSQvXlxpKEqS+0z6KqV52bco2PNrC0f8ILKuw0nsfhgcGy46d
  66 +Su8fmU9+FT6e61i2nteKvt8qkkSkAJKQxRUWYduN24mG/OOIkoeOPdYHi+qEfbyI
  67 +qxiiqcH9cZgLK9AVuJoKtt7vg21OyrWi7S5T/WbTfTz9XL7QGe8ZODZZx6d50uo/
  68 +lDOmXm3p/kdGApvUF1UrL+og22jBLi0Ns6xzCfzrI3SpC9abvU8E9EnxQABuu/gM
  69 +/B63dbaZzSsMVFxeECD9nMWv7IH+/rqyGmjqEJzgKdPGvXhqpebQ1HhWrV+j+ipc
  70 +jplXB1j3GCozDFsninXG102N6wC8
  71 +-----END CERTIFICATE-----
  72 +-----BEGIN CERTIFICATE-----
  73 +MIIFgTCCBGmgAwIBAgIQOXJEOvkit1HX02wQ3TE1lTANBgkqhkiG9w0BAQwFADB7
  74 +MQswCQYDVQQGEwJHQjEbMBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYD
  75 +VQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UE
  76 +AwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTE5MDMxMjAwMDAwMFoXDTI4
  77 +MTIzMTIzNTk1OVowgYgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpOZXcgSmVyc2V5
  78 +MRQwEgYDVQQHEwtKZXJzZXkgQ2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBO
  79 +ZXR3b3JrMS4wLAYDVQQDEyVVU0VSVHJ1c3QgUlNBIENlcnRpZmljYXRpb24gQXV0
  80 +aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAgBJlFzYOw9sI
  81 +s9CsVw127c0n00ytUINh4qogTQktZAnczomfzD2p7PbPwdzx07HWezcoEStH2jnG
  82 +vDoZtF+mvX2do2NCtnbyqTsrkfjib9DsFiCQCT7i6HTJGLSR1GJk23+jBvGIGGqQ
  83 +Ijy8/hPwhxR79uQfjtTkUcYRZ0YIUcuGFFQ/vDP+fmyc/xadGL1RjjWmp2bIcmfb
  84 +IWax1Jt4A8BQOujM8Ny8nkz+rwWWNR9XWrf/zvk9tyy29lTdyOcSOk2uTIq3XJq0
  85 +tyA9yn8iNK5+O2hmAUTnAU5GU5szYPeUvlM3kHND8zLDU+/bqv50TmnHa4xgk97E
  86 +xwzf4TKuzJM7UXiVZ4vuPVb+DNBpDxsP8yUmazNt925H+nND5X4OpWaxKXwyhGNV
  87 +icQNwZNUMBkTrNN9N6frXTpsNVzbQdcS2qlJC9/YgIoJk2KOtWbPJYjNhLixP6Q5
  88 +D9kCnusSTJV882sFqV4Wg8y4Z+LoE53MW4LTTLPtW//e5XOsIzstAL81VXQJSdhJ
  89 +WBp/kjbmUZIO8yZ9HE0XvMnsQybQv0FfQKlERPSZ51eHnlAfV1SoPv10Yy+xUGUJ
  90 +5lhCLkMaTLTwJUdZ+gQek9QmRkpQgbLevni3/GcV4clXhB4PY9bpYrrWX1Uu6lzG
  91 +KAgEJTm4Diup8kyXHAc/DVL17e8vgg8CAwEAAaOB8jCB7zAfBgNVHSMEGDAWgBSg
  92 +EQojPpbxB+zirynvgqV/0DCktDAdBgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rID
  93 +ZsswDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wEQYDVR0gBAowCDAG
  94 +BgRVHSAAMEMGA1UdHwQ8MDowOKA2oDSGMmh0dHA6Ly9jcmwuY29tb2RvY2EuY29t
  95 +L0FBQUNlcnRpZmljYXRlU2VydmljZXMuY3JsMDQGCCsGAQUFBwEBBCgwJjAkBggr
  96 +BgEFBQcwAYYYaHR0cDovL29jc3AuY29tb2RvY2EuY29tMA0GCSqGSIb3DQEBDAUA
  97 +A4IBAQAYh1HcdCE9nIrgJ7cz0C7M7PDmy14R3iJvm3WOnnL+5Nb+qh+cli3vA0p+
  98 +rvSNb3I8QzvAP+u431yqqcau8vzY7qN7Q/aGNnwU4M309z/+3ri0ivCRlv79Q2R+
  99 +/czSAaF9ffgZGclCKxO/WIu6pKJmBHaIkU4MiRTOok3JMrO66BQavHHxW/BBC5gA
  100 +CiIDEOUMsfnNkjcZ7Tvx5Dq2+UUTJnWvu6rvP3t3O9LEApE9GQDTF1w52z97GA1F
  101 +zZOFli9d31kWTz9RvdVFGD/tSo7oBmF0Ixa1DVBzJ0RHfxBdiSprhTEUxOipakyA
  102 +vGp4z7h/jnZymQyd/teRCBaho1+V
  103 +-----END CERTIFICATE-----
  1 +#!/bin/bash
  2 +export PATH=/root/local/bin:$PATH
  3 +kubectl -n <replace-your-k8s-namespace> get pods | grep -q project
  4 +if [ "$?" == "1" ];then
  5 + kubectl create -f /tmp/dev/project/project.yaml --record
  6 + kubectl -n <replace-your-k8s-namespace> get svc | grep -q project
  7 + if [ "$?" == "0" ];then
  8 + echo "project service install success!"
  9 + else
  10 + echo "project service install fail!"
  11 + fi
  12 + kubectl -n <replace-your-k8s-namespace> get pods | grep -q project
  13 + if [ "$?" == "0" ];then
  14 + echo "project deployment install success!"
  15 + else
  16 + echo "project deployment install fail!"
  17 + fi
  18 +else
  19 + kubectl delete -f /tmp/dev/project/project.yaml
  20 + kubectl -n <replace-your-k8s-namespace> get svc | grep -q project
  21 + while [ "$?" == "0" ]
  22 + do
  23 + kubectl -n <replace-your-k8s-namespace> get svc | grep -q project
  24 + done
  25 + kubectl -n <replace-your-k8s-namespace> get pods | grep -q project
  26 + while [ "$?" == "0" ]
  27 + do
  28 + kubectl -n <replace-your-k8s-namespace> get pods | grep -q project
  29 + done
  30 + kubectl create -f /tmp/dev/project/project.yaml --record
  31 + kubectl -n <replace-your-k8s-namespace> get svc | grep -q project
  32 + if [ "$?" == "0" ];then
  33 + echo "project service update success!"
  34 + else
  35 + echo "project service update fail!"
  36 + fi
  37 + kubectl -n <replace-your-k8s-namespace> get pods | grep -q project
  38 + if [ "$?" == "0" ];then
  39 + echo "project deployment update success!"
  40 + else
  41 + echo "project deployment update fail!"
  42 + fi
  43 +fi
  1 +apiVersion: v1
  2 +kind: Service
  3 +metadata:
  4 + name: project
  5 + namespace: <replace-your-k8s-namespace>
  6 + labels:
  7 + k8s-app: project
  8 +spec:
  9 + ports:
  10 + - name: "http"
  11 + port: 80
  12 + targetPort: 8082
  13 + selector:
  14 + k8s-app: project
  15 +---
  16 +apiVersion: extensions/v1beta1
  17 +kind: Deployment
  18 +metadata:
  19 + name: project
  20 + namespace: <replace-your-k8s-namespace>
  21 + labels:
  22 + k8s-app: project
  23 +spec:
  24 + replicas: 1
  25 + template:
  26 + metadata:
  27 + labels:
  28 + k8s-app: project
  29 + spec:
  30 + affinity:
  31 + nodeAffinity:
  32 + preferredDuringSchedulingIgnoredDuringExecution:
  33 + - preference: {}
  34 + weight: 100
  35 + requiredDuringSchedulingIgnoredDuringExecution:
  36 + nodeSelectorTerms:
  37 + - matchExpressions:
  38 + - key: kubernetes.io/hostname
  39 + operator: In
  40 + values:
  41 + - cn-hangzhou.i-bp1djh1xn7taumbue1ze
  42 + - cn-hangzhou.i-bp1djh1xn7taumbue1zd
  43 + - cn-hangzhou.i-bp1euf5u1ph9kbhtndhb
  44 + - cn-hangzhou.i-bp1hyp5oips9cdwxxgxy
  45 + containers:
  46 + - name: project
  47 + image: 192.168.0.243:5000/mmm/project:dev
  48 + imagePullPolicy: Always
  49 + ports:
  50 + - containerPort: 8082
  51 + volumeMounts:
  52 + - mountPath: /opt/logs
  53 + name: accesslogs
  54 + env:
  55 + - name: LOG_LEVEL
  56 + value: "debug"
  57 + - name: ERROR_BASE_CODE
  58 + value: "1"
  59 + - name: ERROR_BASE_CODE_MULTIPLE
  60 + value: "1000"
  61 + volumes:
  62 + - name: accesslogs
  63 + emptyDir: {}
  1 +module gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture
  2 +
  3 +go 1.16
  4 +
  5 +require (
  6 + github.com/beego/beego/v2 v2.0.1
  7 + github.com/go-pg/pg/v10 v10.9.0
  8 + github.com/klauspost/compress v1.11.8 // indirect
  9 + github.com/linmadan/egglib-go v0.0.0-20210313060205-8b5e456b11f7
  10 + github.com/onsi/ginkgo v1.15.2 // indirect
  11 + github.com/onsi/gomega v1.11.0 // indirect
  12 + golang.org/x/text v0.3.5 // indirect
  13 +)
  14 +
  15 +replace github.com/linmadan/egglib-go v0.0.0-20210313060205-8b5e456b11f7 => github.com/tiptok/egglib-go v0.0.0-20210608073225-c852ce95ae34
  1 +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
  2 +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
  3 +github.com/ClickHouse/clickhouse-go v1.4.3/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI=
  4 +github.com/DATA-DOG/go-sqlmock v1.4.1/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
  5 +github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
  6 +github.com/Shopify/sarama v1.25.0 h1:ch1ywjRLjfJtU+EaiJ+l0rWffQ6TRpyYmW4DX7Cb2SU=
  7 +github.com/Shopify/sarama v1.25.0/go.mod h1:y/CFFTO9eaMTNriwu/Q+W4eioLqiDMGkA1W+gmdfj8w=
  8 +github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWsokNbMijUGhmcoBJc=
  9 +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
  10 +github.com/StackExchange/wmi v0.0.0-20170410192909-ea383cf3ba6e/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
  11 +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
  12 +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
  13 +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
  14 +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
  15 +github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
  16 +github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk=
  17 +github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
  18 +github.com/beego/beego/v2 v2.0.1 h1:07a7Z0Ok5vbqyqh+q53sDPl9LdhKh0ZDy3gbyGrhFnE=
  19 +github.com/beego/beego/v2 v2.0.1/go.mod h1:8zyHi1FnWO1mZLwTn62aKRIZF/aIKvkCBB2JYs+eqQI=
  20 +github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ=
  21 +github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU=
  22 +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
  23 +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
  24 +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
  25 +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
  26 +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
  27 +github.com/bkaradzic/go-lz4 v1.0.0/go.mod h1:0YdlkowM3VswSROI7qDxhRvJ3sLhlFrRRwjwegp5jy4=
  28 +github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60=
  29 +github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE=
  30 +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
  31 +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
  32 +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
  33 +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
  34 +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
  35 +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
  36 +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
  37 +github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
  38 +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
  39 +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
  40 +github.com/coreos/etcd v3.3.25+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
  41 +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
  42 +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
  43 +github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
  44 +github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
  45 +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
  46 +github.com/couchbase/go-couchbase v0.0.0-20200519150804-63f3cdb75e0d/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U=
  47 +github.com/couchbase/gomemcached v0.0.0-20200526233749-ec430f949808/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c=
  48 +github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs=
  49 +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
  50 +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
  51 +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
  52 +github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY=
  53 +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
  54 +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
  55 +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
  56 +github.com/dchest/siphash v1.2.1/go.mod h1:q+IRvb2gOSrUnYoPqHiyHXS0FOBBOdl6tONBlVnOnt4=
  57 +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
  58 +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
  59 +github.com/eapache/go-resiliency v1.1.0 h1:1NtRmCAqadE2FN4ZcN6g90TP3uk8cg9rn9eNK2197aU=
  60 +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
  61 +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 h1:YEetp8/yCZMuEPMUDHG0CW/brkkEp8mzqk2+ODEitlw=
  62 +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
  63 +github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc=
  64 +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
  65 +github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
  66 +github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI=
  67 +github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk=
  68 +github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
  69 +github.com/emicklei/proto v1.9.0/go.mod h1:rn1FgRS/FANiZdD2djyH7TMA9jdRDcYQ9IEN9yvjX0A=
  70 +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
  71 +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
  72 +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
  73 +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
  74 +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
  75 +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
  76 +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
  77 +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
  78 +github.com/frankban/quicktest v1.4.1/go.mod h1:36zfPVQyHxymz4cH7wlDmVwDrJuljRB60qkgn7rorfQ=
  79 +github.com/frankban/quicktest v1.7.2 h1:2QxQoC1TS09S7fhCPsrvqYdvP1H5M1P1ih5ABm3BTYk=
  80 +github.com/frankban/quicktest v1.7.2/go.mod h1:jaStnuzAqU1AJdCO0l53JDCJrVDKcS03DbaAcR7Ks/o=
  81 +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
  82 +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
  83 +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
  84 +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
  85 +github.com/glendc/gopher-json v0.0.0-20170414221815-dc4743023d0c/go.mod h1:Gja1A+xZ9BoviGJNA2E9vFkPjjsl+CoJxSXiQM1UXtw=
  86 +github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
  87 +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
  88 +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
  89 +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
  90 +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
  91 +github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
  92 +github.com/go-pg/pg/v10 v10.7.7/go.mod h1:d0w17Xw5x2DtbD/UgB9rnZg3FAck3eDHXff0Srrzuuk=
  93 +github.com/go-pg/pg/v10 v10.9.0 h1:mNIxE7H7/5fHOniVrLgUXNoIgHiJXXvhiNY+PxqtV6k=
  94 +github.com/go-pg/pg/v10 v10.9.0/go.mod h1:rgmTPgHgl5EN2CNKKoMwC7QT62t8BqsdpEkUQuiZMQs=
  95 +github.com/go-pg/zerochecker v0.2.0 h1:pp7f72c3DobMWOb2ErtZsnrPaSvHd2W4o9//8HtF4mU=
  96 +github.com/go-pg/zerochecker v0.2.0/go.mod h1:NJZ4wKL0NmTtz0GKCoJ8kym6Xn/EQzXRl2OnAe7MmDo=
  97 +github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
  98 +github.com/go-redis/redis v6.15.7+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
  99 +github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg=
  100 +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
  101 +github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
  102 +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
  103 +github.com/go-xorm/builder v0.3.4/go.mod h1:KxkQkNN1DpPKTedxXyTQcmH+rXfvk4LZ9SOOBoZBAxw=
  104 +github.com/go-xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:56xuuqnHyryaerycW3BfssRdxQstACi0Epw/yC5E2xM=
  105 +github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
  106 +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
  107 +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
  108 +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
  109 +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
  110 +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
  111 +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
  112 +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
  113 +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
  114 +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
  115 +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
  116 +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
  117 +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
  118 +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
  119 +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
  120 +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
  121 +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
  122 +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
  123 +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
  124 +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
  125 +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
  126 +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
  127 +github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
  128 +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
  129 +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
  130 +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
  131 +github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
  132 +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
  133 +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
  134 +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
  135 +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
  136 +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
  137 +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
  138 +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
  139 +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
  140 +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
  141 +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
  142 +github.com/google/gops v0.3.7/go.mod h1:bj0cwMmX1X4XIJFTjR99R5sCxNssNJ8HebFNvoQlmgY=
  143 +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
  144 +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
  145 +github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
  146 +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
  147 +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
  148 +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
  149 +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
  150 +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
  151 +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
  152 +github.com/grpc-ecosystem/grpc-gateway v1.14.3/go.mod h1:6CwZWGDSPRJidgKAtJVvND6soZe6fT7iteq8wDPdhb0=
  153 +github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
  154 +github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE=
  155 +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
  156 +github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
  157 +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
  158 +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
  159 +github.com/iancoleman/strcase v0.1.2/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE=
  160 +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
  161 +github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03 h1:FUwcHNlEqkqLjLBdCp5PRlCFijNjvcYANOZXzCfXwCM=
  162 +github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o=
  163 +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
  164 +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
  165 +github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
  166 +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
  167 +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
  168 +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
  169 +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
  170 +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
  171 +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
  172 +github.com/justinas/alice v1.2.0/go.mod h1:fN5HRH/reO/zrUflLfTN43t3vXvKzvZIENsNEe7i7qA=
  173 +github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
  174 +github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
  175 +github.com/keybase/go-ps v0.0.0-20161005175911-668c8856d999/go.mod h1:hY+WOq6m2FpbvyrI93sMaypsttvaIL5nhVR92dTMUcQ=
  176 +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
  177 +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
  178 +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
  179 +github.com/klauspost/compress v1.9.7/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
  180 +github.com/klauspost/compress v1.11.8 h1:difgzQsp5mdAz9v8lm3P/I+EpDKMU/6uTMw1y1FObuo=
  181 +github.com/klauspost/compress v1.11.8/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
  182 +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
  183 +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
  184 +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
  185 +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
  186 +github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
  187 +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
  188 +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
  189 +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
  190 +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
  191 +github.com/ledisdb/ledisdb v0.0.0-20200510135210-d35789ec47e6/go.mod h1:n931TsDuKuq+uX4v1fulaMbA/7ZLLhjc85h7chZGBCQ=
  192 +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
  193 +github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
  194 +github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
  195 +github.com/magefile/mage v1.10.0 h1:3HiXzCUY12kh9bIuyXShaVe529fJfyqoVM42o/uom2g=
  196 +github.com/magefile/mage v1.10.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
  197 +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
  198 +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
  199 +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
  200 +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
  201 +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
  202 +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
  203 +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
  204 +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
  205 +github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
  206 +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
  207 +github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
  208 +github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
  209 +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
  210 +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
  211 +github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8=
  212 +github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
  213 +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
  214 +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
  215 +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
  216 +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
  217 +github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
  218 +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
  219 +github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
  220 +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
  221 +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
  222 +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
  223 +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
  224 +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
  225 +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
  226 +github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA=
  227 +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
  228 +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
  229 +github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
  230 +github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
  231 +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
  232 +github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
  233 +github.com/onsi/ginkgo v1.15.2 h1:l77YT15o814C2qVL47NOyjV/6RbaP7kKdrvZnxQ3Org=
  234 +github.com/onsi/ginkgo v1.15.2/go.mod h1:Dd6YFfwBW84ETqqtL0CPyPXillHgY6XhQH3uuCCTr/o=
  235 +github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
  236 +github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
  237 +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
  238 +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
  239 +github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc=
  240 +github.com/onsi/gomega v1.11.0 h1:+CqWgvj0OZycCaqclBD1pxKHAU+tOkHmQIWvDHq2aug=
  241 +github.com/onsi/gomega v1.11.0/go.mod h1:azGKhqFUon9Vuj0YmTfLSmx0FUwqXYSTl5re8lQLTUg=
  242 +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
  243 +github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
  244 +github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
  245 +github.com/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
  246 +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
  247 +github.com/pierrec/lz4 v2.2.6+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
  248 +github.com/pierrec/lz4 v2.5.1+incompatible h1:Yq0up0149Hh5Ekhm/91lgkZuD1ZDnXNM26bycpTzYBM=
  249 +github.com/pierrec/lz4 v2.5.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
  250 +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
  251 +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
  252 +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
  253 +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
  254 +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
  255 +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
  256 +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
  257 +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
  258 +github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
  259 +github.com/prometheus/client_golang v1.7.0 h1:wCi7urQOGBsYcQROHqpUUX4ct84xp40t9R9JX0FuA/U=
  260 +github.com/prometheus/client_golang v1.7.0/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
  261 +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
  262 +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
  263 +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
  264 +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
  265 +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
  266 +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
  267 +github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
  268 +github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc=
  269 +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
  270 +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
  271 +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
  272 +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
  273 +github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8=
  274 +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
  275 +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a h1:9ZKAASQSHhDYGoxY8uLVpewe1GDZ2vu2Tr/vTdVAkFQ=
  276 +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
  277 +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
  278 +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
  279 +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
  280 +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
  281 +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
  282 +github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo=
  283 +github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
  284 +github.com/shirou/gopsutil v0.0.0-20180427012116-c95755e4bcd7/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
  285 +github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc=
  286 +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
  287 +github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw=
  288 +github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s=
  289 +github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA=
  290 +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
  291 +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
  292 +github.com/sirupsen/logrus v1.8.0 h1:nfhvjKcUMhBMVqbKHJlk5RPrrfYr/NMo3692g0dwfWU=
  293 +github.com/sirupsen/logrus v1.8.0/go.mod h1:4GuYW9TZmE769R5STWrRakJc4UqQ3+QQ95fyz7ENv1A=
  294 +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
  295 +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
  296 +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
  297 +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
  298 +github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXctz3kmljlUCu/yB3GZ6oee+dUozsezQE=
  299 +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
  300 +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
  301 +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
  302 +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
  303 +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
  304 +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
  305 +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
  306 +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
  307 +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
  308 +github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
  309 +github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
  310 +github.com/tal-tech/go-zero v1.0.27/go.mod h1:JtNXlsh/CgeIHyQnt5C5M2IcSevW7V0NAnqO93TQgm8=
  311 +github.com/tiptok/egglib-go v0.0.0-20210608073225-c852ce95ae34 h1:9iDNyYbfpv5KLWDLpDywD/aIODg+PNnwn+v9on7KGlE=
  312 +github.com/tiptok/egglib-go v0.0.0-20210608073225-c852ce95ae34/go.mod h1:KT8WFA2LPo5zVKbomCR6HocO4prnIY9DUVGekA3Ifo4=
  313 +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
  314 +github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
  315 +github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
  316 +github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
  317 +github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
  318 +github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
  319 +github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
  320 +github.com/vmihailenco/bufpool v0.1.11 h1:gOq2WmBrq0i2yW5QJ16ykccQ4wH9UyEsgLm6czKAd94=
  321 +github.com/vmihailenco/bufpool v0.1.11/go.mod h1:AFf/MOy3l2CFTKbxwt0mp2MwnqjNEs5H/UxrkA5jxTQ=
  322 +github.com/vmihailenco/msgpack/v5 v5.2.0/go.mod h1:fEM7KuHcnm0GvDCztRpw9hV0PuoO2ciTismP6vjggcM=
  323 +github.com/vmihailenco/msgpack/v5 v5.3.0 h1:8G3at/kelmBKeHY6d6cKnGsYO3BLn+uubitdOtOhyNI=
  324 +github.com/vmihailenco/msgpack/v5 v5.3.0/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc=
  325 +github.com/vmihailenco/tagparser v0.1.2 h1:gnjoVuB/kljJ5wICEEOpx98oXMWPLj22G67Vbd1qPqc=
  326 +github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
  327 +github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
  328 +github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
  329 +github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc=
  330 +github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
  331 +github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
  332 +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
  333 +github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg=
  334 +github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2/go.mod h1:hzfGeIUDq/j97IG+FhNqkowIyEcD88LrW6fyU3K3WqY=
  335 +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
  336 +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
  337 +github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU=
  338 +github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ=
  339 +go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
  340 +go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698/go.mod h1:YoUyTScD3Vcv2RBm3eGVOq7i1ULiz3OuXoQFWOirmAM=
  341 +go.etcd.io/etcd v3.3.25+incompatible/go.mod h1:yaeTdrJi5lOmYerz05bd8+V7KubZs8YSFZfzsF9A6aI=
  342 +go.opentelemetry.io/otel v0.17.0/go.mod h1:Oqtdxmf7UtEvL037ohlgnaYa1h7GtMh0NcSd9eqkC9s=
  343 +go.opentelemetry.io/otel v0.19.0 h1:Lenfy7QHRXPZVsw/12CWpxX6d/JkrX8wrx2vO8G80Ng=
  344 +go.opentelemetry.io/otel v0.19.0/go.mod h1:j9bF567N9EfomkSidSfmMwIwIBuP37AMAIzVW85OxSg=
  345 +go.opentelemetry.io/otel/metric v0.17.0/go.mod h1:hUz9lH1rNXyEwWAhIWCMFWKhYtpASgSnObJFnU26dJ0=
  346 +go.opentelemetry.io/otel/metric v0.19.0 h1:dtZ1Ju44gkJkYvo+3qGqVXmf88tc+a42edOywypengg=
  347 +go.opentelemetry.io/otel/metric v0.19.0/go.mod h1:8f9fglJPRnXuskQmKpnad31lcLJ2VmNNqIsx/uIwBSc=
  348 +go.opentelemetry.io/otel/oteltest v0.17.0/go.mod h1:JT/LGFxPwpN+nlsTiinSYjdIx3hZIGqHCpChcIZmdoE=
  349 +go.opentelemetry.io/otel/oteltest v0.19.0 h1:YVfA0ByROYqTwOxqHVZYZExzEpfZor+MU1rU+ip2v9Q=
  350 +go.opentelemetry.io/otel/oteltest v0.19.0/go.mod h1:tI4yxwh8U21v7JD6R3BcA/2+RBoTKFexE/PJ/nSO7IA=
  351 +go.opentelemetry.io/otel/trace v0.17.0/go.mod h1:bIujpqg6ZL6xUTubIUgziI1jSaUPthmabA/ygf/6Cfg=
  352 +go.opentelemetry.io/otel/trace v0.19.0 h1:1ucYlenXIDA1OlHVLDZKX0ObXV5RLaq06DtUKz5e5zc=
  353 +go.opentelemetry.io/otel/trace v0.19.0/go.mod h1:4IXiNextNOpPnRlI4ryK69mn5iC84bjBWZQA5DXz/qg=
  354 +go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
  355 +go.uber.org/automaxprocs v1.3.0/go.mod h1:9CWT6lKIep8U41DDaPiH6eFscnTyjfTANNQNx6LrIcA=
  356 +go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
  357 +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
  358 +go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
  359 +go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
  360 +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
  361 +golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
  362 +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
  363 +golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
  364 +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
  365 +golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
  366 +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
  367 +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
  368 +golang.org/x/crypto v0.0.0-20210218145215-b8e89b74b9df/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
  369 +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 h1:It14KIkyBFYkHkwZ7k45minvA9aorojkyjGk9KJ5B/w=
  370 +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
  371 +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
  372 +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
  373 +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
  374 +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
  375 +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
  376 +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
  377 +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
  378 +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
  379 +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
  380 +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
  381 +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
  382 +golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
  383 +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
  384 +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
  385 +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
  386 +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
  387 +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
  388 +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
  389 +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
  390 +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
  391 +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
  392 +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
  393 +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
  394 +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
  395 +golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
  396 +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
  397 +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
  398 +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
  399 +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
  400 +golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
  401 +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
  402 +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
  403 +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
  404 +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
  405 +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
  406 +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
  407 +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
  408 +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
  409 +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
  410 +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
  411 +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
  412 +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
  413 +golang.org/x/sys v0.0.0-20171017063910-8dbc5d05d6ed/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
  414 +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
  415 +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
  416 +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
  417 +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
  418 +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
  419 +golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
  420 +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
  421 +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
  422 +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  423 +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  424 +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  425 +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  426 +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  427 +golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  428 +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  429 +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  430 +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  431 +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  432 +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  433 +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  434 +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  435 +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  436 +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  437 +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  438 +golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  439 +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  440 +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  441 +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  442 +golang.org/x/sys v0.0.0-20210218155724-8ebf48af031b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  443 +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
  444 +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
  445 +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
  446 +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
  447 +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
  448 +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
  449 +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
  450 +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
  451 +golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ=
  452 +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
  453 +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
  454 +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
  455 +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
  456 +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
  457 +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
  458 +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
  459 +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
  460 +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
  461 +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
  462 +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
  463 +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
  464 +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
  465 +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
  466 +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
  467 +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
  468 +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
  469 +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
  470 +golang.org/x/tools v0.0.0-20200410132612-ae9902aceb98/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
  471 +golang.org/x/tools v0.0.0-20201211185031-d93e913c1a58/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
  472 +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e h1:4nW4NLDYnU28ojHaHO8OVxFHk/aQ33U01a9cjED+pzE=
  473 +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
  474 +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
  475 +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
  476 +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
  477 +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
  478 +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
  479 +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
  480 +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
  481 +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
  482 +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
  483 +google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
  484 +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
  485 +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
  486 +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
  487 +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
  488 +google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA=
  489 +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
  490 +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
  491 +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
  492 +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
  493 +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
  494 +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
  495 +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
  496 +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
  497 +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
  498 +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
  499 +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
  500 +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
  501 +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
  502 +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
  503 +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
  504 +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
  505 +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
  506 +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
  507 +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
  508 +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
  509 +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
  510 +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
  511 +gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
  512 +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
  513 +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
  514 +gopkg.in/h2non/gock.v1 v1.0.15/go.mod h1:sX4zAkdYX1TRGJ2JY156cFspQn4yRWn6p9EMdODlynE=
  515 +gopkg.in/jcmturner/aescts.v1 v1.0.1 h1:cVVZBK2b1zY26haWB4vbBiZrfFQnfbTVrE3xZq6hrEw=
  516 +gopkg.in/jcmturner/aescts.v1 v1.0.1/go.mod h1:nsR8qBOg+OucoIW+WMhB3GspUQXq9XorLnQb9XtvcOo=
  517 +gopkg.in/jcmturner/dnsutils.v1 v1.0.1 h1:cIuC1OLRGZrld+16ZJvvZxVJeKPsvd5eUIvxfoN5hSM=
  518 +gopkg.in/jcmturner/dnsutils.v1 v1.0.1/go.mod h1:m3v+5svpVOhtFAP/wSz+yzh4Mc0Fg7eRhxkJMWSIz9Q=
  519 +gopkg.in/jcmturner/goidentity.v3 v3.0.0 h1:1duIyWiTaYvVx3YX2CYtpJbUFd7/UuPYCfgXtQ3VTbI=
  520 +gopkg.in/jcmturner/goidentity.v3 v3.0.0/go.mod h1:oG2kH0IvSYNIu80dVAyu/yoefjq1mNfM5bm88whjWx4=
  521 +gopkg.in/jcmturner/gokrb5.v7 v7.2.3 h1:hHMV/yKPwMnJhPuPx7pH2Uw/3Qyf+thJYlisUc44010=
  522 +gopkg.in/jcmturner/gokrb5.v7 v7.2.3/go.mod h1:l8VISx+WGYp+Fp7KRbsiUuXTTOnxIc3Tuvyavf11/WM=
  523 +gopkg.in/jcmturner/rpc.v1 v1.1.0 h1:QHIUxTX1ISuAv9dD2wJ9HWQVuWDX/Zc0PfeC2tjc4rU=
  524 +gopkg.in/jcmturner/rpc.v1 v1.1.0/go.mod h1:YIdkC4XfD6GXbzje11McwsDuOlZQSb9W4vfLvuNnlv8=
  525 +gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
  526 +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
  527 +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
  528 +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
  529 +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
  530 +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
  531 +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
  532 +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
  533 +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
  534 +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
  535 +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
  536 +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
  537 +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
  538 +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
  539 +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
  540 +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
  541 +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
  542 +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
  543 +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
  544 +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
  545 +honnef.co/go/tools v0.0.1-2020.1.5/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
  546 +mellium.im/sasl v0.2.1 h1:nspKSRg7/SyO0cRGY71OkfHab8tf9kCts6a6oTDut0w=
  547 +mellium.im/sasl v0.2.1/go.mod h1:ROaEDLQNuf9vjKqE1SrAfnsobm2YKXT1gnN1uDp1PjQ=
  548 +rsc.io/goversion v1.0.0/go.mod h1:Eih9y/uIBS3ulggl7KNJ09xGSLcuNaLgmvvqa07sgfo=
  549 +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
  550 +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
  551 +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
  552 +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
  1 +package main
  2 +
  3 +import (
  4 + "fmt"
  5 + "github.com/beego/beego/v2/server/web"
  6 + "github.com/linmadan/egglib-go/log/logrus"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/constant"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/log"
  9 +)
  10 +
  11 +func main() {
  12 + log.Logger.Info("server start ....")
  13 + log.Logger.Info(fmt.Sprintf("ENABLE_KAFKA_LOG:%v", constant.ENABLE_KAFKA_LOG))
  14 +
  15 + if constant.ENABLE_KAFKA_LOG {
  16 + w, _ := logrus.NewKafkaWriter(constant.KAFKA_HOST, constant.TOPIC_LOG_STASH, false)
  17 + log.Logger.AddHook(w)
  18 + }
  19 + bw := log.NewBeegoLogWriter(log.LoggerConfig{
  20 + Filename: constant.LOG_FILE,
  21 + Level: 7,
  22 + MaxSize: 1024 * 1024 * 2,
  23 + })
  24 + log.Logger.AddHook(bw)
  25 +
  26 + log.Logger.Info("server start!")
  27 + web.Run()
  28 +}
  1 +package factory
  2 +
  3 +import (
  4 + "github.com/linmadan/egglib-go/transaction/pg"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/repository"
  7 +)
  8 +
  9 +func CreateDeviceRepository(options map[string]interface{}) (domain.DeviceRepository, error) {
  10 + var transactionContext *pg.TransactionContext
  11 + if value, ok := options["transactionContext"]; ok {
  12 + transactionContext = value.(*pg.TransactionContext)
  13 + }
  14 + return repository.NewDeviceRepository(transactionContext)
  15 +}
  16 +
  17 +func CreateProductRepository(options map[string]interface{}) (domain.ProductRepository, error) {
  18 + var transactionContext *pg.TransactionContext
  19 + if value, ok := options["transactionContext"]; ok {
  20 + transactionContext = value.(*pg.TransactionContext)
  21 + }
  22 + return repository.NewProductRepository(transactionContext)
  23 +}
  24 +
  25 +func CreateProductAttendanceRecordRepository(options map[string]interface{}) (domain.ProductAttendanceRecordRepository, error) {
  26 + var transactionContext *pg.TransactionContext
  27 + if value, ok := options["transactionContext"]; ok {
  28 + transactionContext = value.(*pg.TransactionContext)
  29 + }
  30 + return repository.NewProductAttendanceRecordRepository(transactionContext)
  31 +}
  32 +
  33 +func CreateProductCalendarRepository(options map[string]interface{}) (domain.ProductCalendarRepository, error) {
  34 + var transactionContext *pg.TransactionContext
  35 + if value, ok := options["transactionContext"]; ok {
  36 + transactionContext = value.(*pg.TransactionContext)
  37 + }
  38 + return repository.NewProductCalendarRepository(transactionContext)
  39 +}
  40 +
  41 +func CreateProductGroupRepository(options map[string]interface{}) (domain.ProductGroupRepository, error) {
  42 + var transactionContext *pg.TransactionContext
  43 + if value, ok := options["transactionContext"]; ok {
  44 + transactionContext = value.(*pg.TransactionContext)
  45 + }
  46 + return repository.NewProductGroupRepository(transactionContext)
  47 +}
  48 +
  49 +func CreateProductJobRepository(options map[string]interface{}) (domain.ProductJobRepository, error) {
  50 + var transactionContext *pg.TransactionContext
  51 + if value, ok := options["transactionContext"]; ok {
  52 + transactionContext = value.(*pg.TransactionContext)
  53 + }
  54 + return repository.NewProductJobRepository(transactionContext)
  55 +}
  56 +
  57 +func CreateProductPlanRepository(options map[string]interface{}) (domain.ProductPlanRepository, error) {
  58 + var transactionContext *pg.TransactionContext
  59 + if value, ok := options["transactionContext"]; ok {
  60 + transactionContext = value.(*pg.TransactionContext)
  61 + }
  62 + return repository.NewProductPlanRepository(transactionContext)
  63 +}
  64 +
  65 +func CreateProductRecordRepository(options map[string]interface{}) (domain.ProductRecordRepository, error) {
  66 + var transactionContext *pg.TransactionContext
  67 + if value, ok := options["transactionContext"]; ok {
  68 + transactionContext = value.(*pg.TransactionContext)
  69 + }
  70 + return repository.NewProductRecordRepository(transactionContext)
  71 +}
  72 +
  73 +func CreateUnitConversionRepository(options map[string]interface{}) (domain.UnitConversionRepository, error) {
  74 + var transactionContext *pg.TransactionContext
  75 + if value, ok := options["transactionContext"]; ok {
  76 + transactionContext = value.(*pg.TransactionContext)
  77 + }
  78 + return repository.NewUnitConversionRepository(transactionContext)
  79 +}
  80 +
  81 +func CreateWorkshopRepository(options map[string]interface{}) (domain.WorkshopRepository, error) {
  82 + var transactionContext *pg.TransactionContext
  83 + if value, ok := options["transactionContext"]; ok {
  84 + transactionContext = value.(*pg.TransactionContext)
  85 + }
  86 + return repository.NewWorkshopRepository(transactionContext)
  87 +}
  1 +package factory
  2 +
  3 +import (
  4 + "github.com/linmadan/egglib-go/core/application"
  5 + pG "github.com/linmadan/egglib-go/transaction/pg"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
  7 +)
  8 +
  9 +func CreateTransactionContext(options map[string]interface{}) (application.TransactionContext, error) {
  10 + return pG.NewPGTransactionContext(pg.DB), nil
  11 +}
  1 +package application
  2 +
  3 +import (
  4 + "github.com/beego/beego/v2/core/validation"
  5 + "github.com/linmadan/egglib-go/validation/beego"
  6 +)
  7 +
  8 +func init() {
  9 + validation.MessageTmpls = beego.ValidationMessageTmpls
  10 +}
  1 +package constant
  2 +
  3 +import (
  4 + "fmt"
  5 + "os"
  6 + "strconv"
  7 + "strings"
  8 +)
  9 +
  10 +var SERVICE_NAME = "allied-creation-manufacture"
  11 +var SERVICE_ENV = "dev"
  12 +var HTTP_PORT int = 8081
  13 +var CACHE_PREFIX = "allied-creation-manufacture-dev"
  14 +var LOG_LEVEL = "debug"
  15 +var LOG_FILE = "app.log"
  16 +
  17 +var CUSTOMER_ACCOUNT = []int64{3129687560814592, 3129687690100739, 3492238958608384}
  18 +
  19 +const CUSTOMER_ACCOUNT_DELIMITER = ","
  20 +
  21 +/***** 1.数据传输 *****/
  22 +const HeaderCompanyId = "companyId"
  23 +const HeaderUserId = "userId"
  24 +const HeaderOrgId = "orgId"
  25 +
  26 +func init() {
  27 + if os.Getenv("LOG_LEVEL") != "" {
  28 + LOG_LEVEL = os.Getenv("LOG_LEVEL")
  29 + }
  30 + if os.Getenv("CUSTOMER_ACCOUNT") != "" {
  31 + account := os.Getenv("CUSTOMER_ACCOUNT")
  32 + accounts := strings.Split(account, CUSTOMER_ACCOUNT_DELIMITER)
  33 + var tmpAccounts []int64
  34 + for i := range accounts {
  35 + v, err := strconv.ParseInt(accounts[i], 10, 64)
  36 + if err != nil {
  37 + panic(err)
  38 + }
  39 + tmpAccounts = append(tmpAccounts, v)
  40 + }
  41 + if len(tmpAccounts) > 0 {
  42 + CUSTOMER_ACCOUNT = tmpAccounts
  43 + }
  44 + }
  45 + if os.Getenv("SERVICE_ENV") != "" {
  46 + SERVICE_ENV = os.Getenv("SERVICE_ENV")
  47 + }
  48 + if os.Getenv("HTTP_PORT") != "" {
  49 + HTTP_PORT, _ = strconv.Atoi(os.Getenv("HTTP_PORT"))
  50 + }
  51 + SERVICE_NAME = fmt.Sprintf("%v-%v", SERVICE_NAME, SERVICE_ENV)
  52 + CACHE_PREFIX = SERVICE_NAME
  53 +}
  1 +package constant
  2 +
  3 +import "os"
  4 +
  5 +var (
  6 + // kafka 地址
  7 + KAFKA_HOST = "192.168.0.250:9092,192.168.0.251:9092,192.168.0.252:9092" //"106.75.231.90:9092"
  8 + // kafka topic log stash
  9 + TOPIC_LOG_STASH = "go_stash_dev" //"pushMessage"
  10 + // kafka topic up_block_chain
  11 + TOPIC_UP_BLOCK_CHAIN = "allied_creation_message"
  12 + // 是否启用日志收集 (本地不启用)
  13 + ENABLE_KAFKA_LOG = false
  14 +)
  15 +
  16 +func init() {
  17 + if os.Getenv("KAFKA_HOST") != "" {
  18 + KAFKA_HOST = os.Getenv("KAFKA_HOST")
  19 + }
  20 + //if os.Getenv("TOPIC_LOG_STASH") != "" {
  21 + // POSTGRESQL_PORT = os.Getenv("TOPIC_LOG_STASH")
  22 + //}
  23 + if os.Getenv("ENABLE_KAFKA_LOG") != "" {
  24 + ENABLE_KAFKA_LOG = true
  25 + }
  26 +}
  1 +package constant
  2 +
  3 +import (
  4 + "os"
  5 +)
  6 +
  7 +var POSTGRESQL_DB_NAME = "terms"
  8 +var POSTGRESQL_USER = "postgres"
  9 +var POSTGRESQL_PASSWORD = "123456"
  10 +var POSTGRESQL_HOST = "127.0.0.1"
  11 +var POSTGRESQL_PORT = "5432"
  12 +var DISABLE_CREATE_TABLE = false
  13 +var DISABLE_SQL_GENERATE_PRINT = false
  14 +var DISABLE_SQL_GENERATE_COMMENT = true
  15 +
  16 +func init() {
  17 + if os.Getenv("POSTGRESQL_DB_NAME") != "" {
  18 + POSTGRESQL_DB_NAME = os.Getenv("POSTGRESQL_DB_NAME")
  19 + }
  20 + if os.Getenv("POSTGRESQL_USER") != "" {
  21 + POSTGRESQL_USER = os.Getenv("POSTGRESQL_USER")
  22 + }
  23 + if os.Getenv("POSTGRESQL_PASSWORD") != "" {
  24 + POSTGRESQL_PASSWORD = os.Getenv("POSTGRESQL_PASSWORD")
  25 + }
  26 + if os.Getenv("POSTGRESQL_HOST") != "" {
  27 + POSTGRESQL_HOST = os.Getenv("POSTGRESQL_HOST")
  28 + }
  29 + if os.Getenv("POSTGRESQL_PORT") != "" {
  30 + POSTGRESQL_PORT = os.Getenv("POSTGRESQL_PORT")
  31 + }
  32 + if os.Getenv("DISABLE_CREATE_TABLE") != "" {
  33 + DISABLE_CREATE_TABLE = true
  34 + }
  35 + if os.Getenv("DISABLE_SQL_GENERATE_PRINT") != "" {
  36 + DISABLE_SQL_GENERATE_PRINT = true
  37 + }
  38 +}
  1 +package constant
  2 +
  3 +import "os"
  4 +
  5 +var (
  6 + REDIS_HOST = "127.0.0.1"
  7 + REDIS_PORT = "6379"
  8 + REDIS_AUTH = ""
  9 + // 是否关闭仓储层缓存
  10 + DISABLE_REPOSITORY_CACHE = false
  11 + // 缓存过期时间 单位秒
  12 + REPOSITORY_CACHE_EXPIRE = 30 * 60
  13 +)
  14 +
  15 +func init() {
  16 + if os.Getenv("REDIS_HOST") != "" {
  17 + REDIS_HOST = os.Getenv("REDIS_HOST")
  18 + REDIS_AUTH = os.Getenv("REDIS_AUTH")
  19 + }
  20 + if os.Getenv("REDIS_PORT") != "" {
  21 + REDIS_PORT = os.Getenv("REDIS_PORT")
  22 + }
  23 + if _, ok := os.LookupEnv("REDIS_AUTH"); ok {
  24 + REDIS_AUTH = os.Getenv("REDIS_AUTH")
  25 + }
  26 + if os.Getenv("ENABLE_REPOSITORY_CACHE") != "" {
  27 + DISABLE_REPOSITORY_CACHE = false
  28 + }
  29 + if os.Getenv("DISABLE_REPOSITORY_CACHE") != "" {
  30 + DISABLE_REPOSITORY_CACHE = true
  31 + }
  32 +}
  1 +package domain
  2 +
  3 +// 企业对象
  4 +type Company struct {
  5 + // 企业id
  6 + CompanyId int `json:"companyId,omitempty"`
  7 + // 企业名称
  8 + CompanyName string `json:"companyName,omitempty"`
  9 +}
  1 +package domain
  2 +
  3 +import "time"
  4 +
  5 +// 设备
  6 +type Device struct {
  7 + // 设备Id
  8 + DeviceId int `json:"deviceId,omitempty"`
  9 + // 企业id
  10 + CompanyId int `json:"companyId,omitempty"`
  11 + // 组织ID
  12 + OrgId int `json:"orgId,omitempty"`
  13 + // 设备编号
  14 + DeviceCode string `json:"deviceCode,omitempty"`
  15 + // 设备名称
  16 + DeviceName string `json:"deviceName,omitempty"`
  17 + // 设备型号
  18 + DeviceModel string `json:"deviceModel,omitempty"`
  19 + // 设备类型
  20 + DeviceType string `json:"deviceType,omitempty"`
  21 + // 品牌
  22 + Brand string `json:"brand,omitempty"`
  23 + // 设备状态 1:正常 2:封存 3:报废
  24 + DeviceStatus int `json:"deviceStatus,omitempty"`
  25 + // 风险等级 1:高 2:中 3:低
  26 + RiskLevel int `json:"riskLevel,omitempty"`
  27 + // 创建时间
  28 + CreatedAt time.Time `json:"createdAt,omitempty"`
  29 + // 更新时间
  30 + UpdatedAt time.Time `json:"updatedAt,omitempty"`
  31 + // 删除时间
  32 + DeletedAt time.Time `json:"deletedAt,omitempty"`
  33 + // 所属位置
  34 + WorkStation *WorkStation `json:"workStation,omitempty"`
  35 +}
  36 +
  37 +type DeviceRepository interface {
  38 + Save(device *Device) (*Device, error)
  39 + Remove(device *Device) (*Device, error)
  40 + FindOne(queryOptions map[string]interface{}) (*Device, error)
  41 + Find(queryOptions map[string]interface{}) (int64, []*Device, error)
  42 +}
  43 +
  44 +func (device *Device) Identify() interface{} {
  45 + if device.DeviceId == 0 {
  46 + return nil
  47 + }
  48 + return device.DeviceId
  49 +}
  50 +
  51 +func (device *Device) Update(data map[string]interface{}) error {
  52 + if companyId, ok := data["companyId"]; ok {
  53 + device.CompanyId = companyId.(int)
  54 + }
  55 + if orgId, ok := data["orgId"]; ok {
  56 + device.OrgId = orgId.(int)
  57 + }
  58 + if deviceCode, ok := data["deviceCode"]; ok {
  59 + device.DeviceCode = deviceCode.(string)
  60 + }
  61 + if deviceName, ok := data["deviceName"]; ok {
  62 + device.DeviceName = deviceName.(string)
  63 + }
  64 + if deviceModel, ok := data["deviceModel"]; ok {
  65 + device.DeviceModel = deviceModel.(string)
  66 + }
  67 + if deviceType, ok := data["deviceType"]; ok {
  68 + device.DeviceType = deviceType.(string)
  69 + }
  70 + if brand, ok := data["brand"]; ok {
  71 + device.Brand = brand.(string)
  72 + }
  73 + if deviceStatus, ok := data["deviceStatus"]; ok {
  74 + device.DeviceStatus = deviceStatus.(int)
  75 + }
  76 + if riskLevel, ok := data["riskLevel"]; ok {
  77 + device.RiskLevel = riskLevel.(int)
  78 + }
  79 + if createdAt, ok := data["createdAt"]; ok {
  80 + device.CreatedAt = createdAt.(time.Time)
  81 + }
  82 + if updatedAt, ok := data["updatedAt"]; ok {
  83 + device.UpdatedAt = updatedAt.(time.Time)
  84 + }
  85 + if deletedAt, ok := data["deletedAt"]; ok {
  86 + device.DeletedAt = deletedAt.(time.Time)
  87 + }
  88 + if workStationId, ok := data["workStationId"]; ok {
  89 + device.WorkStation.WorkStationId = workStationId.(string)
  90 + }
  91 + if workshopId, ok := data["workshopId"]; ok {
  92 + device.WorkStation.WorkshopId = workshopId.(int)
  93 + }
  94 + if workshopName, ok := data["workshopName"]; ok {
  95 + device.WorkStation.WorkshopName = workshopName.(string)
  96 + }
  97 + if lineId, ok := data["lineId"]; ok {
  98 + device.WorkStation.LineId = lineId.(int)
  99 + }
  100 + if lineName, ok := data["lineName"]; ok {
  101 + device.WorkStation.LineName = lineName.(string)
  102 + }
  103 + if sectionId, ok := data["sectionId"]; ok {
  104 + device.WorkStation.SectionId = sectionId.(int)
  105 + }
  106 + if sectionName, ok := data["sectionName"]; ok {
  107 + device.WorkStation.SectionName = sectionName.(string)
  108 + }
  109 + return nil
  110 +}
  1 +package domain
  2 +
  3 +// 物料
  4 +type Material struct {
  5 + // 物料名称
  6 + MaterialName string `json:"materialName,omitempty"`
  7 + // 物料类别
  8 + MaterialCategory string `json:"materialCategory,omitempty"`
  9 +}
  1 +package domain
  2 +
  3 +// 组织机构
  4 +type Org struct {
  5 + // 组织ID
  6 + OrgId int `json:"orgId,omitempty"`
  7 + // 组织名称
  8 + OrgName string `json:"orgName,omitempty"`
  9 +}
  1 +package domain
  2 +
  3 +import "time"
  4 +
  5 +// 产品信息
  6 +type Product struct {
  7 + // 企业id
  8 + CompanyId int `json:"companyId,omitempty"`
  9 + // 组织ID
  10 + OrgId int `json:"orgId,omitempty"`
  11 + // 产品ID
  12 + ProductId int `json:"productId,omitempty"`
  13 + // 产品编号 编码规则为“CP”+2 位年+2 位月+2 位日+3 位流水码,如 CP211229001
  14 + ProductCode string `json:"productCode,omitempty"`
  15 + // 产品名称
  16 + ProductName string `json:"productName,omitempty"`
  17 + // 产品类别
  18 + ProductCategory string `json:"productCategory,omitempty"`
  19 + // 产品规格
  20 + ProductSpec *UnitQuantity `json:"productSpec,omitempty"`
  21 + // 创建时间
  22 + CreatedAt time.Time `json:"createdAt,omitempty"`
  23 + // 更新时间
  24 + UpdatedAt time.Time `json:"updatedAt,omitempty"`
  25 + // 删除时间
  26 + DeletedAt time.Time `json:"deletedAt,omitempty"`
  27 +}
  28 +
  29 +type ProductRepository interface {
  30 + Save(product *Product) (*Product, error)
  31 + Remove(product *Product) (*Product, error)
  32 + FindOne(queryOptions map[string]interface{}) (*Product, error)
  33 + Find(queryOptions map[string]interface{}) (int64, []*Product, error)
  34 +}
  35 +
  36 +func (product *Product) Identify() interface{} {
  37 + if product.ProductId == 0 {
  38 + return nil
  39 + }
  40 + return product.ProductId
  41 +}
  42 +
  43 +func (product *Product) Update(data map[string]interface{}) error {
  44 + if companyId, ok := data["companyId"]; ok {
  45 + product.CompanyId = companyId.(int)
  46 + }
  47 + if orgId, ok := data["orgId"]; ok {
  48 + product.OrgId = orgId.(int)
  49 + }
  50 + if productCode, ok := data["productCode"]; ok {
  51 + product.ProductCode = productCode.(string)
  52 + }
  53 + if productName, ok := data["productName"]; ok {
  54 + product.ProductName = productName.(string)
  55 + }
  56 + if productCategory, ok := data["productCategory"]; ok {
  57 + product.ProductCategory = productCategory.(string)
  58 + }
  59 + if quantity, ok := data["quantity"]; ok {
  60 + product.ProductSpec.Quantity = quantity.(float64)
  61 + }
  62 + if unit, ok := data["unit"]; ok {
  63 + product.ProductSpec.Unit = unit.(string)
  64 + }
  65 + if unitWeight, ok := data["unitWeight"]; ok {
  66 + product.ProductSpec.UnitWeight = unitWeight.(float64)
  67 + }
  68 + if weight, ok := data["weight"]; ok {
  69 + product.ProductSpec.Weight = weight.(float64)
  70 + }
  71 + if createdAt, ok := data["createdAt"]; ok {
  72 + product.CreatedAt = createdAt.(time.Time)
  73 + }
  74 + if updatedAt, ok := data["updatedAt"]; ok {
  75 + product.UpdatedAt = updatedAt.(time.Time)
  76 + }
  77 + if deletedAt, ok := data["deletedAt"]; ok {
  78 + product.DeletedAt = deletedAt.(time.Time)
  79 + }
  80 + return nil
  81 +}
  1 +package domain
  2 +
  3 +import "time"
  4 +
  5 +// 生产考勤记录
  6 +type ProductAttendanceRecord struct {
  7 + // 考勤记录ID
  8 + ProductAttendanceId int `json:"productAttendanceId,omitempty"`
  9 + // 组织ID
  10 + OrgId int `json:"orgId,omitempty"`
  11 + // 产品ID
  12 + ProductId int `json:"productId,omitempty"`
  13 + // 考勤类型 1.正常 2.支援
  14 + AttendanceType int `json:"attendanceType,omitempty"`
  15 + // 生产工人
  16 + ProductWorker *User `json:"productWorker,omitempty"`
  17 + // 工作位置
  18 + WorkStation *WorkStation `json:"workStation,omitempty"`
  19 + // 签到
  20 + SignIn time.Time `json:"signIn,omitempty"`
  21 + // 签退
  22 + SignOut time.Time `json:"signOut,omitempty"`
  23 + // 考勤状态 1.未审核 2:已审核 3.自动审核
  24 + AttendanceStatus int `json:"attendanceStatus,omitempty"`
  25 + // 工时(审核前)
  26 + WorkTimeBefore float64 `json:"workTimeBefore,omitempty"`
  27 + // 工时(审核后)
  28 + WorkTimeAfter float64 `json:"workTimeAfter,omitempty"`
  29 + // 创建时间
  30 + CreatedAt time.Time `json:"createdAt,omitempty"`
  31 + // 更新时间
  32 + UpdatedAt time.Time `json:"updatedAt,omitempty"`
  33 + // 删除时间
  34 + DeletedAt time.Time `json:"deletedAt,omitempty"`
  35 +}
  36 +
  37 +type ProductAttendanceRecordRepository interface {
  38 + Save(productAttendanceRecord *ProductAttendanceRecord) (*ProductAttendanceRecord, error)
  39 + Remove(productAttendanceRecord *ProductAttendanceRecord) (*ProductAttendanceRecord, error)
  40 + FindOne(queryOptions map[string]interface{}) (*ProductAttendanceRecord, error)
  41 + Find(queryOptions map[string]interface{}) (int64, []*ProductAttendanceRecord, error)
  42 +}
  43 +
  44 +func (productAttendanceRecord *ProductAttendanceRecord) Identify() interface{} {
  45 + if productAttendanceRecord.ProductAttendanceId == 0 {
  46 + return nil
  47 + }
  48 + return productAttendanceRecord.ProductAttendanceId
  49 +}
  50 +
  51 +func (productAttendanceRecord *ProductAttendanceRecord) Update(data map[string]interface{}) error {
  52 + if productAttendanceId, ok := data["productAttendanceId"]; ok {
  53 + productAttendanceRecord.ProductAttendanceId = productAttendanceId.(int)
  54 + }
  55 + if orgId, ok := data["orgId"]; ok {
  56 + productAttendanceRecord.OrgId = orgId.(int)
  57 + }
  58 + if productId, ok := data["productId"]; ok {
  59 + productAttendanceRecord.ProductId = productId.(int)
  60 + }
  61 + if attendanceType, ok := data["attendanceType"]; ok {
  62 + productAttendanceRecord.AttendanceType = attendanceType.(int)
  63 + }
  64 + if userId, ok := data["userId"]; ok {
  65 + productAttendanceRecord.ProductWorker.UserId = userId.(int)
  66 + }
  67 + if userName, ok := data["userName"]; ok {
  68 + productAttendanceRecord.ProductWorker.UserName = userName.(string)
  69 + }
  70 + if employeeType, ok := data["employeeType"]; ok {
  71 + productAttendanceRecord.ProductWorker.EmployeeType = employeeType.(int)
  72 + }
  73 + if icCardNumber, ok := data["icCardNumber"]; ok {
  74 + productAttendanceRecord.ProductWorker.IcCardNumber = icCardNumber.(string)
  75 + }
  76 + if avatar, ok := data["avatar"]; ok {
  77 + productAttendanceRecord.ProductWorker.Avatar = avatar.(string)
  78 + }
  79 + if phone, ok := data["phone"]; ok {
  80 + productAttendanceRecord.ProductWorker.Phone = phone.(string)
  81 + }
  82 + if workStationId, ok := data["workStationId"]; ok {
  83 + productAttendanceRecord.WorkStation.WorkStationId = workStationId.(string)
  84 + }
  85 + if workshopId, ok := data["workshopId"]; ok {
  86 + productAttendanceRecord.WorkStation.WorkshopId = workshopId.(int)
  87 + }
  88 + if workshopName, ok := data["workshopName"]; ok {
  89 + productAttendanceRecord.WorkStation.WorkshopName = workshopName.(string)
  90 + }
  91 + if lineId, ok := data["lineId"]; ok {
  92 + productAttendanceRecord.WorkStation.LineId = lineId.(int)
  93 + }
  94 + if lineName, ok := data["lineName"]; ok {
  95 + productAttendanceRecord.WorkStation.LineName = lineName.(string)
  96 + }
  97 + if sectionId, ok := data["sectionId"]; ok {
  98 + productAttendanceRecord.WorkStation.SectionId = sectionId.(int)
  99 + }
  100 + if sectionName, ok := data["sectionName"]; ok {
  101 + productAttendanceRecord.WorkStation.SectionName = sectionName.(string)
  102 + }
  103 + if signIn, ok := data["signIn"]; ok {
  104 + productAttendanceRecord.SignIn = signIn.(time.Time)
  105 + }
  106 + if signOut, ok := data["signOut"]; ok {
  107 + productAttendanceRecord.SignOut = signOut.(time.Time)
  108 + }
  109 + if attendanceStatus, ok := data["attendanceStatus"]; ok {
  110 + productAttendanceRecord.AttendanceStatus = attendanceStatus.(int)
  111 + }
  112 + if workTimeBefore, ok := data["workTimeBefore"]; ok {
  113 + productAttendanceRecord.WorkTimeBefore = workTimeBefore.(float64)
  114 + }
  115 + if workTimeAfter, ok := data["workTimeAfter"]; ok {
  116 + productAttendanceRecord.WorkTimeAfter = workTimeAfter.(float64)
  117 + }
  118 + if createdAt, ok := data["createdAt"]; ok {
  119 + productAttendanceRecord.CreatedAt = createdAt.(time.Time)
  120 + }
  121 + if updatedAt, ok := data["updatedAt"]; ok {
  122 + productAttendanceRecord.UpdatedAt = updatedAt.(time.Time)
  123 + }
  124 + if deletedAt, ok := data["deletedAt"]; ok {
  125 + productAttendanceRecord.DeletedAt = deletedAt.(time.Time)
  126 + }
  127 + return nil
  128 +}
  1 +package domain
  2 +
  3 +import "time"
  4 +
  5 +// 工厂日历
  6 +type ProductCalendar struct {
  7 + // 工厂日历ID
  8 + ProductCalendarId int `json:"productCalendarId,omitempty"`
  9 + // 企业id
  10 + CompanyId int `json:"companyId,omitempty"`
  11 + // 组织ID
  12 + OrgId int `json:"orgId,omitempty"`
  13 + // 工作位置
  14 + WorkStation *WorkStation `json:"workStation,omitempty"`
  15 + // 上班班次 1:全天 2:白班 4:中班 8:夜班
  16 + WorkOn int `json:"workOn,omitempty"`
  17 + // 日历选择
  18 + CalendarSelected []string `json:"calendarSelected,omitempty"`
  19 + // 上岗时间
  20 + InWorkAt string `json:"inWorkAt,omitempty"`
  21 + // 下岗时间
  22 + OutWorkAt string `json:"outWorkAt,omitempty"`
  23 + // 休息时间 (单位 h)
  24 + BreakTime float64 `json:"breakTime,omitempty"`
  25 + // 工时 (单位 h)
  26 + WorkTime float64 `json:"workTime,omitempty"`
  27 + // 创建时间
  28 + CreatedAt time.Time `json:"createdAt,omitempty"`
  29 + // 更新时间
  30 + UpdatedAt time.Time `json:"updatedAt,omitempty"`
  31 + // 删除时间
  32 + DeletedAt time.Time `json:"deletedAt,omitempty"`
  33 +}
  34 +
  35 +type ProductCalendarRepository interface {
  36 + Save(productCalendar *ProductCalendar) (*ProductCalendar, error)
  37 + Remove(productCalendar *ProductCalendar) (*ProductCalendar, error)
  38 + FindOne(queryOptions map[string]interface{}) (*ProductCalendar, error)
  39 + Find(queryOptions map[string]interface{}) (int64, []*ProductCalendar, error)
  40 +}
  41 +
  42 +func (productCalendar *ProductCalendar) Identify() interface{} {
  43 + if productCalendar.ProductCalendarId == 0 {
  44 + return nil
  45 + }
  46 + return productCalendar.ProductCalendarId
  47 +}
  48 +
  49 +func (productCalendar *ProductCalendar) Update(data map[string]interface{}) error {
  50 + if productCalendarId, ok := data["productCalendarId"]; ok {
  51 + productCalendar.ProductCalendarId = productCalendarId.(int)
  52 + }
  53 + if companyId, ok := data["companyId"]; ok {
  54 + productCalendar.CompanyId = companyId.(int)
  55 + }
  56 + if orgId, ok := data["orgId"]; ok {
  57 + productCalendar.OrgId = orgId.(int)
  58 + }
  59 + if workStationId, ok := data["workStationId"]; ok {
  60 + productCalendar.WorkStation.WorkStationId = workStationId.(string)
  61 + }
  62 + if workshopId, ok := data["workshopId"]; ok {
  63 + productCalendar.WorkStation.WorkshopId = workshopId.(int)
  64 + }
  65 + if workshopName, ok := data["workshopName"]; ok {
  66 + productCalendar.WorkStation.WorkshopName = workshopName.(string)
  67 + }
  68 + if lineId, ok := data["lineId"]; ok {
  69 + productCalendar.WorkStation.LineId = lineId.(int)
  70 + }
  71 + if lineName, ok := data["lineName"]; ok {
  72 + productCalendar.WorkStation.LineName = lineName.(string)
  73 + }
  74 + if sectionId, ok := data["sectionId"]; ok {
  75 + productCalendar.WorkStation.SectionId = sectionId.(int)
  76 + }
  77 + if sectionName, ok := data["sectionName"]; ok {
  78 + productCalendar.WorkStation.SectionName = sectionName.(string)
  79 + }
  80 + if workOn, ok := data["workOn"]; ok {
  81 + productCalendar.WorkOn = workOn.(int)
  82 + }
  83 + //if calendarSelected, ok := data["calendarSelected"]; ok {
  84 + // productCalendar.CalendarSelected = calendarSelected.(array)
  85 + //}
  86 + if inWorkAt, ok := data["inWorkAt"]; ok {
  87 + productCalendar.InWorkAt = inWorkAt.(string)
  88 + }
  89 + if outWorkAt, ok := data["outWorkAt"]; ok {
  90 + productCalendar.OutWorkAt = outWorkAt.(string)
  91 + }
  92 + if breakTime, ok := data["breakTime"]; ok {
  93 + productCalendar.BreakTime = breakTime.(float64)
  94 + }
  95 + if workTime, ok := data["workTime"]; ok {
  96 + productCalendar.WorkTime = workTime.(float64)
  97 + }
  98 + if createdAt, ok := data["createdAt"]; ok {
  99 + productCalendar.CreatedAt = createdAt.(time.Time)
  100 + }
  101 + if updatedAt, ok := data["updatedAt"]; ok {
  102 + productCalendar.UpdatedAt = updatedAt.(time.Time)
  103 + }
  104 + if deletedAt, ok := data["deletedAt"]; ok {
  105 + productCalendar.DeletedAt = deletedAt.(time.Time)
  106 + }
  107 + return nil
  108 +}
  1 +package domain
  2 +
  3 +// 产品扩展
  4 +type ProductExt struct {
  5 + // 单份重量(原材料)
  6 + UnitWeight float64 `json:"unitWeight"`
  7 +}
  1 +package domain
  2 +
  3 +import "time"
  4 +
  5 +// 生产班组
  6 +type ProductGroup struct {
  7 + // 生产小组ID
  8 + ProductGroupId int `json:"productGroupId,omitempty"`
  9 + // 企业id
  10 + CompanyId int `json:"companyId,omitempty"`
  11 + // 组织ID
  12 + OrgId int `json:"orgId,omitempty"`
  13 + // 班组名称
  14 + GroupName string `json:"groupName,omitempty"`
  15 + // 班组长
  16 + GroupLeader *User `json:"groupLeader,omitempty"`
  17 + // 帮组成员列表
  18 + GroupMembers []*User `json:"groupMembers,omitempty"`
  19 + // 上班班次 1:全天 2:白班 4:中班 8:夜班
  20 + WorkOn int `json:"workOn,omitempty"`
  21 + // 工作位置
  22 + WorkStation *WorkStation `json:"workStation,omitempty"`
  23 + // 创建时间
  24 + CreatedAt time.Time `json:"createdAt,omitempty"`
  25 + // 更新时间
  26 + UpdatedAt time.Time `json:"updatedAt,omitempty"`
  27 + // 删除时间
  28 + DeletedAt time.Time `json:"deletedAt,omitempty"`
  29 +}
  30 +
  31 +type ProductGroupRepository interface {
  32 + Save(productGroup *ProductGroup) (*ProductGroup, error)
  33 + Remove(productGroup *ProductGroup) (*ProductGroup, error)
  34 + FindOne(queryOptions map[string]interface{}) (*ProductGroup, error)
  35 + Find(queryOptions map[string]interface{}) (int64, []*ProductGroup, error)
  36 +}
  37 +
  38 +func (productGroup *ProductGroup) Identify() interface{} {
  39 + if productGroup.ProductGroupId == 0 {
  40 + return nil
  41 + }
  42 + return productGroup.ProductGroupId
  43 +}
  44 +
  45 +func (productGroup *ProductGroup) Update(data map[string]interface{}) error {
  46 + if productGroupId, ok := data["productGroupId"]; ok {
  47 + productGroup.ProductGroupId = productGroupId.(int)
  48 + }
  49 + if companyId, ok := data["companyId"]; ok {
  50 + productGroup.CompanyId = companyId.(int)
  51 + }
  52 + if orgId, ok := data["orgId"]; ok {
  53 + productGroup.OrgId = orgId.(int)
  54 + }
  55 + if groupName, ok := data["groupName"]; ok {
  56 + productGroup.GroupName = groupName.(string)
  57 + }
  58 + if userId, ok := data["userId"]; ok {
  59 + productGroup.GroupLeader.UserId = userId.(int)
  60 + }
  61 + if userName, ok := data["userName"]; ok {
  62 + productGroup.GroupLeader.UserName = userName.(string)
  63 + }
  64 + if employeeType, ok := data["employeeType"]; ok {
  65 + productGroup.GroupLeader.EmployeeType = employeeType.(int)
  66 + }
  67 + if icCardNumber, ok := data["icCardNumber"]; ok {
  68 + productGroup.GroupLeader.IcCardNumber = icCardNumber.(string)
  69 + }
  70 + if avatar, ok := data["avatar"]; ok {
  71 + productGroup.GroupLeader.Avatar = avatar.(string)
  72 + }
  73 + if phone, ok := data["phone"]; ok {
  74 + productGroup.GroupLeader.Phone = phone.(string)
  75 + }
  76 + //if groupMembers, ok := data["groupMembers"]; ok {
  77 + // productGroup.GroupMembers = groupMembers.(array)
  78 + //}
  79 + if workOn, ok := data["workOn"]; ok {
  80 + productGroup.WorkOn = workOn.(int)
  81 + }
  82 + if workStationId, ok := data["workStationId"]; ok {
  83 + productGroup.WorkStation.WorkStationId = workStationId.(string)
  84 + }
  85 + if workshopId, ok := data["workshopId"]; ok {
  86 + productGroup.WorkStation.WorkshopId = workshopId.(int)
  87 + }
  88 + if workshopName, ok := data["workshopName"]; ok {
  89 + productGroup.WorkStation.WorkshopName = workshopName.(string)
  90 + }
  91 + if lineId, ok := data["lineId"]; ok {
  92 + productGroup.WorkStation.LineId = lineId.(int)
  93 + }
  94 + if lineName, ok := data["lineName"]; ok {
  95 + productGroup.WorkStation.LineName = lineName.(string)
  96 + }
  97 + if sectionId, ok := data["sectionId"]; ok {
  98 + productGroup.WorkStation.SectionId = sectionId.(int)
  99 + }
  100 + if sectionName, ok := data["sectionName"]; ok {
  101 + productGroup.WorkStation.SectionName = sectionName.(string)
  102 + }
  103 + if createdAt, ok := data["createdAt"]; ok {
  104 + productGroup.CreatedAt = createdAt.(time.Time)
  105 + }
  106 + if updatedAt, ok := data["updatedAt"]; ok {
  107 + productGroup.UpdatedAt = updatedAt.(time.Time)
  108 + }
  109 + if deletedAt, ok := data["deletedAt"]; ok {
  110 + productGroup.DeletedAt = deletedAt.(time.Time)
  111 + }
  112 + return nil
  113 +}
  1 +package domain
  2 +
  3 +import "time"
  4 +
  5 +// 工位(车间-生产线-工段-工位)
  6 +type ProductJob struct {
  7 + // 工位ID
  8 + ProductJobId int `json:"productJobId,omitempty"`
  9 + // 企业id
  10 + CompanyId int `json:"companyId,omitempty"`
  11 + // 组织ID
  12 + OrgId int `json:"orgId,omitempty"`
  13 + // 工位名称
  14 + JobName string `json:"jobName,omitempty"`
  15 + // 创建时间
  16 + CreatedAt time.Time `json:"createdAt,omitempty"`
  17 + // 更新时间
  18 + UpdatedAt time.Time `json:"updatedAt,omitempty"`
  19 + // 删除时间
  20 + DeletedAt time.Time `json:"deletedAt,omitempty"`
  21 + // 工作位置
  22 + WorkStation *WorkStation `json:"workStation,omitempty"`
  23 + // 关联设备列表
  24 + RelatedDevices []int `json:"relatedDevices,omitempty"`
  25 +}
  26 +
  27 +type ProductJobRepository interface {
  28 + Save(productJob *ProductJob) (*ProductJob, error)
  29 + Remove(productJob *ProductJob) (*ProductJob, error)
  30 + FindOne(queryOptions map[string]interface{}) (*ProductJob, error)
  31 + Find(queryOptions map[string]interface{}) (int64, []*ProductJob, error)
  32 +}
  33 +
  34 +func (productJob *ProductJob) Identify() interface{} {
  35 + if productJob.ProductJobId == 0 {
  36 + return nil
  37 + }
  38 + return productJob.ProductJobId
  39 +}
  40 +
  41 +func (productJob *ProductJob) Update(data map[string]interface{}) error {
  42 + if productJobId, ok := data["productJobId"]; ok {
  43 + productJob.ProductJobId = productJobId.(int)
  44 + }
  45 + if companyId, ok := data["companyId"]; ok {
  46 + productJob.CompanyId = companyId.(int)
  47 + }
  48 + if orgId, ok := data["orgId"]; ok {
  49 + productJob.OrgId = orgId.(int)
  50 + }
  51 + if jobName, ok := data["jobName"]; ok {
  52 + productJob.JobName = jobName.(string)
  53 + }
  54 + if createdAt, ok := data["createdAt"]; ok {
  55 + productJob.CreatedAt = createdAt.(time.Time)
  56 + }
  57 + if updatedAt, ok := data["updatedAt"]; ok {
  58 + productJob.UpdatedAt = updatedAt.(time.Time)
  59 + }
  60 + if deletedAt, ok := data["deletedAt"]; ok {
  61 + productJob.DeletedAt = deletedAt.(time.Time)
  62 + }
  63 + if workStationId, ok := data["workStationId"]; ok {
  64 + productJob.WorkStation.WorkStationId = workStationId.(string)
  65 + }
  66 + if workshopId, ok := data["workshopId"]; ok {
  67 + productJob.WorkStation.WorkshopId = workshopId.(int)
  68 + }
  69 + if workshopName, ok := data["workshopName"]; ok {
  70 + productJob.WorkStation.WorkshopName = workshopName.(string)
  71 + }
  72 + if lineId, ok := data["lineId"]; ok {
  73 + productJob.WorkStation.LineId = lineId.(int)
  74 + }
  75 + if lineName, ok := data["lineName"]; ok {
  76 + productJob.WorkStation.LineName = lineName.(string)
  77 + }
  78 + if sectionId, ok := data["sectionId"]; ok {
  79 + productJob.WorkStation.SectionId = sectionId.(int)
  80 + }
  81 + if sectionName, ok := data["sectionName"]; ok {
  82 + productJob.WorkStation.SectionName = sectionName.(string)
  83 + }
  84 + //if relatedDevices, ok := data["relatedDevices"]; ok {
  85 + // productJob.RelatedDevices = relatedDevices.(array)
  86 + //}
  87 + return nil
  88 +}
  1 +package domain
  2 +
  3 +// 生产线
  4 +type ProductLine struct {
  5 + // 生产线ID
  6 + LineId int `json:"lineId,omitempty"`
  7 + // 生产线名称
  8 + LineName string `json:"lineName,omitempty"`
  9 + // 工段列表
  10 + ProductSections []*ProductSection `json:"productSections,omitempty"`
  11 +}
  1 +package domain
  2 +
  3 +import "time"
  4 +
  5 +// 生产计划
  6 +type ProductPlan struct {
  7 + // 生产计划ID
  8 + ProductPlanId int `json:"productPlanId,omitempty"`
  9 + // 企业id
  10 + CompanyId int `json:"companyId,omitempty"`
  11 + // 组织ID
  12 + OrgId int `json:"orgId,omitempty"`
  13 + // 批号
  14 + BatchNumber string `json:"batchNumber,omitempty"`
  15 + // 生产日期
  16 + ProductDate time.Time `json:"productDate,omitempty"`
  17 + // 车间
  18 + Workshop *Workshop `json:"workshop,omitempty"`
  19 + // 上班班次 1:全天 2:白班 4:中班 8:夜班
  20 + WorkOn int `json:"workOn,omitempty"`
  21 + // 机台 (A、B、C、D 区分机器大小)
  22 + Machine string `json:"machine,omitempty"`
  23 + // 计划的产品名称
  24 + PlanProductName string `json:"planProductName,omitempty"`
  25 + // 计划投入
  26 + PlanDevoted *UnitQuantity `json:"planDevoted,omitempty"`
  27 + // 计划状态 (1:上线 2:下线 默认下线)
  28 + PlanStatus int `json:"planStatus,omitempty"`
  29 + // 工作位置
  30 + WorkStation *WorkStation `json:"workStation,omitempty"`
  31 + // 备注
  32 + Remark string `json:"remark,omitempty"`
  33 + // 创建时间
  34 + CreatedAt time.Time `json:"createdAt,omitempty"`
  35 + // 更新时间
  36 + UpdatedAt time.Time `json:"updatedAt,omitempty"`
  37 + // 删除时间
  38 + DeletedAt time.Time `json:"deletedAt,omitempty"`
  39 +}
  40 +
  41 +type ProductPlanRepository interface {
  42 + Save(productPlan *ProductPlan) (*ProductPlan, error)
  43 + Remove(productPlan *ProductPlan) (*ProductPlan, error)
  44 + FindOne(queryOptions map[string]interface{}) (*ProductPlan, error)
  45 + Find(queryOptions map[string]interface{}) (int64, []*ProductPlan, error)
  46 +}
  47 +
  48 +func (productPlan *ProductPlan) Identify() interface{} {
  49 + if productPlan.ProductPlanId == 0 {
  50 + return nil
  51 + }
  52 + return productPlan.ProductPlanId
  53 +}
  54 +
  55 +func (productPlan *ProductPlan) Update(data map[string]interface{}) error {
  56 + //if productPlanId, ok := data["productPlanId"]; ok {
  57 + // productPlan.ProductPlanId = productPlanId.(int)
  58 + //}
  59 + //if companyId, ok := data["companyId"]; ok {
  60 + // productPlan.CompanyId = companyId.(int)
  61 + //}
  62 + //if orgId, ok := data["orgId"]; ok {
  63 + // productPlan.OrgId = orgId.(int)
  64 + //}
  65 + //if batchNumber, ok := data["batchNumber"]; ok {
  66 + // productPlan.BatchNumber = batchNumber.(string)
  67 + //}
  68 + //if productDate, ok := data["productDate"]; ok {
  69 + // productPlan.ProductDate = productDate.(time.Time)
  70 + //}
  71 + //if companyId, ok := data["companyId"]; ok {
  72 + // productPlan.Workshop.CompanyId = companyId.(int)
  73 + //}
  74 + //if orgId, ok := data["orgId"]; ok {
  75 + // productPlan.Workshop.OrgId = orgId.(int)
  76 + //}
  77 + //if workshopId, ok := data["workshopId"]; ok {
  78 + // productPlan.Workshop.WorkshopId = workshopId.(int)
  79 + //}
  80 + //if workshopName, ok := data["workshopName"]; ok {
  81 + // productPlan.Workshop.WorkshopName = workshopName.(string)
  82 + //}
  83 + //if userId, ok := data["userId"]; ok {
  84 + // productPlan.Workshop.Principal.UserId = userId.(int)
  85 + //}
  86 + //if userName, ok := data["userName"]; ok {
  87 + // productPlan.Workshop.Principal.UserName = userName.(string)
  88 + //}
  89 + //if employeeType, ok := data["employeeType"]; ok {
  90 + // productPlan.Workshop.Principal.EmployeeType = employeeType.(int)
  91 + //}
  92 + //if icCardNumber, ok := data["icCardNumber"]; ok {
  93 + // productPlan.Workshop.Principal.IcCardNumber = icCardNumber.(string)
  94 + //}
  95 + //if avatar, ok := data["avatar"]; ok {
  96 + // productPlan.Workshop.Principal.Avatar = avatar.(string)
  97 + //}
  98 + //if phone, ok := data["phone"]; ok {
  99 + // productPlan.Workshop.Principal.Phone = phone.(string)
  100 + //}
  101 + //if productLines, ok := data["productLines"]; ok {
  102 + // productPlan.Workshop.ProductLines = productLines.(array)
  103 + //}
  104 + //if createdAt, ok := data["createdAt"]; ok {
  105 + // productPlan.Workshop.CreatedAt = createdAt.(time.Time)
  106 + //}
  107 + //if updatedAt, ok := data["updatedAt"]; ok {
  108 + // productPlan.Workshop.UpdatedAt = updatedAt.(time.Time)
  109 + //}
  110 + //if deletedAt, ok := data["deletedAt"]; ok {
  111 + // productPlan.Workshop.DeletedAt = deletedAt.(time.Time)
  112 + //}
  113 + //if workOn, ok := data["workOn"]; ok {
  114 + // productPlan.WorkOn = workOn.(int)
  115 + //}
  116 + //if machine, ok := data["machine"]; ok {
  117 + // productPlan.Machine = machine.(string)
  118 + //}
  119 + //if planProductName, ok := data["planProductName"]; ok {
  120 + // productPlan.PlanProductName = planProductName.(string)
  121 + //}
  122 + //if quantity, ok := data["quantity"]; ok {
  123 + // productPlan.PlanDevoted.Quantity = quantity.(float64)
  124 + //}
  125 + //if unit, ok := data["unit"]; ok {
  126 + // productPlan.PlanDevoted.Unit = unit.(string)
  127 + //}
  128 + //if unitWeight, ok := data["unitWeight"]; ok {
  129 + // productPlan.PlanDevoted.UnitWeight = unitWeight.(float64)
  130 + //}
  131 + //if weight, ok := data["weight"]; ok {
  132 + // productPlan.PlanDevoted.Weight = weight.(float64)
  133 + //}
  134 + //if planStatus, ok := data["planStatus"]; ok {
  135 + // productPlan.PlanStatus = planStatus.(int)
  136 + //}
  137 + //if workStationId, ok := data["workStationId"]; ok {
  138 + // productPlan.WorkStation.WorkStationId = workStationId.(string)
  139 + //}
  140 + //if workshopId, ok := data["workshopId"]; ok {
  141 + // productPlan.WorkStation.WorkshopId = workshopId.(int)
  142 + //}
  143 + //if workshopName, ok := data["workshopName"]; ok {
  144 + // productPlan.WorkStation.WorkshopName = workshopName.(string)
  145 + //}
  146 + //if lineId, ok := data["lineId"]; ok {
  147 + // productPlan.WorkStation.LineId = lineId.(int)
  148 + //}
  149 + //if lineName, ok := data["lineName"]; ok {
  150 + // productPlan.WorkStation.LineName = lineName.(string)
  151 + //}
  152 + //if sectionId, ok := data["sectionId"]; ok {
  153 + // productPlan.WorkStation.SectionId = sectionId.(int)
  154 + //}
  155 + //if sectionName, ok := data["sectionName"]; ok {
  156 + // productPlan.WorkStation.SectionName = sectionName.(string)
  157 + //}
  158 + //if remark, ok := data["remark"]; ok {
  159 + // productPlan.Remark = remark.(string)
  160 + //}
  161 + //if createdAt, ok := data["createdAt"]; ok {
  162 + // productPlan.CreatedAt = createdAt.(time.Time)
  163 + //}
  164 + //if updatedAt, ok := data["updatedAt"]; ok {
  165 + // productPlan.UpdatedAt = updatedAt.(time.Time)
  166 + //}
  167 + //if deletedAt, ok := data["deletedAt"]; ok {
  168 + // productPlan.DeletedAt = deletedAt.(time.Time)
  169 + //}
  170 + return nil
  171 +}
  1 +package domain
  2 +
  3 +import "time"
  4 +
  5 +// 生产记录
  6 +type ProductRecord struct {
  7 + // 生产记录ID
  8 + ProductRecordId int `json:"productRecordId,omitempty"`
  9 + // 企业id
  10 + CompanyId int `json:"companyId,omitempty"`
  11 + // 组织ID
  12 + OrgId int `json:"orgId,omitempty"`
  13 + // 生产记录类型:1:领料 2:退料 4:称重 8:二级品称重
  14 + ProductRecordType int `json:"productRecordType,omitempty"`
  15 + // 生产工人
  16 + ProductWorker *User `json:"productWorker,omitempty"`
  17 + // 工作位置
  18 + WorkStation *WorkStation `json:"workStation,omitempty"`
  19 + // 创建时间
  20 + CreatedAt time.Time `json:"createdAt,omitempty"`
  21 + // 更新时间
  22 + UpdatedAt time.Time `json:"updatedAt,omitempty"`
  23 + // 删除时间
  24 + DeletedAt time.Time `json:"deletedAt,omitempty"`
  25 + // 生产记录信息
  26 + ProductRecordInfo *ProductRecordInfo `json:"productRecordInfo,omitempty"`
  27 +}
  28 +
  29 +type ProductRecordRepository interface {
  30 + Save(productRecord *ProductRecord) (*ProductRecord, error)
  31 + Remove(productRecord *ProductRecord) (*ProductRecord, error)
  32 + FindOne(queryOptions map[string]interface{}) (*ProductRecord, error)
  33 + Find(queryOptions map[string]interface{}) (int64, []*ProductRecord, error)
  34 +}
  35 +
  36 +func (productRecord *ProductRecord) Identify() interface{} {
  37 + if productRecord.ProductRecordId == 0 {
  38 + return nil
  39 + }
  40 + return productRecord.ProductRecordId
  41 +}
  42 +
  43 +func (productRecord *ProductRecord) Update(data map[string]interface{}) error {
  44 + return nil
  45 +}
  1 +package domain
  2 +
  3 +// 生产记录信息 (物料、批次、产能(产能、领料、退料、二级品))
  4 +type ProductRecordInfo struct {
  5 + // 产能
  6 + ProductWeigh int `json:"productWeigh,omitempty"`
  7 + // 物料信息
  8 + Material *UnitConversion `json:"material,omitempty"`
  9 + // 生产计划信息(批次)
  10 + ProductPlan *ProductPlan `json:"productPlan,omitempty"`
  11 +}
  1 +package domain
  2 +
  3 +// 工段
  4 +type ProductSection struct {
  5 + // 工段ID
  6 + SectionId int `json:"sectionId,omitempty"`
  7 + // 工段名称
  8 + SectionName string `json:"sectionName,omitempty"`
  9 +}
  1 +package domain
  2 +
  3 +import "time"
  4 +
  5 +// 单位换算
  6 +type UnitConversion struct {
  7 + // 单位换算ID
  8 + UnitConversionId int `json:"unitConversionId,omitempty"`
  9 + // 企业id
  10 + CompanyId int `json:"companyId,omitempty"`
  11 + // 组织ID
  12 + OrgId int `json:"orgId,omitempty"`
  13 + // 工作位置
  14 + WorkStation *WorkStation `json:"workStation,omitempty"`
  15 + // material
  16 + Material *Material `json:"material,omitempty"`
  17 + // 转换前单位数量
  18 + FromUnitQuantity *UnitQuantity `json:"fromUnitQuantity,omitempty"`
  19 + // 转换后单位数量
  20 + ToUnitQuantity *UnitQuantity `json:"toUnitQuantity,omitempty"`
  21 + // 智能称重标识
  22 + IntelligentWeighingFlag bool `json:"intelligentWeighingFlag,omitempty"`
  23 + // 创建时间
  24 + CreatedAt time.Time `json:"createdAt,omitempty"`
  25 + // 更新时间
  26 + UpdatedAt time.Time `json:"updatedAt,omitempty"`
  27 + // 删除时间
  28 + DeletedAt time.Time `json:"deletedAt,omitempty"`
  29 +}
  30 +
  31 +type UnitConversionRepository interface {
  32 + Save(unitConversion *UnitConversion) (*UnitConversion, error)
  33 + Remove(unitConversion *UnitConversion) (*UnitConversion, error)
  34 + FindOne(queryOptions map[string]interface{}) (*UnitConversion, error)
  35 + Find(queryOptions map[string]interface{}) (int64, []*UnitConversion, error)
  36 +}
  37 +
  38 +func (unitConversion *UnitConversion) Identify() interface{} {
  39 + if unitConversion.UnitConversionId == 0 {
  40 + return nil
  41 + }
  42 + return unitConversion.UnitConversionId
  43 +}
  44 +
  45 +func (unitConversion *UnitConversion) Update(data map[string]interface{}) error {
  46 + if unitConversionId, ok := data["unitConversionId"]; ok {
  47 + unitConversion.UnitConversionId = unitConversionId.(int)
  48 + }
  49 + if companyId, ok := data["companyId"]; ok {
  50 + unitConversion.CompanyId = companyId.(int)
  51 + }
  52 + if orgId, ok := data["orgId"]; ok {
  53 + unitConversion.OrgId = orgId.(int)
  54 + }
  55 + if workStationId, ok := data["workStationId"]; ok {
  56 + unitConversion.WorkStation.WorkStationId = workStationId.(string)
  57 + }
  58 + if workshopId, ok := data["workshopId"]; ok {
  59 + unitConversion.WorkStation.WorkshopId = workshopId.(int)
  60 + }
  61 + if workshopName, ok := data["workshopName"]; ok {
  62 + unitConversion.WorkStation.WorkshopName = workshopName.(string)
  63 + }
  64 + if lineId, ok := data["lineId"]; ok {
  65 + unitConversion.WorkStation.LineId = lineId.(int)
  66 + }
  67 + if lineName, ok := data["lineName"]; ok {
  68 + unitConversion.WorkStation.LineName = lineName.(string)
  69 + }
  70 + if sectionId, ok := data["sectionId"]; ok {
  71 + unitConversion.WorkStation.SectionId = sectionId.(int)
  72 + }
  73 + if sectionName, ok := data["sectionName"]; ok {
  74 + unitConversion.WorkStation.SectionName = sectionName.(string)
  75 + }
  76 + if materialName, ok := data["materialName"]; ok {
  77 + unitConversion.Material.MaterialName = materialName.(string)
  78 + }
  79 + if materialCategory, ok := data["materialCategory"]; ok {
  80 + unitConversion.Material.MaterialCategory = materialCategory.(string)
  81 + }
  82 + if quantity, ok := data["quantity"]; ok {
  83 + unitConversion.FromUnitQuantity.Quantity = quantity.(float64)
  84 + }
  85 + if unit, ok := data["unit"]; ok {
  86 + unitConversion.FromUnitQuantity.Unit = unit.(string)
  87 + }
  88 + if unitWeight, ok := data["unitWeight"]; ok {
  89 + unitConversion.FromUnitQuantity.UnitWeight = unitWeight.(float64)
  90 + }
  91 + if weight, ok := data["weight"]; ok {
  92 + unitConversion.FromUnitQuantity.Weight = weight.(float64)
  93 + }
  94 + //if quantity, ok := data["quantity"]; ok {
  95 + // unitConversion.ToUnitQuantity.FromUnitQuantity.Quantity = quantity.(float64)
  96 + //}
  97 + //if unit, ok := data["unit"]; ok {
  98 + // unitConversion.ToUnitQuantity.FromUnitQuantity.Unit = unit.(string)
  99 + //}
  100 + //if unitWeight, ok := data["unitWeight"]; ok {
  101 + // unitConversion.ToUnitQuantity.FromUnitQuantity.UnitWeight = unitWeight.(float64)
  102 + //}
  103 + //if weight, ok := data["weight"]; ok {
  104 + // unitConversion.ToUnitQuantity.FromUnitQuantity.Weight = weight.(float64)
  105 + //}
  106 + //if intelligentWeighingFlag, ok := data["intelligentWeighingFlag"]; ok {
  107 + // unitConversion.IntelligentWeighingFlag = intelligentWeighingFlag.(boolean)
  108 + //}
  109 + if createdAt, ok := data["createdAt"]; ok {
  110 + unitConversion.CreatedAt = createdAt.(time.Time)
  111 + }
  112 + if updatedAt, ok := data["updatedAt"]; ok {
  113 + unitConversion.UpdatedAt = updatedAt.(time.Time)
  114 + }
  115 + if deletedAt, ok := data["deletedAt"]; ok {
  116 + unitConversion.DeletedAt = deletedAt.(time.Time)
  117 + }
  118 + return nil
  119 +}
  1 +package domain
  2 +
  3 +// 单位数量
  4 +type UnitQuantity struct {
  5 + // 数量(保留两位小数)
  6 + Quantity float64 `json:"quantity,omitempty"`
  7 + // 单位
  8 + Unit string `json:"unit,omitempty"`
  9 + // 单份重量(原材料)
  10 + UnitWeight float64 `json:"unitWeight,omitempty"`
  11 + // 重量
  12 + Weight float64 `json:"weight,omitempty"`
  13 +}
  1 +package domain
  2 +
  3 +// 用户对象
  4 +type User struct {
  5 + // 用户Id 用户唯一标识
  6 + UserId int `json:"userId,omitempty"`
  7 + // 用户姓名
  8 + UserName string `json:"userName,omitempty"`
  9 + // 员工类型 1:固定 2:派遣 3.临时
  10 + EmployeeType int `json:"employeeType,omitempty"`
  11 + // IC卡号
  12 + IcCardNumber string `json:"icCardNumber,omitempty"`
  13 + // 头像
  14 + Avatar string `json:"avatar,omitempty"`
  15 + // 手机号码
  16 + Phone string `json:"phone,omitempty"`
  17 +}
  1 +package domain
  2 +
  3 +// 工作位置(车间、生产线、工段组成),唯一标识工作位置
  4 +type WorkStation struct {
  5 + // 工作位置键值 (车间ID+'.'+生产线ID+'.'+工段ID)
  6 + WorkStationId string `json:"workStationId,omitempty"`
  7 + // 车间ID
  8 + WorkshopId int `json:"workshopId,omitempty"`
  9 + // 车间名称
  10 + WorkshopName string `json:"workshopName,omitempty"`
  11 + // 生产线ID
  12 + LineId int `json:"lineId,omitempty"`
  13 + // 生产线名称
  14 + LineName string `json:"lineName,omitempty"`
  15 + // 工段ID
  16 + SectionId int `json:"sectionId,omitempty"`
  17 + // 工段名称
  18 + SectionName string `json:"sectionName,omitempty"`
  19 +}
  1 +package domain
  2 +
  3 +import "time"
  4 +
  5 +// 车间
  6 +type Workshop struct {
  7 + // 企业id
  8 + CompanyId int `json:"companyId,omitempty"`
  9 + // 组织ID
  10 + OrgId int `json:"orgId,omitempty"`
  11 + // 车间ID
  12 + WorkshopId int `json:"workshopId,omitempty"`
  13 + // 车间名称
  14 + WorkshopName string `json:"workshopName,omitempty"`
  15 + // 负责人 (用户对象)
  16 + Principal *User `json:"principal,omitempty"`
  17 + // 生产线
  18 + ProductLines []*ProductLine `json:"productLines,omitempty"`
  19 + // 创建时间
  20 + CreatedAt time.Time `json:"createdAt,omitempty"`
  21 + // 更新时间
  22 + UpdatedAt time.Time `json:"updatedAt,omitempty"`
  23 + // 删除时间
  24 + DeletedAt time.Time `json:"deletedAt,omitempty"`
  25 +}
  26 +
  27 +type WorkshopRepository interface {
  28 + Save(workshop *Workshop) (*Workshop, error)
  29 + Remove(workshop *Workshop) (*Workshop, error)
  30 + FindOne(queryOptions map[string]interface{}) (*Workshop, error)
  31 + Find(queryOptions map[string]interface{}) (int64, []*Workshop, error)
  32 +}
  33 +
  34 +func (workshop *Workshop) Identify() interface{} {
  35 + if workshop.WorkshopId == 0 {
  36 + return nil
  37 + }
  38 + return workshop.WorkshopId
  39 +}
  40 +
  41 +func (workshop *Workshop) Update(data map[string]interface{}) error {
  42 + //if companyId, ok := data["companyId"]; ok {
  43 + // workshop.CompanyId = companyId.(int)
  44 + //}
  45 + //if orgId, ok := data["orgId"]; ok {
  46 + // workshop.OrgId = orgId.(int)
  47 + //}
  48 + //if workshopId, ok := data["workshopId"]; ok {
  49 + // workshop.WorkshopId = workshopId.(int)
  50 + //}
  51 + if workshopName, ok := data["workshopName"]; ok {
  52 + workshop.WorkshopName = workshopName.(string)
  53 + }
  54 + if userId, ok := data["userId"]; ok {
  55 + workshop.Principal.UserId = userId.(int)
  56 + }
  57 + if userName, ok := data["userName"]; ok {
  58 + workshop.Principal.UserName = userName.(string)
  59 + }
  60 + if employeeType, ok := data["employeeType"]; ok {
  61 + workshop.Principal.EmployeeType = employeeType.(int)
  62 + }
  63 + if icCardNumber, ok := data["icCardNumber"]; ok {
  64 + workshop.Principal.IcCardNumber = icCardNumber.(string)
  65 + }
  66 + if avatar, ok := data["avatar"]; ok {
  67 + workshop.Principal.Avatar = avatar.(string)
  68 + }
  69 + if phone, ok := data["phone"]; ok {
  70 + workshop.Principal.Phone = phone.(string)
  71 + }
  72 + //if productLines, ok := data["productLines"]; ok {
  73 + // workshop.ProductLines = productLines.(array)
  74 + //}
  75 + if createdAt, ok := data["createdAt"]; ok {
  76 + workshop.CreatedAt = createdAt.(time.Time)
  77 + }
  78 + if updatedAt, ok := data["updatedAt"]; ok {
  79 + workshop.UpdatedAt = updatedAt.(time.Time)
  80 + }
  81 + if deletedAt, ok := data["deletedAt"]; ok {
  82 + workshop.DeletedAt = deletedAt.(time.Time)
  83 + }
  84 + return nil
  85 +}
  1 +package pg
  2 +
  3 +import (
  4 + "fmt"
  5 + "github.com/go-pg/pg/v10"
  6 + "github.com/go-pg/pg/v10/orm"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/constant"
  8 +
  9 + //_ "gitlab.fjmaimaimai.com/allied-creation/manufacture/pkg/infrastructure/pg/models"
  10 + "github.com/linmadan/egglib-go/persistent/pg/comment"
  11 + "github.com/linmadan/egglib-go/persistent/pg/hooks"
  12 +)
  13 +
  14 +var DB *pg.DB
  15 +
  16 +func init() {
  17 + DB = pg.Connect(&pg.Options{
  18 + User: constant.POSTGRESQL_USER,
  19 + Password: constant.POSTGRESQL_PASSWORD,
  20 + Database: constant.POSTGRESQL_DB_NAME,
  21 + Addr: fmt.Sprintf("%s:%s", constant.POSTGRESQL_HOST, constant.POSTGRESQL_PORT),
  22 + })
  23 + if !constant.DISABLE_SQL_GENERATE_PRINT {
  24 + DB.AddQueryHook(hooks.SqlGeneratePrintHook{})
  25 + }
  26 + if !constant.DISABLE_CREATE_TABLE {
  27 + for _, model := range []interface{}{} {
  28 + err := DB.Model(model).CreateTable(&orm.CreateTableOptions{
  29 + Temp: false,
  30 + IfNotExists: true,
  31 + FKConstraints: true,
  32 + })
  33 + if err != nil {
  34 + panic(err)
  35 + }
  36 + comment.AddComments(DB, model)
  37 + }
  38 + }
  39 +}
  1 +package models
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "time"
  6 +)
  7 +
  8 +type Device struct {
  9 + tableName string `comment:"设备" pg:"devices,alias:device"`
  10 + // 设备Id
  11 + DeviceId int `comment:"设备Id" pg:"pk:device_id"`
  12 + // 企业id
  13 + CompanyId int `comment:"企业id"`
  14 + // 组织ID
  15 + OrgId int `comment:"组织ID"`
  16 + // 设备编号
  17 + DeviceCode string `comment:"设备编号"`
  18 + // 设备名称
  19 + DeviceName string `comment:"设备名称"`
  20 + // 设备型号
  21 + DeviceModel string `comment:"设备型号"`
  22 + // 设备类型
  23 + DeviceType string `comment:"设备类型"`
  24 + // 品牌
  25 + Brand string `comment:"品牌"`
  26 + // 设备状态 1:正常 2:封存 3:报废
  27 + DeviceStatus int `comment:"设备状态 1:正常 2:封存 3:报废"`
  28 + // 风险等级 1:高 2:中 3:低
  29 + RiskLevel int `comment:"风险等级 1:高 2:中 3:低"`
  30 + // 创建时间
  31 + CreatedAt time.Time `comment:"创建时间"`
  32 + // 更新时间
  33 + UpdatedAt time.Time `comment:"更新时间"`
  34 + // 删除时间
  35 + DeletedAt time.Time `comment:"删除时间"`
  36 + // 所属位置
  37 + WorkStation *domain.WorkStation `comment:"所属位置"`
  38 +}
  1 +package models
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "time"
  6 +)
  7 +
  8 +type Product struct {
  9 + tableName string `comment:"产品信息" pg:"products,alias:product"`
  10 + // 企业id
  11 + CompanyId int `comment:"企业id"`
  12 + // 组织ID
  13 + OrgId int `comment:"组织ID"`
  14 + // 产品ID
  15 + ProductId int `comment:"产品ID" pg:"pk:product_id"`
  16 + // 产品编号 编码规则为“CP”+2 位年+2 位月+2 位日+3 位流水码,如 CP211229001
  17 + ProductCode string `comment:"产品编号 编码规则为“CP”+2 位年+2 位月+2 位日+3 位流水码,如 CP211229001"`
  18 + // 产品名称
  19 + ProductName string `comment:"产品名称"`
  20 + // 产品类别
  21 + ProductCategory string `comment:"产品类别"`
  22 + // 产品规格
  23 + ProductSpec *domain.UnitQuantity `comment:"产品规格"`
  24 + // 创建时间
  25 + CreatedAt time.Time `comment:"创建时间"`
  26 + // 更新时间
  27 + UpdatedAt time.Time `comment:"更新时间"`
  28 + // 删除时间
  29 + DeletedAt time.Time `comment:"删除时间"`
  30 +}
  1 +package models
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "time"
  6 +)
  7 +
  8 +type ProductAttendanceRecord struct {
  9 + tableName string `comment:"生产考勤记录" pg:"product_attendance_records,alias:product_attendance_record"`
  10 + // 考勤记录ID
  11 + ProductAttendanceId int `comment:"考勤记录ID"`
  12 + // 组织ID
  13 + OrgId int `comment:"组织ID"`
  14 + // 产品ID
  15 + ProductId int `comment:"产品ID"`
  16 + // 考勤类型 1.正常 2.支援
  17 + AttendanceType int `comment:"考勤类型 1.正常 2.支援"`
  18 + // 生产工人
  19 + ProductWorker *domain.User `comment:"生产工人"`
  20 + // 工作位置
  21 + WorkStation *domain.WorkStation `comment:"工作位置"`
  22 + // 签到
  23 + SignIn time.Time `comment:"签到"`
  24 + // 签退
  25 + SignOut time.Time `comment:"签退"`
  26 + // 考勤状态 1.未审核 2:已审核 3.自动审核
  27 + AttendanceStatus int `comment:"考勤状态 1.未审核 2:已审核 3.自动审核"`
  28 + // 工时(审核前)
  29 + WorkTimeBefore float64 `comment:"工时(审核前)"`
  30 + // 工时(审核后)
  31 + WorkTimeAfter float64 `comment:"工时(审核后)"`
  32 + // 创建时间
  33 + CreatedAt time.Time `comment:"创建时间"`
  34 + // 更新时间
  35 + UpdatedAt time.Time `comment:"更新时间"`
  36 + // 删除时间
  37 + DeletedAt time.Time `comment:"删除时间"`
  38 +}
  1 +package models
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "time"
  6 +)
  7 +
  8 +type ProductCalendar struct {
  9 + tableName string `comment:"工厂日历" pg:"product_calendars,alias:product_calendar"`
  10 + // 工厂日历ID
  11 + ProductCalendarId int `comment:"工厂日历ID" pg:"pk:product_calendar_id"`
  12 + // 企业id
  13 + CompanyId int `comment:"企业id"`
  14 + // 组织ID
  15 + OrgId int `comment:"组织ID"`
  16 + // 工作位置
  17 + WorkStation *domain.WorkStation `comment:"工作位置"`
  18 + // 上班班次 1:全天 2:白班 4:中班 8:夜班
  19 + WorkOn int `comment:"上班班次 1:全天 2:白班 4:中班 8:夜班"`
  20 + // 日历选择
  21 + CalendarSelected []string `comment:"日历选择" pg:",array"`
  22 + // 上岗时间
  23 + InWorkAt string `comment:"上岗时间"`
  24 + // 下岗时间
  25 + OutWorkAt string `comment:"下岗时间"`
  26 + // 休息时间 (单位 h)
  27 + BreakTime float64 `comment:"休息时间 (单位 h)"`
  28 + // 工时 (单位 h)
  29 + WorkTime float64 `comment:"工时 (单位 h)"`
  30 + // 创建时间
  31 + CreatedAt time.Time `comment:"创建时间"`
  32 + // 更新时间
  33 + UpdatedAt time.Time `comment:"更新时间"`
  34 + // 删除时间
  35 + DeletedAt time.Time `comment:"删除时间"`
  36 +}
  1 +package models
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "time"
  6 +)
  7 +
  8 +type ProductGroup struct {
  9 + tableName string `comment:"生产班组" pg:"product_groups,alias:product_group"`
  10 + // 生产小组ID
  11 + ProductGroupId int `comment:"生产小组ID" pg:"pk:product_group_id"`
  12 + // 企业id
  13 + CompanyId int `comment:"企业id"`
  14 + // 组织ID
  15 + OrgId int `comment:"组织ID"`
  16 + // 班组名称
  17 + GroupName string `comment:"班组名称"`
  18 + // 班组长
  19 + GroupLeader *domain.User `comment:"班组长"`
  20 + // 帮组成员列表
  21 + GroupMembers []*domain.User `comment:"帮组成员列表" pg:",array"`
  22 + // 上班班次 1:全天 2:白班 4:中班 8:夜班
  23 + WorkOn int `comment:"上班班次 1:全天 2:白班 4:中班 8:夜班"`
  24 + // 工作位置
  25 + WorkStation *domain.WorkStation `comment:"工作位置"`
  26 + // 创建时间
  27 + CreatedAt time.Time `comment:"创建时间"`
  28 + // 更新时间
  29 + UpdatedAt time.Time `comment:"更新时间"`
  30 + // 删除时间
  31 + DeletedAt time.Time `comment:"删除时间"`
  32 +}
  1 +package models
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "time"
  6 +)
  7 +
  8 +type ProductJob struct {
  9 + tableName string `comment:"工位(车间-生产线-工段-工位)" pg:"product_jobs,alias:product_job"`
  10 + // 工位ID
  11 + ProductJobId int `comment:"工位ID" pg:"pk:product_job_id"`
  12 + // 企业id
  13 + CompanyId int `comment:"企业id"`
  14 + // 组织ID
  15 + OrgId int `comment:"组织ID"`
  16 + // 工位名称
  17 + JobName string `comment:"工位名称"`
  18 + // 创建时间
  19 + CreatedAt time.Time `comment:"创建时间"`
  20 + // 更新时间
  21 + UpdatedAt time.Time `comment:"更新时间"`
  22 + // 删除时间
  23 + DeletedAt time.Time `comment:"删除时间"`
  24 + // 工作位置
  25 + WorkStation *domain.WorkStation `comment:"工作位置"`
  26 + // 关联设备列表
  27 + RelatedDevices []int `comment:"关联设备列表" pg:",array"`
  28 +}
  1 +package models
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "time"
  6 +)
  7 +
  8 +type ProductPlan struct {
  9 + tableName string `comment:"生产计划" pg:"product_plans,alias:product_plan"`
  10 + // 生产计划ID
  11 + ProductPlanId int `comment:"生产计划ID" pg:"pk:product_plan_id"`
  12 + // 企业id
  13 + CompanyId int `comment:"企业id"`
  14 + // 组织ID
  15 + OrgId int `comment:"组织ID"`
  16 + // 批号
  17 + BatchNumber string `comment:"批号"`
  18 + // 生产日期
  19 + ProductDate time.Time `comment:"生产日期"`
  20 + // 车间
  21 + Workshop *domain.Workshop `comment:"车间"`
  22 + // 上班班次 1:全天 2:白班 4:中班 8:夜班
  23 + WorkOn int `comment:"上班班次 1:全天 2:白班 4:中班 8:夜班"`
  24 + // 机台 (A、B、C、D 区分机器大小)
  25 + Machine string `comment:"机台 (A、B、C、D 区分机器大小)"`
  26 + // 计划的产品名称
  27 + PlanProductName string `comment:"计划的产品名称"`
  28 + // 计划投入
  29 + PlanDevoted *domain.UnitQuantity `comment:"计划投入"`
  30 + // 计划状态 (1:上线 2:下线 默认下线)
  31 + PlanStatus int `comment:"计划状态 (1:上线 2:下线 默认下线)"`
  32 + // 工作位置
  33 + WorkStation *domain.WorkStation `comment:"工作位置"`
  34 + // 备注
  35 + Remark string `comment:"备注"`
  36 + // 创建时间
  37 + CreatedAt time.Time `comment:"创建时间"`
  38 + // 更新时间
  39 + UpdatedAt time.Time `comment:"更新时间"`
  40 + // 删除时间
  41 + DeletedAt time.Time `comment:"删除时间"`
  42 +}
  1 +package models
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "time"
  6 +)
  7 +
  8 +type ProductRecord struct {
  9 + tableName string `comment:"生产记录" pg:"product_records,alias:product_record"`
  10 + // 生产记录ID
  11 + ProductRecordId int `comment:"生产记录ID" pg:"pk:product_record_id"`
  12 + // 企业id
  13 + CompanyId int `comment:"企业id"`
  14 + // 组织ID
  15 + OrgId int `comment:"组织ID"`
  16 + // 生产记录类型:1:领料 2:退料 4:称重 8:二级品称重
  17 + ProductRecordType int `comment:"生产记录类型:1:领料 2:退料 4:称重 8:二级品称重"`
  18 + // 生产工人
  19 + ProductWorker *domain.User `comment:"生产工人"`
  20 + // 工作位置
  21 + WorkStation *domain.WorkStation `comment:"工作位置"`
  22 + // 创建时间
  23 + CreatedAt time.Time `comment:"创建时间"`
  24 + // 更新时间
  25 + UpdatedAt time.Time `comment:"更新时间"`
  26 + // 删除时间
  27 + DeletedAt time.Time `comment:"删除时间"`
  28 + // 生产记录信息
  29 + ProductRecordInfo *domain.ProductRecordInfo `comment:"生产记录信息"`
  30 +}
  1 +package models
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "time"
  6 +)
  7 +
  8 +type UnitConversion struct {
  9 + tableName string `comment:"单位换算" pg:"unit_conversions,alias:unit_conversion"`
  10 + // 单位换算ID
  11 + UnitConversionId int `comment:"单位换算ID" pg:"pk:unit_conversion_id"`
  12 + // 企业id
  13 + CompanyId int `comment:"企业id"`
  14 + // 组织ID
  15 + OrgId int `comment:"组织ID"`
  16 + // 工作位置
  17 + WorkStation *domain.WorkStation `comment:"工作位置"`
  18 + // material
  19 + Material *domain.Material `comment:"material"`
  20 + // 转换前单位数量
  21 + FromUnitQuantity *domain.UnitQuantity `comment:"转换前单位数量"`
  22 + // 转换后单位数量
  23 + ToUnitQuantity *domain.UnitQuantity `comment:"转换后单位数量"`
  24 + // 智能称重标识
  25 + IntelligentWeighingFlag bool `comment:"智能称重标识"`
  26 + // 创建时间
  27 + CreatedAt time.Time `comment:"创建时间"`
  28 + // 更新时间
  29 + UpdatedAt time.Time `comment:"更新时间"`
  30 + // 删除时间
  31 + DeletedAt time.Time `comment:"删除时间"`
  32 +}
  1 +package models
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "time"
  6 +)
  7 +
  8 +type Workshop struct {
  9 + tableName string `comment:"车间" pg:"workshops,alias:workshop"`
  10 + // 企业id
  11 + CompanyId int `comment:"企业id"`
  12 + // 组织ID
  13 + OrgId int `comment:"组织ID"`
  14 + // 车间ID
  15 + WorkshopId int `comment:"车间ID" pg:"pk:workshop_id"`
  16 + // 车间名称
  17 + WorkshopName string `comment:"车间名称"`
  18 + // 负责人 (用户对象)
  19 + Principal *domain.User `comment:"负责人 (用户对象)"`
  20 + // 生产线
  21 + ProductLines []*domain.ProductLine `comment:"生产线" pg:",array"`
  22 + // 创建时间
  23 + CreatedAt time.Time `comment:"创建时间"`
  24 + // 更新时间
  25 + UpdatedAt time.Time `comment:"更新时间"`
  26 + // 删除时间
  27 + DeletedAt time.Time `comment:"删除时间"`
  28 +}
  1 +package transform
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  6 +)
  7 +
  8 +func TransformToDeviceDomainModelFromPgModels(deviceModel *models.Device) (*domain.Device, error) {
  9 + return &domain.Device{
  10 + DeviceId: deviceModel.DeviceId,
  11 + CompanyId: deviceModel.CompanyId,
  12 + OrgId: deviceModel.OrgId,
  13 + DeviceCode: deviceModel.DeviceCode,
  14 + DeviceName: deviceModel.DeviceName,
  15 + DeviceModel: deviceModel.DeviceModel,
  16 + DeviceType: deviceModel.DeviceType,
  17 + Brand: deviceModel.Brand,
  18 + DeviceStatus: deviceModel.DeviceStatus,
  19 + RiskLevel: deviceModel.RiskLevel,
  20 + CreatedAt: deviceModel.CreatedAt,
  21 + UpdatedAt: deviceModel.UpdatedAt,
  22 + DeletedAt: deviceModel.DeletedAt,
  23 + WorkStation: deviceModel.WorkStation,
  24 + }, nil
  25 +}
  1 +package transform
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  6 +)
  7 +
  8 +func TransformToProductDomainModelFromPgModels(productModel *models.Product) (*domain.Product, error) {
  9 + return &domain.Product{
  10 + CompanyId: productModel.CompanyId,
  11 + OrgId: productModel.OrgId,
  12 + ProductId: productModel.ProductId,
  13 + ProductCode: productModel.ProductCode,
  14 + ProductName: productModel.ProductName,
  15 + ProductCategory: productModel.ProductCategory,
  16 + ProductSpec: productModel.ProductSpec,
  17 + CreatedAt: productModel.CreatedAt,
  18 + UpdatedAt: productModel.UpdatedAt,
  19 + DeletedAt: productModel.DeletedAt,
  20 + }, nil
  21 +}
  1 +package transform
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  6 +)
  7 +
  8 +func TransformToProductAttendanceRecordDomainModelFromPgModels(productAttendanceRecordModel *models.ProductAttendanceRecord) (*domain.ProductAttendanceRecord, error) {
  9 + return &domain.ProductAttendanceRecord{
  10 + ProductAttendanceId: productAttendanceRecordModel.ProductAttendanceId,
  11 + OrgId: productAttendanceRecordModel.OrgId,
  12 + ProductId: productAttendanceRecordModel.ProductId,
  13 + AttendanceType: productAttendanceRecordModel.AttendanceType,
  14 + ProductWorker: productAttendanceRecordModel.ProductWorker,
  15 + WorkStation: productAttendanceRecordModel.WorkStation,
  16 + SignIn: productAttendanceRecordModel.SignIn,
  17 + SignOut: productAttendanceRecordModel.SignOut,
  18 + AttendanceStatus: productAttendanceRecordModel.AttendanceStatus,
  19 + WorkTimeBefore: productAttendanceRecordModel.WorkTimeBefore,
  20 + WorkTimeAfter: productAttendanceRecordModel.WorkTimeAfter,
  21 + CreatedAt: productAttendanceRecordModel.CreatedAt,
  22 + UpdatedAt: productAttendanceRecordModel.UpdatedAt,
  23 + DeletedAt: productAttendanceRecordModel.DeletedAt,
  24 + }, nil
  25 +}
  1 +package transform
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  6 +)
  7 +
  8 +func TransformToProductCalendarDomainModelFromPgModels(productCalendarModel *models.ProductCalendar) (*domain.ProductCalendar, error) {
  9 + return &domain.ProductCalendar{
  10 + ProductCalendarId: productCalendarModel.ProductCalendarId,
  11 + CompanyId: productCalendarModel.CompanyId,
  12 + OrgId: productCalendarModel.OrgId,
  13 + WorkStation: productCalendarModel.WorkStation,
  14 + WorkOn: productCalendarModel.WorkOn,
  15 + CalendarSelected: productCalendarModel.CalendarSelected,
  16 + InWorkAt: productCalendarModel.InWorkAt,
  17 + OutWorkAt: productCalendarModel.OutWorkAt,
  18 + BreakTime: productCalendarModel.BreakTime,
  19 + WorkTime: productCalendarModel.WorkTime,
  20 + CreatedAt: productCalendarModel.CreatedAt,
  21 + UpdatedAt: productCalendarModel.UpdatedAt,
  22 + DeletedAt: productCalendarModel.DeletedAt,
  23 + }, nil
  24 +}
  1 +package transform
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  6 +)
  7 +
  8 +func TransformToProductGroupDomainModelFromPgModels(productGroupModel *models.ProductGroup) (*domain.ProductGroup, error) {
  9 + return &domain.ProductGroup{
  10 + ProductGroupId: productGroupModel.ProductGroupId,
  11 + CompanyId: productGroupModel.CompanyId,
  12 + OrgId: productGroupModel.OrgId,
  13 + GroupName: productGroupModel.GroupName,
  14 + GroupLeader: productGroupModel.GroupLeader,
  15 + GroupMembers: productGroupModel.GroupMembers,
  16 + WorkOn: productGroupModel.WorkOn,
  17 + WorkStation: productGroupModel.WorkStation,
  18 + CreatedAt: productGroupModel.CreatedAt,
  19 + UpdatedAt: productGroupModel.UpdatedAt,
  20 + DeletedAt: productGroupModel.DeletedAt,
  21 + }, nil
  22 +}
  1 +package transform
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  6 +)
  7 +
  8 +func TransformToProductJobDomainModelFromPgModels(productJobModel *models.ProductJob) (*domain.ProductJob, error) {
  9 + return &domain.ProductJob{
  10 + ProductJobId: productJobModel.ProductJobId,
  11 + CompanyId: productJobModel.CompanyId,
  12 + OrgId: productJobModel.OrgId,
  13 + JobName: productJobModel.JobName,
  14 + CreatedAt: productJobModel.CreatedAt,
  15 + UpdatedAt: productJobModel.UpdatedAt,
  16 + DeletedAt: productJobModel.DeletedAt,
  17 + WorkStation: productJobModel.WorkStation,
  18 + RelatedDevices: productJobModel.RelatedDevices,
  19 + }, nil
  20 +}
  1 +package transform
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  6 +)
  7 +
  8 +func TransformToProductPlanDomainModelFromPgModels(productPlanModel *models.ProductPlan) (*domain.ProductPlan, error) {
  9 + return &domain.ProductPlan{
  10 + ProductPlanId: productPlanModel.ProductPlanId,
  11 + CompanyId: productPlanModel.CompanyId,
  12 + OrgId: productPlanModel.OrgId,
  13 + BatchNumber: productPlanModel.BatchNumber,
  14 + ProductDate: productPlanModel.ProductDate,
  15 + Workshop: productPlanModel.Workshop,
  16 + WorkOn: productPlanModel.WorkOn,
  17 + Machine: productPlanModel.Machine,
  18 + PlanProductName: productPlanModel.PlanProductName,
  19 + PlanDevoted: productPlanModel.PlanDevoted,
  20 + PlanStatus: productPlanModel.PlanStatus,
  21 + WorkStation: productPlanModel.WorkStation,
  22 + Remark: productPlanModel.Remark,
  23 + CreatedAt: productPlanModel.CreatedAt,
  24 + UpdatedAt: productPlanModel.UpdatedAt,
  25 + DeletedAt: productPlanModel.DeletedAt,
  26 + }, nil
  27 +}
  1 +package transform
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  6 +)
  7 +
  8 +func TransformToProductRecordDomainModelFromPgModels(productRecordModel *models.ProductRecord) (*domain.ProductRecord, error) {
  9 + return &domain.ProductRecord{
  10 + ProductRecordId: productRecordModel.ProductRecordId,
  11 + CompanyId: productRecordModel.CompanyId,
  12 + OrgId: productRecordModel.OrgId,
  13 + ProductRecordType: productRecordModel.ProductRecordType,
  14 + ProductWorker: productRecordModel.ProductWorker,
  15 + WorkStation: productRecordModel.WorkStation,
  16 + CreatedAt: productRecordModel.CreatedAt,
  17 + UpdatedAt: productRecordModel.UpdatedAt,
  18 + DeletedAt: productRecordModel.DeletedAt,
  19 + ProductRecordInfo: productRecordModel.ProductRecordInfo,
  20 + }, nil
  21 +}
  1 +package transform
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  6 +)
  7 +
  8 +func TransformToUnitConversionDomainModelFromPgModels(unitConversionModel *models.UnitConversion) (*domain.UnitConversion, error) {
  9 + return &domain.UnitConversion{
  10 + UnitConversionId: unitConversionModel.UnitConversionId,
  11 + CompanyId: unitConversionModel.CompanyId,
  12 + OrgId: unitConversionModel.OrgId,
  13 + WorkStation: unitConversionModel.WorkStation,
  14 + Material: unitConversionModel.Material,
  15 + FromUnitQuantity: unitConversionModel.FromUnitQuantity,
  16 + ToUnitQuantity: unitConversionModel.ToUnitQuantity,
  17 + IntelligentWeighingFlag: unitConversionModel.IntelligentWeighingFlag,
  18 + CreatedAt: unitConversionModel.CreatedAt,
  19 + UpdatedAt: unitConversionModel.UpdatedAt,
  20 + DeletedAt: unitConversionModel.DeletedAt,
  21 + }, nil
  22 +}
  1 +package transform
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  6 +)
  7 +
  8 +func TransformToWorkshopDomainModelFromPgModels(workshopModel *models.Workshop) (*domain.Workshop, error) {
  9 + return &domain.Workshop{
  10 + CompanyId: workshopModel.CompanyId,
  11 + OrgId: workshopModel.OrgId,
  12 + WorkshopId: workshopModel.WorkshopId,
  13 + WorkshopName: workshopModel.WorkshopName,
  14 + Principal: workshopModel.Principal,
  15 + ProductLines: workshopModel.ProductLines,
  16 + CreatedAt: workshopModel.CreatedAt,
  17 + UpdatedAt: workshopModel.UpdatedAt,
  18 + DeletedAt: workshopModel.DeletedAt,
  19 + }, nil
  20 +}
  1 +package repository
  2 +
  3 +import (
  4 + "fmt"
  5 + "github.com/go-pg/pg/v10"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/transform"
  9 +
  10 + "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
  11 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  12 + "github.com/linmadan/egglib-go/utils/snowflake"
  13 +)
  14 +
  15 +type DeviceRepository struct {
  16 + transactionContext *pgTransaction.TransactionContext
  17 +}
  18 +
  19 +func (repository *DeviceRepository) nextIdentify() (int64, error) {
  20 + IdWorker, err := snowflake.NewIdWorker(1)
  21 + if err != nil {
  22 + return 0, err
  23 + }
  24 + id, err := IdWorker.NextId()
  25 + return id, err
  26 +}
  27 +func (repository *DeviceRepository) Save(device *domain.Device) (*domain.Device, error) {
  28 + sqlBuildFields := []string{
  29 + "device_id",
  30 + "company_id",
  31 + "org_id",
  32 + "device_code",
  33 + "device_name",
  34 + "device_model",
  35 + "device_type",
  36 + "brand",
  37 + "device_status",
  38 + "risk_level",
  39 + "created_at",
  40 + "updated_at",
  41 + "deleted_at",
  42 + "work_station",
  43 + }
  44 + insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  45 + insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields)
  46 + returningFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  47 + updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "device_id")
  48 + updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields)
  49 + tx := repository.transactionContext.PgTx
  50 + if device.Identify() == nil {
  51 + deviceId, err := repository.nextIdentify()
  52 + if err != nil {
  53 + return device, err
  54 + } else {
  55 + device.DeviceId = int(deviceId)
  56 + }
  57 + if _, err := tx.QueryOne(
  58 + pg.Scan(
  59 + &device.DeviceId,
  60 + &device.CompanyId,
  61 + &device.OrgId,
  62 + &device.DeviceCode,
  63 + &device.DeviceName,
  64 + &device.DeviceModel,
  65 + &device.DeviceType,
  66 + &device.Brand,
  67 + &device.DeviceStatus,
  68 + &device.RiskLevel,
  69 + &device.CreatedAt,
  70 + &device.UpdatedAt,
  71 + &device.DeletedAt,
  72 + &device.WorkStation,
  73 + ),
  74 + fmt.Sprintf("INSERT INTO devices (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
  75 + device.DeviceId,
  76 + device.CompanyId,
  77 + device.OrgId,
  78 + device.DeviceCode,
  79 + device.DeviceName,
  80 + device.DeviceModel,
  81 + device.DeviceType,
  82 + device.Brand,
  83 + device.DeviceStatus,
  84 + device.RiskLevel,
  85 + device.CreatedAt,
  86 + device.UpdatedAt,
  87 + device.DeletedAt,
  88 + device.WorkStation,
  89 + ); err != nil {
  90 + return device, err
  91 + }
  92 + } else {
  93 + if _, err := tx.QueryOne(
  94 + pg.Scan(
  95 + &device.DeviceId,
  96 + &device.CompanyId,
  97 + &device.OrgId,
  98 + &device.DeviceCode,
  99 + &device.DeviceName,
  100 + &device.DeviceModel,
  101 + &device.DeviceType,
  102 + &device.Brand,
  103 + &device.DeviceStatus,
  104 + &device.RiskLevel,
  105 + &device.CreatedAt,
  106 + &device.UpdatedAt,
  107 + &device.DeletedAt,
  108 + &device.WorkStation,
  109 + ),
  110 + fmt.Sprintf("UPDATE devices SET %s WHERE device_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
  111 + device.DeviceId,
  112 + device.CompanyId,
  113 + device.OrgId,
  114 + device.DeviceCode,
  115 + device.DeviceName,
  116 + device.DeviceModel,
  117 + device.DeviceType,
  118 + device.Brand,
  119 + device.DeviceStatus,
  120 + device.RiskLevel,
  121 + device.CreatedAt,
  122 + device.UpdatedAt,
  123 + device.DeletedAt,
  124 + device.WorkStation,
  125 + device.Identify(),
  126 + ); err != nil {
  127 + return device, err
  128 + }
  129 + }
  130 + return device, nil
  131 +}
  132 +func (repository *DeviceRepository) Remove(device *domain.Device) (*domain.Device, error) {
  133 + tx := repository.transactionContext.PgTx
  134 + deviceModel := new(models.Device)
  135 + deviceModel.DeviceId = device.Identify().(int)
  136 + if _, err := tx.Model(deviceModel).WherePK().Delete(); err != nil {
  137 + return device, err
  138 + }
  139 + return device, nil
  140 +}
  141 +func (repository *DeviceRepository) FindOne(queryOptions map[string]interface{}) (*domain.Device, error) {
  142 + tx := repository.transactionContext.PgTx
  143 + deviceModel := new(models.Device)
  144 + query := sqlbuilder.BuildQuery(tx.Model(deviceModel), queryOptions)
  145 + query.SetWhereByQueryOption("device.device_id = ?", "deviceId")
  146 + if err := query.First(); err != nil {
  147 + if err.Error() == "pg: no rows in result set" {
  148 + return nil, fmt.Errorf("没有此资源")
  149 + } else {
  150 + return nil, err
  151 + }
  152 + }
  153 + if deviceModel.DeviceId == 0 {
  154 + return nil, nil
  155 + } else {
  156 + return transform.TransformToDeviceDomainModelFromPgModels(deviceModel)
  157 + }
  158 +}
  159 +func (repository *DeviceRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.Device, error) {
  160 + tx := repository.transactionContext.PgTx
  161 + var deviceModels []*models.Device
  162 + devices := make([]*domain.Device, 0)
  163 + query := sqlbuilder.BuildQuery(tx.Model(&deviceModels), queryOptions)
  164 + query.SetOffsetAndLimit(20)
  165 + query.SetOrderDirect("device_id", "DESC")
  166 + if count, err := query.SelectAndCount(); err != nil {
  167 + return 0, devices, err
  168 + } else {
  169 + for _, deviceModel := range deviceModels {
  170 + if device, err := transform.TransformToDeviceDomainModelFromPgModels(deviceModel); err != nil {
  171 + return 0, devices, err
  172 + } else {
  173 + devices = append(devices, device)
  174 + }
  175 + }
  176 + return int64(count), devices, nil
  177 + }
  178 +}
  179 +func NewDeviceRepository(transactionContext *pgTransaction.TransactionContext) (*DeviceRepository, error) {
  180 + if transactionContext == nil {
  181 + return nil, fmt.Errorf("transactionContext参数不能为nil")
  182 + } else {
  183 + return &DeviceRepository{
  184 + transactionContext: transactionContext,
  185 + }, nil
  186 + }
  187 +}
  1 +package repository
  2 +
  3 +import (
  4 + "fmt"
  5 + "github.com/go-pg/pg/v10"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/transform"
  9 +
  10 + "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
  11 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  12 + "github.com/linmadan/egglib-go/utils/snowflake"
  13 +)
  14 +
  15 +type ProductAttendanceRecordRepository struct {
  16 + transactionContext *pgTransaction.TransactionContext
  17 +}
  18 +
  19 +func (repository *ProductAttendanceRecordRepository) nextIdentify() (int64, error) {
  20 + IdWorker, err := snowflake.NewIdWorker(1)
  21 + if err != nil {
  22 + return 0, err
  23 + }
  24 + id, err := IdWorker.NextId()
  25 + return id, err
  26 +}
  27 +func (repository *ProductAttendanceRecordRepository) Save(productAttendanceRecord *domain.ProductAttendanceRecord) (*domain.ProductAttendanceRecord, error) {
  28 + sqlBuildFields := []string{
  29 + "product_attendance_id",
  30 + "org_id",
  31 + "product_id",
  32 + "attendance_type",
  33 + "product_worker",
  34 + "work_station",
  35 + "sign_in",
  36 + "sign_out",
  37 + "attendance_status",
  38 + "work_time_before",
  39 + "work_time_after",
  40 + "created_at",
  41 + "updated_at",
  42 + "deleted_at",
  43 + }
  44 + insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  45 + insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields)
  46 + returningFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  47 + updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "productAttendanceRecord_id")
  48 + updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields)
  49 + tx := repository.transactionContext.PgTx
  50 + if productAttendanceRecord.Identify() == nil {
  51 + productAttendanceRecordId, err := repository.nextIdentify()
  52 + if err != nil {
  53 + return productAttendanceRecord, err
  54 + } else {
  55 + productAttendanceRecord.ProductAttendanceId = int(productAttendanceRecordId)
  56 + }
  57 + if _, err := tx.QueryOne(
  58 + pg.Scan(
  59 + &productAttendanceRecord.ProductAttendanceId,
  60 + &productAttendanceRecord.OrgId,
  61 + &productAttendanceRecord.ProductId,
  62 + &productAttendanceRecord.AttendanceType,
  63 + &productAttendanceRecord.ProductWorker,
  64 + &productAttendanceRecord.WorkStation,
  65 + &productAttendanceRecord.SignIn,
  66 + &productAttendanceRecord.SignOut,
  67 + &productAttendanceRecord.AttendanceStatus,
  68 + &productAttendanceRecord.WorkTimeBefore,
  69 + &productAttendanceRecord.WorkTimeAfter,
  70 + &productAttendanceRecord.CreatedAt,
  71 + &productAttendanceRecord.UpdatedAt,
  72 + &productAttendanceRecord.DeletedAt,
  73 + ),
  74 + fmt.Sprintf("INSERT INTO product_attendance_records (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
  75 + productAttendanceRecord.ProductAttendanceId,
  76 + productAttendanceRecord.OrgId,
  77 + productAttendanceRecord.ProductId,
  78 + productAttendanceRecord.AttendanceType,
  79 + productAttendanceRecord.ProductWorker,
  80 + productAttendanceRecord.WorkStation,
  81 + productAttendanceRecord.SignIn,
  82 + productAttendanceRecord.SignOut,
  83 + productAttendanceRecord.AttendanceStatus,
  84 + productAttendanceRecord.WorkTimeBefore,
  85 + productAttendanceRecord.WorkTimeAfter,
  86 + productAttendanceRecord.CreatedAt,
  87 + productAttendanceRecord.UpdatedAt,
  88 + productAttendanceRecord.DeletedAt,
  89 + ); err != nil {
  90 + return productAttendanceRecord, err
  91 + }
  92 + } else {
  93 + if _, err := tx.QueryOne(
  94 + pg.Scan(
  95 + &productAttendanceRecord.ProductAttendanceId,
  96 + &productAttendanceRecord.OrgId,
  97 + &productAttendanceRecord.ProductId,
  98 + &productAttendanceRecord.AttendanceType,
  99 + &productAttendanceRecord.ProductWorker,
  100 + &productAttendanceRecord.WorkStation,
  101 + &productAttendanceRecord.SignIn,
  102 + &productAttendanceRecord.SignOut,
  103 + &productAttendanceRecord.AttendanceStatus,
  104 + &productAttendanceRecord.WorkTimeBefore,
  105 + &productAttendanceRecord.WorkTimeAfter,
  106 + &productAttendanceRecord.CreatedAt,
  107 + &productAttendanceRecord.UpdatedAt,
  108 + &productAttendanceRecord.DeletedAt,
  109 + ),
  110 + fmt.Sprintf("UPDATE product_attendance_records SET %s WHERE product_attendance_record_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
  111 + productAttendanceRecord.ProductAttendanceId,
  112 + productAttendanceRecord.OrgId,
  113 + productAttendanceRecord.ProductId,
  114 + productAttendanceRecord.AttendanceType,
  115 + productAttendanceRecord.ProductWorker,
  116 + productAttendanceRecord.WorkStation,
  117 + productAttendanceRecord.SignIn,
  118 + productAttendanceRecord.SignOut,
  119 + productAttendanceRecord.AttendanceStatus,
  120 + productAttendanceRecord.WorkTimeBefore,
  121 + productAttendanceRecord.WorkTimeAfter,
  122 + productAttendanceRecord.CreatedAt,
  123 + productAttendanceRecord.UpdatedAt,
  124 + productAttendanceRecord.DeletedAt,
  125 + productAttendanceRecord.Identify(),
  126 + ); err != nil {
  127 + return productAttendanceRecord, err
  128 + }
  129 + }
  130 + return productAttendanceRecord, nil
  131 +}
  132 +func (repository *ProductAttendanceRecordRepository) Remove(productAttendanceRecord *domain.ProductAttendanceRecord) (*domain.ProductAttendanceRecord, error) {
  133 + tx := repository.transactionContext.PgTx
  134 + productAttendanceRecordModel := new(models.ProductAttendanceRecord)
  135 + productAttendanceRecordModel.ProductAttendanceId = productAttendanceRecord.Identify().(int)
  136 + if _, err := tx.Model(productAttendanceRecordModel).WherePK().Delete(); err != nil {
  137 + return productAttendanceRecord, err
  138 + }
  139 + return productAttendanceRecord, nil
  140 +}
  141 +func (repository *ProductAttendanceRecordRepository) FindOne(queryOptions map[string]interface{}) (*domain.ProductAttendanceRecord, error) {
  142 + tx := repository.transactionContext.PgTx
  143 + productAttendanceRecordModel := new(models.ProductAttendanceRecord)
  144 + query := sqlbuilder.BuildQuery(tx.Model(productAttendanceRecordModel), queryOptions)
  145 + query.SetWhereByQueryOption("product_attendance_record.product_attendance_record_id = ?", "productAttendanceRecordId")
  146 + if err := query.First(); err != nil {
  147 + if err.Error() == "pg: no rows in result set" {
  148 + return nil, fmt.Errorf("没有此资源")
  149 + } else {
  150 + return nil, err
  151 + }
  152 + }
  153 + if productAttendanceRecordModel.ProductAttendanceId == 0 {
  154 + return nil, nil
  155 + } else {
  156 + return transform.TransformToProductAttendanceRecordDomainModelFromPgModels(productAttendanceRecordModel)
  157 + }
  158 +}
  159 +func (repository *ProductAttendanceRecordRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.ProductAttendanceRecord, error) {
  160 + tx := repository.transactionContext.PgTx
  161 + var productAttendanceRecordModels []*models.ProductAttendanceRecord
  162 + productAttendanceRecords := make([]*domain.ProductAttendanceRecord, 0)
  163 + query := sqlbuilder.BuildQuery(tx.Model(&productAttendanceRecordModels), queryOptions)
  164 + query.SetOffsetAndLimit(20)
  165 + query.SetOrderDirect("product_attendance_record_id", "DESC")
  166 + if count, err := query.SelectAndCount(); err != nil {
  167 + return 0, productAttendanceRecords, err
  168 + } else {
  169 + for _, productAttendanceRecordModel := range productAttendanceRecordModels {
  170 + if productAttendanceRecord, err := transform.TransformToProductAttendanceRecordDomainModelFromPgModels(productAttendanceRecordModel); err != nil {
  171 + return 0, productAttendanceRecords, err
  172 + } else {
  173 + productAttendanceRecords = append(productAttendanceRecords, productAttendanceRecord)
  174 + }
  175 + }
  176 + return int64(count), productAttendanceRecords, nil
  177 + }
  178 +}
  179 +func NewProductAttendanceRecordRepository(transactionContext *pgTransaction.TransactionContext) (*ProductAttendanceRecordRepository, error) {
  180 + if transactionContext == nil {
  181 + return nil, fmt.Errorf("transactionContext参数不能为nil")
  182 + } else {
  183 + return &ProductAttendanceRecordRepository{
  184 + transactionContext: transactionContext,
  185 + }, nil
  186 + }
  187 +}
  1 +package repository
  2 +
  3 +import (
  4 + "fmt"
  5 + "github.com/go-pg/pg/v10"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/transform"
  9 +
  10 + "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
  11 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  12 + "github.com/linmadan/egglib-go/utils/snowflake"
  13 +)
  14 +
  15 +type ProductCalendarRepository struct {
  16 + transactionContext *pgTransaction.TransactionContext
  17 +}
  18 +
  19 +func (repository *ProductCalendarRepository) nextIdentify() (int64, error) {
  20 + IdWorker, err := snowflake.NewIdWorker(1)
  21 + if err != nil {
  22 + return 0, err
  23 + }
  24 + id, err := IdWorker.NextId()
  25 + return id, err
  26 +}
  27 +func (repository *ProductCalendarRepository) Save(productCalendar *domain.ProductCalendar) (*domain.ProductCalendar, error) {
  28 + sqlBuildFields := []string{
  29 + "product_calendar_id",
  30 + "company_id",
  31 + "org_id",
  32 + "work_station",
  33 + "work_on",
  34 + "calendar_selected",
  35 + "in_work_at",
  36 + "out_work_at",
  37 + "break_time",
  38 + "work_time",
  39 + "created_at",
  40 + "updated_at",
  41 + "deleted_at",
  42 + }
  43 + insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  44 + insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields)
  45 + returningFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  46 + updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "productCalendar_id")
  47 + updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields)
  48 + tx := repository.transactionContext.PgTx
  49 + if productCalendar.Identify() == nil {
  50 + productCalendarId, err := repository.nextIdentify()
  51 + if err != nil {
  52 + return productCalendar, err
  53 + } else {
  54 + productCalendar.ProductCalendarId = int(productCalendarId)
  55 + }
  56 + if _, err := tx.QueryOne(
  57 + pg.Scan(
  58 + &productCalendar.ProductCalendarId,
  59 + &productCalendar.CompanyId,
  60 + &productCalendar.OrgId,
  61 + &productCalendar.WorkStation,
  62 + &productCalendar.WorkOn,
  63 + pg.Array(&productCalendar.CalendarSelected),
  64 + &productCalendar.InWorkAt,
  65 + &productCalendar.OutWorkAt,
  66 + &productCalendar.BreakTime,
  67 + &productCalendar.WorkTime,
  68 + &productCalendar.CreatedAt,
  69 + &productCalendar.UpdatedAt,
  70 + &productCalendar.DeletedAt,
  71 + ),
  72 + fmt.Sprintf("INSERT INTO product_calendars (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
  73 + productCalendar.ProductCalendarId,
  74 + productCalendar.CompanyId,
  75 + productCalendar.OrgId,
  76 + productCalendar.WorkStation,
  77 + productCalendar.WorkOn,
  78 + pg.Array(productCalendar.CalendarSelected),
  79 + productCalendar.InWorkAt,
  80 + productCalendar.OutWorkAt,
  81 + productCalendar.BreakTime,
  82 + productCalendar.WorkTime,
  83 + productCalendar.CreatedAt,
  84 + productCalendar.UpdatedAt,
  85 + productCalendar.DeletedAt,
  86 + ); err != nil {
  87 + return productCalendar, err
  88 + }
  89 + } else {
  90 + if _, err := tx.QueryOne(
  91 + pg.Scan(
  92 + &productCalendar.ProductCalendarId,
  93 + &productCalendar.CompanyId,
  94 + &productCalendar.OrgId,
  95 + &productCalendar.WorkStation,
  96 + &productCalendar.WorkOn,
  97 + pg.Array(&productCalendar.CalendarSelected),
  98 + &productCalendar.InWorkAt,
  99 + &productCalendar.OutWorkAt,
  100 + &productCalendar.BreakTime,
  101 + &productCalendar.WorkTime,
  102 + &productCalendar.CreatedAt,
  103 + &productCalendar.UpdatedAt,
  104 + &productCalendar.DeletedAt,
  105 + ),
  106 + fmt.Sprintf("UPDATE product_calendars SET %s WHERE product_calendar_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
  107 + productCalendar.ProductCalendarId,
  108 + productCalendar.CompanyId,
  109 + productCalendar.OrgId,
  110 + productCalendar.WorkStation,
  111 + productCalendar.WorkOn,
  112 + pg.Array(productCalendar.CalendarSelected),
  113 + productCalendar.InWorkAt,
  114 + productCalendar.OutWorkAt,
  115 + productCalendar.BreakTime,
  116 + productCalendar.WorkTime,
  117 + productCalendar.CreatedAt,
  118 + productCalendar.UpdatedAt,
  119 + productCalendar.DeletedAt,
  120 + productCalendar.Identify(),
  121 + ); err != nil {
  122 + return productCalendar, err
  123 + }
  124 + }
  125 + return productCalendar, nil
  126 +}
  127 +func (repository *ProductCalendarRepository) Remove(productCalendar *domain.ProductCalendar) (*domain.ProductCalendar, error) {
  128 + tx := repository.transactionContext.PgTx
  129 + productCalendarModel := new(models.ProductCalendar)
  130 + productCalendarModel.ProductCalendarId = productCalendar.Identify().(int)
  131 + if _, err := tx.Model(productCalendarModel).WherePK().Delete(); err != nil {
  132 + return productCalendar, err
  133 + }
  134 + return productCalendar, nil
  135 +}
  136 +func (repository *ProductCalendarRepository) FindOne(queryOptions map[string]interface{}) (*domain.ProductCalendar, error) {
  137 + tx := repository.transactionContext.PgTx
  138 + productCalendarModel := new(models.ProductCalendar)
  139 + query := sqlbuilder.BuildQuery(tx.Model(productCalendarModel), queryOptions)
  140 + query.SetWhereByQueryOption("product_calendar.product_calendar_id = ?", "productCalendarId")
  141 + if err := query.First(); err != nil {
  142 + if err.Error() == "pg: no rows in result set" {
  143 + return nil, fmt.Errorf("没有此资源")
  144 + } else {
  145 + return nil, err
  146 + }
  147 + }
  148 + if productCalendarModel.ProductCalendarId == 0 {
  149 + return nil, nil
  150 + } else {
  151 + return transform.TransformToProductCalendarDomainModelFromPgModels(productCalendarModel)
  152 + }
  153 +}
  154 +func (repository *ProductCalendarRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.ProductCalendar, error) {
  155 + tx := repository.transactionContext.PgTx
  156 + var productCalendarModels []*models.ProductCalendar
  157 + productCalendars := make([]*domain.ProductCalendar, 0)
  158 + query := sqlbuilder.BuildQuery(tx.Model(&productCalendarModels), queryOptions)
  159 + query.SetOffsetAndLimit(20)
  160 + query.SetOrderDirect("product_calendar_id", "DESC")
  161 + if count, err := query.SelectAndCount(); err != nil {
  162 + return 0, productCalendars, err
  163 + } else {
  164 + for _, productCalendarModel := range productCalendarModels {
  165 + if productCalendar, err := transform.TransformToProductCalendarDomainModelFromPgModels(productCalendarModel); err != nil {
  166 + return 0, productCalendars, err
  167 + } else {
  168 + productCalendars = append(productCalendars, productCalendar)
  169 + }
  170 + }
  171 + return int64(count), productCalendars, nil
  172 + }
  173 +}
  174 +func NewProductCalendarRepository(transactionContext *pgTransaction.TransactionContext) (*ProductCalendarRepository, error) {
  175 + if transactionContext == nil {
  176 + return nil, fmt.Errorf("transactionContext参数不能为nil")
  177 + } else {
  178 + return &ProductCalendarRepository{
  179 + transactionContext: transactionContext,
  180 + }, nil
  181 + }
  182 +}
  1 +package repository
  2 +
  3 +import (
  4 + "fmt"
  5 + "github.com/go-pg/pg/v10"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/transform"
  9 +
  10 + "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
  11 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  12 + "github.com/linmadan/egglib-go/utils/snowflake"
  13 +)
  14 +
  15 +type ProductGroupRepository struct {
  16 + transactionContext *pgTransaction.TransactionContext
  17 +}
  18 +
  19 +func (repository *ProductGroupRepository) nextIdentify() (int64, error) {
  20 + IdWorker, err := snowflake.NewIdWorker(1)
  21 + if err != nil {
  22 + return 0, err
  23 + }
  24 + id, err := IdWorker.NextId()
  25 + return id, err
  26 +}
  27 +func (repository *ProductGroupRepository) Save(productGroup *domain.ProductGroup) (*domain.ProductGroup, error) {
  28 + sqlBuildFields := []string{
  29 + "product_group_id",
  30 + "company_id",
  31 + "org_id",
  32 + "group_name",
  33 + "group_leader",
  34 + "group_members",
  35 + "work_on",
  36 + "work_station",
  37 + "created_at",
  38 + "updated_at",
  39 + "deleted_at",
  40 + }
  41 + insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  42 + insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields)
  43 + returningFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  44 + updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "productGroup_id")
  45 + updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields)
  46 + tx := repository.transactionContext.PgTx
  47 + if productGroup.Identify() == nil {
  48 + productGroupId, err := repository.nextIdentify()
  49 + if err != nil {
  50 + return productGroup, err
  51 + } else {
  52 + productGroup.ProductGroupId = int(productGroupId)
  53 + }
  54 + if _, err := tx.QueryOne(
  55 + pg.Scan(
  56 + &productGroup.ProductGroupId,
  57 + &productGroup.CompanyId,
  58 + &productGroup.OrgId,
  59 + &productGroup.GroupName,
  60 + &productGroup.GroupLeader,
  61 + pg.Array(&productGroup.GroupMembers),
  62 + &productGroup.WorkOn,
  63 + &productGroup.WorkStation,
  64 + &productGroup.CreatedAt,
  65 + &productGroup.UpdatedAt,
  66 + &productGroup.DeletedAt,
  67 + ),
  68 + fmt.Sprintf("INSERT INTO product_groups (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
  69 + productGroup.ProductGroupId,
  70 + productGroup.CompanyId,
  71 + productGroup.OrgId,
  72 + productGroup.GroupName,
  73 + productGroup.GroupLeader,
  74 + pg.Array(productGroup.GroupMembers),
  75 + productGroup.WorkOn,
  76 + productGroup.WorkStation,
  77 + productGroup.CreatedAt,
  78 + productGroup.UpdatedAt,
  79 + productGroup.DeletedAt,
  80 + ); err != nil {
  81 + return productGroup, err
  82 + }
  83 + } else {
  84 + if _, err := tx.QueryOne(
  85 + pg.Scan(
  86 + &productGroup.ProductGroupId,
  87 + &productGroup.CompanyId,
  88 + &productGroup.OrgId,
  89 + &productGroup.GroupName,
  90 + &productGroup.GroupLeader,
  91 + pg.Array(&productGroup.GroupMembers),
  92 + &productGroup.WorkOn,
  93 + &productGroup.WorkStation,
  94 + &productGroup.CreatedAt,
  95 + &productGroup.UpdatedAt,
  96 + &productGroup.DeletedAt,
  97 + ),
  98 + fmt.Sprintf("UPDATE product_groups SET %s WHERE product_group_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
  99 + productGroup.ProductGroupId,
  100 + productGroup.CompanyId,
  101 + productGroup.OrgId,
  102 + productGroup.GroupName,
  103 + productGroup.GroupLeader,
  104 + pg.Array(productGroup.GroupMembers),
  105 + productGroup.WorkOn,
  106 + productGroup.WorkStation,
  107 + productGroup.CreatedAt,
  108 + productGroup.UpdatedAt,
  109 + productGroup.DeletedAt,
  110 + productGroup.Identify(),
  111 + ); err != nil {
  112 + return productGroup, err
  113 + }
  114 + }
  115 + return productGroup, nil
  116 +}
  117 +func (repository *ProductGroupRepository) Remove(productGroup *domain.ProductGroup) (*domain.ProductGroup, error) {
  118 + tx := repository.transactionContext.PgTx
  119 + productGroupModel := new(models.ProductGroup)
  120 + productGroupModel.ProductGroupId = productGroup.Identify().(int)
  121 + if _, err := tx.Model(productGroupModel).WherePK().Delete(); err != nil {
  122 + return productGroup, err
  123 + }
  124 + return productGroup, nil
  125 +}
  126 +func (repository *ProductGroupRepository) FindOne(queryOptions map[string]interface{}) (*domain.ProductGroup, error) {
  127 + tx := repository.transactionContext.PgTx
  128 + productGroupModel := new(models.ProductGroup)
  129 + query := sqlbuilder.BuildQuery(tx.Model(productGroupModel), queryOptions)
  130 + query.SetWhereByQueryOption("product_group.product_group_id = ?", "productGroupId")
  131 + if err := query.First(); err != nil {
  132 + if err.Error() == "pg: no rows in result set" {
  133 + return nil, fmt.Errorf("没有此资源")
  134 + } else {
  135 + return nil, err
  136 + }
  137 + }
  138 + if productGroupModel.ProductGroupId == 0 {
  139 + return nil, nil
  140 + } else {
  141 + return transform.TransformToProductGroupDomainModelFromPgModels(productGroupModel)
  142 + }
  143 +}
  144 +func (repository *ProductGroupRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.ProductGroup, error) {
  145 + tx := repository.transactionContext.PgTx
  146 + var productGroupModels []*models.ProductGroup
  147 + productGroups := make([]*domain.ProductGroup, 0)
  148 + query := sqlbuilder.BuildQuery(tx.Model(&productGroupModels), queryOptions)
  149 + query.SetOffsetAndLimit(20)
  150 + query.SetOrderDirect("product_group_id", "DESC")
  151 + if count, err := query.SelectAndCount(); err != nil {
  152 + return 0, productGroups, err
  153 + } else {
  154 + for _, productGroupModel := range productGroupModels {
  155 + if productGroup, err := transform.TransformToProductGroupDomainModelFromPgModels(productGroupModel); err != nil {
  156 + return 0, productGroups, err
  157 + } else {
  158 + productGroups = append(productGroups, productGroup)
  159 + }
  160 + }
  161 + return int64(count), productGroups, nil
  162 + }
  163 +}
  164 +func NewProductGroupRepository(transactionContext *pgTransaction.TransactionContext) (*ProductGroupRepository, error) {
  165 + if transactionContext == nil {
  166 + return nil, fmt.Errorf("transactionContext参数不能为nil")
  167 + } else {
  168 + return &ProductGroupRepository{
  169 + transactionContext: transactionContext,
  170 + }, nil
  171 + }
  172 +}
  1 +package repository
  2 +
  3 +import (
  4 + "fmt"
  5 + "github.com/go-pg/pg/v10"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/transform"
  9 +
  10 + "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
  11 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  12 + "github.com/linmadan/egglib-go/utils/snowflake"
  13 +)
  14 +
  15 +type ProductJobRepository struct {
  16 + transactionContext *pgTransaction.TransactionContext
  17 +}
  18 +
  19 +func (repository *ProductJobRepository) nextIdentify() (int64, error) {
  20 + IdWorker, err := snowflake.NewIdWorker(1)
  21 + if err != nil {
  22 + return 0, err
  23 + }
  24 + id, err := IdWorker.NextId()
  25 + return id, err
  26 +}
  27 +func (repository *ProductJobRepository) Save(productJob *domain.ProductJob) (*domain.ProductJob, error) {
  28 + sqlBuildFields := []string{
  29 + "product_job_id",
  30 + "company_id",
  31 + "org_id",
  32 + "job_name",
  33 + "created_at",
  34 + "updated_at",
  35 + "deleted_at",
  36 + "work_station",
  37 + "related_devices",
  38 + }
  39 + insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  40 + insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields)
  41 + returningFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  42 + updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "productJob_id")
  43 + updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields)
  44 + tx := repository.transactionContext.PgTx
  45 + if productJob.Identify() == nil {
  46 + productJobId, err := repository.nextIdentify()
  47 + if err != nil {
  48 + return productJob, err
  49 + } else {
  50 + productJob.ProductJobId = int(productJobId)
  51 + }
  52 + if _, err := tx.QueryOne(
  53 + pg.Scan(
  54 + &productJob.ProductJobId,
  55 + &productJob.CompanyId,
  56 + &productJob.OrgId,
  57 + &productJob.JobName,
  58 + &productJob.CreatedAt,
  59 + &productJob.UpdatedAt,
  60 + &productJob.DeletedAt,
  61 + &productJob.WorkStation,
  62 + pg.Array(&productJob.RelatedDevices),
  63 + ),
  64 + fmt.Sprintf("INSERT INTO product_jobs (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
  65 + productJob.ProductJobId,
  66 + productJob.CompanyId,
  67 + productJob.OrgId,
  68 + productJob.JobName,
  69 + productJob.CreatedAt,
  70 + productJob.UpdatedAt,
  71 + productJob.DeletedAt,
  72 + productJob.WorkStation,
  73 + pg.Array(productJob.RelatedDevices),
  74 + ); err != nil {
  75 + return productJob, err
  76 + }
  77 + } else {
  78 + if _, err := tx.QueryOne(
  79 + pg.Scan(
  80 + &productJob.ProductJobId,
  81 + &productJob.CompanyId,
  82 + &productJob.OrgId,
  83 + &productJob.JobName,
  84 + &productJob.CreatedAt,
  85 + &productJob.UpdatedAt,
  86 + &productJob.DeletedAt,
  87 + &productJob.WorkStation,
  88 + pg.Array(&productJob.RelatedDevices),
  89 + ),
  90 + fmt.Sprintf("UPDATE product_jobs SET %s WHERE product_job_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
  91 + productJob.ProductJobId,
  92 + productJob.CompanyId,
  93 + productJob.OrgId,
  94 + productJob.JobName,
  95 + productJob.CreatedAt,
  96 + productJob.UpdatedAt,
  97 + productJob.DeletedAt,
  98 + productJob.WorkStation,
  99 + pg.Array(productJob.RelatedDevices),
  100 + productJob.Identify(),
  101 + ); err != nil {
  102 + return productJob, err
  103 + }
  104 + }
  105 + return productJob, nil
  106 +}
  107 +func (repository *ProductJobRepository) Remove(productJob *domain.ProductJob) (*domain.ProductJob, error) {
  108 + tx := repository.transactionContext.PgTx
  109 + productJobModel := new(models.ProductJob)
  110 + productJobModel.ProductJobId = productJob.Identify().(int)
  111 + if _, err := tx.Model(productJobModel).WherePK().Delete(); err != nil {
  112 + return productJob, err
  113 + }
  114 + return productJob, nil
  115 +}
  116 +func (repository *ProductJobRepository) FindOne(queryOptions map[string]interface{}) (*domain.ProductJob, error) {
  117 + tx := repository.transactionContext.PgTx
  118 + productJobModel := new(models.ProductJob)
  119 + query := sqlbuilder.BuildQuery(tx.Model(productJobModel), queryOptions)
  120 + query.SetWhereByQueryOption("product_job.product_job_id = ?", "productJobId")
  121 + if err := query.First(); err != nil {
  122 + if err.Error() == "pg: no rows in result set" {
  123 + return nil, fmt.Errorf("没有此资源")
  124 + } else {
  125 + return nil, err
  126 + }
  127 + }
  128 + if productJobModel.ProductJobId == 0 {
  129 + return nil, nil
  130 + } else {
  131 + return transform.TransformToProductJobDomainModelFromPgModels(productJobModel)
  132 + }
  133 +}
  134 +func (repository *ProductJobRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.ProductJob, error) {
  135 + tx := repository.transactionContext.PgTx
  136 + var productJobModels []*models.ProductJob
  137 + productJobs := make([]*domain.ProductJob, 0)
  138 + query := sqlbuilder.BuildQuery(tx.Model(&productJobModels), queryOptions)
  139 + query.SetOffsetAndLimit(20)
  140 + query.SetOrderDirect("product_job_id", "DESC")
  141 + if count, err := query.SelectAndCount(); err != nil {
  142 + return 0, productJobs, err
  143 + } else {
  144 + for _, productJobModel := range productJobModels {
  145 + if productJob, err := transform.TransformToProductJobDomainModelFromPgModels(productJobModel); err != nil {
  146 + return 0, productJobs, err
  147 + } else {
  148 + productJobs = append(productJobs, productJob)
  149 + }
  150 + }
  151 + return int64(count), productJobs, nil
  152 + }
  153 +}
  154 +func NewProductJobRepository(transactionContext *pgTransaction.TransactionContext) (*ProductJobRepository, error) {
  155 + if transactionContext == nil {
  156 + return nil, fmt.Errorf("transactionContext参数不能为nil")
  157 + } else {
  158 + return &ProductJobRepository{
  159 + transactionContext: transactionContext,
  160 + }, nil
  161 + }
  162 +}
  1 +package repository
  2 +
  3 +import (
  4 + "fmt"
  5 + "github.com/go-pg/pg/v10"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/transform"
  9 +
  10 + "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
  11 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  12 + "github.com/linmadan/egglib-go/utils/snowflake"
  13 +)
  14 +
  15 +type ProductPlanRepository struct {
  16 + transactionContext *pgTransaction.TransactionContext
  17 +}
  18 +
  19 +func (repository *ProductPlanRepository) nextIdentify() (int64, error) {
  20 + IdWorker, err := snowflake.NewIdWorker(1)
  21 + if err != nil {
  22 + return 0, err
  23 + }
  24 + id, err := IdWorker.NextId()
  25 + return id, err
  26 +}
  27 +func (repository *ProductPlanRepository) Save(productPlan *domain.ProductPlan) (*domain.ProductPlan, error) {
  28 + sqlBuildFields := []string{
  29 + "product_plan_id",
  30 + "company_id",
  31 + "org_id",
  32 + "batch_number",
  33 + "product_date",
  34 + "workshop",
  35 + "work_on",
  36 + "machine",
  37 + "plan_product_name",
  38 + "plan_devoted",
  39 + "plan_status",
  40 + "work_station",
  41 + "remark",
  42 + "created_at",
  43 + "updated_at",
  44 + "deleted_at",
  45 + }
  46 + insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  47 + insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields)
  48 + returningFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  49 + updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "productPlan_id")
  50 + updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields)
  51 + tx := repository.transactionContext.PgTx
  52 + if productPlan.Identify() == nil {
  53 + productPlanId, err := repository.nextIdentify()
  54 + if err != nil {
  55 + return productPlan, err
  56 + } else {
  57 + productPlan.ProductPlanId = int(productPlanId)
  58 + }
  59 + if _, err := tx.QueryOne(
  60 + pg.Scan(
  61 + &productPlan.ProductPlanId,
  62 + &productPlan.CompanyId,
  63 + &productPlan.OrgId,
  64 + &productPlan.BatchNumber,
  65 + &productPlan.ProductDate,
  66 + &productPlan.Workshop,
  67 + &productPlan.WorkOn,
  68 + &productPlan.Machine,
  69 + &productPlan.PlanProductName,
  70 + &productPlan.PlanDevoted,
  71 + &productPlan.PlanStatus,
  72 + &productPlan.WorkStation,
  73 + &productPlan.Remark,
  74 + &productPlan.CreatedAt,
  75 + &productPlan.UpdatedAt,
  76 + &productPlan.DeletedAt,
  77 + ),
  78 + fmt.Sprintf("INSERT INTO product_plans (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
  79 + productPlan.ProductPlanId,
  80 + productPlan.CompanyId,
  81 + productPlan.OrgId,
  82 + productPlan.BatchNumber,
  83 + productPlan.ProductDate,
  84 + productPlan.Workshop,
  85 + productPlan.WorkOn,
  86 + productPlan.Machine,
  87 + productPlan.PlanProductName,
  88 + productPlan.PlanDevoted,
  89 + productPlan.PlanStatus,
  90 + productPlan.WorkStation,
  91 + productPlan.Remark,
  92 + productPlan.CreatedAt,
  93 + productPlan.UpdatedAt,
  94 + productPlan.DeletedAt,
  95 + ); err != nil {
  96 + return productPlan, err
  97 + }
  98 + } else {
  99 + if _, err := tx.QueryOne(
  100 + pg.Scan(
  101 + &productPlan.ProductPlanId,
  102 + &productPlan.CompanyId,
  103 + &productPlan.OrgId,
  104 + &productPlan.BatchNumber,
  105 + &productPlan.ProductDate,
  106 + &productPlan.Workshop,
  107 + &productPlan.WorkOn,
  108 + &productPlan.Machine,
  109 + &productPlan.PlanProductName,
  110 + &productPlan.PlanDevoted,
  111 + &productPlan.PlanStatus,
  112 + &productPlan.WorkStation,
  113 + &productPlan.Remark,
  114 + &productPlan.CreatedAt,
  115 + &productPlan.UpdatedAt,
  116 + &productPlan.DeletedAt,
  117 + ),
  118 + fmt.Sprintf("UPDATE product_plans SET %s WHERE product_plan_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
  119 + productPlan.ProductPlanId,
  120 + productPlan.CompanyId,
  121 + productPlan.OrgId,
  122 + productPlan.BatchNumber,
  123 + productPlan.ProductDate,
  124 + productPlan.Workshop,
  125 + productPlan.WorkOn,
  126 + productPlan.Machine,
  127 + productPlan.PlanProductName,
  128 + productPlan.PlanDevoted,
  129 + productPlan.PlanStatus,
  130 + productPlan.WorkStation,
  131 + productPlan.Remark,
  132 + productPlan.CreatedAt,
  133 + productPlan.UpdatedAt,
  134 + productPlan.DeletedAt,
  135 + productPlan.Identify(),
  136 + ); err != nil {
  137 + return productPlan, err
  138 + }
  139 + }
  140 + return productPlan, nil
  141 +}
  142 +func (repository *ProductPlanRepository) Remove(productPlan *domain.ProductPlan) (*domain.ProductPlan, error) {
  143 + tx := repository.transactionContext.PgTx
  144 + productPlanModel := new(models.ProductPlan)
  145 + productPlanModel.ProductPlanId = productPlan.Identify().(int)
  146 + if _, err := tx.Model(productPlanModel).WherePK().Delete(); err != nil {
  147 + return productPlan, err
  148 + }
  149 + return productPlan, nil
  150 +}
  151 +func (repository *ProductPlanRepository) FindOne(queryOptions map[string]interface{}) (*domain.ProductPlan, error) {
  152 + tx := repository.transactionContext.PgTx
  153 + productPlanModel := new(models.ProductPlan)
  154 + query := sqlbuilder.BuildQuery(tx.Model(productPlanModel), queryOptions)
  155 + query.SetWhereByQueryOption("product_plan.product_plan_id = ?", "productPlanId")
  156 + if err := query.First(); err != nil {
  157 + if err.Error() == "pg: no rows in result set" {
  158 + return nil, fmt.Errorf("没有此资源")
  159 + } else {
  160 + return nil, err
  161 + }
  162 + }
  163 + if productPlanModel.ProductPlanId == 0 {
  164 + return nil, nil
  165 + } else {
  166 + return transform.TransformToProductPlanDomainModelFromPgModels(productPlanModel)
  167 + }
  168 +}
  169 +func (repository *ProductPlanRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.ProductPlan, error) {
  170 + tx := repository.transactionContext.PgTx
  171 + var productPlanModels []*models.ProductPlan
  172 + productPlans := make([]*domain.ProductPlan, 0)
  173 + query := sqlbuilder.BuildQuery(tx.Model(&productPlanModels), queryOptions)
  174 + query.SetOffsetAndLimit(20)
  175 + query.SetOrderDirect("product_plan_id", "DESC")
  176 + if count, err := query.SelectAndCount(); err != nil {
  177 + return 0, productPlans, err
  178 + } else {
  179 + for _, productPlanModel := range productPlanModels {
  180 + if productPlan, err := transform.TransformToProductPlanDomainModelFromPgModels(productPlanModel); err != nil {
  181 + return 0, productPlans, err
  182 + } else {
  183 + productPlans = append(productPlans, productPlan)
  184 + }
  185 + }
  186 + return int64(count), productPlans, nil
  187 + }
  188 +}
  189 +func NewProductPlanRepository(transactionContext *pgTransaction.TransactionContext) (*ProductPlanRepository, error) {
  190 + if transactionContext == nil {
  191 + return nil, fmt.Errorf("transactionContext参数不能为nil")
  192 + } else {
  193 + return &ProductPlanRepository{
  194 + transactionContext: transactionContext,
  195 + }, nil
  196 + }
  197 +}
  1 +package repository
  2 +
  3 +import (
  4 + "fmt"
  5 + "github.com/go-pg/pg/v10"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/transform"
  9 +
  10 + "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
  11 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  12 + "github.com/linmadan/egglib-go/utils/snowflake"
  13 +)
  14 +
  15 +type ProductRecordRepository struct {
  16 + transactionContext *pgTransaction.TransactionContext
  17 +}
  18 +
  19 +func (repository *ProductRecordRepository) nextIdentify() (int64, error) {
  20 + IdWorker, err := snowflake.NewIdWorker(1)
  21 + if err != nil {
  22 + return 0, err
  23 + }
  24 + id, err := IdWorker.NextId()
  25 + return id, err
  26 +}
  27 +func (repository *ProductRecordRepository) Save(productRecord *domain.ProductRecord) (*domain.ProductRecord, error) {
  28 + sqlBuildFields := []string{
  29 + "product_record_id",
  30 + "company_id",
  31 + "org_id",
  32 + "product_record_type",
  33 + "product_worker",
  34 + "work_station",
  35 + "created_at",
  36 + "updated_at",
  37 + "deleted_at",
  38 + "product_record_info",
  39 + }
  40 + insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  41 + insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields)
  42 + returningFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  43 + updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "productRecord_id")
  44 + updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields)
  45 + tx := repository.transactionContext.PgTx
  46 + if productRecord.Identify() == nil {
  47 + productRecordId, err := repository.nextIdentify()
  48 + if err != nil {
  49 + return productRecord, err
  50 + } else {
  51 + productRecord.ProductRecordId = int(productRecordId)
  52 + }
  53 + if _, err := tx.QueryOne(
  54 + pg.Scan(
  55 + &productRecord.ProductRecordId,
  56 + &productRecord.CompanyId,
  57 + &productRecord.OrgId,
  58 + &productRecord.ProductRecordType,
  59 + &productRecord.ProductWorker,
  60 + &productRecord.WorkStation,
  61 + &productRecord.CreatedAt,
  62 + &productRecord.UpdatedAt,
  63 + &productRecord.DeletedAt,
  64 + &productRecord.ProductRecordInfo,
  65 + ),
  66 + fmt.Sprintf("INSERT INTO product_records (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
  67 + productRecord.ProductRecordId,
  68 + productRecord.CompanyId,
  69 + productRecord.OrgId,
  70 + productRecord.ProductRecordType,
  71 + productRecord.ProductWorker,
  72 + productRecord.WorkStation,
  73 + productRecord.CreatedAt,
  74 + productRecord.UpdatedAt,
  75 + productRecord.DeletedAt,
  76 + productRecord.ProductRecordInfo,
  77 + ); err != nil {
  78 + return productRecord, err
  79 + }
  80 + } else {
  81 + if _, err := tx.QueryOne(
  82 + pg.Scan(
  83 + &productRecord.ProductRecordId,
  84 + &productRecord.CompanyId,
  85 + &productRecord.OrgId,
  86 + &productRecord.ProductRecordType,
  87 + &productRecord.ProductWorker,
  88 + &productRecord.WorkStation,
  89 + &productRecord.CreatedAt,
  90 + &productRecord.UpdatedAt,
  91 + &productRecord.DeletedAt,
  92 + &productRecord.ProductRecordInfo,
  93 + ),
  94 + fmt.Sprintf("UPDATE product_records SET %s WHERE product_record_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
  95 + productRecord.ProductRecordId,
  96 + productRecord.CompanyId,
  97 + productRecord.OrgId,
  98 + productRecord.ProductRecordType,
  99 + productRecord.ProductWorker,
  100 + productRecord.WorkStation,
  101 + productRecord.CreatedAt,
  102 + productRecord.UpdatedAt,
  103 + productRecord.DeletedAt,
  104 + productRecord.ProductRecordInfo,
  105 + productRecord.Identify(),
  106 + ); err != nil {
  107 + return productRecord, err
  108 + }
  109 + }
  110 + return productRecord, nil
  111 +}
  112 +func (repository *ProductRecordRepository) Remove(productRecord *domain.ProductRecord) (*domain.ProductRecord, error) {
  113 + tx := repository.transactionContext.PgTx
  114 + productRecordModel := new(models.ProductRecord)
  115 + productRecordModel.ProductRecordId = productRecord.Identify().(int)
  116 + if _, err := tx.Model(productRecordModel).WherePK().Delete(); err != nil {
  117 + return productRecord, err
  118 + }
  119 + return productRecord, nil
  120 +}
  121 +func (repository *ProductRecordRepository) FindOne(queryOptions map[string]interface{}) (*domain.ProductRecord, error) {
  122 + tx := repository.transactionContext.PgTx
  123 + productRecordModel := new(models.ProductRecord)
  124 + query := sqlbuilder.BuildQuery(tx.Model(productRecordModel), queryOptions)
  125 + query.SetWhereByQueryOption("product_record.product_record_id = ?", "productRecordId")
  126 + if err := query.First(); err != nil {
  127 + if err.Error() == "pg: no rows in result set" {
  128 + return nil, fmt.Errorf("没有此资源")
  129 + } else {
  130 + return nil, err
  131 + }
  132 + }
  133 + if productRecordModel.ProductRecordId == 0 {
  134 + return nil, nil
  135 + } else {
  136 + return transform.TransformToProductRecordDomainModelFromPgModels(productRecordModel)
  137 + }
  138 +}
  139 +func (repository *ProductRecordRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.ProductRecord, error) {
  140 + tx := repository.transactionContext.PgTx
  141 + var productRecordModels []*models.ProductRecord
  142 + productRecords := make([]*domain.ProductRecord, 0)
  143 + query := sqlbuilder.BuildQuery(tx.Model(&productRecordModels), queryOptions)
  144 + query.SetOffsetAndLimit(20)
  145 + query.SetOrderDirect("product_record_id", "DESC")
  146 + if count, err := query.SelectAndCount(); err != nil {
  147 + return 0, productRecords, err
  148 + } else {
  149 + for _, productRecordModel := range productRecordModels {
  150 + if productRecord, err := transform.TransformToProductRecordDomainModelFromPgModels(productRecordModel); err != nil {
  151 + return 0, productRecords, err
  152 + } else {
  153 + productRecords = append(productRecords, productRecord)
  154 + }
  155 + }
  156 + return int64(count), productRecords, nil
  157 + }
  158 +}
  159 +func NewProductRecordRepository(transactionContext *pgTransaction.TransactionContext) (*ProductRecordRepository, error) {
  160 + if transactionContext == nil {
  161 + return nil, fmt.Errorf("transactionContext参数不能为nil")
  162 + } else {
  163 + return &ProductRecordRepository{
  164 + transactionContext: transactionContext,
  165 + }, nil
  166 + }
  167 +}
  1 +package repository
  2 +
  3 +import (
  4 + "fmt"
  5 + "github.com/go-pg/pg/v10"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/transform"
  9 +
  10 + "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
  11 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  12 + "github.com/linmadan/egglib-go/utils/snowflake"
  13 +)
  14 +
  15 +type ProductRepository struct {
  16 + transactionContext *pgTransaction.TransactionContext
  17 +}
  18 +
  19 +func (repository *ProductRepository) nextIdentify() (int64, error) {
  20 + IdWorker, err := snowflake.NewIdWorker(1)
  21 + if err != nil {
  22 + return 0, err
  23 + }
  24 + id, err := IdWorker.NextId()
  25 + return id, err
  26 +}
  27 +func (repository *ProductRepository) Save(product *domain.Product) (*domain.Product, error) {
  28 + sqlBuildFields := []string{
  29 + "company_id",
  30 + "org_id",
  31 + "product_id",
  32 + "product_code",
  33 + "product_name",
  34 + "product_category",
  35 + "product_spec",
  36 + "created_at",
  37 + "updated_at",
  38 + "deleted_at",
  39 + }
  40 + insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  41 + insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields)
  42 + returningFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  43 + updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_id")
  44 + updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields)
  45 + tx := repository.transactionContext.PgTx
  46 + if product.Identify() == nil {
  47 + productId, err := repository.nextIdentify()
  48 + if err != nil {
  49 + return product, err
  50 + } else {
  51 + product.ProductId = int(productId)
  52 + }
  53 + if _, err := tx.QueryOne(
  54 + pg.Scan(
  55 + &product.CompanyId,
  56 + &product.OrgId,
  57 + &product.ProductId,
  58 + &product.ProductCode,
  59 + &product.ProductName,
  60 + &product.ProductCategory,
  61 + &product.ProductSpec,
  62 + &product.CreatedAt,
  63 + &product.UpdatedAt,
  64 + &product.DeletedAt,
  65 + ),
  66 + fmt.Sprintf("INSERT INTO products (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
  67 + product.CompanyId,
  68 + product.OrgId,
  69 + product.ProductId,
  70 + product.ProductCode,
  71 + product.ProductName,
  72 + product.ProductCategory,
  73 + product.ProductSpec,
  74 + product.CreatedAt,
  75 + product.UpdatedAt,
  76 + product.DeletedAt,
  77 + ); err != nil {
  78 + return product, err
  79 + }
  80 + } else {
  81 + if _, err := tx.QueryOne(
  82 + pg.Scan(
  83 + &product.CompanyId,
  84 + &product.OrgId,
  85 + &product.ProductId,
  86 + &product.ProductCode,
  87 + &product.ProductName,
  88 + &product.ProductCategory,
  89 + &product.ProductSpec,
  90 + &product.CreatedAt,
  91 + &product.UpdatedAt,
  92 + &product.DeletedAt,
  93 + ),
  94 + fmt.Sprintf("UPDATE products SET %s WHERE product_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
  95 + product.CompanyId,
  96 + product.OrgId,
  97 + product.ProductId,
  98 + product.ProductCode,
  99 + product.ProductName,
  100 + product.ProductCategory,
  101 + product.ProductSpec,
  102 + product.CreatedAt,
  103 + product.UpdatedAt,
  104 + product.DeletedAt,
  105 + product.Identify(),
  106 + ); err != nil {
  107 + return product, err
  108 + }
  109 + }
  110 + return product, nil
  111 +}
  112 +func (repository *ProductRepository) Remove(product *domain.Product) (*domain.Product, error) {
  113 + tx := repository.transactionContext.PgTx
  114 + productModel := new(models.Product)
  115 + productModel.ProductId = product.Identify().(int)
  116 + if _, err := tx.Model(productModel).WherePK().Delete(); err != nil {
  117 + return product, err
  118 + }
  119 + return product, nil
  120 +}
  121 +func (repository *ProductRepository) FindOne(queryOptions map[string]interface{}) (*domain.Product, error) {
  122 + tx := repository.transactionContext.PgTx
  123 + productModel := new(models.Product)
  124 + query := sqlbuilder.BuildQuery(tx.Model(productModel), queryOptions)
  125 + query.SetWhereByQueryOption("product.product_id = ?", "productId")
  126 + if err := query.First(); err != nil {
  127 + if err.Error() == "pg: no rows in result set" {
  128 + return nil, fmt.Errorf("没有此资源")
  129 + } else {
  130 + return nil, err
  131 + }
  132 + }
  133 + if productModel.ProductId == 0 {
  134 + return nil, nil
  135 + } else {
  136 + return transform.TransformToProductDomainModelFromPgModels(productModel)
  137 + }
  138 +}
  139 +func (repository *ProductRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.Product, error) {
  140 + tx := repository.transactionContext.PgTx
  141 + var productModels []*models.Product
  142 + products := make([]*domain.Product, 0)
  143 + query := sqlbuilder.BuildQuery(tx.Model(&productModels), queryOptions)
  144 + query.SetOffsetAndLimit(20)
  145 + query.SetOrderDirect("product_id", "DESC")
  146 + if count, err := query.SelectAndCount(); err != nil {
  147 + return 0, products, err
  148 + } else {
  149 + for _, productModel := range productModels {
  150 + if product, err := transform.TransformToProductDomainModelFromPgModels(productModel); err != nil {
  151 + return 0, products, err
  152 + } else {
  153 + products = append(products, product)
  154 + }
  155 + }
  156 + return int64(count), products, nil
  157 + }
  158 +}
  159 +func NewProductRepository(transactionContext *pgTransaction.TransactionContext) (*ProductRepository, error) {
  160 + if transactionContext == nil {
  161 + return nil, fmt.Errorf("transactionContext参数不能为nil")
  162 + } else {
  163 + return &ProductRepository{
  164 + transactionContext: transactionContext,
  165 + }, nil
  166 + }
  167 +}
  1 +package repository
  2 +
  3 +import (
  4 + "fmt"
  5 + "github.com/go-pg/pg/v10"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/transform"
  9 +
  10 + "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
  11 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  12 + "github.com/linmadan/egglib-go/utils/snowflake"
  13 +)
  14 +
  15 +type UnitConversionRepository struct {
  16 + transactionContext *pgTransaction.TransactionContext
  17 +}
  18 +
  19 +func (repository *UnitConversionRepository) nextIdentify() (int64, error) {
  20 + IdWorker, err := snowflake.NewIdWorker(1)
  21 + if err != nil {
  22 + return 0, err
  23 + }
  24 + id, err := IdWorker.NextId()
  25 + return id, err
  26 +}
  27 +func (repository *UnitConversionRepository) Save(unitConversion *domain.UnitConversion) (*domain.UnitConversion, error) {
  28 + sqlBuildFields := []string{
  29 + "unit_conversion_id",
  30 + "company_id",
  31 + "org_id",
  32 + "work_station",
  33 + "material",
  34 + "from_unit_quantity",
  35 + "to_unit_quantity",
  36 + "intelligent_weighing_flag",
  37 + "created_at",
  38 + "updated_at",
  39 + "deleted_at",
  40 + }
  41 + insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  42 + insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields)
  43 + returningFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  44 + updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "unitConversion_id")
  45 + updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields)
  46 + tx := repository.transactionContext.PgTx
  47 + if unitConversion.Identify() == nil {
  48 + unitConversionId, err := repository.nextIdentify()
  49 + if err != nil {
  50 + return unitConversion, err
  51 + } else {
  52 + unitConversion.UnitConversionId = int(unitConversionId)
  53 + }
  54 + if _, err := tx.QueryOne(
  55 + pg.Scan(
  56 + &unitConversion.UnitConversionId,
  57 + &unitConversion.CompanyId,
  58 + &unitConversion.OrgId,
  59 + &unitConversion.WorkStation,
  60 + &unitConversion.Material,
  61 + &unitConversion.FromUnitQuantity,
  62 + &unitConversion.ToUnitQuantity,
  63 + &unitConversion.IntelligentWeighingFlag,
  64 + &unitConversion.CreatedAt,
  65 + &unitConversion.UpdatedAt,
  66 + &unitConversion.DeletedAt,
  67 + ),
  68 + fmt.Sprintf("INSERT INTO unit_conversions (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
  69 + unitConversion.UnitConversionId,
  70 + unitConversion.CompanyId,
  71 + unitConversion.OrgId,
  72 + unitConversion.WorkStation,
  73 + unitConversion.Material,
  74 + unitConversion.FromUnitQuantity,
  75 + unitConversion.ToUnitQuantity,
  76 + unitConversion.IntelligentWeighingFlag,
  77 + unitConversion.CreatedAt,
  78 + unitConversion.UpdatedAt,
  79 + unitConversion.DeletedAt,
  80 + ); err != nil {
  81 + return unitConversion, err
  82 + }
  83 + } else {
  84 + if _, err := tx.QueryOne(
  85 + pg.Scan(
  86 + &unitConversion.UnitConversionId,
  87 + &unitConversion.CompanyId,
  88 + &unitConversion.OrgId,
  89 + &unitConversion.WorkStation,
  90 + &unitConversion.Material,
  91 + &unitConversion.FromUnitQuantity,
  92 + &unitConversion.ToUnitQuantity,
  93 + &unitConversion.IntelligentWeighingFlag,
  94 + &unitConversion.CreatedAt,
  95 + &unitConversion.UpdatedAt,
  96 + &unitConversion.DeletedAt,
  97 + ),
  98 + fmt.Sprintf("UPDATE unit_conversions SET %s WHERE unit_conversion_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
  99 + unitConversion.UnitConversionId,
  100 + unitConversion.CompanyId,
  101 + unitConversion.OrgId,
  102 + unitConversion.WorkStation,
  103 + unitConversion.Material,
  104 + unitConversion.FromUnitQuantity,
  105 + unitConversion.ToUnitQuantity,
  106 + unitConversion.IntelligentWeighingFlag,
  107 + unitConversion.CreatedAt,
  108 + unitConversion.UpdatedAt,
  109 + unitConversion.DeletedAt,
  110 + unitConversion.Identify(),
  111 + ); err != nil {
  112 + return unitConversion, err
  113 + }
  114 + }
  115 + return unitConversion, nil
  116 +}
  117 +func (repository *UnitConversionRepository) Remove(unitConversion *domain.UnitConversion) (*domain.UnitConversion, error) {
  118 + tx := repository.transactionContext.PgTx
  119 + unitConversionModel := new(models.UnitConversion)
  120 + unitConversionModel.UnitConversionId = unitConversion.Identify().(int)
  121 + if _, err := tx.Model(unitConversionModel).WherePK().Delete(); err != nil {
  122 + return unitConversion, err
  123 + }
  124 + return unitConversion, nil
  125 +}
  126 +func (repository *UnitConversionRepository) FindOne(queryOptions map[string]interface{}) (*domain.UnitConversion, error) {
  127 + tx := repository.transactionContext.PgTx
  128 + unitConversionModel := new(models.UnitConversion)
  129 + query := sqlbuilder.BuildQuery(tx.Model(unitConversionModel), queryOptions)
  130 + query.SetWhereByQueryOption("unit_conversion.unit_conversion_id = ?", "unitConversionId")
  131 + if err := query.First(); err != nil {
  132 + if err.Error() == "pg: no rows in result set" {
  133 + return nil, fmt.Errorf("没有此资源")
  134 + } else {
  135 + return nil, err
  136 + }
  137 + }
  138 + if unitConversionModel.UnitConversionId == 0 {
  139 + return nil, nil
  140 + } else {
  141 + return transform.TransformToUnitConversionDomainModelFromPgModels(unitConversionModel)
  142 + }
  143 +}
  144 +func (repository *UnitConversionRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.UnitConversion, error) {
  145 + tx := repository.transactionContext.PgTx
  146 + var unitConversionModels []*models.UnitConversion
  147 + unitConversions := make([]*domain.UnitConversion, 0)
  148 + query := sqlbuilder.BuildQuery(tx.Model(&unitConversionModels), queryOptions)
  149 + query.SetOffsetAndLimit(20)
  150 + query.SetOrderDirect("unit_conversion_id", "DESC")
  151 + if count, err := query.SelectAndCount(); err != nil {
  152 + return 0, unitConversions, err
  153 + } else {
  154 + for _, unitConversionModel := range unitConversionModels {
  155 + if unitConversion, err := transform.TransformToUnitConversionDomainModelFromPgModels(unitConversionModel); err != nil {
  156 + return 0, unitConversions, err
  157 + } else {
  158 + unitConversions = append(unitConversions, unitConversion)
  159 + }
  160 + }
  161 + return int64(count), unitConversions, nil
  162 + }
  163 +}
  164 +func NewUnitConversionRepository(transactionContext *pgTransaction.TransactionContext) (*UnitConversionRepository, error) {
  165 + if transactionContext == nil {
  166 + return nil, fmt.Errorf("transactionContext参数不能为nil")
  167 + } else {
  168 + return &UnitConversionRepository{
  169 + transactionContext: transactionContext,
  170 + }, nil
  171 + }
  172 +}
  1 +package repository
  2 +
  3 +import (
  4 + "fmt"
  5 + "github.com/go-pg/pg/v10"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/transform"
  9 +
  10 + "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
  11 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  12 + "github.com/linmadan/egglib-go/utils/snowflake"
  13 +)
  14 +
  15 +type WorkshopRepository struct {
  16 + transactionContext *pgTransaction.TransactionContext
  17 +}
  18 +
  19 +func (repository *WorkshopRepository) nextIdentify() (int64, error) {
  20 + IdWorker, err := snowflake.NewIdWorker(1)
  21 + if err != nil {
  22 + return 0, err
  23 + }
  24 + id, err := IdWorker.NextId()
  25 + return id, err
  26 +}
  27 +func (repository *WorkshopRepository) Save(workshop *domain.Workshop) (*domain.Workshop, error) {
  28 + sqlBuildFields := []string{
  29 + "company_id",
  30 + "org_id",
  31 + "workshop_id",
  32 + "workshop_name",
  33 + "principal",
  34 + "product_lines",
  35 + "created_at",
  36 + "updated_at",
  37 + "deleted_at",
  38 + }
  39 + insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  40 + insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields)
  41 + returningFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
  42 + updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "workshop_id")
  43 + updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields)
  44 + tx := repository.transactionContext.PgTx
  45 + if workshop.Identify() == nil {
  46 + workshopId, err := repository.nextIdentify()
  47 + if err != nil {
  48 + return workshop, err
  49 + } else {
  50 + workshop.WorkshopId = int(workshopId)
  51 + }
  52 + if _, err := tx.QueryOne(
  53 + pg.Scan(
  54 + &workshop.CompanyId,
  55 + &workshop.OrgId,
  56 + &workshop.WorkshopId,
  57 + &workshop.WorkshopName,
  58 + &workshop.Principal,
  59 + pg.Array(&workshop.ProductLines),
  60 + &workshop.CreatedAt,
  61 + &workshop.UpdatedAt,
  62 + &workshop.DeletedAt,
  63 + ),
  64 + fmt.Sprintf("INSERT INTO workshops (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
  65 + workshop.CompanyId,
  66 + workshop.OrgId,
  67 + workshop.WorkshopId,
  68 + workshop.WorkshopName,
  69 + workshop.Principal,
  70 + pg.Array(workshop.ProductLines),
  71 + workshop.CreatedAt,
  72 + workshop.UpdatedAt,
  73 + workshop.DeletedAt,
  74 + ); err != nil {
  75 + return workshop, err
  76 + }
  77 + } else {
  78 + if _, err := tx.QueryOne(
  79 + pg.Scan(
  80 + &workshop.CompanyId,
  81 + &workshop.OrgId,
  82 + &workshop.WorkshopId,
  83 + &workshop.WorkshopName,
  84 + &workshop.Principal,
  85 + pg.Array(&workshop.ProductLines),
  86 + &workshop.CreatedAt,
  87 + &workshop.UpdatedAt,
  88 + &workshop.DeletedAt,
  89 + ),
  90 + fmt.Sprintf("UPDATE workshops SET %s WHERE workshop_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
  91 + workshop.CompanyId,
  92 + workshop.OrgId,
  93 + workshop.WorkshopId,
  94 + workshop.WorkshopName,
  95 + workshop.Principal,
  96 + pg.Array(workshop.ProductLines),
  97 + workshop.CreatedAt,
  98 + workshop.UpdatedAt,
  99 + workshop.DeletedAt,
  100 + workshop.Identify(),
  101 + ); err != nil {
  102 + return workshop, err
  103 + }
  104 + }
  105 + return workshop, nil
  106 +}
  107 +func (repository *WorkshopRepository) Remove(workshop *domain.Workshop) (*domain.Workshop, error) {
  108 + tx := repository.transactionContext.PgTx
  109 + workshopModel := new(models.Workshop)
  110 + workshopModel.WorkshopId = workshop.Identify().(int)
  111 + if _, err := tx.Model(workshopModel).WherePK().Delete(); err != nil {
  112 + return workshop, err
  113 + }
  114 + return workshop, nil
  115 +}
  116 +func (repository *WorkshopRepository) FindOne(queryOptions map[string]interface{}) (*domain.Workshop, error) {
  117 + tx := repository.transactionContext.PgTx
  118 + workshopModel := new(models.Workshop)
  119 + query := sqlbuilder.BuildQuery(tx.Model(workshopModel), queryOptions)
  120 + query.SetWhereByQueryOption("workshop.workshop_id = ?", "workshopId")
  121 + if err := query.First(); err != nil {
  122 + if err.Error() == "pg: no rows in result set" {
  123 + return nil, fmt.Errorf("没有此资源")
  124 + } else {
  125 + return nil, err
  126 + }
  127 + }
  128 + if workshopModel.WorkshopId == 0 {
  129 + return nil, nil
  130 + } else {
  131 + return transform.TransformToWorkshopDomainModelFromPgModels(workshopModel)
  132 + }
  133 +}
  134 +func (repository *WorkshopRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.Workshop, error) {
  135 + tx := repository.transactionContext.PgTx
  136 + var workshopModels []*models.Workshop
  137 + workshops := make([]*domain.Workshop, 0)
  138 + query := sqlbuilder.BuildQuery(tx.Model(&workshopModels), queryOptions)
  139 + query.SetOffsetAndLimit(20)
  140 + query.SetOrderDirect("workshop_id", "DESC")
  141 + if count, err := query.SelectAndCount(); err != nil {
  142 + return 0, workshops, err
  143 + } else {
  144 + for _, workshopModel := range workshopModels {
  145 + if workshop, err := transform.TransformToWorkshopDomainModelFromPgModels(workshopModel); err != nil {
  146 + return 0, workshops, err
  147 + } else {
  148 + workshops = append(workshops, workshop)
  149 + }
  150 + }
  151 + return int64(count), workshops, nil
  152 + }
  153 +}
  154 +func NewWorkshopRepository(transactionContext *pgTransaction.TransactionContext) (*WorkshopRepository, error) {
  155 + if transactionContext == nil {
  156 + return nil, fmt.Errorf("transactionContext参数不能为nil")
  157 + } else {
  158 + return &WorkshopRepository{
  159 + transactionContext: transactionContext,
  160 + }, nil
  161 + }
  162 +}
  1 +package log
  2 +
  3 +import (
  4 + "github.com/linmadan/egglib-go/log"
  5 + "github.com/linmadan/egglib-go/log/logrus"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/constant"
  7 +)
  8 +
  9 +var Logger log.Logger
  10 +
  11 +func init() {
  12 + Logger = logrus.NewLogrusLogger()
  13 + Logger.SetServiceName(constant.SERVICE_NAME)
  14 + Logger.SetLevel(constant.LOG_LEVEL)
  15 +}
  1 +package log
  2 +
  3 +import (
  4 + "encoding/json"
  5 + "errors"
  6 + "fmt"
  7 + "github.com/beego/beego/v2/core/logs"
  8 + "io"
  9 + "sync/atomic"
  10 +)
  11 +
  12 +var errOutOfMaxSize = errors.New("msg size is out of limit ")
  13 +
  14 +type BaseHook struct {
  15 + syncWrite bool
  16 + msgChan chan []byte
  17 + maxSize int32
  18 + currentSize int32
  19 + closeChan chan struct{}
  20 + w io.Writer
  21 +}
  22 +
  23 +func (b *BaseHook) Write(p []byte) (n int, err error) {
  24 + if b.syncWrite {
  25 + return b.w.Write(p)
  26 + }
  27 + if b.currentSize >= b.maxSize {
  28 + fmt.Println(errOutOfMaxSize.Error(), b.currentSize)
  29 + return 0, errOutOfMaxSize
  30 + }
  31 + b.msgChan <- p
  32 + atomic.AddInt32(&b.currentSize, 1)
  33 +
  34 + return len(p), nil
  35 +}
  36 +
  37 +// NewBaseHook
  38 +// syncWriteFlag 同步写标识 true:同步写 false:异步写
  39 +func NewBaseHook(syncWriteFlag bool, internalIo io.WriteCloser) (*BaseHook, error) {
  40 + writer := &BaseHook{
  41 + syncWrite: syncWriteFlag,
  42 + maxSize: 10000,
  43 + msgChan: make(chan []byte, 10000),
  44 + closeChan: make(chan struct{}),
  45 + w: internalIo,
  46 + }
  47 + go writer.ConsumeMsg()
  48 + return writer, nil
  49 +}
  50 +
  51 +func (b *BaseHook) ConsumeMsg() {
  52 + for {
  53 + select {
  54 + case <-b.closeChan:
  55 + return
  56 + case m, ok := <-b.msgChan:
  57 + if ok {
  58 + atomic.AddInt32(&b.currentSize, -1)
  59 + if _, err := b.w.Write(m); err != nil {
  60 + fmt.Println(err)
  61 + }
  62 + }
  63 + }
  64 + }
  65 +}
  66 +
  67 +func (b *BaseHook) Close() {
  68 + close(b.msgChan)
  69 + b.closeChan <- struct{}{}
  70 + //b.wc.Close()
  71 +}
  72 +
  73 +type LoggerConfig struct {
  74 + Level int `json:"level,omitempty"`
  75 + Filename string `json:"filename,omitempty"`
  76 + MaxSize int `json:"maxsize,omitempty"`
  77 + //MaxBackups int `json:"max_backups,omitempty"`
  78 + //MaxAge int `json:"max_age,omitempty"`
  79 + //Compress bool `json:"compress,omitempty"`
  80 +}
  81 +
  82 +type internalLog struct {
  83 + *logs.BeeLogger
  84 +}
  85 +
  86 +func NewBeegoLogWriter(conf LoggerConfig) io.Writer {
  87 + logger := logs.GetBeeLogger()
  88 + logger.SetLevel(conf.Level)
  89 + logger.EnableFuncCallDepth(true)
  90 + logger.SetLogFuncCallDepth(2)
  91 + confByte, _ := json.Marshal(conf)
  92 + err := logger.SetLogger(logs.AdapterFile, string(confByte))
  93 + if err != nil {
  94 + fmt.Println(err.Error())
  95 + }
  96 + return &internalLog{logger}
  97 +}
  98 +
  99 +func (l *internalLog) Write(p []byte) (n int, err error) {
  100 + l.Debug(string(p))
  101 + return len(p), nil
  102 +}