Java中调用存储过程

dao层:

import java.util.Map;
public interface AppGthdDao {
    public String gthd(Map map);
}

mapper层



    

测试类:

import com.alibaba.fastjson.JSONObject;
import com.socialsecurity.dao.AppGthdDao;
import com.socialsecurity.util.SqlSessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DataInterchangeTest2 {
    public static void main(String[] args) throws ParseException {
        SqlSession session = SqlSessionFactoryUtil.getSession();
        AppGthdDao mapper = session.getMapper(AppGthdDao.class);
        JSONObject map = new JSONObject();
        BigDecimal aaz001B = null;
        BigDecimal aac040B = null;
        aaz001B = new BigDecimal("1");
        aac040B = new BigDecimal("1000");
        Double aac040 = aac040B.doubleValue();
        Double AAZ001 = aaz001B.doubleValue();
        Date aae030 = null;
        Date aae031 = null;
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");
        String date1 = "2019/2/1";
        String date2 = "2019/3/1";
        aae030 = formatter.parse(date1);
        aae031 = formatter.parse(date2);
        map.put("IS_AAE100", "2");
        map.put("IS_AAZ001", AAZ001);
        map.put("IS_AAC002", "35113");
        map.put("IS_AAE030", aae030);
        map.put("IS_AAE031", aae031);
        map.put("IS_AAC040", aac040);
        mapper.gthd(map);
        String info = (String) map.get("Os_ErrInfo");
        session.commit();
        session.close();
        System.out.println(info);
    }

}

 

 

 

你可能感兴趣的:(Java中调用存储过程)