insert into dept values(#{deptno},#{dname},#{loc})
delete from dept where deptno=#{deptno}
public void deleteByPk(){ //获取数据库链接 SqlSession sqlSession= MyBatiesUtils.getSqlSession(); //删除数据 int count= sqlSession.delete("com.zks.dao.DeptMapper.deleteByPk",80); System.out.println(count); sqlSession.commit(); sqlSession.close(); }修改信息
update dept set loc=#{loc} where deptno=#{deptno}
public void updateByPk(){ //获取数据库链接 SqlSession sqlSession= MyBatiesUtils.getSqlSession(); //修改数据 Mapmap=new HashMap<>(); map.put("deptno",80); map.put("loc","大同"); int count= sqlSession.delete("com.zks.dao.DeptMapper.updateByPk",map); System.out.println(count); sqlSession.commit(); sqlSession.close(); }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)