Commit 3d97869b by 梅存智

我的信箱和我的诉求优化

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