4 changed files with 125 additions and 1 deletions
@ -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; |
||||||
|
} |
||||||
@ -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; |
||||||
|
|
||||||
|
} |
||||||
@ -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…
Reference in new issue