XMLWAN преди 2 години
родител
ревизия
b240c00c70
променени са 1 файла, в които са добавени 26 реда и са изтрити 0 реда
  1. 26 0
      service/secondary_service.go

+ 26 - 0
service/secondary_service.go Целия файл

@@ -17,6 +17,32 @@ func CreateCode() string {
17 17
 	return code
18 18
 }
19 19
 
20
+//查询仓库名称是否重复(用于修改)
21
+func IsStorehouseNameUp(orgid, id int64, storehouse_name string) (bool, error) {
22
+	var total int
23
+	var tmp bool
24
+	err := XTReadDB().Model(&models.Storehouse{}).Where("storehouse_name = ? and user_org_id = ? and status = 1 and id != ?", storehouse_name, orgid, id).Count(&total).Error
25
+	if total > 0 {
26
+		tmp = true //有重复的
27
+	} else {
28
+		tmp = false
29
+	}
30
+	return tmp, err
31
+}
32
+
33
+//查询仓库地址是否重复(用于修改)
34
+func IsStorehouseAddressUp(orgid, id int64, storehouse_address string) (bool, error) {
35
+	var total int
36
+	var tmp bool
37
+	err := XTReadDB().Model(&models.Storehouse{}).Where("storehouse_address = ? and user_org_id = ? and status = 1 and id != ?", storehouse_address, orgid, id).Count(&total).Error
38
+	if total > 0 {
39
+		tmp = true //有重复的
40
+	} else {
41
+		tmp = false
42
+	}
43
+	return tmp, err
44
+}
45
+
20 46
 //查询编号是否重复
21 47
 func FindStorehouseCode(orgid int64, code string) bool {
22 48
 	var total int