30 lines
1.0 KiB
Go
30 lines
1.0 KiB
Go
// Code generated by sql2gorm. DO NOT EDIT.
|
|
package repo
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
// 用户角色表
|
|
type UserRole struct {
|
|
ID uint `gorm:"column:id;primary_key;AUTO_INCREMENT"` // id
|
|
UserAccount string `gorm:"column:user_account;NOT NULL"` // 用户账号
|
|
RoleCode string `gorm:"column:role_code;NOT NULL"` // 名称
|
|
CreatedBy string `gorm:"column:created_by"` // 创建人
|
|
CreatedOn time.Time `gorm:"column:created_on;default:CURRENT_TIMESTAMP;NOT NULL"` // 记录创建时间
|
|
ModifiedBy string `gorm:"column:modified_by"` // 修改人
|
|
ModifiedOn time.Time `gorm:"column:modified_on;default:CURRENT_TIMESTAMP"` // 记录修改时间
|
|
}
|
|
|
|
func (m *UserRole) TableName() string {
|
|
return "user_role"
|
|
}
|
|
|
|
func (r *roleRepo)CreateUserRole(ctx context.Context,items []UserRole)error{
|
|
if len(items) == 0{
|
|
return nil
|
|
}
|
|
|
|
return r.db.Create(&items).Error
|
|
} |