Commit 7ee2fcc3 by wangqi

项目权限

parent 5a75ef57
......@@ -2,6 +2,10 @@ package com.ruoyi.project.ys.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.project.system.domain.SysRole;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -40,6 +44,21 @@ public class YsqqXmxxController extends BaseController
@GetMapping("/list")
public TableDataInfo list(YsqqXmxx ysqqXmxx)
{
// 系统管理员:看所有。
// 创建人能看到
// 项目成员能看到
ysqqXmxx.setCreatedBy(SecurityUtils.getUserId()+"");
// 拿到角色如果是管理员 不限制。不是管理员只能看到自己的帮扶组
List<SysRole> rolelist = SecurityUtils.getLoginUser().getUser().getRoles();
if(StringUtils.isNotEmpty(rolelist)){
for (SysRole role :rolelist){
Long roleid = role.getRoleId();
if(roleid==1||roleid==3){
ysqqXmxx.setCreatedBy(null);
}
}
}
startPage();
List<YsqqXmxx> list = ysqqXmxxService.selectYsqqXmxxList(ysqqXmxx);
return getDataTable(list);
......@@ -195,8 +214,22 @@ public class YsqqXmxxController extends BaseController
@GetMapping("/yscgList")
public TableDataInfo yscgList(YsqqXmxx ysqqXmxx)
{
// 系统管理员:看所有。
// 创建人能看到
// 项目成员能看到
ysqqXmxx.setCreatedBy(SecurityUtils.getUserId()+"");
// 拿到角色如果是管理员 不限制。不是管理员只能看到自己的帮扶组
List<SysRole> rolelist = SecurityUtils.getLoginUser().getUser().getRoles();
if(StringUtils.isNotEmpty(rolelist)){
for (SysRole role :rolelist){
Long roleid = role.getRoleId();
if(roleid==1||roleid==3){
ysqqXmxx.setCreatedBy(null);
}
}
}
startPage();
ysqqXmxx.setExt1("待验收、已验收(待归档)、已归档'");
//ysqqXmxx.setExt1("待验收、已验收(待归档)、已归档'");
List<YsqqXmxx> list = ysqqXmxxService.yscgList(ysqqXmxx);
return getDataTable(list);
}
......
......@@ -64,7 +64,7 @@ public class YsqqXmxxServiceImpl implements IYsqqXmxxService
@Override
public int insertYsqqXmxx(YsqqXmxx ysqqXmxx)
{
ysqqXmxx.setCreateBy(getUserId()+"");
ysqqXmxx.setCreatedBy(getUserId()+"");
ysqqXmxx.setCreatedTime(DateUtils.getNowDate());
return ysqqXmxxMapper.insertYsqqXmxx(ysqqXmxx);
}
......
......@@ -27,11 +27,14 @@
</resultMap>
<sql id="selectYsqqXmxxVo">
select id, xmmc, qk, xmjj, jhdw, jfdw, xmin, xmax, ymin, ymax, created_by, created_time, update_by, update_time, ext1, ext2, ext3, xmzt, xmrq from ysqq_xmxx
select a.id, a.xmmc, a.qk, a.xmjj, a.jhdw, a.jfdw, a.xmin, a.xmax, a.ymin, a.ymax, a.created_by, a.created_time, a.update_by, a.update_time, a.ext1, a.ext2, a.ext3, a.xmzt, a.xmrq from ysqq_xmxx a
</sql>
<select id="selectYsqqXmxxList" parameterType="YsqqXmxx" resultMap="YsqqXmxxResult">
<include refid="selectYsqqXmxxVo"/>
select a.id, a.xmmc, a.qk, a.xmjj, a.jhdw, a.jfdw, a.xmin, a.xmax, a.ymin, a.ymax,
a.created_by, a.created_time, a.update_by, a.update_time, a.ext1, a.ext2, a.ext3, a.xmzt, a.xmrq,b.cyid
from ysqq_xmxx a
left join (select zbid,GROUP_CONCAT(user_id) cyid from ysqq_xmxx_xmcy group by zbid) b on a.id = b.zbid
<where>
<if test="id != null "> and id = #{id}</if>
<if test="xmmc != null and xmmc != ''"> and xmmc like concat('%', #{xmmc}, '%')</if>
......@@ -43,7 +46,7 @@
<if test="xmax != null "> and xmax = #{xmax}</if>
<if test="ymin != null "> and ymin = #{ymin}</if>
<if test="ymax != null "> and ymax = #{ymax}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="createdBy != null and createdBy != ''"> and (created_by = #{createdBy} or FIND_IN_SET(#{createdBy},b.cyid))</if>
<if test="createdTime != null "> and created_time = #{createdTime}</if>
<if test="ext1 != null and ext1 != ''"> and xmzt in ('待验收','已验收(待归档)','已归档')</if>
<if test="ext2 != null and ext2 != ''"> and xmzt in ('已验收(待归档)','已归档')</if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment