aa
This commit is contained in:
@@ -119,7 +119,7 @@ func DelPrinter(appID int, printNos []string) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func UpdatePrinter(appID int, printNo, name, sim, sound string, volume int) (err error) {
|
||||
func UpdatePrinter(appID int, printNo string, name, sim, sound *string, volume *int) (err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
fields []string
|
||||
@@ -128,20 +128,20 @@ func UpdatePrinter(appID int, printNo, name, sim, sound string, volume int) (err
|
||||
if printers, _ := dao.GetPrinters(db, appID, printNo); len(printers) == 0 {
|
||||
return fmt.Errorf("该应用下未找到该打印机!print_no : %v", printNo)
|
||||
} else {
|
||||
if printers[0].Name != name {
|
||||
printers[0].Name = name
|
||||
if printers[0].Name != *name {
|
||||
printers[0].Name = *name
|
||||
fields = append(fields, "name")
|
||||
}
|
||||
if printers[0].SIM != sim {
|
||||
printers[0].SIM = sim
|
||||
if printers[0].SIM != *sim {
|
||||
printers[0].SIM = *sim
|
||||
fields = append(fields, "sim")
|
||||
}
|
||||
if printers[0].Sound != sound {
|
||||
printers[0].Sound = sound
|
||||
if printers[0].Sound != *sound {
|
||||
printers[0].Sound = *sound
|
||||
fields = append(fields, "sound")
|
||||
}
|
||||
if printers[0].Volume != volume {
|
||||
printers[0].Volume = volume
|
||||
if printers[0].Volume != *volume {
|
||||
printers[0].Volume = *volume
|
||||
fields = append(fields, "volume")
|
||||
}
|
||||
if _, err = dao.UpdateEntity(db, printers[0], fields...); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user