1 /**
2 * 数组形式的原生sql
3 */
4 public function arrayA(array $did)
5 {
6 $statement = $this->getEntityManager()->getConnection()->executeQuery('
7 SELECT did, count(1) as num
8 FROM position_structure
9 WHERE did in (?)
10 AND status = 1
11 GROUP BY did
12 ', array($did), array(Connection::PARAM_INT_ARRAY));
13 return $statement->fetchAll();
14 }
15
16 /**
17 * 单个值的原生sql
18 */
19 public function fetchCompaniesByUserId($userId){
20 $statement = $this->getEntityManager()->getConnection()->prepare('
21 SELECT c.id,c.name,c.type FROM company_admin ca
22 LEFT JOIN company c ON c.id = ca.company_id
23 WHERE ca.user_id = :userId');
24 $statement->bindValue('userId', $userId);
25 $statement->execute();
26 return $statement->fetchAll();
27 }

最新文章

  1. 委托 与 Lambda
  2. Rotate Image
  3. Java ANT build.xml
  4. MySQL日期时间函数大全(转)
  5. Winpcap
  6. hadoop启动后jps没有namenode(转)
  7. Dom对象的方法应用一getElementById技巧、getElementsByName() IE,firefox兼容
  8. error C2065:未声明的标识符错误
  9. 用document.getElementsByTagName()返回的真的是数组吗?
  10. Python 时间函数
  11. knockout笔记
  12. Maven入门-4.Maven的依赖
  13. 计时器C#
  14. redis 开启远程访问权限
  15. some knowledge of the IT world
  16. HashMap中capacity、loadFactor、threshold、size等概念的解释<转>
  17. 在 R 中估计 GARCH 参数存在的问题(基于 rugarch 包)
  18. Mabatis中#{}和${}的区别
  19. 基于py3和pymysql的数据库查询,查询某几列的数据
  20. Liferay中request

热门文章

  1. python pickle 模块的使用详解
  2. 常用命令--windows
  3. Python+Selenium(1)- 环境搭建
  4. DFA简介
  5. 838. Push Dominoes —— weekly contest 85
  6. 论文解读 - Relational Pooling for Graph Representations
  7. Git操作:远程仓库(git remote)的添加、管理和删除
  8. 《Python3反爬虫原理与绕过实战》作者韦世东
  9. select模型(二 改进服务端)
  10. facl权限(getfacl/setfacl)