新增角色列表,岗位列表
This commit is contained in:
@@ -37,16 +37,16 @@ func (r *AdminPostDao) AddAdminPost(tx *gorm.DB, model *model.AdminPost) (*model
|
||||
}
|
||||
|
||||
// DeleteAdminPostById 删除岗位-岗位id
|
||||
func (r *AdminPostDao) DeleteAdminPostById(tx *gorm.DB, deptId int64) error {
|
||||
if err := tx.Delete(&model.AdminPost{}, deptId).Error; err != nil {
|
||||
func (r *AdminPostDao) DeleteAdminPostById(tx *gorm.DB, postId int64) error {
|
||||
if err := tx.Delete(&model.AdminPost{}, postId).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EditAdminPostById 修改岗位-岗位id
|
||||
func (r *AdminPostDao) EditAdminPostById(tx *gorm.DB, deptId int64, data interface{}) error {
|
||||
err := tx.Model(&model.AdminPost{}).Where("post_id = ?", deptId).Updates(data).Error
|
||||
func (r *AdminPostDao) EditAdminPostById(tx *gorm.DB, postId int64, data interface{}) error {
|
||||
err := tx.Model(&model.AdminPost{}).Where("post_id = ?", postId).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -61,8 +61,8 @@ func (r *AdminPostDao) GetAdminPostPageSearch(getPostPage requests.GetPostPage,
|
||||
query := global.Db.Model(&model.AdminPost{})
|
||||
|
||||
query = query.Where("post_status = ? ", 1)
|
||||
if getPostPage.DeptName != "" {
|
||||
query = query.Where("post_name like ?", "%"+getPostPage.DeptName+"%")
|
||||
if getPostPage.PostName != "" {
|
||||
query = query.Where("post_name like ?", "%"+getPostPage.PostName+"%")
|
||||
}
|
||||
|
||||
// 查询总数量
|
||||
|
||||
@@ -83,3 +83,12 @@ func (r *AdminRoleDao) EditAdminRoleByIdWithStruct(tx *gorm.DB, roleId int64, mo
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetAdminRoleList 获取角色列表
|
||||
func (r *AdminRoleDao) GetAdminRoleList(maps interface{}) (m []*model.AdminRole, err error) {
|
||||
err = global.Db.Where(maps).Find(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user