Browse Source

feat: [试验管理] 试验列表权限控制

master
memorylkf 1 week ago
parent
commit
ccb49ba908
3 changed files with 27 additions and 0 deletions
  1. +10
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudySubjectUser.java
  2. +16
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java
  3. +1
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudySubjectUserServiceImpl.java

+ 10
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudySubjectUser.java View File

@ -15,6 +15,9 @@ public class StudySubjectUser extends MpBaseEntity
{
private static final long serialVersionUID = 1L;
/** 所属试验 */
private Long studyId;
/** 所属试验-学科 */
private Long studySubjectId;
@ -24,6 +27,13 @@ public class StudySubjectUser extends MpBaseEntity
/** 用户姓名 */
private String userName;
public Long getStudyId() {
return studyId;
}
public void setStudyId(Long studyId) {
this.studyId = studyId;
}
public void setStudySubjectId(Long studySubjectId)
{

+ 16
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java View File

@ -23,6 +23,7 @@ import com.hxhq.common.core.exception.ServiceException;
import com.hxhq.common.core.utils.DateUtils;
import com.hxhq.common.core.utils.StringUtils;
import com.hxhq.common.core.web.domain.AjaxResult;
import com.hxhq.common.security.auth.AuthUtil;
import com.hxhq.common.security.utils.SecurityUtils;
import com.hxhq.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
@ -75,6 +76,21 @@ public class StudyServiceImpl extends ServiceImpl implements
if(form.getStatus()!=null && form.getStatus().intValue()>0){
queryWrapper.eq("s.status",form.getStatus());
}
//又新增权限的表示SDSD能看所有试验其他只能看自己进入的试验
String sdPermit = "business:study:add";
if (!AuthUtil.hasPermi(sdPermit))
{
queryWrapper.apply("(\n" +
"s.id IN (\n" +
"SELECT study_id FROM t_study_subject WHERE del_flag='0' AND leader={0}\n" +
")\n" +
"OR \n" +
"s.id IN (\n" +
"SELECT study_id FROM `t_study_subject_user` WHERE del_flag='0' AND user_id={0}\n" +
")\n" +
"OR create_by={0}\n" +
")",SecurityUtils.getUserId());
}
queryWrapper.orderByDesc("s.id");
return baseMapper.queryList(queryWrapper);
}

+ 1
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudySubjectUserServiceImpl.java View File

@ -73,6 +73,7 @@ public class StudySubjectUserServiceImpl extends ServiceImpl
List<StudySubjectUser> existsList = oldList.stream().filter(o->o.getUserId().equals(item.getUserId())).collect(Collectors.toList());
if(existsList.size()==0){
item.setStudySubjectId(form.getStudySubjectId());
item.setStudyId(studySubject.getStudyId());
addList.add(item);
addNameList.add(item.getUserName());

Loading…
Cancel
Save