SELECT `user`.id AS`用户ID`, `user`.username AS`用户姓名`, Count(distinct person_url_relation.rel_person_id) AS`已标注患者总数`, Count(distinct person_trace.trace_id) AS`已标注轨迹总数`, Count(distinct url_info_second.url_id) AS`已分配的url数` FROM `user` LEFTJOIN url_info_second ON url_info_second.user_id = `user`.id LEFTJOIN person_url_relation ON person_url_relation.rel_url_id = url_info_second.url_id LEFTJOIN person_trace ON person_url_relation.rel_person_id = person_trace.person_id WHERE`user`.id > 14 GROUPBY `user`.id
v2:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
SELECT * FROM ( SELECT `user`.id AS user_id, `user`.username AS user_name, Count(distinct person_url_relation.rel_person_id) AS totalP, Count(distinct person_trace.trace_id) AS totalT, Count(distinct url_info_second.url_id) AS totalU FROM `user` LEFTJOIN url_info_second ON url_info_second.user_id = `user`.id LEFTJOIN person_url_relation ON person_url_relation.rel_url_id = url_info_second.url_id LEFTJOIN person_trace ON person_url_relation.rel_person_id = person_trace.person_id WHERE`user`.id > 14 GROUPBY `user`.id ) AS finshed_t WHERE finshed_t.totalU <> 0
统计第二次未完成标注的url数量:
1 2 3 4 5 6 7 8 9 10 11 12
SELECT`user`.id as'用户ID', IFNULL(k.unfinshed, 0) as'未完成标注的url数' FROM`user`LEFTJOIN ( SELECT url_info_second.user_id AS user_id, Count(distinct url_info_second.url_id) AS unfinshed FROM url_info_second WHERE url_condition = '待标注' GROUPBY url_info_second.user_id )AS k ON k.user_id = `user`.id WHERE`user`.id > 14
合并以上两个结果:[Err] 1248 - Every derived table must have its own alias
SELECT user_id1 AS`用户ID`, user_name AS`用户名`, totalP AS`已标注患者人数`, totalT AS`已标注轨迹总数`, totalU AS`已分配的url数`, unfinshed AS`未完成标注的url数` FROM ( SELECT * FROM ( SELECT * FROM ( SELECT `user`.id AS user_id1, `user`.username AS user_name, Count(distinct person_url_relation.rel_person_id) AS totalP, Count(distinct person_trace.trace_id) AS totalT, Count(distinct url_info_second.url_id) AS totalU FROM `user` LEFTJOIN url_info_second ON url_info_second.user_id = `user`.id LEFTJOIN person_url_relation ON person_url_relation.rel_url_id = url_info_second.url_id LEFTJOIN person_trace ON person_url_relation.rel_person_id = person_trace.person_id WHERE`user`.id > 14 GROUPBY `user`.id ) AS finshed_t WHERE finshed_t.totalU <> 0 )AS finshed LEFTJOIN ( SELECT * FROM ( SELECT`user`.id as user_id2, IFNULL(k.unfinshed, 0) as unfinshed FROM`user`LEFTJOIN ( SELECT url_info_second.user_id AS user_id, Count(distinct url_info_second.url_id) AS unfinshed FROM url_info_second WHERE url_condition = '待标注' GROUPBY url_info_second.user_id )AS k ON k.user_id = `user`.id WHERE`user`.id > 14 ) AS unfinished_url ) ON finished.user_id1 = unfinshed_url.user_id2 ) as t
统计失效url:待审核但无关联人员:
1 2 3 4 5 6 7 8 9 10 11 12 13
SELECT * FROM ( SELECT `user`.id AS user_id, `user`.username AS user_name, Count(distinct url_info_second.url_id) AS totalU FROM `user` LEFTJOIN url_info_second ON url_info_second.user_id = `user`.id WHERE`user`.id > 14 GROUPBY `user`.id ) AS finshed_t WHERE finshed_t.totalU <> 0
1 2 3 4 5 6 7 8 9 10 11 12
SELECT * FROM ( SELECT url_id, user_id, Count(distinct person_url_relation.rel_person_id) AS totalP FROM url_info_second LEFTJOIN person_url_relation ON person_url_relation.rel_url_id = url_info_second.url_id LEFTJOIN person_trace ON person_url_relation.rel_person_id = person_trace.person_id WHERE url_condition = '待审核' GROUPBY url_id ) AS u_p_count
创建 view 时,select 语句无法嵌套
存在问题的url数量:
1 2 3
SELECT user_id,COUNT(url_id) from url_person_count WHERE totalP = 0 GROUPBY user_id
// 如果出现问题,就直接 hard code 写死域名 Instance.defaults.baseURL = 'http://localhost:8081/cc-computer-homepage/backend/web/index.php/api/v1'
当前:PHP/5.6.40
Yii2 对 word、Excel 上传下载的支持——PHPOffice
PHPExcel was officially deprecated in 2017 and permanently archived in 2019. The project has not be maintained for years and must not be used anymore. All users must migrate to its direct successor PhpSpreadsheet, or another alternative.
The current version of PHPWord supports Microsoft Office Open XML (OOXML or OpenXML), OASIS Open Document Format for Office Applications (OpenDocument or ODF), and Rich Text Format (RTF).
// Creating the new document... $phpWord = new \PhpOffice\PhpWord\PhpWord();
/* Note: any element you append to a document must reside inside of a Section. */
// Adding an empty Section to the document... $section = $phpWord->addSection(); // Adding Text element to the Section having font styled by default... $section->addText( '"Learn from yesterday, live for today, hope for tomorrow. ' . 'The important thing is not to stop questioning." ' . '(Albert Einstein)' );
// Saving the document as OOXML file... $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007'); $objWriter->save('helloWorld.docx');
Access to XMLHttpRequest at 'http://localhost:8081/cc-computer-homepage/backend/web/index.php/api/v1/students/batch' from origin 'http://localhost:8084' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
git log --oneline git tag -a '1.0.1' xxxxxx git push --tags
遇到的问题:
1 2
[UnexpectedValueException] Error while installing pcy/my-php-excel-packgist, composer-plugin packages should have a class defined in their extra key to be usable.
IOC is Inversion Of Control. It means that the application won’t manage it’s lifecycle/flow of control itself. The framework (Spring) will. So you just tell the framework how you want (some) elements of your app to work together.
DI is dependency injection. It’s a specific kind of IOC where the framework will manage the dependencies that an object uses (you can call dependency: a service).
乐观锁底层使用原子指令CAS实现(Compare and Swap)。由于是用硬件支持的原子指令,效率非常高,很少有额外的开销。而悲观锁底层用Mutex实现,涉及到一系列的系统调用,额外的开销会比较大。在具体场景上,乐观锁在进行更改时,需要对比之前的的版本号,如果版本号一致即认为数据没有被修改过,可以进行更新;而悲观锁则保证修改数据时线程之间的互斥,在critical section中只有一个线程允许进入。