作者 tangxvhui

bug 修复

... ... @@ -61,13 +61,10 @@ func IncreaseAchevementScore(companyid int64, addScore float64, o orm.Ormer) err
Filter("company_id", companyid).
Exist()
if ok {
//存在
_, err := o.QueryTable(&AchevementScore{}).
Filter("company_id", companyid).
Update(orm.Params{
"grasp_score_remain": orm.ColValue(orm.ColAdd, addScore),
"update_at": time.Now().String(),
})
nowTime := time.Now().Format("2006-01-02 15:04:05")
sql := `update achevement_score set grasp_score_remain=grasp_score_remain+?,update_at=? where company_id=?`
//存在,更新
_, err := o.Raw(sql, addScore, nowTime, companyid).Exec()
return err
}
//不存在
... ...
... ... @@ -32,9 +32,9 @@ func init() {
func (t *Position) SetRelation(parent *Position) error {
if parent == nil {
t.Relation = fmt.Sprintf("%d/", t.Id)
t.Relation = fmt.Sprintf(",%d,", t.Id)
} else {
t.Relation = fmt.Sprintf("%s%d/", parent.Relation, t.Id)
t.Relation = fmt.Sprintf("%s%d,", parent.Relation, t.Id)
}
return nil
}
... ...
... ... @@ -89,5 +89,6 @@ func SetCompanyCharge(data ModuleCompanytData) error {
}
func UpdateCompanyData(data ModuleCompanytData) error {
return nil
}
... ...
... ... @@ -225,7 +225,7 @@ func AddDepartmentData(data ModuleDeparmentData) error {
func DeleteDepartmentData(ids []int64) error {
o := orm.NewOrm()
_, err := o.QueryTable(&models.Department{}).
Filter("id__in", ids).
Filter("business_department_id__in", ids).
Update(orm.Params{
"delete_at": time.Now().Format("2006-01-02 15:04:05"),
})
... ...
... ... @@ -122,10 +122,6 @@ func positionRelationUpdate(positionUpdate models.Position, newparent models.Pos
const (
//获取某个职位的下级职位 锁数据 select ... for update
dataSql0 string = `SELECT id,relation FROM position WHERE relation LIKE ? AND delete_at = 0 FOR UPDATE`
//更新关系树
// string = `update position set relation=? where id=?`
//更新departUpdate的parent_id
//dataSql3 string = `update position set parent_id=? where id=?`
)
var (
positionSubset []*models.Position //子级部门
... ... @@ -136,9 +132,9 @@ func positionRelationUpdate(positionUpdate models.Position, newparent models.Pos
)
if newparent.Id == 0 {
//修改节点为顶层节点的情况
newRelation = fmt.Sprintf("%d/", positionUpdate.Id)
newRelation = fmt.Sprintf(",%d,", positionUpdate.Id)
} else {
newRelation = fmt.Sprintf("%s%d/", newparent.Relation, positionUpdate.Id)
newRelation = fmt.Sprintf("%s%d,", newparent.Relation, positionUpdate.Id)
}
o := orm.NewOrm()
o.Begin()
... ...