package com.pj.project.sys_dict;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pj.utils.so.SoMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * Service: sys_dict -- 字典表
 *
 * @author qzyReal
 */
@Service
public class SysDictService extends ServiceImpl<SysDictMapper, SysDict> implements IService<SysDict> {

    /**
     * 底层 Mapper 对象
     */
    @Autowired
    SysDictMapper sysDictMapper;

    /**
     * 增
     */
    int add(SysDict s) {
        return sysDictMapper.add(s);
    }

    /**
     * 删
     */
    int delete(Long id) {
        return sysDictMapper.delete(id);
    }

    /**
     * 改
     */
    int update(SysDict s) {
        return sysDictMapper.update(s);
    }

    /**
     * 查
     */
    SysDict getById(Long id) {
        return sysDictMapper.getById(id);
    }

    /**
     * 查集合 - 根据条件（参数为空时代表忽略指定条件）
     */
    List<SysDict> getList(SoMap so) {
        return sysDictMapper.getList(so);
    }

    /**
     * 根据编号查询
     * @param code
     * @return
     */
    SysDict findByCode(String code) {
        QueryWrapper<SysDict> ew = new QueryWrapper<>();
        ew.eq("code", code);
        return this.getOne(ew);
    }



}
