修改数据表

This commit is contained in:
孙肖扬 2025-03-05 11:38:51 +08:00
parent 8138fce993
commit 2ea20d665a
4 changed files with 23 additions and 11 deletions

1
go.mod
View File

@ -151,4 +151,5 @@ require (
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gorm.io/plugin/soft_delete v1.2.1
)

8
go.sum
View File

@ -520,6 +520,8 @@ github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg=
github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
@ -607,6 +609,7 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-sqlite3 v1.14.3/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
@ -1451,9 +1454,14 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gorm.io/driver/mysql v1.5.2 h1:QC2HRskSE75wBuOxe0+iCkyJZ+RqpudsQtqkp+IMuXs=
gorm.io/driver/mysql v1.5.2/go.mod h1:pQLhh1Ut/WUAySdTHwBpBv6+JKcj+ua4ZFx1QQTBzb8=
gorm.io/driver/sqlite v1.1.3/go.mod h1:AKDgRWk8lcSQSw+9kxCJnX/yySj8G3rdwYlU57cB45c=
gorm.io/gorm v1.20.1/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
gorm.io/gorm v1.23.0/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk=
gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
gorm.io/gorm v1.25.5 h1:zR9lOiiYf09VNh5Q1gphfyia1JpiClIWG9hQaxB/mls=
gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
gorm.io/plugin/soft_delete v1.2.1 h1:qx9D/c4Xu6w5KT8LviX8DgLcB9hkKl6JC9f44Tj7cGU=
gorm.io/plugin/soft_delete v1.2.1/go.mod h1:Zv7vQctOJTGOsJ/bWgrN1n3od0GBAZgnLjEx+cApLGk=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

View File

@ -7,6 +7,7 @@ import (
"exhibition-register/pb/exhibition"
"exhibition-register/pkg/utils"
"fmt"
"time"
)
type IRegister interface {
@ -56,8 +57,8 @@ func (r *Register) FindAllRecord() (out *exhibition.ExportRecordResp, err error)
IdCardBackPhoto: record.IdCardBackPhoto,
ArtistPhoto: record.ArtistPhoto,
ArtworkName: record.ArtworkName,
CreatedAt: record.CreatedAt.Format("2006-01-02 15:04:05"),
UpdatedAt: record.UpdatedAt.Format("2006-01-02 15:04:05"),
CreatedAt: time.Unix(int64(record.CreatedAt), 0).Format("2006-01-02 15:04:05"),
UpdatedAt: time.Unix(int64(record.UpdatedAt), 0).Format("2006-01-02 15:04:05"),
}
out.Data = append(out.Data, tmp)
}
@ -88,8 +89,8 @@ func (r *Register) RegisterRecordList(in *exhibition.RecordListReq) (out *exhibi
ArtistPhoto: item.ArtistPhoto,
ArtworkFile: item.ArtworkFile,
ArtworkName: item.ArtworkName,
CreatedAt: item.CreatedAt.Format("2006-01-02 15:04:05"),
UpdatedAt: item.UpdatedAt.Format("2006-01-02 15:04:05"),
CreatedAt: time.Unix(int64(item.CreatedAt), 0).Format("2006-01-02 15:04:05"),
UpdatedAt: time.Unix(int64(item.UpdatedAt), 0).Format("2006-01-02 15:04:05"),
}
out.Data = append(out.Data, tmp)
@ -154,8 +155,8 @@ func (r *Register) SaveRegisterRecord(in *exhibition.RegisterInfo) (out *exhibit
ArtistPhoto: tmpRecord.ArtistPhoto,
ArtworkFile: tmpRecord.ArtworkFile,
ArtworkName: tmpRecord.ArtworkName,
CreatedAt: tmpRecord.CreatedAt.Format("2006-01-02 15:04:05"),
UpdatedAt: tmpRecord.UpdatedAt.Format("2006-01-02 15:04:05"),
CreatedAt: time.Unix(int64(tmpRecord.CreatedAt), 0).Format("2006-01-02 15:04:05"),
UpdatedAt: time.Unix(int64(tmpRecord.UpdatedAt), 0).Format("2006-01-02 15:04:05"),
}
out.Data = data
return out, nil
@ -186,8 +187,8 @@ func (r *Register) CheckByPhone(in *exhibition.RegisterInfo) (out *exhibition.Ch
ArtistPhoto: record.ArtistPhoto,
ArtworkFile: record.ArtworkFile,
ArtworkName: record.ArtworkName,
CreatedAt: record.CreatedAt.Format("2006-01-02 15:04:05"),
UpdatedAt: record.UpdatedAt.Format("2006-01-02 15:04:05"),
CreatedAt: time.Unix(int64(record.CreatedAt), 0).Format("2006-01-02 15:04:05"),
UpdatedAt: time.Unix(int64(record.UpdatedAt), 0).Format("2006-01-02 15:04:05"),
}
out.Data = data
out.IsExist = true

View File

@ -1,10 +1,9 @@
package model
import "gorm.io/gorm"
import "gorm.io/plugin/soft_delete"
type RegisterRecord struct {
gorm.Model
ID int32 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"`
UUID string `json:"uuid" gorm:"primaryKey;column:uuid;type:varchar(255);comment:报名记录Uid"`
ArtistName string `json:"artist_name" gorm:"column:artist_name;type:varchar(255);comment:画家姓名"`
Gender int32 `json:"gender" gorm:"column:gender;type:int;comment:性别1男2女"`
@ -17,4 +16,7 @@ type RegisterRecord struct {
ArtistPhoto string `json:"artist_photo" gorm:"column:artist_photo;type:varchar(1000);comment:画家本人近照"`
ArtworkFile string `json:"artwork_file" gorm:"column:artwork_file;type:varchar(1000);comment:作品文件"`
ArtworkName string `json:"artwork_name" gorm:"column:artwork_name;type:varchar(255);comment:作品名称"`
CreatedAt int32 `gorm:"column:created_at;autoCreateTime"`
UpdatedAt int32 `gorm:"column:updated_at;autoCreateTime"`
DeletedAt soft_delete.DeletedAt
}