package com.ag.dynamicmodule.basecode.dao;

import com.ag.dynamicmodule.basecode.pojo.CClientTypeRelaData;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by Administrator on 2019/9/24 0024.
 */
@Repository
public class CClientTypeRelaDataDao {
    @Autowired
    SqlSessionTemplate sqlSessionTemplate;

    /**
     * 新增数据
     * @param cClientTypeRelaData
     * @return
     */
    public int insert(CClientTypeRelaData cClientTypeRelaData){
        return sqlSessionTemplate.insert("resources/basecode.CClientTypeRelaDataMapper.insertSelective",cClientTypeRelaData);
    }

    /**
     * 修改数据
     * @param cClientTypeRelaData
     * @return
     */
    public int update(CClientTypeRelaData cClientTypeRelaData){
        return sqlSessionTemplate.update("resources/basecode.CClientTypeRelaDataMapper.updateByPrimaryKeySelective",cClientTypeRelaData);
    }

    /**
     * 查询CClient表数据
     * @param ids
     * @return
     */
    public List selectCClient(String ids){
        return sqlSessionTemplate.selectList("resources/basecode.CClientTypeRelaDataMapper.selectCClient",ids);
    }
    /**
     * 删除CClient表数据
     * @param id
     * @return
     */
    public int delete(String id){
        return  sqlSessionTemplate.delete("resources/basecode.CClientTypeRelaDataMapper.deleteByPrimaryKey",id);
    }
    public int deleteByClientCode(String clientCode){
        return  sqlSessionTemplate.delete("resources/basecode.CClientTypeRelaDataMapper.deleteByClientCode",clientCode);
    }
}
