package com.sptg.video.cloud.biz.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.sptg.video.cloud.api.entity.SysParams;
import com.sptg.video.cloud.biz.mapper.SysParamsMapper;
import com.sptg.video.cloud.biz.service.VCSysParamsServiceInterface;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zwx
 * @create 2020/10/16 18:22
 * 系统参数 服务层实现层
 */
@Service
@RequiredArgsConstructor
public class VCSysParamsServiceImpl extends ServiceImpl<SysParamsMapper, SysParams> implements VCSysParamsServiceInterface {

    @Override
    public SysParams findSysParamsById(Long id) {
        Wrapper<SysParams> wrapper = new EntityWrapper<>();
        wrapper.eq("l_id",id);
        return this.selectOne(wrapper);
    }

    @Override
    public SysParams findSysParamsByAcountPwd(String account, String userPwd) {
        Wrapper<SysParams> wrapper = new EntityWrapper<>();
        wrapper.eq("s_account", account);
        if(userPwd != null){
            wrapper.eq("s_pwd", userPwd);
        }
        return this.selectOne(wrapper);
    }

    @Override
    public List<SysParams> getList() {
        Wrapper<SysParams> wrapper = new EntityWrapper<>();
        return this.selectList(wrapper);
    }
}
