package customerForm import ( "appPlatform/overall" "strings" ) /* * @ 作者: 秦东 @ 时间: 2024-03-06 13:23:03 @ 功能: 公司值班设定表 */ type SCApplication struct { Id int64 `gorm:"column:id;type:bigint(20) unsigned;primary_key;AUTO_INCREMENT" json:"id"` MastersKey int64 `gorm:"column:masters_key;type:bigint(20) unsigned;default:0;comment:主表标识;NOT NULL" json:"masters_key"` Creater int64 `gorm:"column:creater;type:bigint(20);comment:申请人" json:"creater"` CreaterTime int64 `gorm:"column:creater_time;type:bigint(20) unsigned;default:0;comment:创建时间;NOT NULL" json:"creater_time"` EditTime int64 `gorm:"column:edit_time;type:bigint(20) unsigned;default:0;comment:编辑时间;NOT NULL" json:"edit_time"` FlowId int64 `gorm:"column:flow_id;type:bigint(20) unsigned;default:0;comment:流程识别标识;NOT NULL" json:"flow_id"` States int `gorm:"column:states;type:int(11) unsigned;default:1;comment:状态(1:启用,2:禁用;3:删除);NOT NULL" json:"states"` FlowIsOpen int `gorm:"column:flowIsOpen;type:int(1) unsigned;default:2;comment:是否开启工作流;NOT NULL" json:"flowIsOpen"` Diao4Huan4Ren2 string `gorm:"column:diao4huan4ren2;type:mediumtext;comment:调换人" json:"diao4huan4ren2"` Shen1Qing3Yuan2Yin1 string `gorm:"column:shen1qing3yuan2yin1;type:mediumtext;comment:申请原因" json:"shen1qing3yuan2yin1"` Diao4Huan4Fang1Shi4 string `gorm:"column:diao4huan4fang1shi4;type:varchar(50);comment:调换方式" json:"diao4huan4fang1shi4"` Shou3Ji1Hao4 string `gorm:"column:shou3ji1hao4;type:varchar(255);comment:手机号" json:"shou3ji1hao4"` CreaterOrg int `gorm:"column:createrOrg;type:int(1) unsigned;default:2;comment:创建人行政组织;NOT NULL" json:"createrOrg"` Dang1Zhi2Ri4Qi141995810 int64 `gorm:"column:dang1zhi2ri4qi141995810;type:bigint(20) unsigned;default:0;comment:当值日期;NOT NULL" json:"dang1zhi2ri4qi141995810"` Zhi2Ban1Lei4Xing2 string `gorm:"column:zhi2ban1lei4xing2;type:varchar(50);comment:值班类型" json:"zhi2ban1lei4xing2"` Diao4Huan4Ri4Qi1 int64 `gorm:"column:diao4huan4ri4qi1;type:bigint(20) unsigned;default:0;comment:调换日期;NOT NULL" json:"diao4huan4ri4qi1"` Fu4Jian4 string `gorm:"column:fu4jian4;type:mediumtext;comment:附件" json:"fu4jian4"` Shou3Ji1Hao453554781 string `gorm:"column:shou3ji1hao453554781;type:varchar(255);comment:手机号" json:"shou3ji1hao453554781"` } func (cont *SCApplication) TableName() string { return "shiftChangeApplication" } // 编辑内容 func (cont *SCApplication) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Updates(saveData).Error return } // 获取内容 func (cont *SCApplication) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_CustomerForm.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 *SCApplication) CountCont(whereMap interface{}) (countId int64) { overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Count(&countId) return } // 读取全部信息 func (cont *SCApplication) ContMap(whereMap interface{}, field ...string) (countAry []SCApplication, err error) { gormDb := overall.CONSTANT_DB_CustomerForm.Model(&cont) if len(field) > 0 { fieldStr := strings.Join(field, ",") gormDb = gormDb.Select(fieldStr) } err = gormDb.Where(whereMap).Find(&countAry).Error return } // 删除内容 func (cont *SCApplication) DelCont(whereMap interface{}) (err error) { err = overall.CONSTANT_DB_CustomerForm.Where(whereMap).Delete(&cont).Error return }