标签:play img cto one sql code lse void commit
1 public class StudentDAOImpl implements IStudentDAO { 2 3 @Override 4 public void save(Student stu) { 5 SqlSession session = MybatisUtil.getSession(); 6 session.insert("cn.woldcode.smis.mapper.StudentMapper.save",stu); 7 session.commit(); 8 session.close(); 9 } 10 11 @Override 12 public void delete(Long id) { 13 SqlSession session = MybatisUtil.getSession(); 14 session.delete("cn.woldcode.smis.mapper.StudentMapper.delete",id); 15 session.commit(); 16 session.close(); 17 } 18 19 @Override 20 public void update(Student stu) { 21 SqlSession session = MybatisUtil.getSession(); 22 session.update("cn.woldcode.smis.mapper.StudentMapper.update",stu); 23 session.commit(); 24 session.close(); 25 } 26 27 @Override 28 public Student get(Long id) { 29 SqlSession session = MybatisUtil.getSession(); 30 Student stu = session.selectOne("cn.woldcode.smis.mapper.StudentMapper.get",id); 31 session.close(); 32 return stu; 33 } 34 35 @Override 36 public List<Student> listAll() { 37 SqlSession session = MybatisUtil.getSession(); 38 List<Student> list = session.selectList("cn.woldcode.smis.mapper.StudentMapper.listAll"); 39 session.close(); 40 return list; 41 } 42 43 44 }
标签:play img cto one sql code lse void commit
原文地址:https://www.cnblogs.com/ranxiaofan/p/11908788.html