|
|
@ -1,6 +1,8 @@ |
|
|
|
package com.palnet.biz.jpa.repository.pty; |
|
|
|
package com.palnet.biz.jpa.repository.pty; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.palnet.biz.api.acnt.jwt.utils.JwtTokenUtil; |
|
|
|
import com.palnet.biz.api.bas.group.model.*; |
|
|
|
import com.palnet.biz.api.bas.group.model.*; |
|
|
|
import com.palnet.biz.jpa.entity.QPtyCstmrBas; |
|
|
|
import com.palnet.biz.jpa.entity.QPtyCstmrBas; |
|
|
|
import com.palnet.biz.jpa.entity.QPtyCstmrDtl; |
|
|
|
import com.palnet.biz.jpa.entity.QPtyCstmrDtl; |
|
|
@ -14,6 +16,7 @@ import com.querydsl.jpa.impl.JPAQueryFactory; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.log4j.Log4j2; |
|
|
|
import lombok.extern.log4j.Log4j2; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Repository; |
|
|
|
import org.springframework.stereotype.Repository; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
@ -30,6 +33,10 @@ public class PtyGroupQueryRepository{ |
|
|
|
* @param rq |
|
|
|
* @param rq |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private JwtTokenUtil jwtTokenUtil; |
|
|
|
|
|
|
|
|
|
|
|
public List<BasGroupModel> list(BasGroupRqModel rq){ |
|
|
|
public List<BasGroupModel> list(BasGroupRqModel rq){ |
|
|
|
|
|
|
|
|
|
|
|
QPtyGroupBas bas = QPtyGroupBas.ptyGroupBas; |
|
|
|
QPtyGroupBas bas = QPtyGroupBas.ptyGroupBas; |
|
|
@ -194,6 +201,8 @@ public class PtyGroupQueryRepository{ |
|
|
|
|
|
|
|
|
|
|
|
BooleanBuilder builder = new BooleanBuilder(); |
|
|
|
BooleanBuilder builder = new BooleanBuilder(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String appAuth = jwtTokenUtil.getUserAuthByToken(); |
|
|
|
|
|
|
|
|
|
|
|
if(!StringUtils.isEmpty(rq.getGroupNm())) { |
|
|
|
if(!StringUtils.isEmpty(rq.getGroupNm())) { |
|
|
|
builder.and(bas.groupNm.like("%" + rq.getGroupNm() + "%")); |
|
|
|
builder.and(bas.groupNm.like("%" + rq.getGroupNm() + "%")); |
|
|
|
} |
|
|
|
} |
|
|
@ -203,7 +212,19 @@ public class PtyGroupQueryRepository{ |
|
|
|
// builder.and(cstmrDtl.memberName.eq(memberName));
|
|
|
|
// builder.and(cstmrDtl.memberName.eq(memberName));
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(appAuth.equals("USER")) { |
|
|
|
|
|
|
|
builder.and(bas.groupId.in( |
|
|
|
|
|
|
|
JPAExpressions |
|
|
|
|
|
|
|
.select(bas.groupId) |
|
|
|
|
|
|
|
.from(bas) |
|
|
|
|
|
|
|
.leftJoin(dtl) |
|
|
|
|
|
|
|
.on(bas.groupId.eq(dtl.groupId)) |
|
|
|
|
|
|
|
.where(bas.useYn.eq("Y")) |
|
|
|
|
|
|
|
.where(dtl.cstmrSno.eq(rq.getCstmrSno())) |
|
|
|
|
|
|
|
.where(dtl.groupAuthCd.eq("MASTER").or(dtl.groupAuthCd.eq("LEADER"))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
)); |
|
|
|
|
|
|
|
} |
|
|
|
if(!StringUtils.isEmpty(rq.getAprvYn())) { |
|
|
|
if(!StringUtils.isEmpty(rq.getAprvYn())) { |
|
|
|
builder.and(dtl.aprvlYn.eq(rq.getAprvYn())); |
|
|
|
builder.and(dtl.aprvlYn.eq(rq.getAprvYn())); |
|
|
|
} |
|
|
|
} |
|
|
@ -237,18 +258,6 @@ public class PtyGroupQueryRepository{ |
|
|
|
.on(cstmr.cstmrSno.eq(cstmrDtl.cstmrSno)) |
|
|
|
.on(cstmr.cstmrSno.eq(cstmrDtl.cstmrSno)) |
|
|
|
.where(builder) |
|
|
|
.where(builder) |
|
|
|
|
|
|
|
|
|
|
|
.where(bas.groupId.in( |
|
|
|
|
|
|
|
JPAExpressions |
|
|
|
|
|
|
|
.select(bas.groupId) |
|
|
|
|
|
|
|
.from(bas) |
|
|
|
|
|
|
|
.leftJoin(dtl) |
|
|
|
|
|
|
|
.on(bas.groupId.eq(dtl.groupId)) |
|
|
|
|
|
|
|
.where(bas.useYn.eq("Y")) |
|
|
|
|
|
|
|
.where(dtl.cstmrSno.eq(rq.getCstmrSno())) |
|
|
|
|
|
|
|
// .where(dtl.groupAuthCd.eq("CREATER").or(dtl.groupAuthCd.eq("ADMIN")))
|
|
|
|
|
|
|
|
.where(dtl.groupAuthCd.eq("MASTER").or(dtl.groupAuthCd.eq("LEADER"))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
)) |
|
|
|
|
|
|
|
.where(dtl.cstmrSno.ne(rq.getCstmrSno())) |
|
|
|
.where(dtl.cstmrSno.ne(rq.getCstmrSno())) |
|
|
|
// .where(dtl.groupAuthCd.ne("CREATER"))
|
|
|
|
// .where(dtl.groupAuthCd.ne("CREATER"))
|
|
|
|
.where(dtl.groupAuthCd.ne("MASTER")) |
|
|
|
.where(dtl.groupAuthCd.ne("MASTER")) |
|
|
@ -322,12 +331,25 @@ public class PtyGroupQueryRepository{ |
|
|
|
QPtyCstmrDtl cstmrDtl = QPtyCstmrDtl.ptyCstmrDtl; |
|
|
|
QPtyCstmrDtl cstmrDtl = QPtyCstmrDtl.ptyCstmrDtl; |
|
|
|
|
|
|
|
|
|
|
|
BooleanBuilder builder = new BooleanBuilder(); |
|
|
|
BooleanBuilder builder = new BooleanBuilder(); |
|
|
|
|
|
|
|
String appAuth = jwtTokenUtil.getUserAuthByToken(); |
|
|
|
|
|
|
|
|
|
|
|
builder.and(bas.useYn.eq("Y")); |
|
|
|
builder.and(bas.useYn.eq("Y")); |
|
|
|
builder.and(dtl.joinYn.eq("Y")); |
|
|
|
builder.and(dtl.joinYn.eq("Y")); |
|
|
|
builder.and(dtl.aprvlYn.eq("Y")); |
|
|
|
builder.and(dtl.aprvlYn.eq("Y")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(appAuth.equals("USER")) { |
|
|
|
|
|
|
|
builder.and(bas.groupId.in( |
|
|
|
|
|
|
|
JPAExpressions |
|
|
|
|
|
|
|
.select(bas.groupId) |
|
|
|
|
|
|
|
.from(bas) |
|
|
|
|
|
|
|
.leftJoin(dtl) |
|
|
|
|
|
|
|
.on(bas.groupId.eq(dtl.groupId)) |
|
|
|
|
|
|
|
.where(bas.useYn.eq("Y")) |
|
|
|
|
|
|
|
.where(dtl.cstmrSno.eq(rq.getCstmrSno())) |
|
|
|
|
|
|
|
.where(dtl.groupAuthCd.eq("MASTER").or(dtl.groupAuthCd.eq("LEADER"))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
)); |
|
|
|
|
|
|
|
} |
|
|
|
if(!StringUtils.isEmpty(rq.getGroupNm())) { |
|
|
|
if(!StringUtils.isEmpty(rq.getGroupNm())) { |
|
|
|
builder.and(bas.groupNm.like("%" + rq.getGroupNm() + "%")); |
|
|
|
builder.and(bas.groupNm.like("%" + rq.getGroupNm() + "%")); |
|
|
|
} |
|
|
|
} |
|
|
@ -367,18 +389,6 @@ public class PtyGroupQueryRepository{ |
|
|
|
.leftJoin(cstmrDtl) |
|
|
|
.leftJoin(cstmrDtl) |
|
|
|
.on(cstmr.cstmrSno.eq(cstmrDtl.cstmrSno)) |
|
|
|
.on(cstmr.cstmrSno.eq(cstmrDtl.cstmrSno)) |
|
|
|
.where(builder) |
|
|
|
.where(builder) |
|
|
|
.where(bas.groupId.in( |
|
|
|
|
|
|
|
JPAExpressions |
|
|
|
|
|
|
|
.select(bas.groupId) |
|
|
|
|
|
|
|
.from(bas) |
|
|
|
|
|
|
|
.leftJoin(dtl) |
|
|
|
|
|
|
|
.on(bas.groupId.eq(dtl.groupId)) |
|
|
|
|
|
|
|
.where(bas.useYn.eq("Y")) |
|
|
|
|
|
|
|
.where(dtl.cstmrSno.eq(rq.getCstmrSno())) |
|
|
|
|
|
|
|
// .where(dtl.groupAuthCd.eq("CREATER").or(dtl.groupAuthCd.eq("ADMIN")))
|
|
|
|
|
|
|
|
.where(dtl.groupAuthCd.eq("MASTER").or(dtl.groupAuthCd.eq("LEADER"))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
)) |
|
|
|
|
|
|
|
.where(dtl.cstmrSno.ne(rq.getCstmrSno())) |
|
|
|
.where(dtl.cstmrSno.ne(rq.getCstmrSno())) |
|
|
|
|
|
|
|
|
|
|
|
.orderBy(bas.createDt.desc()) |
|
|
|
.orderBy(bas.createDt.desc()) |
|
|
|