|
|
|
@ -0,0 +1,82 @@ |
|
|
|
package com.yvan.workbench.controller; |
|
|
|
|
|
|
|
import com.galaxis.rcs.common.entity.LccBasExecutor; |
|
|
|
import com.galaxis.rcs.common.entity.LccBasLocation; |
|
|
|
import com.galaxis.rcs.common.entity.LccInvLedger; |
|
|
|
import com.querydsl.sql.SQLQuery; |
|
|
|
import com.yvan.workbench.model.request.QueryExecutorReq; |
|
|
|
import com.yvan.workbench.model.request.QueryInvLedgerReq; |
|
|
|
import com.yvan.workbench.model.request.QueryInvLpnReq; |
|
|
|
import com.yvan.workbench.model.request.QueryLocationReq; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.clever.core.model.request.QueryByPage; |
|
|
|
import org.clever.core.model.request.page.Page; |
|
|
|
import org.clever.data.jdbc.DaoFactory; |
|
|
|
import org.clever.data.jdbc.QueryDSL; |
|
|
|
import org.clever.data.jdbc.querydsl.utils.QueryDslUtils; |
|
|
|
|
|
|
|
import java.util.LinkedHashMap; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import static com.galaxis.rcs.common.query.QLccBasContainer.lccBasContainer; |
|
|
|
import static com.galaxis.rcs.common.query.QLccBasExecutor.lccBasExecutor; |
|
|
|
import static com.galaxis.rcs.common.query.QLccBasLocation.lccBasLocation; |
|
|
|
import static com.galaxis.rcs.common.query.QLccInvLedger.lccInvLedger; |
|
|
|
import static com.galaxis.rcs.common.query.QLccInvLpn.lccInvLpn; |
|
|
|
|
|
|
|
/** |
|
|
|
* 作者:lizw <br/> |
|
|
|
* 创建时间:2025/07/03 14:33 <br/> |
|
|
|
*/ |
|
|
|
public class DeviceManager { |
|
|
|
private static final QueryDSL QUERY_DSL = DaoFactory.getQueryDSL(); |
|
|
|
|
|
|
|
public static List<LccBasLocation> queryLocation(QueryLocationReq req) { |
|
|
|
SQLQuery<LccBasLocation> query = QUERY_DSL.selectFrom(lccBasLocation).orderBy(lccBasLocation.locCode.asc()); |
|
|
|
if (StringUtils.isNotBlank(req.getLocCode())) { |
|
|
|
query.where(lccBasLocation.locCode.eq(req.getLocCode().trim())); |
|
|
|
} |
|
|
|
return query.fetch(); |
|
|
|
} |
|
|
|
|
|
|
|
public static List<LccBasExecutor> queryExecutor(QueryExecutorReq req) { |
|
|
|
SQLQuery<LccBasExecutor> query = QUERY_DSL.selectFrom(lccBasExecutor).orderBy(lccBasExecutor.executorId.asc()); |
|
|
|
if (StringUtils.isNotBlank(req.getVirtualFloorCode())) { |
|
|
|
query.where(lccBasExecutor.executorId.eq(req.getVirtualFloorCode().trim())); |
|
|
|
} |
|
|
|
if (req.getIsActive() != null) { |
|
|
|
query.where(lccBasExecutor.isActive.eq(req.getIsActive())); |
|
|
|
} |
|
|
|
return query.fetch(); |
|
|
|
} |
|
|
|
|
|
|
|
public static Page<LinkedHashMap<String, Object>> queryInvLpn(QueryInvLpnReq req) { |
|
|
|
SQLQuery<LinkedHashMap<String, Object>> query = QUERY_DSL.select(QueryDslUtils.linkedMap(lccInvLpn, lccBasLocation, lccBasContainer)) |
|
|
|
.from(lccInvLpn) |
|
|
|
.innerJoin(lccBasLocation).on( |
|
|
|
lccInvLpn.locCode.eq(lccBasLocation.locCode).and( |
|
|
|
lccBasLocation.envId.eq(lccBasLocation.envId) |
|
|
|
) |
|
|
|
) |
|
|
|
.innerJoin(lccBasContainer).on( |
|
|
|
lccInvLpn.lpn.eq(lccInvLpn.lpn).and( |
|
|
|
lccBasContainer.envId.eq(lccInvLpn.envId) |
|
|
|
) |
|
|
|
).orderBy(lccInvLpn.lpn.asc()); |
|
|
|
if (StringUtils.isNotBlank(req.getLpn())) { |
|
|
|
query.where(lccInvLpn.lpn.eq(req.getLpn().trim())); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(req.getLocCode())) { |
|
|
|
query.where(lccInvLpn.locCode.eq(req.getLocCode().trim())); |
|
|
|
} |
|
|
|
return QueryDslUtils.queryByPage(query, QueryByPage.getCurrent()); |
|
|
|
} |
|
|
|
|
|
|
|
public static Page<LccInvLedger> queryInvLedger(QueryInvLedgerReq req) { |
|
|
|
SQLQuery<LccInvLedger> query = QUERY_DSL.selectFrom(lccInvLedger).orderBy(lccInvLedger.ledgerId.asc()); |
|
|
|
if (StringUtils.isNotBlank(req.getLpn())) { |
|
|
|
query.where(lccInvLedger.lpn.eq(req.getLpn().trim())); |
|
|
|
} |
|
|
|
return QueryDslUtils.queryByPage(query, QueryByPage.getCurrent()); |
|
|
|
} |
|
|
|
} |