package cn.com.git.htsc.uac.core.repository.report;

import cn.com.git.htsc.uac.core.api.dto.report.ReportCampaignDayOutDTO;
import oracle.jdbc.OracleTypes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.SqlOutParameter;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.simple.SimpleJdbcCall;
import org.springframework.stereotype.Repository; import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.Map; /**
* Created by wangyang on 2016/10/28.
*/
@Repository
public class ReportCampaignTotalRepository {
@Autowired
private JdbcTemplate primaryJdbcTemplate; public List<ReportCampaignDayOutDTO> getCampaignTotal(String start_date,String end_date,String campId,String deptId,String statu){
SimpleJdbcCall jdbcCall = new SimpleJdbcCall(primaryJdbcTemplate).withProcedureName("pro_credit_total").declareParameters(
new SqlOutParameter("results_out", OracleTypes.CURSOR, new QueryExchangeOrderDTOTypeMapper())
);
MapSqlParameterSource mapSqlParameterSource = new MapSqlParameterSource();
mapSqlParameterSource.addValue("startd", start_date);
mapSqlParameterSource.addValue("endd", end_date);
mapSqlParameterSource.addValue("actiid", campId);
mapSqlParameterSource.addValue("deptid", deptId);
mapSqlParameterSource.addValue("stat", statu);
Map<String, Object> results = jdbcCall.execute(mapSqlParameterSource);
List<ReportCampaignDayOutDTO> results_out = (List<ReportCampaignDayOutDTO>) results.get("results_out");
return results_out;
} private class QueryExchangeOrderDTOTypeMapper implements RowMapper {
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
ReportCampaignDayOutDTO dayOutDTO=new ReportCampaignDayOutDTO();
dayOutDTO.setCampaignId(rs.getString("campaign_id"));
dayOutDTO.setDayJoinPersonNum(rs.getLong("day_join_person_num"));
dayOutDTO.setDayJoinCountNum(rs.getLong("day_join_count_num"));
dayOutDTO.setDayCreditEarnNum(rs.getLong("day_credit_earn_num"));
dayOutDTO.setDayCreditExpendNum(rs.getLong("day_credit_expend_num"));
return dayOutDTO;
}
}
}

最新文章

  1. stl之截取:以一段字符串截取字符串
  2. placeholder的兼容性探索之路
  3. css读书笔记1:HTML标记和文档结构
  4. 两种获取connectionString的方式
  5. 如何在安裝SELinux的环境执行Quartus II
  6. Moving a Subversion Repository to Another Server
  7. POJ 2948 DP
  8. 避免VMware P2V 过程中遇到的磁盘问题及解决 版本5.5
  9. 树莓派linux系统中显示隐藏文件的几种方法
  10. iPhone照片格式heic图片怎么打开
  11. wap2app(九)-- 使用mui.previewImage之后,页面a链接不能跳转
  12. 安卓开发笔记——个性化TextView(新浪微博)
  13. 如何修改帝国cms文章点击量默认值和成倍增加
  14. JS导入导出Excel表格的方法
  15. centos Cannot allocate memory for the buffer pool
  16. Docker for Windows(一)下载与安装
  17. Linux下vim 快捷键
  18. rar安装和使用
  19. MySQL数据库错误号:2003 - Can&#39;t connect to MYSQL server on &#39;localhost&#39;(10061)
  20. Linux - 归档和压缩

热门文章

  1. Resharper中注释代码的快捷键
  2. zoj 3088 Easter Holidays(最长路+最短路+打印路径)
  3. 用cmd改计算机名.bat 无需重启电脑生效
  4. ACM1228_STL的应用
  5. 《University Calculus》-chape8-无穷序列和无穷级数-基本极限恒等式
  6. 解放程序猿宝贵的右手(或者是左手) ——Android自动化测试技巧
  7. Pipe - POJ 1039(线段相交交点)
  8. 每天一道算法_6_I Think I Need a Houseboat
  9. php中传值与传引用的区别。什么时候传值什么时候传引用?
  10. The app references non-public selectors in Payload