深圳全飞鸿

标题: PMP里DAO的用法 [打印本页]

作者: syant    时间: 2024-4-29 14:27
标题: PMP里DAO的用法
本帖最后由 syant 于 2024-4-30 20:46 编辑

多表查询
  1. $bug = $this->dao->select('t1.*, t2.name AS projectName, t3.title AS storyTitle, t3.status AS storyStatus, t3.version AS latestStoryVersion, t4.name AS taskName, t5.title AS planName')
  2.             ->from(TABLE_BUG)->alias('t1')
  3.             ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
  4.             ->leftJoin(TABLE_STORY)->alias('t3')->on('t1.story = t3.id')
  5.             ->leftJoin(TABLE_TASK)->alias('t4')->on('t1.task = t4.id')
  6.             ->leftJoin(TABLE_PRODUCTPLAN)->alias('t5')->on('t1.plan = t5.id')
  7.             ->where('t1.id')->eq((int)$bugID)->fetch();
复制代码



作者: syant    时间: 2024-4-29 14:29
UPDATE的方法
  1. $this->dao->update(TABLE_TASK)->set('assignedTo=openedBy, assignedDate = finishedDate')->where('status')->eq('done')->exec();
  2.         $this->saveLogs($this->dao->get());
  3.         $this->dao->update(TABLE_TASK)->set('a
复制代码

作者: syant    时间: 2024-4-30 20:47
单表多条件
  1. $this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('story')->in($idList)->andWhere('project')->eq($projectID)->orderBy('order_asc')->fetch('order');
复制代码

作者: F007    时间: 2024-5-7 18:57
test
作者: F007    时间: 2024-5-8 09:49
test




欢迎光临 深圳全飞鸿 (http://www.nagomes.com/disc/) Powered by Discuz! X3.2