作者 tangxvhui

Merge branch 'test' into dev

... ... @@ -8,7 +8,7 @@ import (
)
type Company struct {
Id int64 `orm:"column(id);auto"`
Id int64 `orm:"column(id);pk"`
Name string `orm:"column(name);size(40)"`
AdminId int64 `orm:"column(admin_id)"`
CreateAt time.Time `orm:"column(create_at);type(timestamp);auto_now"`
... ... @@ -64,7 +64,6 @@ func AddCompany(m *Company, om ...orm.Ormer) (id int64, err error) {
}
m.CreateAt = time.Now()
m.UpdateAt = time.Now()
m.Enable = COMPANY_ENABLE_YES
m.DeleteAt = time.Unix(0, 0)
id, err = o.Insert(m)
return
... ...
... ... @@ -2,7 +2,6 @@ package models
import (
"encoding/json"
"errors"
"fmt"
"oppmg/common/log"
"oppmg/protocol"
... ... @@ -12,7 +11,7 @@ import (
)
type Department struct {
Id int64 `orm:"column(id);auto"`
Id int64 `orm:"column(id);pk"`
CompanyId int64 `orm:"column(company_id)" description:"公司id"`
Name string `orm:"column(name);size(30)" description:"部门名称"`
CreateAt time.Time `orm:"column(create_at);type(timestamp)" description:"创建时间"`
... ... @@ -53,9 +52,6 @@ func (t *Department) SetManages(v []int64) {
}
func (t *Department) SetRelation(parent *Department) error {
if t.Id == 0 {
return errors.New("Id==0")
}
if parent == nil {
t.Relation = fmt.Sprintf(",%d,", t.Id)
} else if parent.Id == 0 {
... ...
... ... @@ -8,7 +8,7 @@ import (
)
type Position struct {
Id int64 `orm:"column(id);auto" description:"职位表id"`
Id int64 `orm:"column(id);pk" description:"职位表id"`
CompanyId int64 `orm:"column(company_id)" description:"表company.id 公司编号"`
Name string `orm:"column(name);size(100)" description:"职位名称"`
ParentId int64 `orm:"column(parent_id)" description:"父级id"`
... ...
... ... @@ -9,7 +9,7 @@ import (
)
type UserCompany struct {
Id int64 `orm:"column(id);auto" description:"唯一标识"`
Id int64 `orm:"column(id);pk" description:"唯一标识"`
CompanyId int64 `orm:"column(company_id)" description:"表company.id 公司编号"`
UserId int64 `orm:"column(user_id)" description:"表user.id 用户编号"`
NickName string `orm:"column(nick_name)"`
... ...
... ... @@ -241,7 +241,7 @@ func AddCompanyData(data ModuleCompanytData) error {
if err != nil {
o.Rollback()
log.Error("处理user_department数据失败:%s", err)
return protocol.NewErrWithMessage("1")
return errors.New("处理user_department数据失败")
}
//添加部门主管
log.Info("添加department_charge表数据")
... ... @@ -622,9 +622,8 @@ func initUserDedaprtmet(newDepartment *models.Department, newUserCompany *models
//添加部门
newUserDepartment = &models.UserDepartment{
UserCompanyId: newUserCompany.Id,
//UserId: newUserCompany.UserId,
CompanyId: newUserCompany.CompanyId,
DepartmentId: newDepartment.Id,
CompanyId: newUserCompany.CompanyId,
DepartmentId: newDepartment.Id,
}
_, err = models.AddUserDepartment(newUserDepartment, o)
if err != nil {
... ...