dao.impl 川长思鸟来 2022-06-15 12:45 145阅读 0赞 //package cn.emay.emas.dao.impl; // //import java.util.List; // //import org.apache.ibatis.session.SqlSessionFactory; //import org.mybatis.spring.support.SqlSessionDaoSupport; //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.stereotype.Repository; //import org.springframework.stereotype.Service; //import org.springframework.transaction.annotation.Transactional; // //import cn.emay.emas.dao.UsrMapper; //import cn.emay.emas.entity.Usr; //import cn.emay.emas.util.Constants; // //@Service //public class UsrMapperImpl implements UsrMapper \{ @Autowired private SqlSessionFactory sqlSessionFactory; @Override public int deleteByPrimaryKey(Long id) \{ String sql = Constants.getStatementId("cn.emay.emas.dao.UsrMapper", "deleteByPrimaryKey"); return getSqlSession().delete(sql, id); \} @Override public int insert(Usr record) \{ String sql = Constants.getStatementId("cn.emay.emas.dao.UsrMapper", "insert"); return getSqlSession().insert(sql, record); \} @Override public int insertSelective(Usr record) \{ // TODO Auto-generated method stub return 0; \} @Override public Usr selectByPrimaryKey(Long id) \{ String sql = Constants.getStatementId("cn.emay.emas.dao.UsrMapper", "selectByPrimaryKey"); return getSqlSession().selectOne(sql,id); \} @Override public int updateByPrimaryKeySelective(Usr record) \{ // TODO Auto-generated method stub return 0; \} @Override public int updateByPrimaryKey(Usr record) \{ String sql = Constants.getStatementId("cn.emay.emas.dao.UsrMapper", "updateByPrimaryKey"); return getSqlSession().update(sql, record); \} @Override public List<Usr> findAll() \{ String sql = Constants.getStatementId("cn.emay.emas.dao.UsrMapper", "findAll"); return getSqlSession().selectList(sql); \} // //\}
相关 链接mysql数据库,编辑daoimpl层 首先创建一个文件(database.properties)存放<四大金刚>(driverName驱动名,url地址,user账户名,password密码) ![在这里 野性酷女/ 2022年05月10日 00:38/ 0 赞/ 125 阅读
还没有评论,来说两句吧...