修复需要从前端传新增人修改人的问题
This commit is contained in:
@@ -18,15 +18,16 @@ var DatasourcePlatform = new(datasourcePlatformDao)
|
||||
type datasourcePlatformDao struct{}
|
||||
|
||||
// Insert 插入数据源平台
|
||||
func (d *datasourcePlatformDao) Insert(ctx context.Context, req *dto.CreateDatasourcePlatformReq) (ID int64, err error) {
|
||||
func (d *datasourcePlatformDao) Insert(ctx context.Context, req *dto.CreateDatasourcePlatformReq, createdBy string) (ID int64, err error) {
|
||||
var res *entity.DatasourcePlatform
|
||||
if err = gconv.Struct(req, &res); err != nil {
|
||||
return
|
||||
}
|
||||
// 设置创建时间
|
||||
// 设置创建时间和更新时间
|
||||
// 设置创建人和时间(服务端生成,不依赖前端入参)
|
||||
now := time.Now()
|
||||
res.CreatedBy = createdBy
|
||||
res.CreatedAt = &now
|
||||
res.UpdatedBy = createdBy
|
||||
res.UpdatedAt = &now
|
||||
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.DatasourcePlatformTable).Data(&res).Insert()
|
||||
@@ -37,9 +38,10 @@ func (d *datasourcePlatformDao) Insert(ctx context.Context, req *dto.CreateDatas
|
||||
}
|
||||
|
||||
// Update 更新数据源平台
|
||||
func (d *datasourcePlatformDao) Update(ctx context.Context, req *dto.UpdateDatasourcePlatformReq) (rows int64, err error) {
|
||||
// 设置更新时间
|
||||
func (d *datasourcePlatformDao) Update(ctx context.Context, req *dto.UpdateDatasourcePlatformReq, updatedBy string) (rows int64, err error) {
|
||||
// 设置更新人和更新时间(服务端生成,不依赖前端入参)
|
||||
data := gconv.Map(req)
|
||||
data[entity.DatasourcePlatformCols.UpdatedBy] = updatedBy
|
||||
data[entity.DatasourcePlatformCols.UpdatedAt] = time.Now()
|
||||
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.DatasourcePlatformTable).
|
||||
|
||||
Reference in New Issue
Block a user