mybatisPlus or 使用


/**
     * 查询是否有权限
     */
    @GetMapping(API_PREFIX+"/getPermissionLogCount")
    @Override
    public Integer getPermissionLogCount(String openId
        ,@RequestParam(value = "tournamentId",required = false,defaultValue = "") String tournamentId
        ,@RequestParam(value = "applicationType",required = false,defaultValue = "") String applicationType) {
        return permissionLogService.count(
            new LambdaQueryWrapper<PermissionLog>()
          //相当于 select count(id)
PermissionLog from where getApplicantOpenid = openId and ((getRoleType = "SYSTEM") or (getRoleType = "TOURNAMENT") or (getTournamentId = tournamentId and getApplicationType = applicationType and getIsApproved = “Y” ))
          .eq(org.springblade.competition.entity.PermissionLog::getApplicantOpenid, openId)
 .and(
wrapper1 -> wrapper1.eq(org.springblade.competition.entity.PermissionLog::getRoleType,"SYSTEM") // 赛事创建者 .or(wrapper -> wrapper.eq(org.springblade.competition.entity.PermissionLog::getRoleType,"TOURNAMENT") .eq(org.springblade.competition.entity.PermissionLog::getTournamentId,tournamentId) ) // TOURNAMENT/ACCOUNT/ALBUM .or(w->w.eq(org.springblade.competition.entity.PermissionLog::getTournamentId,tournamentId) .eq (org.springblade.competition.entity.PermissionLog::getApplicationType, applicationType) .eq(org.springblade.competition.entity.PermissionLog::getIsApproved,"Y") ) ) ); }

复杂一点的单表 最好还是写一条sql 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM