Search in sources :

Example 1 with SysRole

use of com.zyd.blog.persistence.beans.SysRole in project OneBlog by zhangyd-c.

the class SysRoleServiceImpl method insertList.

@Override
public void insertList(List<Role> entities) {
    Assert.notNull(entities, "entities不可为空!");
    List<SysRole> sysRole = new ArrayList<>();
    for (Role role : entities) {
        role.setUpdateTime(new Date());
        role.setCreateTime(new Date());
        sysRole.add(role.getSysRole());
    }
    roleMapper.insertList(sysRole);
}
Also used : SysRole(com.zyd.blog.persistence.beans.SysRole) Role(com.zyd.blog.business.entity.Role) SysRole(com.zyd.blog.persistence.beans.SysRole)

Example 2 with SysRole

use of com.zyd.blog.persistence.beans.SysRole in project OneBlog by zhangyd-c.

the class SysRoleServiceImpl method queryRoleListWithSelected.

/**
 * 获取ztree使用的角色列表
 *
 * @param userId
 * @return
 */
@Override
public List<Map<String, Object>> queryRoleListWithSelected(Integer userId) {
    List<SysRole> sysRole = roleMapper.queryRoleListWithSelected(userId);
    if (CollectionUtils.isEmpty(sysRole)) {
        return null;
    }
    List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
    Map<String, Object> map = null;
    for (SysRole role : sysRole) {
        map = new HashMap<String, Object>(3);
        map.put("id", role.getId());
        map.put("pId", 0);
        map.put("checked", role.getSelected() != null && role.getSelected() == 1);
        map.put("name", role.getDescription());
        mapList.add(map);
    }
    return mapList;
}
Also used : SysRole(com.zyd.blog.persistence.beans.SysRole)

Example 3 with SysRole

use of com.zyd.blog.persistence.beans.SysRole in project OneBlog by zhangyd-c.

the class SysRoleServiceImpl method getByPrimaryKey.

@Override
public Role getByPrimaryKey(Long primaryKey) {
    Assert.notNull(primaryKey, "PrimaryKey不可为空!");
    SysRole sysRole = roleMapper.selectByPrimaryKey(primaryKey);
    return null == sysRole ? null : new Role(sysRole);
}
Also used : SysRole(com.zyd.blog.persistence.beans.SysRole) Role(com.zyd.blog.business.entity.Role) SysRole(com.zyd.blog.persistence.beans.SysRole)

Example 4 with SysRole

use of com.zyd.blog.persistence.beans.SysRole in project OneBlog by zhangyd-c.

the class SysRoleServiceImpl method findPageBreakByCondition.

@Override
public PageInfo<Role> findPageBreakByCondition(RoleConditionVO vo) {
    PageHelper.startPage(vo.getPageNumber(), vo.getPageSize());
    List<SysRole> sysRoles = roleMapper.findPageBreakByCondition(vo);
    if (CollectionUtils.isEmpty(sysRoles)) {
        return null;
    }
    List<Role> roles = this.getRole(sysRoles);
    PageInfo bean = new PageInfo<SysRole>(sysRoles);
    bean.setList(roles);
    return bean;
}
Also used : SysRole(com.zyd.blog.persistence.beans.SysRole) Role(com.zyd.blog.business.entity.Role) PageInfo(com.github.pagehelper.PageInfo) SysRole(com.zyd.blog.persistence.beans.SysRole)

Aggregations

SysRole (com.zyd.blog.persistence.beans.SysRole)4 Role (com.zyd.blog.business.entity.Role)3 PageInfo (com.github.pagehelper.PageInfo)1