Browse Source

feat: [试验管理] 取消邀请人判断是否有表单

master
memorylkf 1 hour ago
parent
commit
99caaa8b34
3 changed files with 50 additions and 2 deletions
  1. +11
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudySubjectUserMapper.java
  2. +13
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudySubjectUserServiceImpl.java
  3. +26
    -0
      hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudySubjectUserMapper.xml

+ 11
- 1
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudySubjectUserMapper.java View File

@ -2,6 +2,10 @@ package com.hxhq.business.mapper;
import com.hxhq.business.domain.StudySubjectUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 试验-学科-成员Mapper接口
*
@ -10,5 +14,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface StudySubjectUserMapper extends BaseMapper<StudySubjectUser>
{
/**
* 获取有表单的和姓名
* @param studyId
* @param userIdList
* @return
*/
String getHasFormNameList(@Param("studyId") Long studyId, @Param("userIdList") List<Long> userIdList);
}

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

@ -20,6 +20,8 @@ import com.hxhq.business.service.IStudyService;
import com.hxhq.business.service.IStudySubjectService;
import com.hxhq.business.utils.JctUtil;
import com.hxhq.common.core.exception.ServiceException;
import com.hxhq.common.core.utils.StringUtils;
import com.hxhq.common.core.web.domain.AjaxResult;
import com.hxhq.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -63,7 +65,7 @@ public class StudySubjectUserServiceImpl extends ServiceImpl
if(studySubject==null){
throw new ServiceException("试验不存在");
}
studyService.checkPassword(form.getSign());
//传入的成员信息
List<StudySubjectUser> itemList = form.getSubjectUserList();
//已经设置的学科信息
@ -113,6 +115,16 @@ public class StudySubjectUserServiceImpl extends ServiceImpl
updateBatchById(modifyList);
}
if(deleteList.size()>0){
String name = baseMapper.getHasFormNameList(study.getId(),deleteList.stream().map(o->o.getUserId()).collect(Collectors.toList()));
if(StringUtils.isNoneBlank(name)){
throw new ServiceException(name+"已创建过表单,无法取消勾选");
}
}
if(StringUtils.isBlank(form.getSign().getQmrmm())){
return ;
}
studyService.checkPassword(form.getSign());
if(deleteList.size()>0){
removeBatchByIds(deleteList);
}

+ 26
- 0
hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudySubjectUserMapper.xml View File

@ -3,4 +3,30 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hxhq.business.mapper.StudySubjectUserMapper">
<select id="getHasFormNameList" resultType="java.lang.String">
SELECT GROUP_CONCAT(DISTINCT user_mc SEPARATOR '、') FROM
(
SELECT DISTINCT user_mc
FROM `t_study_form_fill` WHERE del_flag='0' AND study_id=#{studyId} AND user_id IN
<foreach collection="userIdList" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
UNION ALL
SELECT DISTINCT user_mc
FROM `t_study_form_pre` WHERE del_flag='0' AND study_id=#{studyId} AND user_id IN
<foreach collection="userIdList" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
UNION ALL
SELECT DISTINCT user_mc
FROM `t_study_form_plan` WHERE del_flag='0' AND study_id=#{studyId} AND user_id IN
<foreach collection="userIdList" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
)a
</select>
</mapper>

Loading…
Cancel
Save