|  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         Long director = null; | 
 |  |  |         if (deptId==null && userId == null){ | 
 |  |  |             if (getRole().getId()==3){ | 
 |  |  |                 userId = getUserId(); | 
 |  |  | 
 |  |  |                 deptId = getDeptId(); | 
 |  |  |                 userId = null; | 
 |  |  |             } | 
 |  |  |             director = getUserId(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return R.ok(cstmrService.getPage3(new Page<>(curr, limit) | 
 |  |  |                 , getHostId() | 
 |  |  |                 , deptId == null ? null : String.valueOf(deptId) | 
 |  |  |                 , userId | 
 |  |  |                 , director | 
 |  |  |                 , Cools.isEmpty(followerName) ? null : ids | 
 |  |  |                 , conditionName | 
 |  |  |                 , condition) | 
 |  |  | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         Long director = null; | 
 |  |  |         if (deptId==null && userId == null){ | 
 |  |  |             if (getRole().getId()==3){ | 
 |  |  |                 userId = getUserId(); | 
 |  |  | 
 |  |  |                 deptId = getDeptId(); | 
 |  |  |                 userId = null; | 
 |  |  |             } | 
 |  |  |             director = getUserId(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return R.ok(cstmrService.getPage33(new Page<>(curr, limit) | 
 |  |  |                 , getHostId() | 
 |  |  |                 , deptId == null ? null : String.valueOf(deptId) | 
 |  |  |                 , userId | 
 |  |  |                 , director | 
 |  |  |                 , Cools.isEmpty(followerName) ? null : ids | 
 |  |  |                 , conditionName | 
 |  |  |                 , condition) | 
 
 |  |  | 
 |  |  |     Cstmr selectCstmrByNewestUuid(@Param("hostId") Long hostId); | 
 |  |  |  | 
 |  |  |     List<Cstmr> listByPage2(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") Long deptId, @Param("userId") Long userId,@Param("roleId") Long roleId, @Param("conditionName") String conditionName ,@Param("condition") String condition); | 
 |  |  |     List<Cstmr> listByPage1(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId, @Param("conditionName") String conditionName ,@Param("condition") String condition); | 
 |  |  |     List<Cstmr> listByPage11(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId, @Param("conditionName") String conditionName ,@Param("condition") String condition); | 
 |  |  |     List<Cstmr> listByPage3(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId,@Param("cstmrIds") List<Integer> cstmrIds, @Param("conditionName") String conditionName ,@Param("condition") String condition); | 
 |  |  |     List<Cstmr> listByPage33(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId,@Param("cstmrIds") List<Integer> cstmrIds, @Param("conditionName") String conditionName ,@Param("condition") String condition); | 
 |  |  |     List<Cstmr> listByPage1(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId,@Param("director")Long director, @Param("conditionName") String conditionName ,@Param("condition") String condition); | 
 |  |  |     List<Cstmr> listByPage11(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId,@Param("director")Long director, @Param("conditionName") String conditionName ,@Param("condition") String condition); | 
 |  |  |     List<Cstmr> listByPage3(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId,@Param("director")Long director,@Param("cstmrIds") List<Integer> cstmrIds, @Param("conditionName") String conditionName ,@Param("condition") String condition); | 
 |  |  |     List<Cstmr> listByPage33(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId,@Param("director")Long director,@Param("cstmrIds") List<Integer> cstmrIds, @Param("conditionName") String conditionName ,@Param("condition") String condition); | 
 |  |  |     List<Cstmr> listByPage(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId,@Param("condition") String condition); | 
 |  |  |     List<Cstmr> listByPageCstmr2(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId,@Param("condition") String condition); | 
 |  |  |  | 
 
 |  |  | 
 |  |  | import com.baomidou.mybatisplus.plugins.Page; | 
 |  |  | import com.baomidou.mybatisplus.service.IService; | 
 |  |  | import com.zy.crm.manager.entity.Cstmr; | 
 |  |  | import org.apache.ibatis.annotations.Param; | 
 |  |  |  | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | 
 |  |  |     String getUuid(Long hostId); | 
 |  |  |  | 
 |  |  |     Page<Cstmr> getPage2(Page<Cstmr> page, Long hostId, Long deptId, Long userId,Long roleId, String conditionName, String condition); | 
 |  |  |     Page<Cstmr> getPage1(Page<Cstmr> page, Long hostId, String deptId, Long userId, String conditionName, String condition); | 
 |  |  |     Page<Cstmr> getPage3(Page<Cstmr> page, Long hostId, String deptId, Long userId, List<Integer> cstmrIds, String conditionName, String condition); | 
 |  |  |     Page<Cstmr> getPage33(Page<Cstmr> page, Long hostId, String deptId, Long userId, List<Integer> cstmrIds, String conditionName, String condition); | 
 |  |  |     Page<Cstmr> getPage1(Page<Cstmr> page, Long hostId, String deptId, Long userId,Long director, String conditionName, String condition); | 
 |  |  |     Page<Cstmr> getPage3(Page<Cstmr> page, Long hostId, String deptId, Long userId,Long director, List<Integer> cstmrIds, String conditionName, String condition); | 
 |  |  |     Page<Cstmr> getPage33(Page<Cstmr> page, Long hostId, String deptId, Long userId,Long director, List<Integer> cstmrIds, String conditionName, String condition); | 
 |  |  |     Page<Cstmr> getPage(Page<Cstmr> page, Long hostId, String deptId, Long userId,  String condition); | 
 |  |  |     Page<Cstmr> getPageCstmr2(Page<Cstmr> page, Long hostId, String deptId, Long userId,  String condition); | 
 |  |  |  | 
 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public Page<Cstmr> getPage1(Page<Cstmr> page, Long hostId, String deptId, Long userId,String conditionName,  String condition) { | 
 |  |  |         return page.setRecords(baseMapper.listByPage1(page, hostId, deptId, userId,conditionName, condition)); | 
 |  |  |     public Page<Cstmr> getPage1(Page<Cstmr> page, Long hostId, String deptId, Long userId,  Long director, String conditionName,  String condition) { | 
 |  |  |         return page.setRecords(baseMapper.listByPage1(page, hostId, deptId, userId, director, conditionName, condition)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public Page<Cstmr> getPage3(Page<Cstmr> page, Long hostId, String deptId, Long userId, List<Integer> cstmrIds, String conditionName, String condition) { | 
 |  |  |     public Page<Cstmr> getPage3(Page<Cstmr> page, Long hostId, String deptId, Long userId,  Long director, List<Integer> cstmrIds, String conditionName, String condition) { | 
 |  |  |         if (cstmrIds==null){ | 
 |  |  |             return page.setRecords(baseMapper.listByPage1(page, hostId, deptId, userId,conditionName, condition)); | 
 |  |  |             return page.setRecords(baseMapper.listByPage1(page, hostId, deptId, userId,  director,conditionName, condition)); | 
 |  |  |         }else { | 
 |  |  |             return page.setRecords(baseMapper.listByPage3(page, hostId, deptId, userId,cstmrIds,conditionName, condition)); | 
 |  |  |             return page.setRecords(baseMapper.listByPage3(page, hostId, deptId, userId,  director,cstmrIds,conditionName, condition)); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public Page<Cstmr> getPage33(Page<Cstmr> page, Long hostId, String deptId, Long userId, List<Integer> cstmrIds, String conditionName, String condition) { | 
 |  |  |     public Page<Cstmr> getPage33(Page<Cstmr> page, Long hostId, String deptId, Long userId,  Long director, List<Integer> cstmrIds, String conditionName, String condition) { | 
 |  |  |         if (cstmrIds==null){ | 
 |  |  |             return page.setRecords(baseMapper.listByPage11(page, hostId, deptId, userId,conditionName, condition)); | 
 |  |  |             return page.setRecords(baseMapper.listByPage11(page, hostId, deptId, userId, director,conditionName, condition)); | 
 |  |  |         }else { | 
 |  |  |             return page.setRecords(baseMapper.listByPage33(page, hostId, deptId, userId,cstmrIds,conditionName, condition)); | 
 |  |  |             return page.setRecords(baseMapper.listByPage33(page, hostId, deptId, userId, director,cstmrIds,conditionName, condition)); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 
 |  |  | 
 |  |  |                 and | 
 |  |  |                 ( | 
 |  |  |                 <if test="userId != null and userId != ''"> | 
 |  |  |                     user_id = #{userId} | 
 |  |  |                     mc.mp.user_id = #{userId} | 
 |  |  |                     or | 
 |  |  |                     mc.mp.director = #{userId} | 
 |  |  |                     or | 
 |  |  |                 </if> | 
 |  |  |                 <if test="userId == null or userId == ''"> | 
 |  |  |                     user_id is not null | 
 |  |  |                 </if> | 
 |  |  |                 or | 
 |  |  |                 director = #{userId} | 
 |  |  |                 or | 
 |  |  |                 mc.id in | 
 |  |  |                 ( | 
 |  |  |                 select | 
 |  |  | 
 |  |  |                 </if> | 
 |  |  |             </otherwise> | 
 |  |  |         </choose> | 
 |  |  |         <if test="director != null and director != ''"> | 
 |  |  |             or mc.director = #{director} | 
 |  |  |         </if> | 
 |  |  |         ORDER BY mc.create_time DESC | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  | 
 |  |  |                 (CHARINDEX(','+#{deptId}+',', ','+sd.path+',') > 0 OR sd.id = #{deptId}) | 
 |  |  |                 or | 
 |  |  |                 ( | 
 |  |  |                 user_id = #{userId} | 
 |  |  |                 mc.user_id = #{userId} | 
 |  |  |                 or | 
 |  |  |                 mc.id in | 
 |  |  |                 ( | 
 |  |  | 
 |  |  |                 and | 
 |  |  |                 ( | 
 |  |  |                 <if test="userId != null and userId != ''"> | 
 |  |  |                     user_id = #{userId} | 
 |  |  |                     mc.mp.user_id = #{userId} | 
 |  |  |                     or | 
 |  |  |                     mc.mp.director = #{userId} | 
 |  |  |                     or | 
 |  |  |                 </if> | 
 |  |  |                 <if test="userId == null or userId == ''"> | 
 |  |  |                     user_id is not null | 
 |  |  |                 </if> | 
 |  |  |                 or | 
 |  |  |                 director = #{userId} | 
 |  |  |                 or | 
 |  |  |                 mc.id in | 
 |  |  |                 ( | 
 |  |  |                 select | 
 |  |  | 
 |  |  |                 </if> | 
 |  |  |             </otherwise> | 
 |  |  |         </choose> | 
 |  |  |         <if test="director != null and director != ''"> | 
 |  |  |             or mc.director = #{director} | 
 |  |  |         </if> | 
 |  |  |         ORDER BY mc.create_time DESC | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  | 
 |  |  |                 and | 
 |  |  |                 ( | 
 |  |  |                 <if test="userId != null and userId != ''"> | 
 |  |  |                     user_id = #{userId} | 
 |  |  |                     mc.mp.user_id = #{userId} | 
 |  |  |                     or | 
 |  |  |                     mc.mp.director = #{userId} | 
 |  |  |                     or | 
 |  |  |                 </if> | 
 |  |  |                 <if test="userId == null or userId == ''"> | 
 |  |  |                     user_id is not null | 
 |  |  |                 </if> | 
 |  |  |                 or | 
 |  |  |                 director = #{userId} | 
 |  |  |                 or | 
 |  |  |                 mc.id in | 
 |  |  |                 ( | 
 |  |  |                 select | 
 |  |  | 
 |  |  |                 </if> | 
 |  |  |             </otherwise> | 
 |  |  |         </choose> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         <if test="director != null and director != ''"> | 
 |  |  |             or mc.director = #{director} | 
 |  |  |         </if> | 
 |  |  |         ORDER BY mc.create_time DESC | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <select id="listByPage3" resultMap="BaseResultMap"> | 
 |  |  |     <select id="listByPage33" resultMap="BaseResultMap"> | 
 |  |  |         SELECT | 
 |  |  |         mc.* | 
 |  |  |         FROM man_cstmr mc | 
 |  |  | 
 |  |  |                 and | 
 |  |  |                 ( | 
 |  |  |                 <if test="userId != null and userId != ''"> | 
 |  |  |                     user_id = #{userId} | 
 |  |  |                     mc.mp.user_id = #{userId} | 
 |  |  |                     or | 
 |  |  |                     mc.mp.director = #{userId} | 
 |  |  |                     or | 
 |  |  |                 </if> | 
 |  |  |                 <if test="userId == null or userId == ''"> | 
 |  |  |                     user_id is not null | 
 |  |  |                 </if> | 
 |  |  |                 or | 
 |  |  |                 director = #{userId} | 
 |  |  |                 or | 
 |  |  |                 mc.id in | 
 |  |  |                 ( | 
 |  |  |                 select | 
 |  |  | 
 |  |  |                 </if> | 
 |  |  |             </otherwise> | 
 |  |  |         </choose> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         <if test="director != null and director != ''"> | 
 |  |  |             or mc.director = #{director} | 
 |  |  |         </if> | 
 |  |  |         ORDER BY mc.create_time DESC | 
 |  |  |     </select> | 
 |  |  |  |