Commit 3d97869b by 梅存智

我的信箱和我的诉求优化

parent 0073cb7c
......@@ -32,5 +32,5 @@ public interface SystemMailboxClients {
Boolean removeById(@RequestParam("id")Long id);
@GetMapping("/systemMailbox/selectMyPage")
Page<SystemMailboxParamVo> selectMyPage(@RequestParam("pageNo")Integer pageNo, @RequestParam("pageSize")Integer pageSize);
Page<SystemMailboxParamVo> selectMyPage(@RequestParam("pageNo")Integer pageNo, @RequestParam("pageSize")Integer pageSize, @RequestParam("type")Integer type);
}
......@@ -43,7 +43,7 @@ public class SystemMailboxController {
}
@GetMapping("selectMyPage")
public Page<SystemMailboxParamVo> selectMyPage(@RequestParam("pageNo")Integer pageNo, @RequestParam("pageSize")Integer pageSize){
return systemMailboxService.selectMyPage(pageNo,pageSize);
public Page<SystemMailboxParamVo> selectMyPage(@RequestParam("pageNo")Integer pageNo, @RequestParam("pageSize")Integer pageSize, @RequestParam("type")Integer type){
return systemMailboxService.selectMyPage(pageNo,pageSize, type);
}
}
......@@ -15,8 +15,8 @@ import java.util.List;
*/
public interface SystemMailboxMapper extends BaseMapper<SystemMailbox> {
List<SystemMailboxParamVo> selectMyPage(@Param("accountId") Long accountId, @Param("type") Integer type, @Param("pageNo") Integer pageNo,@Param("pageSize") Integer pageSize);
List<SystemMailboxParamVo> selectMyPage(@Param("accountId") Long accountId, @Param("roleType") Integer roleType, @Param("type") Integer type, @Param("pageNo") Integer pageNo,@Param("pageSize") Integer pageSize);
int selectMyCount(@Param("accountId") Long accountId, @Param("type") Integer type);
int selectMyCount(@Param("accountId") Long accountId, @Param("roleType") Integer roleType, @Param("type") Integer type);
}
......@@ -23,6 +23,6 @@ public interface SystemMailboxService extends IService<SystemMailbox> {
Boolean removeById(Long id);
Page<SystemMailboxParamVo> selectMyPage(Integer pageNo, Integer pageSize);
Page<SystemMailboxParamVo> selectMyPage(Integer pageNo, Integer pageSize, Integer type);
}
......@@ -147,23 +147,23 @@ public class SystemMailboxServiceImpl extends ServiceImpl<SystemMailboxMapper,Sy
}
@Override
public Page<SystemMailboxParamVo> selectMyPage(Integer pageNo,Integer pageSize){
public Page<SystemMailboxParamVo> selectMyPage(Integer pageNo,Integer pageSize, Integer type){
pageNo = pageSize * (pageNo - 1);
Long accountId = ContextHolder.get().getAccountId();
List<Long> roleIds = myItemConfigmapper.getJjXxRoleCount(accountId);
Integer type = null;//信箱类型 1: 纪检 2: 书记,null没权限看 纪检和书记,只能看自己的
Integer roleType = null;//信箱类型 1: 纪检 2: 书记,null没权限看 纪检和书记,只能看自己的
if(CollectionUtil.isNotEmpty(roleIds)){
if(roleIds.contains(1877604582759526400L)&&!roleIds.contains(1877605828904022016L)){
type = 2;
roleType = 2;
}
if(!roleIds.contains(1877604582759526400L)&&roleIds.contains(1877605828904022016L)){
type = 1;
roleType = 1;
}
}
Page<SystemMailboxParamVo> page = new Page<>(pageNo,pageSize);
page.setTotal(this.baseMapper.selectMyCount(accountId, type));
page.setRecords(this.baseMapper.selectMyPage(accountId, type, pageNo, pageSize));
page.setTotal(this.baseMapper.selectMyCount(accountId, roleType, type));
page.setRecords(this.baseMapper.selectMyPage(accountId, roleType, type, pageNo, pageSize));
return page;
}
}
......@@ -18,12 +18,18 @@
system_mailbox
where
deleted = 0
<if test="type != null">
and type=#{type}
<if test="type == 2">
<if test="roleType != null">
and type=#{roleType} and create_by_id != #{accountId}
</if>
<if test="type == null">
<if test="roleType == null">
and create_by_id = #{accountId}
</if>
</if>
<if test="type == 1">
and create_by_id = #{accountId}
</if>
<if test="type == 1">
union all
select
id,
......@@ -35,6 +41,7 @@
where
deleted = 0
and create_by_id = #{accountId}
</if>
) a
order by a.submit_time desc
LIMIT #{pageNo}, #{pageSize}
......@@ -52,12 +59,18 @@
system_mailbox
where
deleted = 0
<if test="type != null">
and type=#{type}
<if test="type == 2">
<if test="roleType != null">
and type=#{roleType} and create_by_id != #{accountId}
</if>
<if test="type == null">
<if test="roleType == null">
and create_by_id = #{accountId}
</if>
</if>
<if test="type == 1">
and create_by_id = #{accountId}
</if>
<if test="type == 1">
union all
select
id,
......@@ -69,6 +82,7 @@
where
deleted = 0
and create_by_id = #{accountId}
</if>
) a
</select>
</mapper>
\ No newline at end of file
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