作者 tangxvhui

bug 修复

@@ -61,13 +61,10 @@ func IncreaseAchevementScore(companyid int64, addScore float64, o orm.Ormer) err @@ -61,13 +61,10 @@ func IncreaseAchevementScore(companyid int64, addScore float64, o orm.Ormer) err
61 Filter("company_id", companyid). 61 Filter("company_id", companyid).
62 Exist() 62 Exist()
63 if ok { 63 if ok {
64 - //存在  
65 - _, err := o.QueryTable(&AchevementScore{}).  
66 - Filter("company_id", companyid).  
67 - Update(orm.Params{  
68 - "grasp_score_remain": orm.ColValue(orm.ColAdd, addScore),  
69 - "update_at": time.Now().String(),  
70 - }) 64 + nowTime := time.Now().Format("2006-01-02 15:04:05")
  65 + sql := `update achevement_score set grasp_score_remain=grasp_score_remain+?,update_at=? where company_id=?`
  66 + //存在,更新
  67 + _, err := o.Raw(sql, addScore, nowTime, companyid).Exec()
71 return err 68 return err
72 } 69 }
73 //不存在 70 //不存在
@@ -32,9 +32,9 @@ func init() { @@ -32,9 +32,9 @@ func init() {
32 32
33 func (t *Position) SetRelation(parent *Position) error { 33 func (t *Position) SetRelation(parent *Position) error {
34 if parent == nil { 34 if parent == nil {
35 - t.Relation = fmt.Sprintf("%d/", t.Id) 35 + t.Relation = fmt.Sprintf(",%d,", t.Id)
36 } else { 36 } else {
37 - t.Relation = fmt.Sprintf("%s%d/", parent.Relation, t.Id) 37 + t.Relation = fmt.Sprintf("%s%d,", parent.Relation, t.Id)
38 } 38 }
39 return nil 39 return nil
40 } 40 }
@@ -89,5 +89,6 @@ func SetCompanyCharge(data ModuleCompanytData) error { @@ -89,5 +89,6 @@ func SetCompanyCharge(data ModuleCompanytData) error {
89 } 89 }
90 90
91 func UpdateCompanyData(data ModuleCompanytData) error { 91 func UpdateCompanyData(data ModuleCompanytData) error {
  92 +
92 return nil 93 return nil
93 } 94 }
@@ -225,7 +225,7 @@ func AddDepartmentData(data ModuleDeparmentData) error { @@ -225,7 +225,7 @@ func AddDepartmentData(data ModuleDeparmentData) error {
225 func DeleteDepartmentData(ids []int64) error { 225 func DeleteDepartmentData(ids []int64) error {
226 o := orm.NewOrm() 226 o := orm.NewOrm()
227 _, err := o.QueryTable(&models.Department{}). 227 _, err := o.QueryTable(&models.Department{}).
228 - Filter("id__in", ids). 228 + Filter("business_department_id__in", ids).
229 Update(orm.Params{ 229 Update(orm.Params{
230 "delete_at": time.Now().Format("2006-01-02 15:04:05"), 230 "delete_at": time.Now().Format("2006-01-02 15:04:05"),
231 }) 231 })
@@ -122,10 +122,6 @@ func positionRelationUpdate(positionUpdate models.Position, newparent models.Pos @@ -122,10 +122,6 @@ func positionRelationUpdate(positionUpdate models.Position, newparent models.Pos
122 const ( 122 const (
123 //获取某个职位的下级职位 锁数据 select ... for update 123 //获取某个职位的下级职位 锁数据 select ... for update
124 dataSql0 string = `SELECT id,relation FROM position WHERE relation LIKE ? AND delete_at = 0 FOR UPDATE` 124 dataSql0 string = `SELECT id,relation FROM position WHERE relation LIKE ? AND delete_at = 0 FOR UPDATE`
125 - //更新关系树  
126 - // string = `update position set relation=? where id=?`  
127 - //更新departUpdate的parent_id  
128 - //dataSql3 string = `update position set parent_id=? where id=?`  
129 ) 125 )
130 var ( 126 var (
131 positionSubset []*models.Position //子级部门 127 positionSubset []*models.Position //子级部门
@@ -136,9 +132,9 @@ func positionRelationUpdate(positionUpdate models.Position, newparent models.Pos @@ -136,9 +132,9 @@ func positionRelationUpdate(positionUpdate models.Position, newparent models.Pos
136 ) 132 )
137 if newparent.Id == 0 { 133 if newparent.Id == 0 {
138 //修改节点为顶层节点的情况 134 //修改节点为顶层节点的情况
139 - newRelation = fmt.Sprintf("%d/", positionUpdate.Id) 135 + newRelation = fmt.Sprintf(",%d,", positionUpdate.Id)
140 } else { 136 } else {
141 - newRelation = fmt.Sprintf("%s%d/", newparent.Relation, positionUpdate.Id) 137 + newRelation = fmt.Sprintf("%s%d,", newparent.Relation, positionUpdate.Id)
142 } 138 }
143 o := orm.NewOrm() 139 o := orm.NewOrm()
144 o.Begin() 140 o.Begin()