package cn.cslg.pas.service; import cn.cslg.pas.domain.SystemDict; import cn.cslg.pas.domain.SystemDictAssociate; import cn.cslg.pas.mapper.SystemDictMapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; /** *

* 系统字典 服务类 *

* * @author 王岩 * @since 2022-03-30 */ @Service @RequiredArgsConstructor(onConstructor_ = {@Lazy}) public class SystemDictService extends ServiceImpl { public List getSystemDictListByType(List type) { if (type == null || type.size() == 0) { return new ArrayList<>(); } LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.in(SystemDict::getType, type); return this.list(queryWrapper); } public String getSystemDictLabelByTypeAndValue(String type, Object value) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(SystemDict::getType, type); queryWrapper.eq(SystemDict::getValue, value); SystemDict systemDict = this.getOne(queryWrapper); if (systemDict != null) { return systemDict.getLabel(); } return ""; } }