68 changed files with 1230 additions and 199 deletions
@ -0,0 +1,220 @@ |
|||
package departmentpc |
|||
|
|||
import ( |
|||
"fmt" |
|||
"key_performance_indicators/models/modelshr" |
|||
"key_performance_indicators/models/modelskpi" |
|||
"key_performance_indicators/overall" |
|||
"key_performance_indicators/overall/publicmethod" |
|||
"strconv" |
|||
"strings" |
|||
"time" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
// 部门指标列表
|
|||
func (a *ApiMethod) DepartmentTargetList(c *gin.Context) { |
|||
var receivedValue departListQuery |
|||
c.ShouldBindJSON(&receivedValue) |
|||
if receivedValue.Page == 0 { |
|||
receivedValue.Page = 1 |
|||
} |
|||
if receivedValue.PageSize == 0 { |
|||
receivedValue.PageSize = 20 |
|||
} |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&modelskpi.EvaluationTarget{}) |
|||
if receivedValue.State != 0 { //状态(1:启用;2:禁用;3:删除)
|
|||
gormDb = gormDb.Where("et_state = ?", receivedValue.State) |
|||
} else { |
|||
gormDb = gormDb.Where("et_state BETWEEN ? AND ?", 1, 2) |
|||
} |
|||
if receivedValue.Title != "" { //指标名称
|
|||
gormDb = gormDb.Where("et_state LIKE ?", "%"+receivedValue.Title+"%") |
|||
} |
|||
if receivedValue.Class != 0 { //1:定性考核;2:定量考核
|
|||
gormDb = gormDb.Where("et_type = ?", receivedValue.Class) |
|||
} |
|||
if receivedValue.DepartmentId != "" { //部门ID
|
|||
gormDb = gormDb.Where("FIND_IN_SET(?,`departments_post`)", receivedValue.DepartmentId) |
|||
} |
|||
if receivedValue.DimensionId != "" { //维度ID
|
|||
gormDb = gormDb.Where("et_dimension = ?", receivedValue.DimensionId) |
|||
} |
|||
if receivedValue.ReportPerson != "" { //上报人
|
|||
gormDb = gormDb.Where("FIND_IN_SET(?,`et_report`)", receivedValue.ReportPerson) |
|||
} |
|||
if receivedValue.ScoringMethod != 0 { //计分方式(1:自动;2:手动)
|
|||
gormDb = gormDb.Where("et_scoring_method = ?", receivedValue.ScoringMethod) |
|||
} |
|||
if receivedValue.Cycle != 0 { //1:班;2:天;3:周;4:月;5:季度;6:年
|
|||
gormDb = gormDb.Where("et_cycle = ?", receivedValue.Cycle) |
|||
} |
|||
|
|||
var total int64 |
|||
totalErr := gormDb.Count(&total).Error |
|||
if totalErr != nil { |
|||
total = 0 |
|||
} |
|||
var departmentTargetList []modelskpi.EvaluationTarget |
|||
gormDb = publicmethod.PageTurningSettings(gormDb, receivedValue.Page, receivedValue.PageSize) |
|||
err := gormDb.Order("`et_id` DESC").Find(&departmentTargetList).Error |
|||
if err != nil { |
|||
publicmethod.Result(105, err, c) |
|||
return |
|||
} |
|||
var targetList []printDepartmentTarget |
|||
for _, v := range departmentTargetList { |
|||
var targetCont printDepartmentTarget |
|||
targetCont.Id = v.Id |
|||
targetCont.Title = v.Title //指标名称"`
|
|||
targetCont.Type = v.Type //1:定性考核;2:定量考核"`
|
|||
targetCont.State = v.State //状态(1:启用;2:禁用;3:删除)"`
|
|||
targetCont.AddTime = v.AddTime //制定时间"`
|
|||
targetCont.Share = v.Share //1:共用;2:私用"`
|
|||
targetCont.RelevantDepartments = v.RelevantDepartments //相关部门"`
|
|||
targetCont.Dimension = v.Dimension //维度"`
|
|||
targetCont.Key = v.Key //UUID"`
|
|||
targetCont.Report = v.Report //上报人"`
|
|||
targetCont.Uniteing = v.Uniteing //计量单位"`
|
|||
targetCont.Cycles = v.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年"`
|
|||
targetCont.CycleAttres = v.CycleAttres //辅助计数"`
|
|||
targetCont.VisibleRange = v.VisibleRange //可见范围"`
|
|||
targetCont.VisibleRangeGroup = v.VisibleRangeGroup //可见范围(集团)"`
|
|||
targetCont.ScoringMethod = v.ScoringMethod //计分方式(1:自动;2:手动)"`
|
|||
var dutyClassCont modelskpi.DutyClass |
|||
dutyClassCont.GetCont(map[string]interface{}{"`id`": v.Dimension}, "`title`") |
|||
targetCont.DimensionTitle = dutyClassCont.Title |
|||
targetList = append(targetList, targetCont) |
|||
} |
|||
publicmethod.ResultList(0, receivedValue.Page, receivedValue.PageSize, total, int64(len(targetList)), targetList, c) |
|||
} |
|||
|
|||
// 实验查询
|
|||
func (a *ApiMethod) Shiyan(c *gin.Context) { |
|||
// var receivedValue departListQuery
|
|||
// c.ShouldBindJSON(&receivedValue)
|
|||
|
|||
// if receivedValue.DepartmentId == "" {
|
|||
// receivedValue.DepartmentId = "316"
|
|||
// }
|
|||
// if receivedValue.DimensionId == "" {
|
|||
// receivedValue.DimensionId = "1"
|
|||
// }
|
|||
|
|||
// var evalCont []modelskpi.EvaluationTarget
|
|||
|
|||
// // gormDb := overall.CONSTANT_DB_KPI.Model(&modelskpi.EvaluationTarget{}).Select("evaluationtarget.*,(?) AS tdm", overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Select("id").Where("department_id = ? AND target_id = et_id ", receivedValue.DepartmentId).Find(&modelskpi.TargetDepartment{})).Having("tdm IS NOT NULL").Find(&evalCont).Error
|
|||
// // fmt.Printf("gormDb----->%v----->%v\n", gormDb, evalCont)
|
|||
// err := overall.CONSTANT_DB_KPI.Raw("SELECT e.*,(SELECT id FROM target_department td WHERE td.department_id = ? AND td.post_id = ? AND td.target_id = e.et_id) as tdm FROM evaluationtarget e HAVING tdm IS NOT NULL", receivedValue.DepartmentId, receivedValue.DimensionId).Scan(&evalCont).Error
|
|||
// fmt.Printf("gormDb----->%v----->%v\n", err, evalCont)
|
|||
//校正部门级考核
|
|||
var dimeTargetList []modelskpi.DetailedTarget |
|||
err := overall.CONSTANT_DB_KPI.Where("dt_state = 1").Find(&dimeTargetList).Error |
|||
if err != nil || len(dimeTargetList) < 1 { |
|||
publicmethod.Result(107, err, c) |
|||
return |
|||
} |
|||
// fmt.Printf("总数---->%v\n", len(dimeTargetList))
|
|||
// var xieChengChuli []modelskpi.DetailedTarget
|
|||
// for i, v := range dimeTargetList {
|
|||
// if (i+1)%100 == 0 {
|
|||
// xieChengChuli = append(xieChengChuli, v)
|
|||
// fmt.Printf("循环--%v-->%v\n", i, len(xieChengChuli))
|
|||
// xieChengChuli = []modelskpi.DetailedTarget{}
|
|||
// } else {
|
|||
// xieChengChuli = append(xieChengChuli, v)
|
|||
// }
|
|||
// }
|
|||
|
|||
for _, v := range dimeTargetList { |
|||
xiaoZhengBuMen(v) |
|||
} |
|||
|
|||
fmt.Printf("jieshu---->%v\n", len(dimeTargetList)) |
|||
} |
|||
|
|||
// 校正部门定性考核关联关系
|
|||
func xiaoZhengBuMen(detaTar modelskpi.DetailedTarget) { |
|||
if detaTar.Paretment != "" { |
|||
bumenAry := strings.Split(detaTar.Paretment, ",") |
|||
if len(bumenAry) > 0 { |
|||
for _, v := range bumenAry { |
|||
zbLmXzBm(detaTar.ParentId, detaTar.ParentIdSun, detaTar.Id, 3, v) |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
//编辑指标、栏目、细则关联部门
|
|||
/* |
|||
@tarId 指标 |
|||
@sunId 栏目 |
|||
@lawsId 细则 |
|||
@class 类型(1:指标;2:子目标;3:细则) |
|||
@bumenId 部门 |
|||
*/ |
|||
func zbLmXzBm(tarId, sunId, lawsId int64, class int, bumenId string) { |
|||
var tarDepCont modelskpi.TargetDepartment |
|||
where := publicmethod.MapOut[string]() |
|||
where["`target_id`"] = tarId |
|||
where["`target_sun_id`"] = sunId |
|||
where["`target_bylaws`"] = lawsId |
|||
where["`department_id`"] = bumenId |
|||
err := tarDepCont.GetCont(where, "`id`", "`state`") |
|||
if err == nil { |
|||
//存在,判断状态
|
|||
if tarDepCont.State != 1 { //不是启用状态,改为启用
|
|||
eidtWher := publicmethod.MapOut[string]() |
|||
eidtWher["``id``"] = tarDepCont.Id |
|||
saveErr := tarDepCont.EiteCont(eidtWher, map[string]interface{}{"`state`": 1, "`time`": time.Now().Unix()}) |
|||
|
|||
fmt.Printf("编辑---->tarId----%v---->sunId----%v---->lawsId----%v---->class----%v---->bumenId----%v------>saveErr----->%v\n", tarId, sunId, lawsId, class, bumenId, saveErr) |
|||
} |
|||
} else { |
|||
tarDepCont.TargetId = tarId //指标ID"`
|
|||
tarDepCont.TargetSunId = sunId //子目标"`
|
|||
tarDepCont.TargetBylaws = lawsId //指标细则"`
|
|||
tarDepCont.Type = class //类型(1:指标;2:子目标;3:细则)"`
|
|||
bumenIdInt, _ := strconv.ParseInt(bumenId, 10, 64) |
|||
tarDepCont.DepartmentId = bumenIdInt //部门ID"`
|
|||
tarDepCont.PostId = 0 //岗位ID"`
|
|||
tarDepCont.ReportPerson = "" //上报人"`
|
|||
tarDepCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
|
|||
tarDepCont.Time = time.Now().Unix() //写入时间"`
|
|||
addErr := overall.CONSTANT_DB_KPI.Create(&tarDepCont).Error |
|||
fmt.Printf("编辑---->tarId----%v---->sunId----%v---->lawsId----%v---->class----%v---->bumenId----%v------>saveErr----->%v\n", tarId, sunId, lawsId, class, bumenId, addErr) |
|||
} |
|||
} |
|||
|
|||
// 获取部门定性考核部门关联列表
|
|||
func (a *ApiMethod) GetDepartAboutTarget(c *gin.Context) { |
|||
var receivedValue publicmethod.PublicId |
|||
err := c.ShouldBindJSON(&receivedValue) |
|||
if err != nil { |
|||
publicmethod.Result(100, err, c) |
|||
return |
|||
} |
|||
var targetDepartmentID []int64 |
|||
disrErr := overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Distinct("`department_id`").Where("`state` = 1 AND `target_id` = ?", receivedValue.Id).Find(&targetDepartmentID).Error |
|||
if disrErr != nil { |
|||
publicmethod.Result(107, err, c) |
|||
return |
|||
} |
|||
var departmentList []modelshr.AdministrativeOrganization |
|||
departErr := overall.CONSTANT_DB_HR.Model(&modelshr.AdministrativeOrganization{}).Select("`id`,`name`,`superior`,`ispower`").Where("`id` IN ?", targetDepartmentID).Find(&departmentList).Error |
|||
if departErr != nil || len(departmentList) < 1 { |
|||
publicmethod.Result(107, err, c) |
|||
return |
|||
} |
|||
var outList []departOutcome |
|||
for _, v := range departmentList { |
|||
var outCont departOutcome |
|||
outCont.Id = strconv.FormatInt(v.Id, 10) |
|||
outCont.Name = v.Name |
|||
outCont.Superior = strconv.FormatInt(v.Superior, 10) |
|||
outCont.Ispower = v.IsPower |
|||
outList = append(outList, outCont) |
|||
} |
|||
publicmethod.Result(0, outList, c) |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
package departmentpc |
|||
|
|||
import ( |
|||
"key_performance_indicators/models/modelskpi" |
|||
"key_performance_indicators/overall/publicmethod" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
type ApiMethod struct{} |
|||
|
|||
// 部门考核WEB端入口
|
|||
func (a *ApiMethod) Index(c *gin.Context) { |
|||
outputCont := publicmethod.MapOut[string]() |
|||
outputCont["index"] = "部门考核PC端入口" |
|||
publicmethod.Result(0, outputCont, c) |
|||
} |
|||
|
|||
// 查询部门考核列表
|
|||
type departListQuery struct { |
|||
publicmethod.PagesTurn |
|||
Title string `json:"title"` //指标名称
|
|||
Class int `json:"class"` //1:定性考核;2:定量考核
|
|||
State int `json:"state"` //状态(1:启用;2:禁用;3:删除)
|
|||
DepartmentId string `json:"departmentid"` //部门ID
|
|||
DimensionId string `json:"dimensionid"` //维度ID
|
|||
ReportPerson string `json:"reportperson"` //上报人
|
|||
ScoringMethod int `json:"scoringmethod"` //计分方式(1:自动;2:手动)
|
|||
Cycle int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
|
|||
} |
|||
|
|||
// 输出部门指标列表
|
|||
type printDepartmentTarget struct { |
|||
modelskpi.EvaluationTarget |
|||
DimensionTitle string `json:"dimensiontitle"` //维度名称
|
|||
} |
|||
|
|||
// 输出指标已经关联的部门
|
|||
type departOutcome struct { |
|||
publicmethod.PublicId //部门id
|
|||
publicmethod.PublicName //部门名称
|
|||
Superior string `json:"superior"` //上级
|
|||
Ispower int `json:"ispower"` //是否为主部门
|
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
package departmentweb |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall/publicmethod" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
type ApiMethod struct{} |
|||
|
|||
// 部门考核WEB端入口
|
|||
func (a *ApiMethod) Index(c *gin.Context) { |
|||
outputCont := publicmethod.MapOut[string]() |
|||
outputCont["index"] = "部门考核WEB端入口" |
|||
publicmethod.Result(0, outputCont, c) |
|||
} |
|||
@ -1,9 +1,19 @@ |
|||
package version1 |
|||
|
|||
import "key_performance_indicators/api/version1/honoraryArchives" |
|||
import ( |
|||
"key_performance_indicators/api/version1/departmentseting/departmentpc" |
|||
"key_performance_indicators/api/version1/departmentseting/departmentweb" |
|||
"key_performance_indicators/api/version1/honoraryArchives" |
|||
"key_performance_indicators/api/version1/postseting/postpc" |
|||
"key_performance_indicators/api/version1/postseting/postweb" |
|||
) |
|||
|
|||
type ApiEntry struct { |
|||
HonorsApi honoraryArchives.ApiMethod |
|||
HonorsApi honoraryArchives.ApiMethod |
|||
PostPcApi postpc.ApiMethod |
|||
PostWebApi postweb.ApiMethod |
|||
DeparmentPcApi departmentpc.ApiMethod |
|||
DeparmentWebApi departmentweb.ApiMethod |
|||
} |
|||
|
|||
var AppApiEntry = new(ApiEntry) |
|||
|
|||
@ -0,0 +1,111 @@ |
|||
package postpc |
|||
|
|||
import ( |
|||
"fmt" |
|||
"key_performance_indicators/models/modelshr" |
|||
"key_performance_indicators/models/modelskpi" |
|||
"key_performance_indicators/overall" |
|||
"key_performance_indicators/overall/publicmethod" |
|||
"sort" |
|||
"strconv" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
// 获取岗位相关指标
|
|||
func (a *ApiMethod) GetPostAboutTarget(c *gin.Context) { |
|||
var receivedValue publicmethod.PublicId |
|||
err := c.ShouldBindJSON(&receivedValue) |
|||
if err != nil { |
|||
publicmethod.Result(100, err, c) |
|||
return |
|||
} |
|||
//获取岗位相关信息
|
|||
var postCont modelshr.Position |
|||
postContErr := postCont.GetCont(map[string]interface{}{"`id`": receivedValue.Id}, "`id`", "`duties`", "`administrative_organization`", "`superior`", "`department`") |
|||
if postContErr != nil { |
|||
publicmethod.Result(107, postContErr, c) |
|||
return |
|||
} |
|||
//根据维度生成方案列表
|
|||
//1、获取维度
|
|||
var dimensionModels modelskpi.DutyClass |
|||
dimensionList, dimeErr := dimensionModels.ContMap(map[string]interface{}{"`state`": 1}, "`id`", "`title`", "`sort`") |
|||
fmt.Printf("dimensionList--->%v\n", dimensionList) |
|||
if dimeErr != nil || len(dimensionList) <= 0 { |
|||
publicmethod.Result(107, postContErr, c) |
|||
return |
|||
} |
|||
//2、根据维度获取岗位相关指标
|
|||
var postPlanSync postDimeTarSync |
|||
for _, v := range dimensionList { |
|||
syncSeting.Add(1) |
|||
go postPlanSync.GetPostTargent(postCont, v) |
|||
} |
|||
syncSeting.Wait() |
|||
planAry := postPlanSync.readDataLock() //读取线程通道数据
|
|||
if len(planAry) < 1 { |
|||
publicmethod.Result(1, planAry, c, "该岗位没有设定专属指标!您可以从部门指标中引入!") |
|||
return |
|||
} |
|||
//根据维度序号排序
|
|||
sort.Slice(planAry, func(i, j int) bool { |
|||
return planAry[i].Sort < planAry[j].Sort |
|||
}) |
|||
publicmethod.Result(0, planAry, c) |
|||
} |
|||
|
|||
// 获取岗位与维度相关的指标
|
|||
/* |
|||
@position 岗位信息 |
|||
@dutyClass 维度信息 |
|||
*/ |
|||
func (p *postDimeTarSync) GetPostTargent(position modelshr.Position, dutyClass modelskpi.DutyClass) { |
|||
p.mutext.Lock() |
|||
defer p.mutext.Unlock() |
|||
//获取相关指标
|
|||
var postTargetList []modelskpi.PostTarget |
|||
postTarErr := overall.CONSTANT_DB_KPI.Model(&modelskpi.PostTarget{}).Where("`state` = 1 AND `dimension` = ? AND `rele_depart` = ? AND FIND_IN_SET(?,`departments_post`)", dutyClass.Id, position.AdministrativeOrganization, position.Id).Find(&postTargetList).Error |
|||
fmt.Printf("postTargetList---->%v\n", postTargetList) |
|||
if postTarErr == nil && len(postTargetList) > 0 { |
|||
var planCont postAboutDimeTar |
|||
planCont.Id = strconv.FormatInt(dutyClass.Id, 10) |
|||
planCont.Name = dutyClass.Title |
|||
planCont.Sort = dutyClass.Sort |
|||
for _, v := range postTargetList { |
|||
var targetCont postAboutTarget |
|||
targetCont.Id = strconv.FormatInt(v.Id, 10) |
|||
targetCont.Name = v.Title |
|||
targetCont.Content = "" //指标描述
|
|||
targetCont.StandardScore = getPostDimeTarWeight(position.AdministrativeOrganization, position.Id, dutyClass.Id, v.Id, 1) //标准分
|
|||
targetCont.Unit = v.Unit //单位
|
|||
targetCont.IsTrue = 2 //是否允许修改 1:不允许;2:允许
|
|||
targetCont.State = 1 //状态 1:启用;2:禁用;3:观察
|
|||
|
|||
planCont.Child = append(planCont.Child, targetCont) |
|||
} |
|||
p.planList = append(p.planList, planCont) |
|||
} |
|||
syncSeting.Done() |
|||
} |
|||
|
|||
/* |
|||
获取岗位考核指标或维度标准分 |
|||
@orgid 行政组织 |
|||
@postid 岗位 |
|||
@dimensionid 维度 |
|||
@targetid 指标 |
|||
@hierarchy 1:维度;2:指标 |
|||
*/ |
|||
func getPostDimeTarWeight(orgid, postid, dimensionid, targetid int64, hierarchy int) int64 { |
|||
if hierarchy == 0 { |
|||
hierarchy = 2 |
|||
} |
|||
var ddpwCont modelskpi.DepartDimePostWeight |
|||
if hierarchy == 1 { |
|||
ddpwCont.GetCont(map[string]interface{}{"orgid": orgid, "postid": postid, "dimension": dimensionid, "hierarchy": 1}, "`weight`") |
|||
} else { |
|||
ddpwCont.GetCont(map[string]interface{}{"orgid": orgid, "postid": postid, "dimension": dimensionid, "target": targetid, "hierarchy": 2}, "`weight`") |
|||
} |
|||
return ddpwCont.Weight |
|||
} |
|||
@ -0,0 +1,52 @@ |
|||
package postpc |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall/publicmethod" |
|||
"sync" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
type ApiMethod struct{} |
|||
|
|||
// 协程设置
|
|||
var syncSeting = sync.WaitGroup{} |
|||
|
|||
// 岗位指标协程操作
|
|||
type postDimeTarSync struct { |
|||
planList []postAboutDimeTar |
|||
mutext sync.RWMutex |
|||
} |
|||
|
|||
// 读取岗位指标协程数据
|
|||
func (d *postDimeTarSync) readDataLock() []postAboutDimeTar { |
|||
d.mutext.RLock() |
|||
defer d.mutext.RUnlock() |
|||
return d.planList |
|||
} |
|||
|
|||
// 岗位考核PC端入口
|
|||
func (a *ApiMethod) Index(c *gin.Context) { |
|||
outputCont := publicmethod.MapOut[string]() |
|||
outputCont["index"] = "岗位考核PC端入口" |
|||
publicmethod.Result(0, outputCont, c) |
|||
} |
|||
|
|||
// 获取岗位相关指标
|
|||
type postAboutTarget struct { |
|||
publicmethod.PublicId |
|||
publicmethod.PublicName //指标名称
|
|||
Content string `json:"content"` //指标描述
|
|||
StandardScore int64 `json:"standardscore"` //标准分
|
|||
Unit string `json:"unit"` //单位
|
|||
IsTrue int `json:"istrue"` //是否允许修改 1:不允许;2:允许
|
|||
State int `json:"state"` //状态 1:启用;2:禁用;3:观察
|
|||
} |
|||
|
|||
// 岗位相关维度指标列表
|
|||
type postAboutDimeTar struct { |
|||
publicmethod.PublicId |
|||
publicmethod.PublicName //维度名称
|
|||
Sort int `json:"sort"` //排序
|
|||
Child []postAboutTarget `json:"child"` //指标列表
|
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
package postweb |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall/publicmethod" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
type ApiMethod struct{} |
|||
|
|||
// 岗位考核WEB端入口
|
|||
func (a *ApiMethod) Index(c *gin.Context) { |
|||
outputCont := publicmethod.MapOut[string]() |
|||
outputCont["index"] = "岗位考核WEB端入口" |
|||
publicmethod.Result(0, outputCont, c) |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
package departmentseting |
|||
|
|||
import ( |
|||
"key_performance_indicators/api/version1" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
// 部门考核PC端
|
|||
func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) { |
|||
apiRouter := router.Group("department_pc") |
|||
|
|||
var methodBinding = version1.AppApiEntry.DeparmentPcApi |
|||
{ |
|||
apiRouter.GET("", methodBinding.Index) //入口
|
|||
apiRouter.POST("", methodBinding.Index) //入口
|
|||
|
|||
apiRouter.POST("departmenttargetlist", methodBinding.DepartmentTargetList) //部门指标列表
|
|||
apiRouter.POST("shiyan", methodBinding.Shiyan) //实验
|
|||
apiRouter.POST("getdepartabouttarget", methodBinding.GetDepartAboutTarget) //获取部门定性考核部门关联列表
|
|||
} |
|||
} |
|||
@ -0,0 +1,4 @@ |
|||
package departmentseting |
|||
|
|||
//部门考核
|
|||
type ApiRouter struct{} |
|||
@ -0,0 +1,19 @@ |
|||
package departmentseting |
|||
|
|||
import ( |
|||
"key_performance_indicators/api/version1" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
// 部门考核web端
|
|||
func (a *ApiRouter) RouterGroupWeb(router *gin.RouterGroup) { |
|||
apiRouter := router.Group("department_web") |
|||
|
|||
var methodBinding = version1.AppApiEntry.DeparmentWebApi |
|||
{ |
|||
apiRouter.GET("", methodBinding.Index) //入口
|
|||
apiRouter.POST("", methodBinding.Index) //入口
|
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
package postseting |
|||
|
|||
import ( |
|||
"key_performance_indicators/api/version1" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
// 岗位考核PC端
|
|||
func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) { |
|||
apiRouter := router.Group("postpc") |
|||
|
|||
var methodBinding = version1.AppApiEntry.PostPcApi |
|||
{ |
|||
apiRouter.GET("", methodBinding.Index) //入口
|
|||
apiRouter.POST("", methodBinding.Index) //入口
|
|||
apiRouter.POST("getpostabouttarget", methodBinding.GetPostAboutTarget) //获取岗位相关指标
|
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,4 @@ |
|||
package postseting |
|||
|
|||
//岗位考核
|
|||
type ApiRouter struct{} |
|||
@ -0,0 +1,18 @@ |
|||
package postseting |
|||
|
|||
import ( |
|||
"key_performance_indicators/api/version1" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
// 岗位考核web端
|
|||
func (a *ApiRouter) RouterGroupWeb(router *gin.RouterGroup) { |
|||
apiRouter := router.Group("postweb") |
|||
|
|||
var methodBinding = version1.AppApiEntry.PostWebApi |
|||
{ |
|||
apiRouter.GET("", methodBinding.Index) //入口
|
|||
apiRouter.POST("", methodBinding.Index) //入口
|
|||
} |
|||
} |
|||
Binary file not shown.
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import "key_performance_indicators/overall" |
|||
|
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import "key_performance_indicators/overall" |
|||
|
|||
@ -0,0 +1,64 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 部门考核指标权重
|
|||
type DepartDimePostWeight struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Type int64 `json:"type" gorm:"column:type;type:bigint(20) unsigned;default:0;not null;comment:1:定性考核;2:定量考核"` |
|||
Orgid int64 `json:"orgid" gorm:"column:orgid;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` |
|||
Postid int64 `json:"postid" gorm:"column:postid;type:bigint(20) unsigned;default:0;not null;comment:岗位"` |
|||
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:考核维度"` |
|||
Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"` |
|||
Weight int64 `json:"weight" gorm:"column:weight;type:int(6) unsigned;default:0;not null;comment:权重"` |
|||
Addtime int64 `json:"addtime" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:添加时间"` |
|||
Hierarchy int64 `json:"hierarchy" gorm:"column:hierarchy;type:bigint(20) unsigned;default:0;not null;comment:维度;2:指标"` |
|||
} |
|||
|
|||
func (DepartDimePostWeight *DepartDimePostWeight) TableName() string { |
|||
return "depart_dime_post_weight" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *DepartDimePostWeight) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *DepartDimePostWeight) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.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 *DepartDimePostWeight) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *DepartDimePostWeight) ContMap(whereMap interface{}, field ...string) (countAry []DepartDimePostWeight, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *DepartDimePostWeight) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,73 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 指标细则
|
|||
type DetailedTarget struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:dt_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Title string `json:"title" gorm:"column:dt_title;type:text;comment:指标细则"` |
|||
Content string `json:"content" gorm:"column:dt_content;type:text;comment:指标说明"` |
|||
ParentId int64 `json:"parentid" gorm:"column:dt_parentid;type:bigint(20) unsigned;default:0;not null;comment:归属指标栏目"` |
|||
ParentIdSun int64 `json:"parentidsun" gorm:"column:dt_parentid_sun;type:bigint(20) unsigned;default:0;not null;comment:归属指标子栏目"` |
|||
State int `json:"state" gorm:"column:dt_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
AddTime int64 `json:"addtime" gorm:"column:dt_time;type:bigint(20) unsigned;default:0;not null;comment:制定时间"` |
|||
MinScore int64 `json:"minscore" gorm:"column:dt_min_score;type:bigint(20) unsigned;default:0;not null;comment:最小分*100保存"` |
|||
MaxScore int64 `json:"maxscore" gorm:"column:dt_max_score;type:bigint(20) unsigned;default:0;not null;comment:最大分*100保存"` |
|||
Company string `json:"company" gorm:"column:dt_company;type:varchar(20) unsigned;default:0;not null;comment:单位"` |
|||
AddReduce int `json:"addreduce" gorm:"column:dt_add_reduce;type:int(1) unsigned;default:1;not null;comment:1:减少;2:增加;3:无属性,现场确认加或减"` |
|||
CensorType string `json:"censortype" gorm:"column:dt_censor_type;type:text;comment:检查方式"` |
|||
CensorCont string `json:"censorcont" gorm:"column:dt_censor_cont;type:longtext;comment:检查依据"` |
|||
CensorRate int `json:"censorrate" gorm:"column:dt_censor_rate;type:int(5) unsigned;default:1;not null;comment:检查频次"` |
|||
Cycles int `json:"cycle" gorm:"column:dt_cycle;type:tinyint(1) unsigned;default:1;not null;comment:1:班;2:天;3:周;4:月;5:季度;6:年"` |
|||
CycleAttres int `json:"cycleattr" gorm:"column:dt_cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"` |
|||
Paretment string `json:"paretment" gorm:"column:dt_paretment;type:longtext;comment:接受考核的部门"` |
|||
Reportary string `json:"reportary" gorm:"column:reportary;type:longtext;comment:提报人"` |
|||
} |
|||
|
|||
func (DetailedTarget *DetailedTarget) TableName() string { |
|||
return "detailed_target" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *DetailedTarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *DetailedTarget) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.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 *DetailedTarget) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *DetailedTarget) ContMap(whereMap interface{}, field ...string) (countAry []DetailedTarget, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *DetailedTarget) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,62 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 考核维度
|
|||
type DutyClass struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id"` |
|||
Title string `json:"title" gorm:"column:title;type:varchar(255);comment:考核维度名称"` |
|||
Type int `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:1;not null;comment:类型(1:定性考核;2:定量考核)"` |
|||
Weight int `json:"weight" gorm:"column:weight;type:int(3) 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:tinyint(1) unsigned;default:1;not null;comment:状态"` |
|||
Sort int `json:"sort" gorm:"column:sort;type:int(5) unsigned;default:0;not null;comment:排序"` |
|||
} |
|||
|
|||
func (DutyClass *DutyClass) TableName() string { |
|||
return "dutyclass" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *DutyClass) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *DutyClass) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.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 *DutyClass) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *DutyClass) ContMap(whereMap interface{}, field ...string) (countAry []DutyClass, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *DutyClass) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,71 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 测评指标
|
|||
type EvaluationTarget struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:et_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Title string `json:"title" gorm:"column:et_title;type:varchar(255);comment:指标名称"` |
|||
Type int `json:"type" gorm:"column:et_type;type:int(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"` |
|||
State int `json:"state" gorm:"column:et_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
AddTime int64 `json:"addTime" gorm:"column:et_time;type:bigint(20) unsigned;default:0;not null;comment:制定时间"` |
|||
Share int `json:"share" gorm:"column:et_share;type:int(1) unsigned;default:1;not null;comment:1:共用;2:私用"` |
|||
RelevantDepartments string `json:"relevantdepartments" gorm:"column:et_relevant_departments;type:text;comment:相关部门"` |
|||
Dimension int64 `json:"dimension" gorm:"column:et_dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` |
|||
Key int64 `json:"key" gorm:"column:et_key;type:bigint(20) unsigned;default:0;not null;comment:UUID"` |
|||
Report string `json:"report" gorm:"column:et_report;type:text;comment:上报人"` |
|||
Uniteing string `json:"unites" gorm:"column:et_unit;type:varchar(255);comment:计量单位"` |
|||
Cycles int `json:"cycle" gorm:"column:et_cycle;type:tinyint(1) unsigned;default:1;not null;comment:1:班;2:天;3:周;4:月;5:季度;6:年"` |
|||
CycleAttres int `json:"cycleattr" gorm:"column:et_cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"` |
|||
VisibleRange string `json:"visiblerange" gorm:"column:et_visible_range;type:text;comment:可见范围"` |
|||
VisibleRangeGroup string `json:"visiblerangegroup" gorm:"column:et_visible_group;type:text;comment:可见范围(集团)"` |
|||
ScoringMethod int `json:"scoringmethod" gorm:"column:et_scoring_method;type:tinyint(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"` |
|||
} |
|||
|
|||
func (EvaluationTarget *EvaluationTarget) TableName() string { |
|||
return "evaluationtarget" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *EvaluationTarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *EvaluationTarget) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.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 *EvaluationTarget) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *EvaluationTarget) ContMap(whereMap interface{}, field ...string) (countAry []EvaluationTarget, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *EvaluationTarget) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,72 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 岗位指标
|
|||
type PostTarget struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Title string `json:"title" gorm:"column:title;type:varchar(255) unsigned;default:'';not null;comment:标题"` |
|||
Type int `json:"type" gorm:"column:type;type:int(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
Share int `json:"share" gorm:"column:share;type:int(1) unsigned;default:1;not null;comment:1:共用;2:私用"` |
|||
ReleDepart int64 `json:"reledepart" gorm:"column:rele_depart;type:bigint(20) unsigned;default:0;not null;comment:相关部门"` |
|||
DepartmentsPost string `json:"departmentspost" gorm:"column:departments_post;type:text ;default:'';comment:相关岗位"` |
|||
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` |
|||
Key int64 `json:"key" gorm:"column:key;type:bigint(20) unsigned;default:0;not null;comment:UUID"` |
|||
Report string `json:"report" gorm:"column:report;type:text ;default:'';comment:上报人"` |
|||
Unit string `json:"unit" gorm:"column:unit;type:varchar(255) unsigned;default:'';not null;comment:单位"` |
|||
Cycle int `json:"cycle" gorm:"column:cycle;type:int(1) unsigned;default:1;not null;comment:1:班;2:天;3:周;4:月;5:季度;6:年"` |
|||
Cycleattr int `json:"cycleattr" gorm:"column:cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"` |
|||
ScoringMethod int64 `json:"scoringmethod" gorm:"column:scoring_method;type:int(1) unsigned;default:0;not null;comment:计分方式(1:自动;2:手动)"` |
|||
VisibleRange string `json:"visiblerange" gorm:"column:visible_range;type:text ;default:'';comment:可见范围"` |
|||
VisibleGroup string `json:"visiblegroup" gorm:"column:visible_group;type:text ;default:'';comment:可见范围(集团)"` |
|||
} |
|||
|
|||
func (PostTarget *PostTarget) TableName() string { |
|||
return "post_target" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *PostTarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *PostTarget) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.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 *PostTarget) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *PostTarget) ContMap(whereMap interface{}, field ...string) (countAry []PostTarget, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *PostTarget) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,65 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 考核维度
|
|||
type TargetDepartment struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id"` |
|||
TargetId int64 `json:"targetid" gorm:"column:target_id;type:bigint(20) unsigned;default:0;not null;comment:指标ID"` |
|||
TargetSunId int64 `json:"targetsunid" gorm:"column:target_sun_id;type:bigint(20) unsigned;default:0;not null;comment:子目标"` |
|||
TargetBylaws int64 `json:"targetbylaws" gorm:"column:target_bylaws;type:bigint(20) unsigned;default:0;not null;comment:指标细则"` |
|||
Type int `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:1;not null;comment:类型(1:指标;2:子目标;3:细则)"` |
|||
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门ID"` |
|||
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位ID"` |
|||
ReportPerson string `json:"reportperson" gorm:"column:report_person;type:longtext;comment:上报人"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"` |
|||
} |
|||
|
|||
func (TargetDepartment *TargetDepartment) TableName() string { |
|||
return "target_department" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *TargetDepartment) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *TargetDepartment) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.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 *TargetDepartment) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *TargetDepartment) ContMap(whereMap interface{}, field ...string) (countAry []TargetDepartment, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *TargetDepartment) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelsschool |
|||
|
|||
//菜单功能
|
|||
type MenuOperation struct { |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelsschool |
|||
|
|||
import "key_performance_indicators/overall" |
|||
|
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelsschool |
|||
|
|||
import "key_performance_indicators/overall" |
|||
|
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelsschool |
|||
|
|||
import "key_performance_indicators/overall" |
|||
|
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelsschool |
|||
|
|||
import "key_performance_indicators/overall" |
|||
|
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelswechat |
|||
|
|||
//企业微信人员架构
|
|||
type WechatUsers struct { |
|||
Loading…
Reference in new issue