package com.ag.dynamicmodule.basecode.dao;

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

import java.util.List;

/**
 * Created by chishk on 2017/12/14.
 */
@Repository
public class CClientDao {
    @Autowired
    SqlSessionTemplate sqlSessionTemplate;

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

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

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