MyBatis 调用存储过程

sqlxml,这个中的call 与后不能够换行;

<select id="getPersonCount" parameterMap="getPCMap"
        statementType="CALLABLE">
        CALL test.get_user_count(?,?)
    </select>
    <parameterMap type="java.util.Map" id="getPCMap">
        <parameter property="idtype" jdbcType="INTEGER" mode="IN" />
        <parameter property="usercount" jdbcType="INTEGER" mode="OUT" />
    </parameterMap>

 

test

statement = "PersonCondition.getPersonCount";
            Map<String, Integer> parameterMap = new HashMap<String, Integer>();
            parameterMap.put("idtype", 0);
            parameterMap.put("usercount", -1);

            sqlSession.selectOne(statement, parameterMap);

            Integer integer = parameterMap.get("usercount");
            System.out.println(integer);

procedure

BEGIN
IF id1=0 THEN
select count(*) from person where  id > 15 into count_id;
ELSE
select count(*) from person where  id < 15 into count_id;
end IF;
END

 

网站地图xml地图