Browse Source

基本资源层--问题涉及人资源层查询

master
buaixuexideshitongxue 2 weeks ago
parent
commit
6d7cf916c1
  1. 25
      src/main/java/com/biutag/supervision/pojo/param/negativeBlame/NegativeBlameConfinementQueryParam.java
  2. 33
      src/main/java/com/biutag/supervision/pojo/param/negativeBlame/NegativeBlameQueryParam.java
  3. 2
      src/main/java/com/biutag/supervision/repository/base/BaseDAO.java
  4. 66
      src/main/java/com/biutag/supervision/repository/negativeBlame/NegativeBlameResourceService.java

25
src/main/java/com/biutag/supervision/pojo/param/negativeBlame/NegativeBlameConfinementQueryParam.java

@ -0,0 +1,25 @@
package com.biutag.supervision.pojo.param.negativeBlame;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import java.util.Set;
/**
* @ClassName NegativeBlameConfinementQueryParam
* @Description 涉及人查询查找采取禁闭措施的数据
* @Author shihao
* @Date 2026/1/23 11:06
*/
@Setter
@Getter
@Schema(description = "涉及人查询,查找采取禁闭措施的数据")
public class NegativeBlameConfinementQueryParam {
@Schema(description = "涉及人员禁闭处罚ids")
private Set<String> confinementIds;
@Schema(description = "领导禁闭处罚ids")
private Set<String> leadConfinementIds;
}

33
src/main/java/com/biutag/supervision/pojo/param/negativeBlame/NegativeBlameQueryParam.java

@ -0,0 +1,33 @@
package com.biutag.supervision.pojo.param.negativeBlame;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import java.util.Set;
/**
* @ClassName NegativeBlameQueryParam
* @Description 问题涉及人查询参数
* @Author shihao
* @Date 2026/1/23 10:03
*/
@Getter
@Setter
public class NegativeBlameQueryParam {
@Schema(description = "涉及人员禁闭处罚id")
private String confinementId;
@Schema(description = "涉及人员禁闭处罚ids")
private Set<String> confinementIds;
@Schema(description = "领导禁闭处罚id")
private String leadConfinementId;
@Schema(description = "领导禁闭处罚ids")
private Set<String> leadConfinementIds;
}

2
src/main/java/com/biutag/supervision/repository/base/BaseDAO.java

@ -31,7 +31,7 @@ public abstract class BaseDAO {
* @param <T>
* @param <E>
*/
protected <T, E> void setBatchQuery(T single, Set<T> batch, LambdaQueryWrapper<E> wrapper, SFunction<E, T> function) {
protected <T, E> void setBatchQuery(T single, Collection<T> batch, LambdaQueryWrapper<E> wrapper, SFunction<E, T> function) {
if (CollectionUtils.isEmpty(batch)) {
if (isEmpty(single)) {
return;

66
src/main/java/com/biutag/supervision/repository/negativeBlame/NegativeBlameResourceService.java

@ -0,0 +1,66 @@
package com.biutag.supervision.repository.negativeBlame;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.biutag.supervision.mapper.NegativeBlameMapper;
import com.biutag.supervision.pojo.entity.NegativeBlame;
import com.biutag.supervision.pojo.param.negativeBlame.NegativeBlameConfinementQueryParam;
import com.biutag.supervision.pojo.param.negativeBlame.NegativeBlameQueryParam;
import com.biutag.supervision.repository.base.BaseDAO;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
/**
* @ClassName NegativeBlameResourceService
* @Description NegativeBlameResourceService
*/
@Service
public class NegativeBlameResourceService extends BaseDAO {
@Resource
private NegativeBlameMapper negativeBlameMapper;
public List<NegativeBlame> query(NegativeBlameQueryParam param) {
LambdaQueryWrapper<NegativeBlame> queryWrapper = new LambdaQueryWrapper<>();
setBatchQuery(param.getConfinementId(), param.getConfinementIds(), queryWrapper, NegativeBlame::getConfinementId);
setBatchQuery(param.getLeadConfinementId(), param.getLeadConfinementIds(), queryWrapper, NegativeBlame::getLeadConfinementId);
// 防御
if (queryWrapper.getExpression() == null || queryWrapper.getExpression().getSqlSegment().isEmpty()) {
return Collections.emptyList();
}
return negativeBlameMapper.selectList(queryWrapper);
}
/**
* 查询被关禁闭的人
* @param param
* @return
*/
public List<NegativeBlame> queryConfinement(NegativeBlameConfinementQueryParam param) {
boolean hasLead = CollectionUtil.isNotEmpty(param.getLeadConfinementIds());
boolean hasConf = CollectionUtil.isNotEmpty(param.getConfinementIds());
if (!hasLead && !hasConf) {
return Collections.emptyList();
}
LambdaQueryWrapper<NegativeBlame> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.and(w -> w
.in(hasLead, NegativeBlame::getLeadConfinementId, param.getLeadConfinementIds())
.or(hasLead && hasConf)
.in(hasConf, NegativeBlame::getConfinementId, param.getConfinementIds())
);
// 防御
if (queryWrapper.getExpression() == null || queryWrapper.getExpression().getSqlSegment().isEmpty()) {
return Collections.emptyList();
}
return negativeBlameMapper.selectList(queryWrapper);
}
}
Loading…
Cancel
Save