int mode = carInfoService.getCompanyCarMode(companyId);

public int getCompanyCarMode(Long companyId) {
String sql = "select t.id from iov_biz_car_info t join iov_biz_device d on d.iov_biz_car_info_id = t.id and d.is_primary = 1 where d.cbm_mag_company_id = ? and rownum = 1";
List<Number> create = findBySQL(sql, new Object[] { companyId });
sql = "select t.id from iov_biz_car_info t join iov_biz_device d on d.iov_biz_car_info_id = t.id and d.is_primary = 1 join iov_biz_l_car_info_company lc on lc.iov_biz_car_info_id =t.id where lc.cbm_mag_company_id = ? and rownum = 1";
List<Number> link = findBySQL(sql, new Object[] { companyId });
if (create.size() > 0 && link.size() < 1) {//本企业
return 1;
}
if (create.size() < 1 && link.size() > 0) {//授权
return 2;
}
return 0;
} objectList = getService().findCountGroupByProvince(companyId, companyIds, posIds, mode); public List<Object[]> findCountByProvince(Long companyId, List<Long> companyIds, List<Long> posIds, int carMode) {
Map<String, Object> params = Maps.newHashMap();
StringBuilder hql = new StringBuilder();
hql.append("select t.province, count(distinct t.id) as count from ");
hql.append(Device.class.getName()).append(" t inner join t.carInfo t10 left join t10.companies t3 ");
if (CollectionUtils.isNotEmpty(posIds)) {
hql.append(" join t10.positions t2 ");
}
hql.append(" where 1=1 ");
switch (carMode) {
case 1:
hql.append(" and t.company.id in (:companyIds) ");
params.put("companyIds", companyIds);
break;
case 2:
hql.append(" and t3.id =:companyId ");
params.put("companyId", companyId);
break;
default:
hql.append(" and (t.company.id in (:companyIds) or t3.id =:companyId) ");
params.put("companyId", companyId);
params.put("companyIds", companyIds);
break;
}
if (CollectionUtils.isNotEmpty(posIds)) {
hql.append(" and t2.id in (:posIds) ");
params.put("posIds", posIds);
}
hql.append(" and t.primary=1 group by t.province order by count(distinct t.id) desc");
return findByNamedParam(hql.toString(), params);
}

关于数据源为授权车辆、企业车辆的判断(限foton)的更多相关文章

  1. 2016中国人工智能企业TOP100, CBinsight2016年100家人工智能公司

    2016中国人工智能企业TOP100 不论在学界还是业界,均有代表人物对人工智能表示了担忧,如史蒂芬·霍金和比尔·盖茨.尽管如此,国内外科技巨头都积极发力人工智能,一波波创业者也相继涌入.人工智能成为 ...

  2. ActiveReports 报表控件V12新特性 -- 无需ETL处理,即可实现跨数据源分析数据

    ActiveReports是一款专注于 .NET 平台的报表控件,全面满足 HTML5 / WinForms / ASP.NET / ASP.NET MVC / WPF 等平台下报表设计和开发工作需求 ...

  3. 详解登录认证及授权--Shiro系列(一)

    Apache Shiro 是一个强大而灵活的开源安全框架,它干净利落地处理身份认证,授权,企业会话管理和加密.Apache Shiro 的首要目标是易于使用和理解.安全有时候是很复杂的,甚至是痛苦的, ...

  4. Rshare Pro是否可以放入至客户企业App Store?

    现在很多客户内部部署了苹果授权的企业内部的AppStore,我们的Rshare Pro 是完全允许放入企业搭建的AppStore平台中.但每份需要收费20美元,换成人民币是120元.

  5. Apache shiro集群实现 (四)shiro授权(Authentication)--访问控制

    Apache shiro集群实现 (一) shiro入门介绍 Apache shiro集群实现 (二) shiro 的INI配置 Apache shiro集群实现 (三)shiro身份认证(Shiro ...

  6. ASP.NET Core Identity 实战(4)授权过程

    这篇文章我们将一起来学习 Asp.Net Core 中的(注:这样描述不准确,稍后你会明白)授权过程 前情提要 在之前的文章里,我们有提到认证和授权是两个分开的过程,而且认证过程不属于Identity ...

  7. Java实现网易企业邮箱发送邮件

    最近项目需要用网易企业邮箱发送邮件,特意来将实现过程记录一下: maven导入jar包 <!-- javax.mai 核心包 --> <dependency> <grou ...

  8. JEECG 多数据源设计

    转至元数据起始   为什么要有多数据源? 通常一个系统只需要连接一个数据库就可以了,Jeecg数据源是配置在spring-mvc-hibernate.xml文件中,这种数据源我们叫做主数据源.但是在企 ...

  9. 课程分享 企业普及版贝斯OA与工作流系统

    企业普及版贝斯OA与工作流系统 基于J2EE+JBPM3.x/JBPM4.3+Flex流程设计器+Jquery+授权认证企业普及版贝斯OA与工作流系统 假设对这个课程有兴趣的.能够和我联系.QQ205 ...

随机推荐

  1. 几个超级好用但很少有人知道的 webstorm技巧

    我总结一些我发现的比较实用的功能,内容来自日常工作中用到的功能.图片来自PPT,是在公司内部的分享. 你不知道的webstorm进阶使用技巧 1.双击shift 全局搜索,可以搜索代码.设置等. 如果 ...

  2. 在Linux系统下搭建和配置一个minio文件服务器(一)

    1.minio文件服务器的介绍 Minio 是一个基于Go语言的对象存储服务.它实现了大部分亚马逊S3云存储服务接口,可以看做是是S3的开源版本,非常适合于存储大容量非结构化的数据,例如图片.视频.日 ...

  3. echarts中折线图切换为数据视图(表格布局)表头无法对齐解决方法

                dataView: {               show: true,               readOnly: true,               option ...

  4. myisamchk是用来做什么的?MyISAM Static和MyISAM Dynamic有什么区别?

    myisamchk是用来做什么的? 它用来压缩MyISAM[歌1] 表,这减少了磁盘或内存使用. MyISAM Static和MyISAM Dynamic有什么区别? 在MyISAM Static上的 ...

  5. Tomcat 8.5集群配置

    示例 <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions= ...

  6. python_多级菜单_纯循环与分支

    源代码: #!/usr/bin/python3 __author__ = 'beimenchuixue' __blog__ = 'http://www.cnblogs.com/2bjiujiu/' d ...

  7. Centos-shell-特殊字符

    shell 通配符 # 注意完全不同于正则,类似正则 * 任意至少一个字符 ? 任意一个字符 []   []中任意一个字符,相关字符集a-z A-Z 0-9 shell 重定向 # 重新指定系统标准输 ...

  8. 060 01 Android 零基础入门 01 Java基础语法 06 Java一维数组 07 冒泡排序

    060 01 Android 零基础入门 01 Java基础语法 06 Java一维数组 07 冒泡排序 本文知识点:冒泡排序 冒泡排序 实际案例分析冒泡排序流程 第1轮比较: 第1轮比较的结果:把最 ...

  9. matplotlib.pyplot.imshow如何显示灰度图

    转载:https://www.zhihu.com/question/24058898 作者:采石工链接:https://www.zhihu.com/question/24058898/answer/1 ...

  10. Centos最小化安装后,不能使用yum命令的解决办法

    刚刚最小化方式安装了CentOS 7 后,想查看一下config,却发现没有config文件,就想用yum下载一个,但是发现yum不能正常工作!!! 一,输入安装X Window命令,安装出错!! 在 ...