package com.wb.permission.domain;

import com.wb.permission.pojo.WbRole;
import com.wb.util.SysUtil;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
* Description:
* Author: wangll
* Version: 1.0
* Create Date: 2020-03-08 21:37:56
*/
@Service
public class WbRoleBO {
    @Autowired
    SqlSessionTemplate sqlSessionTemplate;

    /**
    * Description: 新增和修改
    * @param wbRole
     * @param type
    * @return
    * Note: Nothing much.
    */
    public void save(WbRole wbRole,String type){
        if ("A".equals(type)) {
            sqlSessionTemplate.insert("resources/permission.WbRoleMapper.insertSelective",wbRole);
        }else if ("E".equals(type)){
            sqlSessionTemplate.update("resources/permission.WbRoleMapper.updateByPrimaryKeySelective",wbRole);
        }else{

        }
    }

    /**
    * Description: 新增
    * @param wbRole
    * @return
    * Note: Nothing much.
    */
    public void insert(WbRole wbRole){
       sqlSessionTemplate.insert("resources/permission.WbRoleMapper.insertSelective",wbRole);
    }

    /**
    * Description: 修改
    * @param wbRole
    * @return
    * Note: Nothing much.
    */
    public void update(WbRole wbRole){
       sqlSessionTemplate.update("resources/permission.WbRoleMapper.updateByPrimaryKeySelective",wbRole);
    }

    /**
    * Description: 删除
    * @param roleId
    * @return
    * Note: Nothing much.
    */
    public void delete(String roleId){
       sqlSessionTemplate.delete("resources/permission.WbRoleMapper.deleteByPrimaryKey",roleId);
    }

}