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.
64 lines
2.6 KiB
64 lines
2.6 KiB
package modelskpi
|
|
|
|
import (
|
|
"appPlatform/overall"
|
|
"strings"
|
|
)
|
|
|
|
// 性质考核方案权重
|
|
type DepartmentDimensionWeight struct {
|
|
Id int64 `json:"id" gorm:"primaryKey;column:ddw_id;type:bigint(20) unsigned;not null;comment:Id;index"`
|
|
Type int64 `json:"type" gorm:"column:ddw_type;type:bigint(20) unsigned;default:0;not null;comment:1:定性考核;2:定量考核"`
|
|
Group int64 `json:"group" gorm:"column:ddw_group;type:bigint(20) unsigned;default:0;not null;comment:归属集团"`
|
|
DepartmentId int64 `json:"parentid" gorm:"column:ddw_derpatment;type:bigint(20) unsigned;default:0;not null;comment:部门ID"`
|
|
Dimension int64 `json:"dimension" gorm:"column:ddw_dimension;type:bigint(20) unsigned;default:0;not null;comment:考核维度"`
|
|
Target int64 `json:"target" gorm:"column:ddw_target;type:bigint(20) unsigned;default:0;not null;comment:指标"`
|
|
Weight int64 `json:"weight" gorm:"column:ddw_weight;type:int(6) unsigned;default:0;not null;comment:权重"`
|
|
Addtime int64 `json:"addtime" gorm:"column:ddw_time;type:bigint(20) unsigned;default:0;not null;comment:添加时间"`
|
|
Hierarchy int64 `json:"hierarchy" gorm:"column:ddw_hierarchy;type:bigint(20) unsigned;default:0;not null;comment:维度;2:指标"`
|
|
}
|
|
|
|
func (DepartmentDimensionWeight *DepartmentDimensionWeight) TableName() string {
|
|
return "department_dimension_weight"
|
|
}
|
|
|
|
// 编辑内容
|
|
func (cont *DepartmentDimensionWeight) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
|
|
return
|
|
}
|
|
|
|
// 获取内容
|
|
func (cont *DepartmentDimensionWeight) 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 *DepartmentDimensionWeight) CountCont(whereMap interface{}) (countId int64) {
|
|
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
|
|
return
|
|
}
|
|
|
|
// 读取全部信息
|
|
func (cont *DepartmentDimensionWeight) ContMap(whereMap interface{}, field ...string) (countAry []DepartmentDimensionWeight, 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 *DepartmentDimensionWeight) DelCont(whereMap interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
|
|
return
|
|
}
|
|
|