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();
    }
  • 相关阅读:
    .Net 第三方控件(转)
    DevExpress控件之GridControl控件
    sql语句linq语言lambda表达式对照
    匿名方法和Lambda表达式
    LINQ To ADO.Net中几个方法(1)
    const与readonly的区别
    InvokeRequired 属性 与Invoke方法
    DevExpress控件使用
    VC菜单操作
    VC获取各类指针
  • 原文地址:https://www.cnblogs.com/excellencesy/p/9171355.html
Copyright © 2011-2022 走看看