import java.util.ArrayList;
import java.util.List; import org.apache.log4j.Logger;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.stereotype.Repository; import com.yundaex.common.dao.impl.BaseDaoImpl;
import com.yundaex.wms.basicdata.constant.RivPrintHistoryLSqlConstant;
import com.yundaex.wms.basicdata.dao.RivPrintHistoryLDao;
import com.yundaex.wms.basicdata.po.RivPrintHistoryL;
import com.yundaex.wms.basicdata.vo.DifferentUserQtyVO; @Repository("printHistoryLDao")
public class RivPrintHistoryLDaoImpl extends BaseDaoImpl<RivPrintHistoryL> implements RivPrintHistoryLDao { @Override
public List<DifferentUserQtyVO> queryTopQtyUser(String beginDate, String endDate, Integer orgId) {
MapSqlParameterSource map = new MapSqlParameterSource();
map.addValue("beginDate", beginDate);
map.addValue("endDate", endDate);
map.addValue("orgId", orgId);
List<DifferentUserQtyVO> results = this.jdbcTemplate.query(RivPrintHistoryLSqlConstant.PRINT_HISTORY_TOP_QTY_USER_SQL,map,
new BeanPropertyRowMapper<DifferentUserQtyVO>(DifferentUserQtyVO.class));
return results;
}
}
public class RivPrintHistoryLSqlConstant {
public static String PRINT_HISTORY_TOP_QTY_USER_SQL =
" SELECT "
+ " '打印' AS operateType, "
+ " tab1.PHL_PRINT_USER_ID AS userId, "
+ " ( "
+ " SELECT "
+ " UP_NAME "
+ " FROM "
+ " tab_user_profile "
+ " WHERE "
+ " UP_USER_ID = tab1.PHL_PRINT_USER_ID "
+ " ) AS userName, "
+ " tab1.qty "
+ " FROM "
+ " ( "
+ " SELECT "
+ " PHL_PRINT_USER_ID, "
+ " count(1) AS qty "
+ " FROM "
+ " riv_print_history_l "
+ " WHERE "
+ " CREATE_TIME >= :beginDate "
+ " AND CREATE_TIME < :endDate "
+ " GROUP BY "
+ " PHL_PRINT_USER_ID "
+ " ORDER BY "
+ " qty DESC "
+ " LIMIT 1 "
+ " ) tab1 "
+ " WHERE "
+ " tab1.PHL_PRINT_USER_ID IN ( "
+ " SELECT "
+ " u.usr_id "
+ " FROM "
+ " tab_user u "
+ " INNER JOIN tab_user_role ur ON ur.ur_user_id = u.usr_id "
+ " INNER JOIN tab_role r ON ur.ur_role_id = r.rl_id "
+ " INNER JOIN tab_role_data_authority rda ON rda.rda_role_id = r.rl_id "
+ " WHERE "
+ " rda.rda_dimension_code = 'organization' "
+ " AND rda.rda_entity_id = :orgId "
+ " UNION "
+ " SELECT "
+ " u.usr_id "
+ " FROM "
+ " tab_user u "
+ " INNER JOIN tab_user_profile up ON up.UP_USER_ID = u.usr_id "
+ " INNER JOIN tab_domain dmn ON dmn.dmn_id = up.up_domain "
+ " INNER JOIN tab_domain_role dr ON dr.dr_domain_id = dmn.dmn_id "
+ " INNER JOIN tab_role r ON dr.dr_role_id = r.rl_id "
+ " INNER JOIN tab_role_data_authority rda ON rda.rda_role_id = r.rl_id "
+ " WHERE "
+ " rda.rda_dimension_code = 'organization' "
+ " AND rda.rda_entity_id = :orgId "
+ " UNION "
+ " SELECT "
+ " up.up_id "
+ " FROM "
+ " tab_user_profile up "
+ " WHERE "
+ " up.up_user_prop = 'admin' "
+ " ) "
;
}
public List<Map<String, Object>> queryOrgInfo(List<String> orgParam) {
Map<String, Object> params = new HashMap<String, Object>();
String sql = "select org.org_id, org.org_code from riv_organization org where org.org_code in (:orgCodes)";
params.put("orgCodes", orgParam);
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, params);
return list;
}
import java.util.List;

import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.stereotype.Repository; import com.yundaex.common.dao.impl.BaseDaoImpl;
import com.yundaex.wms.outbound.dao.RivMainpickStartPrintTemplateDao;
import com.yundaex.wms.outbound.po.RivMainpickStartPrintTemplate; @Repository
public class RivMainpickStartPrintTemplateDaoImpl extends BaseDaoImpl<RivMainpickStartPrintTemplate> implements RivMainpickStartPrintTemplateDao { @Override
public List<Integer> queryExistRecordsByOnhIds(List<Integer> onhIds) {
MapSqlParameterSource map = new MapSqlParameterSource();
map.addValue("onhIds", onhIds);
String sql = "select ONH_ID from riv_mainpick_start_print_template where ONH_ID in(:onhIds)";
List<Integer> results = this.jdbcTemplate.queryForList(sql,map,Integer.class);
return results;
}
}

最新文章

  1. EFCore教程
  2. 一. HTML认识
  3. 学习WPF——WPF布局——了解布局容器
  4. poj1680 最短路判环
  5. DBA_Oracle Event等待事件分析(概念)
  6. 【LeetCode 160】Intersection of Two Linked Lists
  7. JS中的prototype属性
  8. iOS 本地化应用程序(NSLocalizedString)
  9. cocos2d-x2.2.5 + cocos2d-x3.2鸟跳便宜源代码“开源”
  10. (2)Python索引和切片
  11. day20
  12. Windows Azure 搭建网络代理 Proxy
  13. maya2015卸载/安装失败/如何彻底卸载清除干净maya2015注册表和文件的方法
  14. ubuntu下hadoop0.20.2报错/dfs/name is in an inconsistent state
  15. MySQL ERROR 1300 (HY000): Invalid utf8 character string
  16. 图解openssl实现私有CA
  17. [Web 前端] Jquery 复制元素,并修改属性, 追加到另一个元素后面
  18. 7. 集成学习(Ensemble Learning)Stacking
  19. iOS Emoji
  20. linux安全第二周学习总结

热门文章

  1. 设置document.domain实现js跨域注意点
  2. 分享知识-快乐自己:Spring中的(三种)异常处理机制
  3. Mybatis中的like模糊查询
  4. listen 62
  5. kettle脚本定时任务不执行
  6. linux增加vlan网卡配置
  7. BZOJ_1818_[Cqoi2010]内部白点 _扫描线+树状数组
  8. 洛谷【P3437】[POI2006]TET-Tetris 3D
  9. Poj_1068 Parencodings
  10. 微信公众平台:扫一扫demo