array(2) { ["docs"]=> array(0) { } ["count"]=> int(0) } 111string(0) "" int(1) int(10) int(70) int(8640000) string(13) "likecs_art_db" array(1) { ["query"]=> array(1) { ["match_all"]=> object(stdClass)#28 (0) { } } } array(1) { ["createtime.keyword"]=> array(1) { ["order"]=> string(4) "desc" } } int(10) int(0) int(8640000) array(2) { ["docs"]=> array(0) { } ["count"]=> int(0) } 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

 

相关文章: