//获取部门id
String orgId = ResourceUtil.getUserSystemData(DataBaseConstant.SYS_ORG_ID);
List<Map<String,String>> deptsIds=systemService.getDeptIds(orgId);
StringBuffer codes= new StringBuffer();
for(Map<String,String> map : deptsIds){
String orgCode = map.get("ORG_CODE");
codes.append(orgCode).append(",");
}
if (StringUtil.isNotEmpty(codes)) {
codes.deleteCharAt(codes.length()-1);
}
String userSql ="select * from t_s_base_user where id in(select user_id from t_s_user_org tsuo,t_s_depart tsd where tsuo.org_id=tsd.id and tsd.org_code in ("+codes+"))";
List<Object> users=systemService.findListbySql(userSql);
Map<String,String> salesmans = new HashMap<String,String>();
for (int i = 0; i < users.size(); i++) {
Object[] dc = (Object[]) users.get(i);
String name= dc[4].toString();
String id=dc[0].toString();
salesmans.put(id, name);
}
req.setAttribute("salesmans",salesmans);