提交 5c765ba2 作者: 张开石

1、添加获取会议类型列表接口

父级 b07807a1
......@@ -18,18 +18,6 @@ import java.util.List;
public interface MeetTypeMapper extends BaseMapper<MeetType> {
/**
* 根据userId查询系统通用的会议类型
* @return
*/
List<MeetTypeDto> selectSystemMeetTypeList(@Param("userId") String userId);
/**
* 根据userId查询自定义的模板
* todo 没有增加权限条件
* @return
*/
List<MeetTypeDto> selectCustomMeetTypeList(@Param("userId") String userId);
/**
* 查询会议类型下拉框
......
package com.cmeeting.mapper.primary;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cmeeting.dto.MeetTypeDto;
import com.cmeeting.dto.RecordTemplateDto;
import com.cmeeting.pojo.MeetingRecordTemplate;
import org.apache.ibatis.annotations.Mapper;
......@@ -18,14 +19,14 @@ public interface MeetingRecordTemplateMapper extends BaseMapper<MeetingRecordTem
* 查询授权的模板-会议类型维度
* @return
*/
List<RecordTemplateDto> selectPermissionTmplInMeetType(@Param("userId") String userId,
List<MeetTypeDto> selectPermissionTmplInMeetType(@Param("userId") String userId,
@Param("deptIdList") List<String> deptIdList);
/**
* 获取指定授权的模板-纪要模板维度
* @return
*/
List<RecordTemplateDto> selectPermissionTmpl(@Param("userId") String userId,
List<MeetTypeDto> selectPermissionTmpl(@Param("userId") String userId,
@Param("deptIdList") List<String> deptIdList);
/**
......@@ -33,5 +34,5 @@ public interface MeetingRecordTemplateMapper extends BaseMapper<MeetingRecordTem
* @param userId
* @return
*/
List<RecordTemplateDto> selectAllTmplWithoutPermission(String userId);
List<MeetTypeDto> selectAllTmplWithoutPermission(String userId);
}
\ No newline at end of file
......@@ -39,17 +39,6 @@ public interface MeetTypeService extends IService<MeetType> {
*/
List<MeetTypeDto> getMeetTypeList();
/**
* 获取系统通用会议类型
* @return
*/
List<MeetTypeDto> getSystemMeetTypeList();
/**
* 获取用户自定义会议类型
* @return
*/
List<MeetTypeDto> getCustomMeetTypeList();
/**
* 获取会议类型下拉框
......
......@@ -2,6 +2,7 @@ package com.cmeeting.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.cmeeting.dto.MeetTypeDto;
import com.cmeeting.dto.RecordTemplateDto;
import com.cmeeting.dto.UserDTO;
import com.cmeeting.pojo.MeetingRecordTemplate;
......@@ -72,8 +73,16 @@ public interface MeetingRecordTemplateService extends IService<MeetingRecordTemp
void delete(Long id);
/**
* 获取模板下拉列表,有权限控制
* 获取模板下拉列表
* @return
*/
List<RecordTemplateDto> getTemplateSelect();
/**
* 获取模板列表
* @param userId 用户id
* @param parentDeptIdList 部门id列表
* @return
*/
List<MeetTypeDto> getMeetTypeList(String userId, List<String> parentDeptIdList);
}
......@@ -13,13 +13,12 @@ import com.cmeeting.dto.MeetTypeDto;
import com.cmeeting.exception.RobotBaseException;
import com.cmeeting.mapper.primary.MeetTemplateEnableMapper;
import com.cmeeting.mapper.primary.MeetingRecordTemplateMapper;
import com.cmeeting.pojo.MeetTemplateEnable;
import com.cmeeting.pojo.MeetType;
import com.cmeeting.pojo.MeetingRecordTemplate;
import com.cmeeting.pojo.ModulePermission;
import com.cmeeting.pojo.*;
import com.cmeeting.service.MeetTypeService;
import com.cmeeting.mapper.primary.MeetTypeMapper;
import com.cmeeting.service.MeetingRecordTemplateService;
import com.cmeeting.service.ModulePermissionService;
import com.cmeeting.service.SysUserSyncService;
import com.cmeeting.vo.AuthVO;
import com.cmeeting.vo.MeetingTypeVo;
import lombok.extern.slf4j.Slf4j;
......@@ -33,6 +32,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author Administrator
......@@ -52,6 +52,10 @@ public class MeetTypeServiceImpl extends ServiceImpl<MeetTypeMapper, MeetType>
private MeetTemplateEnableMapper meetTemplateEnableMapper;
@Resource
private ModulePermissionService modulePermissionService;
@Autowired
private MeetingRecordTemplateService meetingRecordTemplateService;
@Resource
private SysUserSyncService sysUserSyncService;
/**
* 添加会议类型
......@@ -156,50 +160,14 @@ public class MeetTypeServiceImpl extends ServiceImpl<MeetTypeMapper, MeetType>
*/
@Override
public List<MeetTypeDto> getMeetTypeList() {
List<MeetTypeDto> meetTypeDtoList = new ArrayList<>();
// 获取系统通用的会议类型
List<MeetTypeDto> systemMeetTypeList = getSystemMeetTypeList();
meetTypeDtoList.addAll(systemMeetTypeList);
// 获取用户自定义会议类型
List<MeetTypeDto> customMeetTypeList = getCustomMeetTypeList();
meetTypeDtoList.addAll(customMeetTypeList);
return meetTypeDtoList;
}
/**
* 获取系统通用会议类型
*
* @return
*/
@Override
public List<MeetTypeDto> getSystemMeetTypeList() {
// 获取当前用户向上的的部门集合
RobotSecurityUser loginUser = SecurityUtil.getUser();
// 查询系统通用会议类型
List<MeetTypeDto> meetTypeDtoList = meetTypeMapper.selectSystemMeetTypeList(loginUser.getUserId());
meetTypeDtoList.stream().forEach(meetTypeDto -> meetTypeDto.setType(MeetingTypeConstant.TYPE_SYSTEM));
List<SysUserSyncCategory> categoryList = sysUserSyncService.getCategoryListByUserId(loginUser.getUserId());
List<String> parentDeptIdList = categoryList.stream().map(SysUserSyncCategory::getDeptId).collect(Collectors.toList());
return meetTypeDtoList;
return meetingRecordTemplateService.getMeetTypeList(loginUser.getUserId(), parentDeptIdList);
}
/**
* 获取用户自定义会议类型
* 目前只有所有人的逻辑
* @return
*/
@Override
public List<MeetTypeDto> getCustomMeetTypeList() {
RobotSecurityUser loginUser = SecurityUtil.getUser();
String userId = loginUser.getUserId();
List<MeetTypeDto> meetTypeDtoList = meetTypeMapper.selectCustomMeetTypeList(userId);
meetTypeDtoList.stream().forEach(meetTypeDto -> meetTypeDto.setType(MeetingTypeConstant.TYPE_CUSTOM));
return meetTypeDtoList;
}
/**
* 获取会议类型下拉列表
......
......@@ -13,6 +13,7 @@ import com.cmeeting.ad.entity.SysUserSync;
import com.cmeeting.ad.util.SecurityUtil;
import com.cmeeting.constant.MeetingTypeConstant;
import com.cmeeting.constant.RecordTemplateConstant;
import com.cmeeting.dto.MeetTypeDto;
import com.cmeeting.dto.RecordTemplateDto;
import com.cmeeting.dto.UserDTO;
import com.cmeeting.exception.RobotBaseException;
......@@ -30,6 +31,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
......@@ -368,18 +370,36 @@ public class MeetingRecordTemplateServiceImpl extends ServiceImpl<MeetingRecordT
List<SysUserSyncCategory> categoryList = sysUserSyncService.getCategoryListByUserId(loginUser.getUserId());
List<String> parentDeptIdList = categoryList.stream().map(SysUserSyncCategory::getDeptId).collect(Collectors.toList());
List<RecordTemplateDto> resultList = new ArrayList<>();
List<MeetTypeDto> meetTypeList = getMeetTypeList(loginUser.getUserId(), parentDeptIdList);
List<RecordTemplateDto> allRecordTemplates = meetTypeList.stream()
.map(MeetTypeDto::getRecordTemplateDTOList)
.filter(Objects::nonNull)
.flatMap(List::stream)
.filter(template -> ObjectUtils.isEmpty(template.getId()))
.collect(Collectors.toList());
return allRecordTemplates;
}
/**
* 获取模板列表
* @param userId 用户id
* @param parentDeptIdList 部门id列表
* @return
*/
@Override
public List<MeetTypeDto> getMeetTypeList(String userId, List<String> parentDeptIdList) {
List<MeetTypeDto> resultList = new ArrayList<>();
// 查询指定授权的模板 - 从会议类型维度查询
List<RecordTemplateDto> permissionTmplInMeetTypeDtoList = baseMapper.selectPermissionTmplInMeetType(loginUser.getUserId(), parentDeptIdList);
List<MeetTypeDto> permissionTmplInMeetTypeDtoList = baseMapper.selectPermissionTmplInMeetType(userId, parentDeptIdList);
resultList.addAll(permissionTmplInMeetTypeDtoList);
// 查询指定授权的模板 - 从纪要模板维度查询
List<RecordTemplateDto> permissionDeptTmplDtoList = baseMapper.selectPermissionTmpl(loginUser.getUserId(), parentDeptIdList);
List<MeetTypeDto> permissionDeptTmplDtoList = baseMapper.selectPermissionTmpl(userId, parentDeptIdList);
resultList.addAll(permissionDeptTmplDtoList);
// 获取非授权的模板,包括系统通用的和自己创建的
List<RecordTemplateDto> recordTemplateDtoList = baseMapper.selectAllTmplWithoutPermission(loginUser.getUserId());
List<MeetTypeDto> recordTemplateDtoList = baseMapper.selectAllTmplWithoutPermission(userId);
resultList.addAll(recordTemplateDtoList);
return resultList;
......
......@@ -43,55 +43,6 @@
</collection>
</resultMap>
<select id="selectSystemMeetTypeList" resultMap="MeetTypeDtoResultMap">
SELECT
meet_type.id AS meeting_type_id,
meet_type.`name` AS meeting_type_name,
meet_type.personal_permission AS meeting_type_personal_permission,
meet_type.auth_type AS meeting_type_auth_type,
meet_type.rel_id AS meeting_type_rel_id,
meet_type.content AS meeting_type_content,
cmt_meeting_record_template.id AS template_id,
cmt_meeting_record_template.`name` AS template_name,
cmt_meeting_record_template.type_detail AS template_type_detail,
cmt_meeting_record_template.create_time AS template_create_time,
cmt_meeting_record_template.prompt AS template_prompt,
cmt_meeting_record_template.refer_template_id AS template_refer_template_id,
IF(meet_template_enable.id IS NULL, 0, 1) AS template_enabled
FROM
meet_type
LEFT JOIN cmt_meeting_record_template ON cmt_meeting_record_template.meeting_type = meet_type.id
AND cmt_meeting_record_template.is_del = 0
LEFT JOIN meet_template_enable ON cmt_meeting_record_template.id = meet_template_enable.rel_id
AND meet_template_enable.user_id = #{userId}
WHERE
meet_type.is_del = 0
and cmt_meeting_record_template.`type` = 'system'
</select>
<!-- 根据userId查询自定义的模板 -->
<select id="selectCustomMeetTypeList" resultMap="MeetTypeDtoResultMap">
SELECT
meet_type.id AS meeting_type_id,
meet_type.`name` AS meeting_type_name,
meet_type.content AS meeting_type_content,
cmt_meeting_record_template.id AS template_id,
cmt_meeting_record_template.`name` AS template_name,
cmt_meeting_record_template.`type` AS template_type,
cmt_meeting_record_template.type_detail AS template_type_detail,
cmt_meeting_record_template.create_time AS template_create_time,
IF(meet_template_enable.id IS NULL, 0, 1) AS template_enabled
FROM
meet_type
LEFT JOIN cmt_meeting_record_template ON cmt_meeting_record_template.meeting_type = meet_type.id
AND cmt_meeting_record_template.is_del = 0
LEFT JOIN meet_template_enable ON cmt_meeting_record_template.id = meet_template_enable.rel_id
AND meet_template_enable.user_id = #{userId}
WHERE
meet_type.is_del = 0
and cmt_meeting_record_template.`type` = 'custom'
</select>
<!-- 查询会议类型下拉框 -->
<select id="selectMeetTypeSelect" resultMap="MeetTypeDtoResultMap">
select
......
......@@ -8,23 +8,54 @@
</select>
<sql id="templateColumnSql">
meet_type.id as template_type_id,
meet_type.`name` AS meeting_type_name,
meet_type.personal_permission AS meeting_type_personal_permission,
meet_type.auth_type AS meeting_type_auth_type,
meet_type.rel_id AS meeting_type_rel_id,
meet_type.content AS meeting_type_content,
cmt_meeting_record_template.id as template_id,
cmt_meeting_record_template.name as template_name,
cmt_meeting_record_template.type_detail as template_type_detail,
cmt_meeting_record_template.create_time AS template_create_time,
cmt_meeting_record_template.prompt as template_prompt,
cmt_meeting_record_template.refer_template_id AS template_refer_template_id,
IF(meet_template_enable.id IS NULL, 0, 1) AS template_enabled
</sql>
<resultMap id="MeetTypeDtoResultMap" type="com.cmeeting.dto.MeetTypeDto">
<id property="id" column="meeting_type_id" />
<result property="name" column="meeting_type_name" />
<result property="personalPermission" column="meeting_type_personal_permission" />
<result property="authType" column="meeting_type_auth_type" />
<result property="relId" column="meeting_type_rel_id" />
<result property="content" column="meeting_type_content" />
<collection property="recordTemplateDTOList" javaType="List" ofType="com.cmeeting.dto.RecordTemplateDto">
<id property="id" column="template_id" />
<result property="name" column="template_name" />
<result property="typeDetail" column="template_type_detail" />
<result property="createTime" column="template_create_time" />
<result property="enable" column="template_enabled" />
<result property="prompt" column="template_prompt" />
<result property="referTemplateId" column="template_refer_template_id" />
</collection>
</resultMap>
<!-- 查询授权的模板-会议类型维度 -->
<select id="selectPermissionTmplInMeetType" resultType="com.cmeeting.dto.RecordTemplateDto">
<select id="selectPermissionTmplInMeetType" resultMap="MeetTypeDtoResultMap">
select
cmt_meeting_record_template.id as template_id,
cmt_meeting_record_template.name as template_name,
cmt_meeting_record_template.type_detail as template_type_detail,
cmt_meeting_record_template.prompt as template_prompt
<include refid="templateColumnSql" />
from
meet_type,
cmt_meeting_record_template,
meet_type
left join cmt_meeting_record_template on meet_type.id = cmt_meeting_record_template.meeting_type and cmt_meeting_record_template.is_del = 0
and cmt_meeting_record_template.type = 'custom'
LEFT JOIN meet_template_enable ON cmt_meeting_record_template.id = meet_template_enable.rel_id
AND meet_template_enable.user_id = #{userId},
module_permission
where
meet_type.is_del = 0
and cmt_meeting_record_template.is_del = 0
and meet_type.auth_type = 2
and meet_type.id = cmt_meeting_record_template.meeting_type
and cmt_meeting_record_template.type = 'custom'
and module_permission.type = 0
and module_permission.purpose = 1
and module_permission.target_id = meet_type.id
......@@ -36,20 +67,17 @@
union
select
cmt_meeting_record_template.id as template_id,
cmt_meeting_record_template.name as template_name,
cmt_meeting_record_template.type_detail as template_type_detail,
cmt_meeting_record_template.prompt as template_prompt
<include refid="templateColumnSql" />
from
meet_type,
cmt_meeting_record_template,
meet_type
left join cmt_meeting_record_template on meet_type.id = cmt_meeting_record_template.meeting_type and cmt_meeting_record_template.is_del = 0
and cmt_meeting_record_template.type = 'custom'
LEFT JOIN meet_template_enable ON cmt_meeting_record_template.id = meet_template_enable.rel_id
AND meet_template_enable.user_id = #{userId},
module_permission
where
meet_type.is_del = 0
and cmt_meeting_record_template.is_del = 0
and meet_type.auth_type = 2
and meet_type.id = cmt_meeting_record_template.meeting_type
and cmt_meeting_record_template.type = 'custom'
and module_permission.type = 1
and module_permission.purpose = 1
and module_permission.target_id = meet_type.id
......@@ -58,37 +86,32 @@
union
select
cmt_meeting_record_template.id as template_id,
cmt_meeting_record_template.name as template_name,
cmt_meeting_record_template.type_detail as template_type_detail,
cmt_meeting_record_template.prompt as template_prompt
<include refid="templateColumnSql" />
from
meet_type,
cmt_meeting_record_template
meet_type
left join cmt_meeting_record_template on meet_type.id = cmt_meeting_record_template.meeting_type and cmt_meeting_record_template.is_del = 0
and cmt_meeting_record_template.type = 'custom'
LEFT JOIN meet_template_enable ON cmt_meeting_record_template.id = meet_template_enable.rel_id
AND meet_template_enable.user_id = #{userId}
where
meet_type.is_del = 0
and cmt_meeting_record_template.is_del = 0
and meet_type.auth_type = 1
and meet_type.id = cmt_meeting_record_template.meeting_type
and cmt_meeting_record_template.type = 'custom'
</select>
<!-- 获取指定授权的模板-纪要模板维度 -->
<select id="selectPermissionTmpl" resultType="com.cmeeting.dto.RecordTemplateDto">
<select id="selectPermissionTmpl" resultMap="MeetTypeDtoResultMap">
select
cmt_meeting_record_template.id as template_id,
cmt_meeting_record_template.name as template_name,
cmt_meeting_record_template.type_detail as template_type_detail,
cmt_meeting_record_template.prompt as template_prompt
<include refid="templateColumnSql" />
from
cmt_meeting_record_template,
module_permission
meet_type
left join cmt_meeting_record_template on meet_type.id = cmt_meeting_record_template.meeting_type and cmt_meeting_record_template.is_del = 0
and cmt_meeting_record_template.type = 'custom'
left join module_permission on module_permission.target_id = cmt_meeting_record_template.id and module_permission.type = 0
and module_permission.purpose = 2
LEFT JOIN meet_template_enable ON cmt_meeting_record_template.id = meet_template_enable.rel_id
AND meet_template_enable.user_id = #{userId}
where
cmt_meeting_record_template.is_del = 0
and cmt_meeting_record_template.type = 'custom'
and module_permission.type = 0
and module_permission.purpose = 2
and module_permission.target_id = cmt_meeting_record_template.id
meet_type.is_del = 0
and module_permission.rel_id in
<foreach collection="deptIdList" item="deptId" open="(" separator="," close=")" index="index">
#{deptId}
......@@ -97,51 +120,47 @@
union
select
cmt_meeting_record_template.id as template_id,
cmt_meeting_record_template.name as template_name,
cmt_meeting_record_template.type_detail as template_type_detail,
cmt_meeting_record_template.prompt as template_prompt
<include refid="templateColumnSql" />
from
cmt_meeting_record_template,
module_permission
meet_type
left join cmt_meeting_record_template on meet_type.id = cmt_meeting_record_template.meeting_type and cmt_meeting_record_template.is_del = 0
and cmt_meeting_record_template.type = 'custom'
left join module_permission on module_permission.target_id = cmt_meeting_record_template.id and module_permission.type = 1
and module_permission.purpose = 2
LEFT JOIN meet_template_enable ON cmt_meeting_record_template.id = meet_template_enable.rel_id
AND meet_template_enable.user_id = #{userId}
where
cmt_meeting_record_template.is_del = 0
and cmt_meeting_record_template.type = 'custom'
and module_permission.type = 1
and module_permission.purpose = 2
and module_permission.target_id = cmt_meeting_record_template.id
meet_type.is_del = 0
and module_permission.rel_id = #{userId}
union
select
cmt_meeting_record_template.id as template_id,
cmt_meeting_record_template.name as template_name,
cmt_meeting_record_template.type_detail as template_type_detail,
cmt_meeting_record_template.prompt as template_prompt
<include refid="templateColumnSql" />
from
cmt_meeting_record_template,
module_permission
meet_type
left join cmt_meeting_record_template on meet_type.id = cmt_meeting_record_template.meeting_type and cmt_meeting_record_template.is_del = 0
and cmt_meeting_record_template.type = 'custom'
left join module_permission on module_permission.target_id = cmt_meeting_record_template.id and module_permission.type = 1
and module_permission.purpose = 2
LEFT JOIN meet_template_enable ON cmt_meeting_record_template.id = meet_template_enable.rel_id
AND meet_template_enable.user_id = #{userId}
where
cmt_meeting_record_template.is_del = 0
and cmt_meeting_record_template.type = 'custom'
and module_permission.type = 1
and module_permission.purpose = 2
and module_permission.target_id = cmt_meeting_record_template.id
meet_type.is_del = 0
and module_permission.rel_id = 'all'
</select>
<!-- 获取非授权的模板,包括系统通用的和自己创建的 -->
<select id="selectAllTmplWithoutPermission" resultType="com.cmeeting.dto.RecordTemplateDto">
<select id="selectAllTmplWithoutPermission" resultMap="MeetTypeDtoResultMap">
select
cmt_meeting_record_template.id as template_id,
cmt_meeting_record_template.name as template_name,
cmt_meeting_record_template.type_detail as template_type_detail,
cmt_meeting_record_template.prompt as template_prompt
<include refid="templateColumnSql" />
from
cmt_meeting_record_template
meet_type
left join cmt_meeting_record_template on meet_type.id = cmt_meeting_record_template.meeting_type and cmt_meeting_record_template.is_del = 0
LEFT JOIN meet_template_enable ON cmt_meeting_record_template.id = meet_template_enable.rel_id
AND meet_template_enable.user_id = #{userId}
where
cmt_meeting_record_template.is_del = 0
meet_type.is_del = 0
and (cmt_meeting_record_template.type = 'system' or cmt_meeting_record_template.user_id = #{userId})
</select>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论