作者 tangxvhui

调整model 的结构

@@ -442,7 +442,6 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu @@ -442,7 +442,6 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu
442 } 442 }
443 443
444 if evaluationData.Executor.UserId != param.ExecutorId { 444 if evaluationData.Executor.UserId != param.ExecutorId {
445 -  
446 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") 445 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
447 } 446 }
448 447
@@ -16,10 +16,9 @@ type SummaryEvaluationValue struct { @@ -16,10 +16,9 @@ type SummaryEvaluationValue struct {
16 Types EvaluationType `json:"types"` //评估类型 16 Types EvaluationType `json:"types"` //评估类型
17 Remark string `json:"remark"` //填写的内容反馈 17 Remark string `json:"remark"` //填写的内容反馈
18 Weight float64 `json:"weight"` //"权重" 18 Weight float64 `json:"weight"` //"权重"
19 - Rating RatingLevel `json:"rating" ` //评级时的填写值 19 + Rating RatingLevel `json:"rating"` //评级时的填写值
20 CreatedAt time.Time `json:"createdAt"` //数据创建时间 20 CreatedAt time.Time `json:"createdAt"` //数据创建时间
21 UpdatedAt time.Time `json:"updatedAt"` //数据更新时间 21 UpdatedAt time.Time `json:"updatedAt"` //数据更新时间
22 - DeletedAt *time.Time `json:"deletedAt"` //数据删除时间  
23 } 22 }
24 23
25 type SummaryEvaluationValueRepository interface { 24 type SummaryEvaluationValueRepository interface {
@@ -20,5 +20,4 @@ type SummaryEvaluationValue struct { @@ -20,5 +20,4 @@ type SummaryEvaluationValue struct {
20 Remark string //填写的内容反馈 20 Remark string //填写的内容反馈
21 CreatedAt time.Time //数据创建时间 21 CreatedAt time.Time //数据创建时间
22 UpdatedAt time.Time //数据更新时间 22 UpdatedAt time.Time //数据更新时间
23 - DeletedAt *time.Time //数据删除时间  
24 } 23 }
@@ -34,7 +34,6 @@ func (repo *SummaryEvaluationValueRepository) TransformToDomain(d *models.Summar @@ -34,7 +34,6 @@ func (repo *SummaryEvaluationValueRepository) TransformToDomain(d *models.Summar
34 Rating: d.Rating, 34 Rating: d.Rating,
35 CreatedAt: d.CreatedAt, 35 CreatedAt: d.CreatedAt,
36 UpdatedAt: d.UpdatedAt, 36 UpdatedAt: d.UpdatedAt,
37 - DeletedAt: d.DeletedAt,  
38 } 37 }
39 } 38 }
40 39
@@ -51,7 +50,6 @@ func (repo *SummaryEvaluationValueRepository) Save(param *domain.SummaryEvaluati @@ -51,7 +50,6 @@ func (repo *SummaryEvaluationValueRepository) Save(param *domain.SummaryEvaluati
51 Remark: param.Remark, 50 Remark: param.Remark,
52 CreatedAt: param.CreatedAt, 51 CreatedAt: param.CreatedAt,
53 UpdatedAt: param.UpdatedAt, 52 UpdatedAt: param.UpdatedAt,
54 - DeletedAt: param.DeletedAt,  
55 } 53 }
56 db := repo.transactionContext.PgTx 54 db := repo.transactionContext.PgTx
57 if m.Id == 0 { 55 if m.Id == 0 {
@@ -74,11 +72,8 @@ func (repo *SummaryEvaluationValueRepository) Save(param *domain.SummaryEvaluati @@ -74,11 +72,8 @@ func (repo *SummaryEvaluationValueRepository) Save(param *domain.SummaryEvaluati
74 72
75 func (repo *SummaryEvaluationValueRepository) Remove(id int) error { 73 func (repo *SummaryEvaluationValueRepository) Remove(id int) error {
76 tx := repo.transactionContext.PgTx 74 tx := repo.transactionContext.PgTx
77 - nowTime := time.Now()  
78 _, err := tx.Model(&models.SummaryEvaluationValue{}). 75 _, err := tx.Model(&models.SummaryEvaluationValue{}).
79 - Where("id=?", id).  
80 - Set("deleted_at=?", nowTime).  
81 - Update() 76 + Where("id=?", id).Delete()
82 return err 77 return err
83 } 78 }
84 79
@@ -104,8 +99,7 @@ func (repo *SummaryEvaluationValueRepository) FindOne(queryOptions map[string]in @@ -104,8 +99,7 @@ func (repo *SummaryEvaluationValueRepository) FindOne(queryOptions map[string]in
104 func (repo *SummaryEvaluationValueRepository) Find(queryOptions map[string]interface{}) (int, []*domain.SummaryEvaluationValue, error) { 99 func (repo *SummaryEvaluationValueRepository) Find(queryOptions map[string]interface{}) (int, []*domain.SummaryEvaluationValue, error) {
105 tx := repo.transactionContext.PgTx 100 tx := repo.transactionContext.PgTx
106 var m []*models.SummaryEvaluationValue 101 var m []*models.SummaryEvaluationValue
107 - query := tx.Model(&m).  
108 - Where("deleted_at isnull") 102 + query := tx.Model(&m)
109 if v, ok := queryOptions["limit"].(int); ok { 103 if v, ok := queryOptions["limit"].(int); ok {
110 query.Limit(v) 104 query.Limit(v)
111 } 105 }