|
@@ -51,6 +51,33 @@ func (problemInfoService *ProblemInfoService) GetProblemInfo(id uint) (err error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func (problemInfoService *ProblemInfoService) GetProblemInfoCount() (err error, countInfo []autocode.ProblemCount) {
|
|
|
|
+ global.GVA_DB.Raw("SELECT statistics.matterid as matterid,pt.problem as problem,statistics.mattercount as mattercount,statistics.num as num,statistics.mattercount / num as proportion FROM ( SELECT substring_index( substring_index( a.matter, '|', b.help_topic_id + 1 ), '|',- 1 ) AS matterid, count( 1 ) AS mattercount," +
|
|
|
|
+ " ( SELECT count( 1 ) FROM problem_info a JOIN mysql.help_topic b ON b.help_topic_id < ( length( a.matter ) - length( REPLACE ( a.matter, '|', '' ) ) + 1 ) WHERE ( a.matter != '' AND a.matter IS NOT NULL )) num FROM problem_info a JOIN mysql.help_topic b ON b.help_topic_id < ( length( a.matter ) - length( REPLACE ( a.matter, '|', '' ) ) + 1 ) " +
|
|
|
|
+ " WHERE ( a.matter != '' AND a.matter IS NOT NULL ) GROUP BY matterid ) statistics INNER JOIN problem_type pt ON pt.id = statistics.matterid").Scan(&countInfo)
|
|
|
|
+ return err, countInfo
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func (problemInfoService *ProblemInfoService) GetProblemInfoSum() (err error, countInfo []autocode.ProblemSum) {
|
|
|
|
+ global.GVA_DB.Raw("SELECT statistics1.unit_id unit_id,statistics1.unit_name unit_name,statistics1.mattercount totalnum,statistics2.mattercount handnum,statistics1.num,statistics2.mattercount/statistics1.mattercount handproportion FROM (" +
|
|
|
|
+ "SELECT a.unit_id,a.unit_name,count(substring_index(substring_index(a.matter,'|',b.help_topic_id+1),'|',-1)) AS mattercount,(" +
|
|
|
|
+ "SELECT count(1) FROM problem_info a JOIN mysql.help_topic b ON b.help_topic_id< (length(a.matter)-length(" +
|
|
|
|
+ "REPLACE (a.matter,'|',''))+1) WHERE (a.matter !='' AND a.matter IS NOT NULL)) num FROM problem_info a JOIN mysql.help_topic b ON b.help_topic_id< (length(a.matter)-length(" +
|
|
|
|
+ "REPLACE (a.matter,'|',''))+1) WHERE (a.matter !='' AND a.matter IS NOT NULL) GROUP BY unit_id) statistics1 INNER JOIN (" +
|
|
|
|
+ "SELECT a.unit_id,count(substring_index(substring_index(a.matter,'|',b.help_topic_id+1),'|',-1)) AS mattercount FROM problem_info a JOIN mysql.help_topic b ON b.help_topic_id< (length(a.matter)-length(" +
|
|
|
|
+ "REPLACE (a.matter,'|',''))+1) WHERE (a.matter !='' AND a.matter IS NOT NULL) AND a.`status` !='Untreated' GROUP BY unit_id) statistics2 ON statistics1.unit_id=statistics2.unit_id").Scan(&countInfo)
|
|
|
|
+ return err, countInfo
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func (problemInfoService *ProblemInfoService) GetPLaceRate() (err error, countInfo []autocode.PlaceRate) {
|
|
|
|
+ global.GVA_DB.Raw("SELECT statistics.site_type site_type,dict.label label,statistics.mattercount mattercount,statistics.num num,statistics.mattercount/num proportion FROM (" +
|
|
|
|
+ "SELECT a.site_type,count(substring_index(substring_index(a.matter,'|',b.help_topic_id+1),'|',-1)) AS mattercount,(" +
|
|
|
|
+ "SELECT count(1) FROM problem_info a JOIN mysql.help_topic b ON b.help_topic_id< (length(a.matter)-length(" +
|
|
|
|
+ "REPLACE (a.matter,'|',''))+1) WHERE (a.matter !='' AND a.matter IS NOT NULL)) num FROM problem_info a JOIN mysql.help_topic b ON b.help_topic_id< (length(a.matter)-length(" +
|
|
|
|
+ " REPLACE (a.matter,'|',''))+1) WHERE (a.matter !='' AND a.matter IS NOT NULL) GROUP BY site_type) statistics INNER JOIN sys_dictionary_details dict ON dict.`value`=statistics.site_type AND dict.sys_dictionary_id=8 AND dict.deleted_at IS NULL;").Scan(&countInfo)
|
|
|
|
+ return err, countInfo
|
|
|
|
+}
|
|
|
|
+
|
|
// GetProblemInfoInfoList 分页获取ProblemInfo记录
|
|
// GetProblemInfoInfoList 分页获取ProblemInfo记录
|
|
// Author [piexlmax](https://github.com/piexlmax)
|
|
// Author [piexlmax](https://github.com/piexlmax)
|
|
func (problemInfoService *ProblemInfoService) GetProblemInfoInfoList(info autoCodeReq.ProblemInfoSearch) (err error, infoList []autocode.ProblemInfo, total int64) {
|
|
func (problemInfoService *ProblemInfoService) GetProblemInfoInfoList(info autoCodeReq.ProblemInfoSearch) (err error, infoList []autocode.ProblemInfo, total int64) {
|