10 changed files with 567 additions and 90 deletions
@ -0,0 +1,77 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 划分责任 division_responsibilities
|
|||
type DivisionResponsibilities struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:df_id;type:bigint(20) unsigned;not null"` |
|||
ScoreFlow int64 `json:"scoreflow" gorm:"column:df_sf_id;type:bigint(20) unsigned;default:0;not null;comment:归属加减分关联值"` |
|||
Type int `json:"type" gorm:"column:df_type;type:tinyint(1) unsigned;default:1;not null;comment:责任类型(1、主要责任人;2、互保责任人;3、责任班组;4、责任班组长;5、主管;6、三大员;7、厂长、主任)"` |
|||
UserName string `json:"username" gorm:"column:df_user_name;type:varchar(100);comment:责任人名"` |
|||
UserNumber string `json:"usernumber" gorm:"column:df_user_number;type:varchar(100);comment:责任人工号"` |
|||
UserKey int64 `json:"userkey" gorm:"column:df_user_key;type:bigint(20) unsigned;default:0;not null;comment:责任人KEY"` |
|||
Department int64 `json:"department" gorm:"column:df_department_id;type:bigint(20) unsigned;default:0;not null;comment:责任人部门"` |
|||
Group int64 `json:"group" gorm:"column:df_group;type:bigint(20) unsigned;default:0;not null;comment:责任人集团"` |
|||
Tema int64 `json:"tema" gorm:"column:df_tema;type:bigint(20) unsigned;default:0;not null;comment:责任人班组"` |
|||
Weight int64 `json:"weight" gorm:"column:df_weight;type:int(7) unsigned;default:0;not null;comment:比重"` |
|||
Time int64 `json:"time" gorm:"column:df_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
EiteTime int64 `json:"eitetime" gorm:"column:df_eite_time;type:bigint(20) unsigned;default:0;not null;comment:修改时间"` |
|||
DistributionUser int64 `json:"distributionuser" gorm:"column:df_distribution_user;type:bigint(20) unsigned;default:0;not null;comment:分配任key"` |
|||
EvaluationDepartment int64 `json:"evaluationdepartment" gorm:"column:df_evaluation_department;type:bigint(20) unsigned;default:0;not null;comment:测评部门"` |
|||
EvaluationUser int64 `json:"evaluationuser" gorm:"column:df_evaluation_user;type:bigint(20) unsigned;default:0;not null;comment:测评人"` |
|||
EvaluationGroup int64 `json:"evaluationgroup" gorm:"column:df_evaluation_group;type:bigint(20) unsigned;default:0;not null;comment:测评集团"` |
|||
} |
|||
|
|||
func (DivisionResponsibilities *DivisionResponsibilities) TableName() string { |
|||
return "division_responsibilities" |
|||
} |
|||
|
|||
// 添加
|
|||
func (cont *DivisionResponsibilities) AddCont() (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Create(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *DivisionResponsibilities) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *DivisionResponsibilities) 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 *DivisionResponsibilities) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *DivisionResponsibilities) ContMap(whereMap interface{}, field ...string) (countAry []DivisionResponsibilities, 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 *DivisionResponsibilities) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,81 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 定量考核数据流
|
|||
type DutyFlowData struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:fld_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
EvaluationPlan int64 `json:"evaluationplan" gorm:"column:fld_evaluation_id;type:bigint(20) unsigned;default:0;not null;comment:考核方案项目ID"` |
|||
Key int64 `json:"key" gorm:"column:fld_flow_log;type:bigint(20) unsigned;default:0;not null;comment:识别标志"` |
|||
Score int64 `json:"score" gorm:"column:fld_score;type:bigint(20) unsigned;default:0;not null;comment:数据"` |
|||
Content string `json:"content" gorm:"column:fld_cont;type:mediumtext;comment:描述"` |
|||
Enclosure string `json:"enclosure" gorm:"column:fld_enclosure;type:longtext;comment:附件"` |
|||
Time int64 `json:"time" gorm:"column:fld_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
ScoringMethod int `json:"scoringmethod" gorm:"column:fld_scoring_method;type:int(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"` |
|||
ScoringScore float64 `json:"scoringscore" gorm:"column:fld_scoring_score;type:bigint(20) unsigned;default:0;not null;comment:手动分"` |
|||
PlanVersion string `json:"planversion" gorm:"column:fld_planversion;type:varchar(255);comment:版本号"` |
|||
Year int64 `json:"year" gorm:"column:fld_year;type:int(7) unsigned;default:0;not null;comment:年分"` |
|||
Quarter int64 `json:"quarter" gorm:"column:fld_quarter;type:int(2) unsigned;default:0;not null;comment:季度"` |
|||
Month int64 `json:"month" gorm:"column:fld_month;type:int(2) unsigned;default:0;not null;comment:月"` |
|||
Week int64 `json:"week" gorm:"column:fld_week;type:int(5) unsigned;default:0;not null;comment:周"` |
|||
ToDay int64 `json:"today" gorm:"column:fld_day;type:int(5) unsigned;default:0;not null;comment:天"` |
|||
TargetId int64 `json:"targetid" gorm:"column:fld_target_id;type:bigint(20) unsigned;default:0;not null;comment:指标ID"` |
|||
|
|||
EvaluationDepartment int64 `json:"evaluationdepartment" gorm:"column:fl_evaluation_department;type:bigint(20) unsigned;default:0;not null;comment:测评部门"` |
|||
EvaluationUser int64 `json:"evaluationuser" gorm:"column:fl_evaluation_user;type:bigint(20) unsigned;default:0;not null;comment:测评人"` |
|||
EvaluationGroup int64 `json:"evaluationgroup" gorm:"column:fl_evaluation_group;type:bigint(20) unsigned;default:0;not null;comment:测评集团"` |
|||
EnclosureFlow string `json:"enclosure" gorm:"column:fl_enclosure;type:longtext;comment:附件"` |
|||
DutyGroup int64 `json:"dutygroup" gorm:"column:fl_duty_group;type:bigint(20) unsigned;default:0;not null;comment:职责集团"` |
|||
DutyDepartment int64 `json:"dutydepartment" gorm:"column:fl_duty_department;type:bigint(20) unsigned;default:0;not null;comment:职责部门"` |
|||
Reply int `json:"reply" gorm:"column:fl_reply;type:int(2) unsigned;default:1;not null;comment:状态(0:删除;1:起草;2:审批;3:通过)"` |
|||
ContentFlow string `json:"content" gorm:"column:fl_content;type:mediumtext;comment:描述"` |
|||
Baseline string `json:"baseline" gorm:"column:fl_baseline;type:longtext;comment:基准线 "` |
|||
} |
|||
|
|||
func (DutyFlowData *DutyFlowData) TableName() string { |
|||
return "duty_flow_data" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *DutyFlowData) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *DutyFlowData) 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 *DutyFlowData) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *DutyFlowData) ContMap(whereMap interface{}, field ...string) (countAry []DutyFlowData, 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 *DutyFlowData) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
Loading…
Reference in new issue