正在显示
1 个修改的文件
包含
1 行增加
和
42 行删除
| @@ -9,7 +9,6 @@ import ( | @@ -9,7 +9,6 @@ import ( | ||
| 9 | 9 | ||
| 10 | type UserDepartment struct { | 10 | type UserDepartment struct { |
| 11 | Id int64 `orm:"column(id);auto" description:"主键"` | 11 | Id int64 `orm:"column(id);auto" description:"主键"` |
| 12 | - //UserId int64 `orm:"column(user_id)" description:"用户id"` | ||
| 13 | CompanyId int64 `orm:"column(company_id)" description:"公司id"` | 12 | CompanyId int64 `orm:"column(company_id)" description:"公司id"` |
| 14 | DepartmentId int64 `orm:"column(department_id)" description:"部门id"` | 13 | DepartmentId int64 `orm:"column(department_id)" description:"部门id"` |
| 15 | CreateTime time.Time `orm:"column(create_time);type(timestamp);null" description:"创建时间"` | 14 | CreateTime time.Time `orm:"column(create_time);type(timestamp);null" description:"创建时间"` |
| @@ -68,46 +67,6 @@ func AddUserDepartment(m *UserDepartment, om ...orm.Ormer) (id int64, err error) | @@ -68,46 +67,6 @@ func AddUserDepartment(m *UserDepartment, om ...orm.Ormer) (id int64, err error) | ||
| 68 | return | 67 | return |
| 69 | } | 68 | } |
| 70 | 69 | ||
| 71 | -// GetUserDepartmentById retrieves UserDepartment by Id. Returns error if | ||
| 72 | -// Id doesn't exist | ||
| 73 | -// func GetUserDepartmentById(id int64) (v *UserDepartment, err error) { | ||
| 74 | -// o := orm.NewOrm() | ||
| 75 | -// v = &UserDepartment{Id: id} | ||
| 76 | -// if err = o.Read(v); err == nil { | ||
| 77 | -// return v, nil | ||
| 78 | -// } | ||
| 79 | -// return nil, err | ||
| 80 | -// } | ||
| 81 | - | ||
| 82 | -// UpdateUserDepartment updates UserDepartment by Id and returns error if | ||
| 83 | -// the record to be updated doesn't exist | ||
| 84 | -// func UpdateUserDepartmentById(m *UserDepartment) (err error) { | ||
| 85 | -// o := orm.NewOrm() | ||
| 86 | -// v := UserDepartment{Id: m.Id} | ||
| 87 | -// // ascertain id exists in the database | ||
| 88 | -// if err = o.Read(&v); err == nil { | ||
| 89 | -// var num int64 | ||
| 90 | -// if num, err = o.Update(m); err == nil { | ||
| 91 | -// fmt.Println("Number of records updated in database:", num) | ||
| 92 | -// } | ||
| 93 | -// } | ||
| 94 | -// return | ||
| 95 | -// } | ||
| 96 | - | ||
| 97 | -// func GetUserDepartment(userid, companyid int64) ([]*UserDepartment, error) { | ||
| 98 | -// o := orm.NewOrm() | ||
| 99 | -// var ( | ||
| 100 | -// err error | ||
| 101 | -// result []*UserDepartment | ||
| 102 | -// ) | ||
| 103 | -// _, err = o.QueryTable(&UserDepartment{}). | ||
| 104 | -// Filter("user_id", userid). | ||
| 105 | -// Filter("company_id", companyid). | ||
| 106 | -// Filter("enable_status", 1). | ||
| 107 | -// All(&result) | ||
| 108 | -// return result, err | ||
| 109 | -// } | ||
| 110 | - | ||
| 111 | func CountUserDepartByDepart(departid int64) (int64, error) { | 70 | func CountUserDepartByDepart(departid int64) (int64, error) { |
| 112 | var ( | 71 | var ( |
| 113 | cnt int64 | 72 | cnt int64 |
| @@ -142,7 +101,7 @@ func ExistUserDepart(departid int64, usercompanyid int64) bool { | @@ -142,7 +101,7 @@ func ExistUserDepart(departid int64, usercompanyid int64) bool { | ||
| 142 | ok = o.QueryTable(&UserDepartment{}). | 101 | ok = o.QueryTable(&UserDepartment{}). |
| 143 | Filter("department_id", departid). | 102 | Filter("department_id", departid). |
| 144 | Filter("user_company_id", usercompanyid). | 103 | Filter("user_company_id", usercompanyid). |
| 145 | - Filter("delete_at", 0). | 104 | + Filter("enable_status", USER_DEPARTMENT_ENABLE_YES). |
| 146 | Exist() | 105 | Exist() |
| 147 | return ok | 106 | return ok |
| 148 | } | 107 | } |
-
请 注册 或 登录 后发表评论