From 85faccc42c06891840a322e748a413a07a018f8f Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期二, 07 五月 2024 11:53:41 +0800
Subject: [PATCH] 工人,工种软删除

---
 models/work_type_manage.go |    2 +-
 utils/salary_calculate.go  |   24 ++++++++++++------------
 models/worker.go           |    3 ++-
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/models/work_type_manage.go b/models/work_type_manage.go
index d937a25..c7ea433 100644
--- a/models/work_type_manage.go
+++ b/models/work_type_manage.go
@@ -115,7 +115,7 @@
 func (slf *WorkTypeManageSearch) Delete() error {
 	var db = slf.build()
 
-	if err := db.Unscoped().Delete(&WorkTypeManage{}).Error; err != nil {
+	if err := db.Delete(&WorkTypeManage{}).Error; err != nil {
 		return err
 	}
 
diff --git a/models/worker.go b/models/worker.go
index 20d60f0..091693d 100644
--- a/models/worker.go
+++ b/models/worker.go
@@ -11,6 +11,7 @@
 	// Worker 浜哄姏璧勬簮
 	Worker struct {
 		BaseModelString
+		DeletedAt      gorm.DeletedAt        `gorm:"index"`
 		Name           string                `gorm:"index;type:varchar(191);not null;comment:浜哄憳濮撳悕" json:"name"`
 		PhoneNum       string                `gorm:"type:varchar(191);comment:鎵嬫満鍙�" json:"phoneNum"`
 		ShopID         string                `gorm:"type:varchar(191);comment:鎵�灞炶溅闂碔D" json:"shopId"`
@@ -200,7 +201,7 @@
 func (slf *WorkerSearch) Delete() error {
 	var db = slf.build()
 
-	if err := db.Unscoped().Delete(&Worker{}).Error; err != nil {
+	if err := db.Delete(&Worker{}).Error; err != nil {
 		return err
 	}
 
diff --git a/utils/salary_calculate.go b/utils/salary_calculate.go
index b5c4618..d2c2471 100644
--- a/utils/salary_calculate.go
+++ b/utils/salary_calculate.go
@@ -10,21 +10,21 @@
 // 钖祫璁$畻鏁版嵁
 type SalaryCalculateData struct {
 	DailySilkProduction     decimal.Decimal `json:"dailySilkProduction"`     // 鏃ヤ骇涓濋噺
-	WasteSilkQuantity       decimal.Decimal `json:"wasteSilkQuantity"`       // 閲庣氦鏁伴噺
-	RawSilkUnitPrice        decimal.Decimal `json:"rawSilkUnitPrice"`        // 鐢熶笣鍗曚环
-	WasteSilkUnitPrice      decimal.Decimal `json:"wasteSilkUnitPrice"`      // 閲庣氦鍗曚环
-	BucketCount             decimal.Decimal `json:"bucketCount"`             //妗舵暟(鏃�)
-	AttendanceDays          int             `json:"attendanceDays"`          // 鍑哄嫟澶╂暟
-	GroupAverageMonthlyWage decimal.Decimal `json:"groupAverageMonthlyWage"` //鍚岀粍鎸¤溅宸ユ湀骞冲潎宸ヨ祫
-	GroupCarHeadWage        decimal.Decimal `json:"groupCarHeadWage"`        //鍚岀粍杞﹀ご宸ュ伐璧�
+	WasteSilkQuantity       decimal.Decimal `json:"wasteSilkQuantity"`       // 閲庣氦鏁伴噺  //todo
+	RawSilkUnitPrice        decimal.Decimal `json:"rawSilkUnitPrice"`        // 鐢熶笣鍗曚环  //todo
+	WasteSilkUnitPrice      decimal.Decimal `json:"wasteSilkUnitPrice"`      // 閲庣氦鍗曚环 //todo
+	BucketCount             decimal.Decimal `json:"bucketCount"`             //妗舵暟(鏃�) //todo
+	AttendanceDays          int             `json:"attendanceDays"`          // 鍑哄嫟澶╂暟 //todo
+	GroupAverageMonthlyWage decimal.Decimal `json:"groupAverageMonthlyWage"` //鍚岀粍鎸¤溅宸ユ湀骞冲潎宸ヨ祫 //todo
+	GroupCarHeadWage        decimal.Decimal `json:"groupCarHeadWage"`        //鍚岀粍杞﹀ご宸ュ伐璧� //todo
 
 	WeekdayOvertimeHours decimal.Decimal `json:"weekdayOvertimeHours"` // 宸ヤ綔鏃ュ姞鐝椂闀�
-	FullAttendanceAward  int             `json:"FullAttendanceAward"`  // 婊″嫟濂�
-	WeekendOvertimeHours decimal.Decimal `json:"weekendOvertimeHours"` // 浼戞伅鏃ュ姞鐝椂闀�
-	LeaveDays            decimal.Decimal `json:"LeaveDays"`            //璇峰亣澶╂暟
-	ApprenticeDays       decimal.Decimal `json:"apprenticeDays"`       // 甯﹀緬澶╂暟
+	FullAttendanceAward  int             `json:"FullAttendanceAward"`  // 婊″嫟濂� //todo
+	WeekendOvertimeHours decimal.Decimal `json:"weekendOvertimeHours"` // 浼戞伅鏃ュ姞鐝椂闀� //todo
+	LeaveDays            decimal.Decimal `json:"LeaveDays"`            //璇峰亣澶╂暟 //todo
+	ApprenticeDays       decimal.Decimal `json:"apprenticeDays"`       // 甯﹀緬澶╂暟 //todo
 	TotalAttendanceDays  int             `json:"totalAttendanceDays"`  // 鍑哄嫟澶╂暟
-	Seniority            decimal.Decimal `json:"seniority"`            // 宸ラ緞
+	Seniority            decimal.Decimal `json:"seniority"`            // 宸ラ緞 //todo
 }
 
 // CalculateSalary 璁$畻宸ヨ祫鐨勫嚱鏁�

--
Gitblit v1.8.0