1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- 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;
- /**
- * <p>
- * 系统字典 服务类
- * </p>
- *
- * @author 王岩
- * @since 2022-03-30
- */
- @Service
- @RequiredArgsConstructor(onConstructor_ = {@Lazy})
- public class SystemDictService extends ServiceImpl<SystemDictMapper, SystemDict> {
- public List<SystemDict> getSystemDictListByType(List<String> type) {
- if (type == null || type.size() == 0) {
- return new ArrayList<>();
- }
- LambdaQueryWrapper<SystemDict> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.in(SystemDict::getType, type);
- return this.list(queryWrapper);
- }
- public String getSystemDictLabelByTypeAndValue(String type, Object value) {
- LambdaQueryWrapper<SystemDict> 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 "";
- }
- }
|