package com.github.wxiaoqi.security.admin.biz;



import com.github.wxiaoqi.security.admin.entity.BranchCompanyLevel;
import com.github.wxiaoqi.security.admin.mapper.BranchCompanyLevelMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;


@Service
@Slf4j
public class BranchCompanyLevelBiz extends BaseBiz<BranchCompanyLevelMapper, BranchCompanyLevel>{




    public ObjectRestResponse addOrUpd(BranchCompanyLevel branchCompanyLevel){
        Integer id = branchCompanyLevel.getId() == null ? 0 :branchCompanyLevel.getId();
        if (id > 0 ){
             updateSelectiveById(branchCompanyLevel);
        }else {
             insertSelective(branchCompanyLevel);
        }
        return  ObjectRestResponse.succ();
    }

    public List<BranchCompanyLevel> getList(){
        Example example=new Example(BranchCompanyLevel.class);
        example.createCriteria().andEqualTo("isDel",0);
        return  selectByExample(example);
    }





}
