com.ruoyi.system.domain.SysPost Java Examples

The following examples show how to use com.ruoyi.system.domain.SysPost. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SysPostController.java    From supplierShop with MIT License 6 votes vote down vote up
/**
 * 修改保存岗位
 */
@RequiresPermissions("system:post:edit")
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@Validated SysPost post)
{
    if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
    {
        return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
    }
    else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
    {
        return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
    }
    post.setUpdateBy(ShiroUtils.getLoginName());
    return toAjax(postService.updatePost(post));
}
 
Example #2
Source File: SysUserServiceImpl.java    From supplierShop with MIT License 6 votes vote down vote up
/**
 * 查询用户所属岗位组
 * 
 * @param userId 用户ID
 * @return 结果
 */
@Override
public String selectUserPostGroup(Long userId)
{
    List<SysPost> list = postMapper.selectPostsByUserId(userId);
    StringBuffer idsStr = new StringBuffer();
    for (SysPost post : list)
    {
        idsStr.append(post.getPostName()).append(",");
    }
    if (StringUtils.isNotEmpty(idsStr.toString()))
    {
        return idsStr.substring(0, idsStr.length() - 1);
    }
    return idsStr.toString();
}
 
Example #3
Source File: SysPostController.java    From supplierShop with MIT License 6 votes vote down vote up
/**
 * 新增保存岗位
 */
@RequiresPermissions("system:post:add")
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@Validated SysPost post)
{
    if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
    {
        return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
    }
    else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
    {
        return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
    }
    post.setCreateBy(ShiroUtils.getLoginName());
    return toAjax(postService.insertPost(post));
}
 
Example #4
Source File: SysPostServiceImpl.java    From supplierShop with MIT License 6 votes vote down vote up
/**
 * 根据用户ID查询岗位
 * 
 * @param userId 用户ID
 * @return 岗位列表
 */
@Override
public List<SysPost> selectPostsByUserId(Long userId)
{
    List<SysPost> userPosts = postMapper.selectPostsByUserId(userId);
    List<SysPost> posts = postMapper.selectPostAll();
    for (SysPost post : posts)
    {
        for (SysPost userRole : userPosts)
        {
            if (post.getPostId().longValue() == userRole.getPostId().longValue())
            {
                post.setFlag(true);
                break;
            }
        }
    }
    return posts;
}
 
Example #5
Source File: SysUserServiceImpl.java    From ruoyiplus with MIT License 6 votes vote down vote up
/**
 * 查询用户所属岗位组
 * 
 * @param userId 用户ID
 * @return 结果
 */
@Override
public String selectUserPostGroup(Long userId)
{
    List<SysPost> list = postMapper.selectPostsByUserId(userId);
    StringBuffer idsStr = new StringBuffer();
    for (SysPost post : list)
    {
        idsStr.append(post.getPostName()).append(",");
    }
    if (StringUtils.isNotEmpty(idsStr.toString()))
    {
        return idsStr.substring(0, idsStr.length() - 1);
    }
    return idsStr.toString();
}
 
Example #6
Source File: SysPostServiceImpl.java    From ruoyiplus with MIT License 6 votes vote down vote up
/**
 * 根据用户ID查询岗位
 * 
 * @param userId 用户ID
 * @return 岗位列表
 */
@Override
public List<SysPost> selectPostsByUserId(Long userId)
{
    List<SysPost> userPosts = postMapper.selectPostsByUserId(userId);
    List<SysPost> posts = postMapper.selectPostAll();
    for (SysPost post : posts)
    {
        for (SysPost userRole : userPosts)
        {
            if (post.getPostId().longValue() == userRole.getPostId().longValue())
            {
                post.setFlag(true);
                break;
            }
        }
    }
    return posts;
}
 
Example #7
Source File: SysPostController.java    From ruoyiplus with MIT License 5 votes vote down vote up
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:post:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysPost post)
{
    List<SysPost> list = postService.selectPostList(post);
    ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
    return util.exportExcel(list, "岗位数据");
}
 
Example #8
Source File: SysPostServiceImpl.java    From RuoYi with Apache License 2.0 5 votes vote down vote up
/**
 * 批量删除岗位信息
 *
 * @param ids 需要删除的数据ID
 * @throws BusinessException 异常
 */
@Override
public int deletePostByIds(String ids) throws BusinessException {
    Long[] postIds = Convert.toLongArray(ids);
    for (Long postId : postIds) {
        SysPost post = selectPostById(postId);
        if (countUserPostById(postId) > 0) {
            throw new BusinessException(String.format("%1$s已分配,不能删除", post.getPostName()));
        }
    }
    return postMapper.deletePostByIds(postIds);
}
 
