mybatis 存储过程

CREATE DEFINER = `swc`@`%` PROCEDURE `NewProc`(i_begindate date,i_enddate date,i_channelid SMALLINT,i_platid TINYINT,i_page INT,i_rows INT,out o_rows_total INT)
    COMMENT '获取收入信息'
BEGIN

    DECLARE i_begin_row INT DEFAULT 0;

    SET i_begin_row = (i_page - 1) * i_rows;

        IF i_platid = 0 THEN
           
         SELECT postdate                
         , channelid
         , channelname
         , platid
         , platname  
         FROM tmp
         ORDER BY channelid
         LIMIT i_begin_row, i_rows;

       ELSE
          
        SELECT postdate                
         , channelid
         , channelname
         , platid
         , platname  
         FROM tmp
         ORDER BY postdate
         LIMIT i_begin_row, i_rows;
         END IF ;
  
  
    SELECT COUNT(1)
      INTO o_rows_total
      FROM tmp;

END;

 

 


"http://mybatis.org/dtd/mybatis-3-mapper.dtd">

 
 

 

 

@RequestMapping(value = "/analyse", method = RequestMethod.POST)
 @AutoReturn
 public void list(Analyse s) throws ParseException {
  HashMap map=new HashMap();
  map.put("end", s.getDynamic().get("endDate"));
  map.put("begin",  s.getDynamic().get("startDate"));
  map.put("channel", 0);
  map.put("platid", 0);
  map.put("page", s.getPage()+1);
  map.put("rows", s.getRows());
  List analyse=analyseService.list(map);
  this.setResult(analyse);
  int total=Integer.parseInt(map.get("total").toString());
  this.setTotal(total);
  this.setSuccess(true);
 }

你可能感兴趣的:(mybatis,sql,java,java)