38 changed files with 1475 additions and 56 deletions
@ -0,0 +1,230 @@ |
|||
package dutyassess |
|||
|
|||
import ( |
|||
"fmt" |
|||
"strconv" |
|||
"strings" |
|||
"time" |
|||
|
|||
"github.com/flipped-aurora/gin-vue-admin/server/commonus" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/global" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel" |
|||
) |
|||
|
|||
//判断考核细则是否存在(新规则)
|
|||
/* |
|||
参数说明 |
|||
@ascription 归属指标栏目 |
|||
@title 指标细则 |
|||
@explain 指标说明' |
|||
@explainId 指标明细ID |
|||
@ReferenceScore 分数 |
|||
@CompanyCont 单位 |
|||
@sunTargetId 子栏目 |
|||
*/ |
|||
// func JudgeDetailsCopy(ascription, title, explain, explainId, ReferenceScore, CompanyCont string, sunTargetId int64, addReduce int) (content assessmentmodel.DetailedTarget, isTrue bool)
|
|||
// detailedTargetInfo, dtiIsTrue := commonus.JudgeDetailsCopy(requestData.Target, v.Title, v.Content, v.DetailedTarget, v.ReferenceScore, v.Unit, sunTargetCont.Id, v.AddOrReduce)
|
|||
/* |
|||
参数说明 |
|||
@ascription 归属指标栏目 |
|||
@sunTargetId 子栏目 |
|||
@detailedTarget 考核细则 |
|||
*/ |
|||
func JudgeDetailsCopyEs(ascription string, sunTargetId int64, detailedTarget QualEvalSunList) (content assessmentmodel.DetailedTarget, isTrue bool) { |
|||
|
|||
if detailedTarget.AddOrReduce == 0 { |
|||
detailedTarget.AddOrReduce = 1 |
|||
} |
|||
var minScoreInt int64 |
|||
var maxScoreInt int64 |
|||
scoreAry := strings.Split(detailedTarget.ReferenceScore, "-") |
|||
scoreLen := len(scoreAry) |
|||
// fmt.Printf("ScoreAry:%v----------->%v------------>%v------------>%v\n", ReferenceScore, scoreLen, scoreAry[0], scoreAry)
|
|||
if scoreLen > 0 { |
|||
if scoreLen == 1 { |
|||
maxScore, _ := strconv.ParseFloat(scoreAry[0], 64) |
|||
zhhh := maxScore * 100 |
|||
zhuanStr := strconv.FormatFloat(zhhh, 'f', -1, 64) |
|||
maxScoreInt, _ = strconv.ParseInt(strconv.FormatFloat(maxScore*100, 'f', -1, 64), 10, 64) |
|||
minScoreInt = 0 |
|||
|
|||
fmt.Printf("ScoreAry--1-----:%v----------->%v------------>%v------------>%v\n", maxScore, maxScoreInt, zhuanStr, zhhh) |
|||
} else { |
|||
minScore, _ := strconv.ParseFloat(scoreAry[0], 64) |
|||
maxScore, _ := strconv.ParseFloat(scoreAry[scoreLen-1], 64) |
|||
minScoreInt, _ = strconv.ParseInt(strconv.FormatFloat(minScore*100, 'f', -1, 64), 10, 64) |
|||
maxScoreInt, _ = strconv.ParseInt(strconv.FormatFloat(maxScore*100, 'f', -1, 64), 10, 64) |
|||
} |
|||
} else { |
|||
minScoreInt = 0 |
|||
maxScoreInt = 0 |
|||
} |
|||
isTrue = false |
|||
if detailedTarget.DetailedTarget != "" { |
|||
judgeIdErr := global.GVA_DB_Performanceappraisal.Where("`dt_id` = ?", detailedTarget.DetailedTarget).First(&content).Error |
|||
if judgeIdErr == nil { |
|||
eiteCont := commonus.MapOut() |
|||
if minScoreInt > maxScoreInt { |
|||
eiteCont["dt_min_score"] = maxScoreInt |
|||
eiteCont["dt_max_score"] = minScoreInt |
|||
} else { |
|||
eiteCont["dt_min_score"] = minScoreInt |
|||
eiteCont["dt_max_score"] = maxScoreInt |
|||
} |
|||
eiteCont["dt_title"] = detailedTarget.Title |
|||
eiteCont["dt_content"] = detailedTarget.CensorCont |
|||
eiteCont["dt_company"] = detailedTarget.Unit |
|||
eiteCont["dt_add_reduce"] = detailedTarget.AddOrReduce |
|||
eiteCont["dt_time"] = time.Now().Unix() |
|||
|
|||
if detailedTarget.Cycles != 0 { |
|||
eiteCont["dt_cycle"] = detailedTarget.Cycles |
|||
} |
|||
if detailedTarget.CycleAttres != 0 { |
|||
eiteCont["dt_cycleattr"] = detailedTarget.CycleAttres |
|||
} |
|||
|
|||
if detailedTarget.CensorType != 0 { |
|||
eiteCont["dt_censor_type"] = detailedTarget.CensorType |
|||
} |
|||
eiteCont["dt_censor_cont"] = detailedTarget.CensorCont |
|||
if detailedTarget.CensorRate != 0 { |
|||
eiteCont["dt_censor_rate"] = detailedTarget.CensorRate |
|||
} |
|||
|
|||
global.GVA_DB_Performanceappraisal.Model(&content).Where("`dt_id` = ?", detailedTarget.DetailedTarget).Updates(&eiteCont) |
|||
// fmt.Printf("echo --------------1---------->%v\n", content)
|
|||
isTrue = true |
|||
return |
|||
} |
|||
} |
|||
judgeErr := global.GVA_DB_Performanceappraisal.Where("`dt_parentid` = ? AND `dt_title` = ?", ascription, detailedTarget.Title).First(&content).Error |
|||
if judgeErr == nil { |
|||
isTrue = true |
|||
eiteCont := commonus.MapOut() |
|||
if minScoreInt > maxScoreInt { |
|||
eiteCont["dt_min_score"] = maxScoreInt |
|||
eiteCont["dt_max_score"] = minScoreInt |
|||
} else { |
|||
eiteCont["dt_min_score"] = minScoreInt |
|||
eiteCont["dt_max_score"] = maxScoreInt |
|||
} |
|||
eiteCont["dt_content"] = detailedTarget.CensorCont |
|||
eiteCont["dt_company"] = detailedTarget.Unit |
|||
eiteCont["dt_add_reduce"] = detailedTarget.AddOrReduce |
|||
eiteCont["dt_time"] = time.Now().Unix() |
|||
|
|||
if detailedTarget.Cycles != 0 { |
|||
eiteCont["dt_cycle"] = detailedTarget.Cycles |
|||
} |
|||
if detailedTarget.CycleAttres != 0 { |
|||
eiteCont["dt_cycleattr"] = detailedTarget.CycleAttres |
|||
} |
|||
|
|||
if detailedTarget.CensorType != 0 { |
|||
eiteCont["dt_censor_type"] = detailedTarget.CensorType |
|||
} |
|||
eiteCont["dt_censor_cont"] = detailedTarget.CensorCont |
|||
if detailedTarget.CensorRate != 0 { |
|||
eiteCont["dt_censor_rate"] = detailedTarget.CensorRate |
|||
} |
|||
|
|||
global.GVA_DB_Performanceappraisal.Model(&content).Where("`dt_id` = ?", content.Id).Updates(&eiteCont) |
|||
// fmt.Printf("echo --------------2---------->%v\n", content)
|
|||
return |
|||
} |
|||
ascriptionId, ascriptionErr := strconv.ParseInt(ascription, 10, 64) |
|||
if ascriptionErr != nil { |
|||
ascriptionId = 0 |
|||
} |
|||
|
|||
var minScoreIsTrue int64 = 0 |
|||
var maxScoreIsTrue int64 = 0 |
|||
if minScoreInt > maxScoreInt { |
|||
minScoreIsTrue = maxScoreInt |
|||
maxScoreIsTrue = minScoreInt |
|||
} else { |
|||
minScoreIsTrue = minScoreInt |
|||
maxScoreIsTrue = maxScoreInt |
|||
} |
|||
|
|||
// fmt.Printf("ScoreAry---KKKK:%v----------->%v------------>%v------------>%v", minScoreIsTrue, maxScoreIsTrue, minScoreIsTrue, maxScoreIsTrue)
|
|||
|
|||
var saveColumEs assessmentmodel.DetailedTarget |
|||
|
|||
saveColumEs.Title = detailedTarget.Title |
|||
saveColumEs.Content = detailedTarget.CensorCont |
|||
saveColumEs.ParentId = ascriptionId |
|||
saveColumEs.ParentIdSun = sunTargetId |
|||
saveColumEs.State = 1 |
|||
saveColumEs.AddTime = time.Now().Unix() |
|||
saveColumEs.MinScore = minScoreIsTrue |
|||
saveColumEs.MaxScore = maxScoreIsTrue |
|||
saveColumEs.Company = detailedTarget.Unit |
|||
if detailedTarget.AddOrReduce > 0 { |
|||
saveColumEs.AddReduce = detailedTarget.AddOrReduce |
|||
} else { |
|||
saveColumEs.AddReduce = 1 |
|||
} |
|||
if detailedTarget.CensorType > 0 { |
|||
saveColumEs.CensorType = detailedTarget.CensorType |
|||
} else { |
|||
saveColumEs.CensorType = 1 |
|||
} |
|||
saveColumEs.CensorCont = detailedTarget.CensorCont |
|||
if detailedTarget.CensorRate > 0 { |
|||
saveColumEs.CensorRate = detailedTarget.CensorRate |
|||
} else { |
|||
saveColumEs.CensorRate = 1 |
|||
} |
|||
var targetInfoCont assessmentmodel.EvaluationTarget |
|||
tarEvlWhe := commonus.MapOut() |
|||
tarEvlWhe["et_id"] = ascriptionId |
|||
targetInfoCont.GetCont(tarEvlWhe, "et_cycle", "et_cycleattr") |
|||
if detailedTarget.Cycles > 0 { |
|||
saveColumEs.Cycles = detailedTarget.Cycles |
|||
} else { |
|||
if targetInfoCont.Cycles > 1 { |
|||
saveColumEs.Cycles = targetInfoCont.Cycles |
|||
} else { |
|||
saveColumEs.Cycles = 4 |
|||
} |
|||
|
|||
} |
|||
if detailedTarget.CycleAttres > 0 { |
|||
saveColumEs.CycleAttres = detailedTarget.CycleAttres |
|||
} else { |
|||
if targetInfoCont.CycleAttres > 1 { |
|||
saveColumEs.CycleAttres = targetInfoCont.CycleAttres |
|||
} else { |
|||
saveColumEs.CycleAttres = 1 |
|||
} |
|||
} |
|||
|
|||
addErr := global.GVA_DB_Performanceappraisal.Create(&saveColumEs).Error |
|||
|
|||
// saveColum := assessmentmodel.DetailedTarget{
|
|||
// Title: detailedTarget.Title,
|
|||
// Content: detailedTarget.CensorCont,
|
|||
// ParentId: ascriptionId,
|
|||
// ParentIdSun: sunTargetId,
|
|||
// State: 1,
|
|||
// AddTime: time.Now().Unix(),
|
|||
// Company: detailedTarget.Unit,
|
|||
// MinScore: minScoreIsTrue,
|
|||
// MaxScore: maxScoreIsTrue,
|
|||
// AddReduce: detailedTarget.AddOrReduce,
|
|||
// Cycles: detailedTarget.Cycles,
|
|||
// CycleAttres: detailedTarget.CycleAttres,
|
|||
// }
|
|||
// addErr := global.GVA_DB_Performanceappraisal.Create(&saveColum).Error
|
|||
if addErr != nil { |
|||
// fmt.Printf("echo --------------3---------->%v\n", saveColum.Id)
|
|||
return |
|||
} |
|||
// fmt.Printf("echo --------------4---------->%v\n", saveColum.Id)
|
|||
isTrue = true |
|||
// content = saveColum
|
|||
content = saveColumEs |
|||
return |
|||
} |
|||
@ -0,0 +1,66 @@ |
|||
package dutyassess |
|||
|
|||
import ( |
|||
"github.com/flipped-aurora/gin-vue-admin/server/commonus" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/global" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/model/hrsystem" |
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
//岗位考核方案列表
|
|||
func (d *DutyAssessApi) PositionDepartPlanVersion(c *gin.Context) { |
|||
var requestData positionPlanVersio |
|||
err := c.ShouldBindJSON(&requestData) |
|||
|
|||
if err != nil { |
|||
// response.Result(101, err, "数据获取失败!", c)
|
|||
// return
|
|||
} |
|||
gormDb := global.GVA_DB_Performanceappraisal |
|||
if requestData.Group != "" { |
|||
gormDb = gormDb.Where("`group` = ?", requestData.Group) |
|||
} |
|||
if requestData.DeaprtId != "" { |
|||
gormDb = gormDb.Where("`department` = ?", requestData.DeaprtId) |
|||
} |
|||
if requestData.Position != "" { |
|||
gormDb = gormDb.Where("`position` = ?", requestData.Position) |
|||
} |
|||
if requestData.Year != "" { |
|||
gormDb = gormDb.Where("`years` = ?", requestData.Year) |
|||
} |
|||
if requestData.Versio != "" { |
|||
gormDb = gormDb.Where("`version` LIKE ?", "%"+requestData.Versio+"%") |
|||
} |
|||
if requestData.VersioNum != "" { |
|||
gormDb = gormDb.Where("`key` LIKE ?", "%"+requestData.VersioNum+"%") |
|||
} |
|||
if requestData.State != 0 { |
|||
gormDb = gormDb.Where("`state` = ?", requestData.State) |
|||
} else { |
|||
gormDb = gormDb.Where("`state` IN (1,2)") |
|||
} |
|||
// response.Result(104, requestData, "没有查询到数据", c)
|
|||
// return
|
|||
var planVersio []positionPlanVersionOut |
|||
dataErr := gormDb.Order("`addtime` DESC").Find(&planVersio).Error |
|||
if dataErr != nil { |
|||
response.Result(104, dataErr, "没有查询到数据", c) |
|||
return |
|||
} |
|||
for i, v := range planVersio { |
|||
var groupCont hrsystem.AdministrativeOrganization |
|||
groupCont.GetCont(map[string]interface{}{"id": v.Group}, "name") |
|||
planVersio[i].GroupName = groupCont.Name |
|||
groupCont.GetCont(map[string]interface{}{"id": v.Department}, "name") |
|||
planVersio[i].DeaprtName = groupCont.Name |
|||
var positionCont hrsystem.Position |
|||
groupCont.GetCont(map[string]interface{}{"id": v.Department}, "name") |
|||
planVersio[i].PositionName = positionCont.Name |
|||
planVersio[i].Time = commonus.TimeStampToDate(v.AddTime, 20) |
|||
} |
|||
response.Result(0, planVersio, "获取成功", c) |
|||
} |
|||
|
|||
//添加岗位
|
|||
@ -0,0 +1,48 @@ |
|||
package hrsystem |
|||
|
|||
import ( |
|||
"strings" |
|||
|
|||
"github.com/flipped-aurora/gin-vue-admin/server/global" |
|||
) |
|||
|
|||
//行政组织
|
|||
type AdministrativeOrganization struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(50) unsigned;default:'';not null;comment:行政编码"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:组织名称"` |
|||
Superior int64 `json:"superior" gorm:"column:superior;type:bigint(20) unsigned;default:0;not null;comment:上级ID"` |
|||
OrganizationType int64 `json:"organizationtype" gorm:"column:organization_type;type:bigint(20) unsigned;default:0;not null;comment:行政组织类型"` |
|||
Abbreviation string `json:"abbreviation" gorm:"column:abbreviation;type:varchar(255) unsigned;default:'';not null;comment:行政组织简称"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
WechatOrganizationId int64 `json:"wechatorganizationid" gorm:"column:wechat_organization_id;type:bigint(20) unsigned;default:0;not null;comment:微信组织架构对照码"` |
|||
} |
|||
|
|||
func (AdministrativeOrganization *AdministrativeOrganization) TableName() string { |
|||
return "administrative_organization" |
|||
} |
|||
|
|||
//编辑行政组织内容
|
|||
func (cont *AdministrativeOrganization) EiteCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { |
|||
err = global.GVA_DB_HrDataBase.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
//获取行政组织内容
|
|||
func (cont *AdministrativeOrganization) GetCont(whereMap map[string]interface{}, field ...string) (err error) { |
|||
gormDb := global.GVA_DB_HrDataBase.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
//根据条件获取总数
|
|||
func (cont *AdministrativeOrganization) CountCont(whereMap map[string]interface{}) (countId int64) { |
|||
global.GVA_DB_HrDataBase.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
package hrsystem |
|||
|
|||
import ( |
|||
"strings" |
|||
|
|||
"github.com/flipped-aurora/gin-vue-admin/server/global" |
|||
) |
|||
|
|||
//行政组织类型
|
|||
type AdministrativeOrganizationType struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:类型名称"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
Level int64 `json:"level" gorm:"column:level;type:int(5) unsigned;default:1;not null;comment:级别"` |
|||
} |
|||
|
|||
func (AdministrativeOrganizationType *AdministrativeOrganizationType) TableName() string { |
|||
return "administrative_organization_type" |
|||
} |
|||
|
|||
//编辑职务分类内容
|
|||
func (cont *AdministrativeOrganizationType) EiteCont(whereMap interface{}, saveData map[string]interface{}) (err error) { |
|||
err = global.GVA_DB_HrDataBase.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
//获取详细内容
|
|||
func (cont *AdministrativeOrganizationType) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := global.GVA_DB_HrDataBase.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
package hrsystem |
|||
|
|||
import "github.com/flipped-aurora/gin-vue-admin/server/global" |
|||
|
|||
//职务
|
|||
type Duties struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:职务名称"` |
|||
JobType int64 `json:"jobtype" gorm:"column:job_type;type:bigint(20) unsigned;default:0;not null;comment:归属职务类型"` |
|||
Weight int64 `json:"weight" gorm:"column:weight;type:bigint(20) unsigned;default:1;not null;comment:权重"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(50) unsigned;default:'';not null;comment:编码"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
} |
|||
|
|||
func (Duties *Duties) TableName() string { |
|||
return "duties" |
|||
} |
|||
|
|||
//编辑职务分类内容
|
|||
func (Duties *Duties) EiteCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { |
|||
err = global.GVA_DB_HrDataBase.Model(&Duties).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
package hrsystem |
|||
|
|||
import "github.com/flipped-aurora/gin-vue-admin/server/global" |
|||
|
|||
//职务分类
|
|||
type JobClass struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:职务分类名称"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
} |
|||
|
|||
func (JobClass *JobClass) TableName() string { |
|||
return "job_class" |
|||
} |
|||
|
|||
//编辑职务分类内容
|
|||
func (JobClass *JobClass) EiteJobClassCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { |
|||
err = global.GVA_DB_HrDataBase.Model(&JobClass).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,49 @@ |
|||
package hrsystem |
|||
|
|||
import ( |
|||
"strings" |
|||
|
|||
"github.com/flipped-aurora/gin-vue-admin/server/global" |
|||
) |
|||
|
|||
//职位(岗位)
|
|||
type Position struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(50) unsigned;default:'';not null;comment:职位编码"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:职位名称"` |
|||
Duties int64 `json:"duties" gorm:"column:duties;type:bigint(20) unsigned;default:0;not null;comment:职务"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
AdministrativeOrganization int64 `json:"administrativeorganization" gorm:"column:administrative_organization;type:bigint(20) unsigned;default:0;not null;comment:归属行政组织"` |
|||
Superior int64 `json:"superior" gorm:"column:superior;type:bigint(20) unsigned;default:0;not null;comment:上级ID"` |
|||
PersonInCharge int `json:"personincharge" gorm:"column:person_in_charge;type:int(1) unsigned;default:2;not null;comment:是否为本部门负责人(1:是;2:否)"` |
|||
Department int64 `json:"department" gorm:"column:department;type:bigint(20) unsigned;default:0;not null;comment:部门"` |
|||
} |
|||
|
|||
func (Position *Position) TableName() string { |
|||
return "position" |
|||
} |
|||
|
|||
//编辑职务分类内容
|
|||
func (cont *Position) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = global.GVA_DB_HrDataBase.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
//获取行政组织内容
|
|||
func (cont *Position) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := global.GVA_DB_HrDataBase.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
//根据条件获取总数
|
|||
func (cont *Position) CountCont(whereMap interface{}) (countId int64) { |
|||
global.GVA_DB_HrDataBase.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue