zoukankan      html  css  js  c++  java
  • 输出参数之简单类型

    1.mapper

    <select id="selectStudentCount" parameterType="String"
            resultType="Integer">
        select count(*) from student where STU_ID= #{value}
    </select>

    2,java

    public interface StudentMapper {
        public void insertStudent(Student student);
        public void deteteStudent(String id);
        public void updateStudent(Student student);
        public List<Student> selectStudentByQueryVo(QueryVo queryVo);
        public List<Student> selectStudent(String id);
        public Integer selectStudentCount(String id);
    }

    3,test

    @Test
    public void testInteger() throws IOException
    {
        //读取配置信息
        String resource="applicationContext.xml";
        //根据配置文件构建sqlsessionFactory
        InputStream in=Resources.getResourceAsStream(resource);
        //通过sqlsessionFactory创建sqlsession
        SqlSessionFactory sqlSessionFactory=new SqlSessionFactoryBuilder().build(in);
        SqlSession sqlSession =sqlSessionFactory.openSession(); 
        //获取接口类
        StudentMapper studentMapper=sqlSession.getMapper(StudentMapper.class);
        Integer count=studentMapper.selectStudentCount("1")    ;
        List<Student> student=studentMapper.selectStudent("1");
        System.out.println(count);
        System.out.println(student);
        sqlSession.close();
    }
  • 相关阅读:
    2.六角星绘制
    1.五角星绘制
    Redis
    javaScript
    反射
    区分'方法'和'函数'
    递归,二分法
    匿名函数,排序函数,过滤函数,映射函数,
    生成器,生成器函数,推导式,生成器表达式.
    函数,闭包,迭代器
  • 原文地址:https://www.cnblogs.com/excellencesy/p/9171355.html
Copyright © 2011-2022 走看看