4 changed files with 203 additions and 0 deletions
@ -0,0 +1,78 @@ |
|||||
|
package modelAppPlatform |
||||
|
|
||||
|
import ( |
||||
|
"appPlatform/overall" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-04-23 11:25:43 |
||||
|
@ 功能: 员工信息导入模板 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
type UserInfoDownTemplate struct { |
||||
|
Id int64 `json:"id" gorm:"primaryKey;column:id;type:int(5) unsigned;not null;comment:Id;index"` |
||||
|
OrgId int64 `json:"orgId" gorm:"column:orgId;type:bigint(20) unsigned;default:0;not null;comment:归属哪个行政组织"` |
||||
|
FileName string `json:"fileName" gorm:"column:fileName;type:varchar(255) unsigned;default:'';not null;comment:文件名称"` |
||||
|
FilePath string `json:"filePath" gorm:"column:filePath;type:mediumtext;default:'';comment:文件物理地址"` |
||||
|
FileUrl string `json:"fileUrl" gorm:"column:fileUrl;type:mediumtext;default:'';comment:文件网络地址"` |
||||
|
Status int `json:"status" gorm:"column:status;type:int(1) unsigned NOT NULL DEFAULT '1' comment:状态(1:启用;2:禁用;3:删除)"` |
||||
|
DateTime int64 `json:"dateTime" gorm:"column:dateTime;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
||||
|
} |
||||
|
|
||||
|
func (UserInfoDownTemplate *UserInfoDownTemplate) TableName() string { |
||||
|
return "UserInfoDownTemplate" |
||||
|
} |
||||
|
|
||||
|
// 编辑内容
|
||||
|
func (cont *UserInfoDownTemplate) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Updates(saveData).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 获取内容
|
||||
|
func (cont *UserInfoDownTemplate) GetCont(whereMap interface{}, field ...string) (err error) { |
||||
|
gormDb := overall.CONSTANT_DB_AppPlatform.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 *UserInfoDownTemplate) CountCont(whereMap interface{}) (countId int64) { |
||||
|
overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Count(&countId) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 读取全部信息
|
||||
|
func (cont *UserInfoDownTemplate) ContMap(whereMap interface{}, field ...string) (countAry []UserInfoDownTemplate, err error) { |
||||
|
gormDb := overall.CONSTANT_DB_AppPlatform.Model(&cont) |
||||
|
if len(field) > 0 { |
||||
|
fieldStr := strings.Join(field, ",") |
||||
|
gormDb = gormDb.Select(fieldStr) |
||||
|
} |
||||
|
err = gormDb.Where(whereMap).Find(&countAry).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 删除内容
|
||||
|
func (cont *UserInfoDownTemplate) DelCont(whereMap interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_AppPlatform.Where(whereMap).Delete(&cont).Error |
||||
|
return |
||||
|
} |
||||
Loading…
Reference in new issue