作者 tangxvhui

调整model 的结构

... ... @@ -442,7 +442,6 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu
}
if evaluationData.Executor.UserId != param.ExecutorId {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
}
... ...
... ... @@ -16,10 +16,9 @@ type SummaryEvaluationValue struct {
Types EvaluationType `json:"types"` //评估类型
Remark string `json:"remark"` //填写的内容反馈
Weight float64 `json:"weight"` //"权重"
Rating RatingLevel `json:"rating" ` //评级时的填写值
Rating RatingLevel `json:"rating"` //评级时的填写值
CreatedAt time.Time `json:"createdAt"` //数据创建时间
UpdatedAt time.Time `json:"updatedAt"` //数据更新时间
DeletedAt *time.Time `json:"deletedAt"` //数据删除时间
}
type SummaryEvaluationValueRepository interface {
... ...
... ... @@ -20,5 +20,4 @@ type SummaryEvaluationValue struct {
Remark string //填写的内容反馈
CreatedAt time.Time //数据创建时间
UpdatedAt time.Time //数据更新时间
DeletedAt *time.Time //数据删除时间
}
... ...
... ... @@ -34,7 +34,6 @@ func (repo *SummaryEvaluationValueRepository) TransformToDomain(d *models.Summar
Rating: d.Rating,
CreatedAt: d.CreatedAt,
UpdatedAt: d.UpdatedAt,
DeletedAt: d.DeletedAt,
}
}
... ... @@ -51,7 +50,6 @@ func (repo *SummaryEvaluationValueRepository) Save(param *domain.SummaryEvaluati
Remark: param.Remark,
CreatedAt: param.CreatedAt,
UpdatedAt: param.UpdatedAt,
DeletedAt: param.DeletedAt,
}
db := repo.transactionContext.PgTx
if m.Id == 0 {
... ... @@ -74,11 +72,8 @@ func (repo *SummaryEvaluationValueRepository) Save(param *domain.SummaryEvaluati
func (repo *SummaryEvaluationValueRepository) Remove(id int) error {
tx := repo.transactionContext.PgTx
nowTime := time.Now()
_, err := tx.Model(&models.SummaryEvaluationValue{}).
Where("id=?", id).
Set("deleted_at=?", nowTime).
Update()
Where("id=?", id).Delete()
return err
}
... ... @@ -104,8 +99,7 @@ func (repo *SummaryEvaluationValueRepository) FindOne(queryOptions map[string]in
func (repo *SummaryEvaluationValueRepository) Find(queryOptions map[string]interface{}) (int, []*domain.SummaryEvaluationValue, error) {
tx := repo.transactionContext.PgTx
var m []*models.SummaryEvaluationValue
query := tx.Model(&m).
Where("deleted_at isnull")
query := tx.Model(&m)
if v, ok := queryOptions["limit"].(int); ok {
query.Limit(v)
}
... ...