Example #9
Source File: SysPostController.java    From RuoYi with Apache License 2.0 5 votes vote down vote up
/**
 * 修改保存岗位
 */
@RequiresPermissions("system:post:edit")
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(SysPost post) {
    post.setUpdateBy(ShiroUtils.getLoginName());
    return toAjax(postService.updatePost(post));
}
 
Example #10
Source File: SysPostController.java    From RuoYi with Apache License 2.0 5 votes vote down vote up
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:post:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysPost post) {
    List<SysPost> list = postService.selectPostList(post);
    ExcelUtil<SysPost> util = new ExcelUtil<>(SysPost.class);
    return util.exportExcel(list, "岗位信息");
}
 
Example #11
Source File: SysPostServiceImpl.java    From ruoyiplus with MIT License 5 votes vote down vote up
/**
 * 校验岗位名称是否唯一
 * 
 * @param post 岗位信息
 * @return 结果
 */
@Override
public String checkPostNameUnique(SysPost post)
{
    Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
    SysPost info = postMapper.checkPostNameUnique(post.getPostName());
    if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
    {
        return UserConstants.POST_NAME_NOT_UNIQUE;
    }
    return UserConstants.POST_NAME_UNIQUE;
}
 
Example #12
Source File: SysPostServiceImpl.java    From RuoYi with Apache License 2.0 5 votes vote down vote up
/**
 * 校验岗位名称是否唯一
 *
 * @param post 岗位信息
 * @return 结果
 */
@Override
public String checkPostNameUnique(SysPost post) {
    SysPost info = postMapper.checkPostNameUnique(post.getPostName());
    if (ObjectUtil.isNotNull(info) && !info.getPostId().equals(post.getPostId())) {
        return UserConstants.POST_NAME_NOT_UNIQUE;
    }
    return UserConstants.POST_NAME_UNIQUE;
}
 
Example #13
Source File: SysPostServiceImpl.java    From supplierShop with MIT License 5 votes vote down vote up
/**
 * 批量删除岗位信息
 * 
 * @param ids 需要删除的数据ID
 * @throws Exception
 */
@Override
public int deletePostByIds(String ids) throws BusinessException
{
    Long[] postIds = Convert.toLongArray(ids);
    for (Long postId : postIds)
    {
        SysPost post = selectPostById(postId);
        if (countUserPostById(postId) > 0)
        {
            throw new BusinessException(String.format("%1$s已分配,不能删除", post.getPostName()));
        }
    }
    return postMapper.deletePostByIds(postIds);
}
 
Example #14
Source File: SysPostServiceImpl.java    From ruoyiplus with MIT License 5 votes vote down vote up
/**
 * 批量删除岗位信息
 * 
 * @param ids 需要删除的数据ID
 * @throws Exception
 */
@Override
public int deletePostByIds(String ids) throws BusinessException
{
    Long[] postIds = Convert.toLongArray(ids);
    for (Long postId : postIds)
    {
        SysPost post = selectPostById(postId);
        if (countUserPostById(postId) > 0)
        {
            throw new BusinessException(String.format("%1$s已分配,不能删除", post.getPostName()));
        }
    }
    return postMapper.deletePostByIds(postIds);
}
 
Example #15
Source File: SysPostServiceImpl.java    From RuoYi with Apache License 2.0 5 votes vote down vote up
/**
 * 校验岗位编码是否唯一
 *
 * @param post 岗位信息
 * @return 结果
 */
@Override
public String checkPostCodeUnique(SysPost post) {
    SysPost info = postMapper.checkPostCodeUnique(post.getPostCode());
    if (ObjectUtil.isNotNull(info) && !info.getPostId().equals(post.getPostId())) {
        return UserConstants.POST_CODE_NOT_UNIQUE;
    }
    return UserConstants.POST_CODE_UNIQUE;
}
 
Example #16
Source File: SysPostServiceImpl.java    From supplierShop with MIT License 5 votes vote down vote up
/**
 * 校验岗位名称是否唯一
 * 
 * @param post 岗位信息
 * @return 结果
 */
@Override
public String checkPostNameUnique(SysPost post)
{
    Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
    SysPost info = postMapper.checkPostNameUnique(post.getPostName());
    if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
    {
        return UserConstants.POST_NAME_NOT_UNIQUE;
    }
    return UserConstants.POST_NAME_UNIQUE;
}
 
