Commit cc237398 by Joneq

修改静态分值

parent b3ba55bc
......@@ -28,6 +28,7 @@ type (
//---静态开始
GetCompanyCresitsList(ctx context.Context) (r []map[string]string, err error)
InsertScores(ctx context.Context, score model.Scores) (insertId int64, err error)
InsertBankStaticScores(ctx context.Context, score model.Scores) (insertId int64, err error)
GetCompanyBaseInfoByCid(c context.Context, companyId int64) (r map[string]string, err error)
GetCompanyScoreFieldsByCid(c context.Context, companyId int64) (r map[string]string, err error)
GetBasicInfoByCid(c context.Context, erpCompanyCode string) (r map[string]string, err error)
......
......@@ -58,6 +58,56 @@ func (d *dao) InsertScores(ctx context.Context,score model.Scores) (insertId int
return
}
//修改静态银行的分数
func (d *dao) InsertBankStaticScores(ctx context.Context,score model.Scores) (insertId int64,err error) {
var(
exitId int64
execSql string
affectNum int64
rows *sql.Rows
)
rows,err = d.db_bank.Query(ctx,"select id from lie_scores where `type` = ? and project_pid = ? and project_id = ? and com_credits_id = ? limit 0,1", score.Type,score.ProjectPid,score.ProjectId,score.ComCreditsId)
defer rows.Close()
logic.CheckErr(err)
twoMap,err := GetAllParam(rows)
exitId = 0
for _,v:=range twoMap{
exitId = logic.StringTurnInt64(v["id"])
break
}
if exitId == 0 {
execSql = "INSERT INTO `lie_scores` (`type`, `project_pid`, `project_id`, `total_score`, `current_score`, `weight`, `final_score`, `com_credits_id`, `create_time`)VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)"
row,err := d.db_bank.Exec(ctx,execSql,score.Type,score.ProjectPid,score.ProjectId,score.TotalScore,score.CurrentScore,score.Weight,score.FinalScore,score.ComCreditsId,time.Now().Unix())
if err != nil {
logic.CheckErr(err)
}else{
affectNum,_ = row.LastInsertId()
}
}else{
execSql = "update `lie_scores` set `type` = ?, `project_pid` = ?, `project_id` = ?, `total_score` = ?, `current_score` = ?, `weight` = ?, `final_score` = ?, `update_time` = ? where `type` = ? and project_pid = ? and project_id = ? and com_credits_id = ?"
row,err := d.db_bank.Exec(ctx,execSql,score.Type,score.ProjectPid,score.ProjectId,score.TotalScore,score.CurrentScore,score.Weight,score.FinalScore,time.Now().Unix(),score.Type,score.ProjectPid,score.ProjectId,score.ComCreditsId)
if err != nil {
logic.CheckErr(err)
}else{
affectNum,_ = row.RowsAffected()
}
}
insertId = affectNum
return
}
//增加或者修改记录(动态模型专用)
func (d *dao) InsertScores2(ctx context.Context,score model.Scores,month_six_zi int64) (insertId int64,err error) {
......
......@@ -150,6 +150,7 @@ func (s *Service) InsertScores(c context.Context,score model.Scores) (res int64,
//调用DB方法,获取会员数据
res, err = s.dao.InsertScores(c,score)
res, err = s.dao.InsertBankStaticScores(c,score)
logic.CheckErr(err)
return
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment