应用集成平台服务端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

95 lines
5.4 KiB

package modelskpi
import (
"appPlatform/overall"
"strings"
"time"
)
type QualitativeEvaluationView struct {
Id int64 `json:"id" gorm:"primaryKey;column:qe_id;type:bigint(20) unsigned;not null;comment:Id;index"`
Title string `json:"title" gorm:"column:qe_title;type:text;comment:考核名称"`
DepartmentId string `json:"parentid" gorm:"column:qe_department_id;type:text;comment:执行考核部门ID"`
Dimension int64 `json:"dimension" gorm:"column:qe_dimension;type:bigint(20) unsigned;default:0;not null;comment:考核维度"`
Target int64 `json:"target" gorm:"column:qe_target;type:bigint(20) unsigned;default:0;not null;comment:考核指标"`
TargetSun int64 `json:"targetsun" gorm:"column:qe_target_sun;type:bigint(20) unsigned;default:0;not null;comment:考核指标子栏目"`
DetailedTarget int64 `json:"detailedtarget" gorm:"column:qe_detailed_target;type:bigint(20) unsigned;default:0;not null;comment:考核细则"`
Type int `json:"type" gorm:"column:qe_type;type:int(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"`
Weight int64 `json:"weight" gorm:"column:qe_weight;type:int(5) unsigned;default:0;not null;comment:权重"`
Unit string `json:"unit" gorm:"column:qe_unit;type:varchar(255);comment:单位"`
ReferenceScore int64 `json:"referencescore" gorm:"column:qe_reference_score;type:int(9) unsigned;default:0;not null;comment:标准分值"`
State int `json:"state" gorm:"column:qe_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
Addtime int64 `json:"addtime" gorm:"column:qe_addtime;type:bigint(20) unsigned;default:0;not null;comment:添加时间"`
Eitetime int64 `json:"eitetime" gorm:"column:qe_eitetime;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"`
Group int64 `json:"group" gorm:"column:qe_group;type:bigint(20) unsigned;default:0;not null;comment:归属集团"`
QualEvalId string `json:"qualevalid" gorm:"column:qe_qual_eval_id;type:varchar(200) unsigned;default:0;not null;comment:性质考核方案"`
Cycles int `json:"cycle" gorm:"column:qe_cycle;type:tinyint(1) unsigned;default:1;not null;comment:1:班;2:天;3:周;4:月;5:季度;6:年"`
CycleAttres int `json:"cycleattr" gorm:"column:qe_cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"`
AcceptEvaluation int64 `json:"acceptevaluation" gorm:"column:qe_accept_evaluation;type:bigint(20) unsigned;default:0;not null;comment:接受考核部门"`
Operator string `json:"operator" gorm:"column:qe_operator;type:text;comment:执行人"`
Content string `json:"content" gorm:"column:qe_content;type:text;comment:补充说明"`
MinScore int64 `json:"minscore" gorm:"column:qe_min_score;type:bigint(20) unsigned;default:0;not null;comment:最小分*100保存"`
MaxScore int64 `json:"maxscore" gorm:"column:qe_max_score;type:bigint(20) unsigned;default:0;not null;comment:最大分*100保存"`
CensorType string `json:"censortype" gorm:"column:qe_censor_type;type:tinyint(1) unsigned;default:1;not null;comment:检查方式"`
CensorCont string `json:"censorcont" gorm:"column:qe_censor_cont;type:longtext;comment:检查依据"`
CensorRate int `json:"censorrate" gorm:"column:qe_censor_rate;type:int(5) unsigned;default:1;not null;comment:检查频次"`
EtTitle string `json:"ettitle" gorm:"column:et_title;type:varchar(255);comment:指标名称"`
}
func (QualitativeEvaluationView *QualitativeEvaluationView) TableName() string {
return "qualitative_evaluation_view"
}
// 编辑内容
func (cont *QualitativeEvaluationView) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *QualitativeEvaluationView) 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 *QualitativeEvaluationView) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *QualitativeEvaluationView) ContMap(whereMap interface{}, field ...string) (countAry []QualitativeEvaluationView, 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 *QualitativeEvaluationView) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}
// 判断子目标是否存在
func (cont *QualitativeEvaluationView) JudgeIsTrue(whereMap interface{}, addCont QualitativeEvaluationView) (err error) {
err = cont.GetCont(whereMap)
if err != nil {
err = overall.CONSTANT_DB_KPI.Create(&addCont).Error
} else {
if cont.State != 1 {
err = cont.EiteCont(map[string]interface{}{"`q_id`": cont.Id}, map[string]interface{}{"`q_state`": 1, "`q_time`": time.Now().Unix()})
}
}
return nil
}