Example #17
Source File: SysPostController.java    From RuoYi with Apache License 2.0 5 votes vote down vote up
/**
 * 新增保存岗位
 */
@RequiresPermissions("system:post:add")
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(SysPost post) {
    post.setCreateBy(ShiroUtils.getLoginName());
    return toAjax(postService.insertPost(post));
}
 
Example #18
Source File: SysPostController.java    From ruoyiplus with MIT License 5 votes vote down vote up
/**
 * 校验岗位编码
 */
@PostMapping("/checkPostCodeUnique")
@ResponseBody
public String checkPostCodeUnique(SysPost post)
{
    return postService.checkPostCodeUnique(post);
}
 
Example #19
Source File: SysPostController.java    From supplierShop with MIT License 5 votes vote down vote up
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:post:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysPost post)
{
    List<SysPost> list = postService.selectPostList(post);
    ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
    return util.exportExcel(list, "岗位数据");
}
 
Example #20
Source File: SysPostController.java    From supplierShop with MIT License 5 votes vote down vote up
/**
 * 校验岗位名称
 */
@PostMapping("/checkPostNameUnique")
@ResponseBody
public String checkPostNameUnique(SysPost post)
{
    return postService.checkPostNameUnique(post);
}
 
Example #21
Source File: SysPostController.java    From supplierShop with MIT License 5 votes vote down vote up
/**
 * 校验岗位编码
 */
@PostMapping("/checkPostCodeUnique")
@ResponseBody
public String checkPostCodeUnique(SysPost post)
{
    return postService.checkPostCodeUnique(post);
}
 
Example #22
Source File: SysPostController.java    From ruoyiplus with MIT License 5 votes vote down vote up
/**
 * 校验岗位名称
 */
@PostMapping("/checkPostNameUnique")
@ResponseBody
public String checkPostNameUnique(SysPost post)
{
    return postService.checkPostNameUnique(post);
}
 
Example #23
Source File: SysPostController.java    From ruoyiplus with MIT License 5 votes vote down vote up
/**
 * 修改保存岗位
 */
@RequiresPermissions("system:post:edit")
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(SysPost post)
{
    post.setUpdateBy(ShiroUtils.getLoginName());
    return toAjax(postService.updatePost(post));
}
 
Example #24
Source File: SysPostController.java    From ruoyiplus with MIT License 5 votes vote down vote up
/**
 * 新增保存岗位
 */
@RequiresPermissions("system:post:add")
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(SysPost post)
{
    post.setCreateBy(ShiroUtils.getLoginName());
    return toAjax(postService.insertPost(post));
}
 
Example #25
Source File: SysPostServiceImpl.java    From supplierShop with MIT License 5 votes vote down vote up
/**
 * 校验岗位编码是否唯一
 * 
 * @param post 岗位信息
 * @return 结果
 */
@Override
public String checkPostCodeUnique(SysPost post)
{
    Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
    SysPost info = postMapper.checkPostCodeUnique(post.getPostCode());
    if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
    {
        return UserConstants.POST_CODE_NOT_UNIQUE;
    }
    return UserConstants.POST_CODE_UNIQUE;
}
 
Example #26
Source File: SysPostServiceImpl.java    From ruoyiplus with MIT License 4 votes vote down vote up
/**
 * 查询所有岗位
 * 
 * @return 岗位列表
 */
@Override
public List<SysPost> selectPostAll()
{
    return postMapper.selectPostAll();
}
 
Example #27
Source File: SysPostController.java    From RuoYi with Apache License 2.0 4 votes vote down vote up
/**
 * 校验岗位编码
 */
@PostMapping("/checkPostCodeUnique")
@ResponseBody
public String checkPostCodeUnique(SysPost post) {
    return postService.checkPostCodeUnique(post);
}
 
Example #28
Source File: SysPostServiceImpl.java    From supplierShop with MIT License 4 votes vote down vote up
/**
 * 查询所有岗位
 * 
 * @return 岗位列表
 */
@Override
public List<SysPost> selectPostAll()
{
    return postMapper.selectPostAll();
}
 
Example #29
Source File: SysPostMapper.java    From ruoyiplus with MIT License 2 votes vote down vote up
/**
 * 查询岗位数据集合
 * 
 * @param post 岗位信息
 * @return 岗位数据集合
 */
public List<SysPost> selectPostList(SysPost post);
 
Example #30
Source File: SysPostMapper.java    From ruoyiplus with MIT License 2 votes vote down vote up
/**
 * 修改岗位信息
 * 
 * @param post 岗位信息
 * @return 结果
 */
public int updatePost(SysPost post);