Commit 79999b43 authored by KeYong's avatar KeYong

Merge remote-tracking branch 'origin/develop_dl_plan6' into develop_dl_plan6

# Conflicts: # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/FireFightingSystemMapper.java # amos-boot-system-equip/src/main/resources/mapper/FireFightingSystemMapper.xml
parents e1d7ec4e f167c609
......@@ -149,9 +149,9 @@ public interface DynamicFormInstanceMapper extends BaseMapper<DynamicFormInstanc
* @return
*/
Page<Map<String, Object>> getPersonInfoByPage(Page page, @Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> dutyCardCount( @Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> dutyCardCount();
List<Map<String, Object>> dutyCardList (@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> dutyCardList ();
}
......@@ -35,9 +35,9 @@ public interface IDutyCommonService {
IPage<Map<String, Object>> pageListDetail(int current, int size, String beginDate, String endDate, String bizOrgCode) throws ParseException;
List<Map<String, Object>> dutyCardCount(String bizOrgCode)throws ParseException;
List<Map<String, Object>> dutyCardCount()throws ParseException;
List<Map<String, Object>> dutyCardList(String bizOrgCode)throws ParseException;
List<Map<String, Object>> dutyCardList()throws ParseException;
/**
* 值班明细
......
......@@ -627,7 +627,7 @@ WHERE
<select id="dutyCardCount" resultType="java.util.Map">
SELECT
'1601' as peopleType,
'fire' as peopleType,
count(*) as total
from
(SELECT
......@@ -645,14 +645,18 @@ WHERE
WHERE
c.sequence_nbr IS NOT NULL
AND cs.sign_time LIKE concat( CURRENT_DATE ( ), '%' )
AND c.biz_org_code LIKE concat(#{bizOrgCode},'%')
GROUP BY
cs.USER_ID
ORDER BY
cs.sign_time DESC) d
union all
SELECT
b.peopleType,
(CASE b.peopleType
WHEN 1602 THEN
'run'
ELSE
'overhaul'
END) peopleType,
count( * ) as total
FROM
(
......@@ -682,10 +686,9 @@ WHERE
) a
LEFT JOIN cb_org_usr ou ON ou.sequence_nbr = a.id
LEFT JOIN cb_dynamic_form_instance cfi ON ou.sequence_nbr = cfi.instance_id
where ou.biz_org_code like concat(#{bizOrgCode}, '%')
GROUP BY
a.id
) b WHERE b.peopleType != '1601'
) b WHERE b.peopleType in ('1602','1604')
GROUP BY
peopleType
</select>
......@@ -695,7 +698,7 @@ WHERE
c.sequence_nbr as id,
c.biz_org_name as userName,
IFNULL( cf.mobile_phone, '' ) telephone,
'驻站消防员' as peopleType
'1601' as peopleType
FROM
cb_org_usr c
RIGHT JOIN cb_sign cs ON c.sequence_nbr = cs.USER_ID
......@@ -706,7 +709,6 @@ WHERE
WHERE
c.sequence_nbr IS NOT NULL
AND cs.sign_time LIKE concat( CURRENT_DATE ( ), '%' )
AND c.biz_org_code LIKE concat(#{bizOrgCode},'%')
GROUP BY
cs.USER_ID
ORDER BY
......@@ -716,7 +718,7 @@ WHERE
id,
userName,
telephone,
(select name from cb_data_dictionary WHERE code = b.peopleType ) as peopleType
peopleType
FROM
(
SELECT
......@@ -745,9 +747,8 @@ WHERE
) a
LEFT JOIN cb_org_usr ou ON ou.sequence_nbr = a.id
LEFT JOIN cb_dynamic_form_instance cfi ON ou.sequence_nbr = cfi.instance_id
where ou.biz_org_code like concat(#{bizOrgCode}, '%')
GROUP BY
a.id
) b WHERE b.peopleType != '1601')
) b WHERE b.peopleType in ('1602','1604'))
</select>
</mapper>
......@@ -88,13 +88,8 @@ public class DutyPersonController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "值班管理卡片人员统计", notes = "值班管理卡片人员统计")
public ResponseModel<Map<String, Object>> cardDetail() throws ParseException {
ReginParams selectedOrgInfo = getSelectedOrgInfo();
String bizOrgCode = ObjectUtils.isEmpty(selectedOrgInfo) || ObjectUtils.isEmpty(selectedOrgInfo.getPersonIdentity()) ? "" : selectedOrgInfo.getPersonIdentity().getBizOrgCode();
if (StringUtils.isEmpty(bizOrgCode)) {
return ResponseHelper.buildResponse(null);
}
Map<String, Object> map = new HashMap<>();
List<Map<String, Object>> maps = iDutyPersonService.dutyCardCount(bizOrgCode);
List<Map<String, Object>> maps = iDutyPersonService.dutyCardCount();
maps.forEach(e->map.put(e.get("peopleType").toString(),e.get("total")));
return ResponseHelper.buildResponse(map);
}
......@@ -104,12 +99,8 @@ public class DutyPersonController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "值班管理卡片人员统计", notes = "值班管理卡片人员统计")
public ResponseModel<List<Map<String, Object>>> cardList() throws ParseException {
ReginParams selectedOrgInfo = getSelectedOrgInfo();
String bizOrgCode = ObjectUtils.isEmpty(selectedOrgInfo) || ObjectUtils.isEmpty(selectedOrgInfo.getPersonIdentity()) ? "" : selectedOrgInfo.getPersonIdentity().getBizOrgCode();
if (StringUtils.isEmpty(bizOrgCode)) {
return ResponseHelper.buildResponse(null);
}
return ResponseHelper.buildResponse(iDutyPersonService.dutyCardList(bizOrgCode));
return ResponseHelper.buildResponse(iDutyPersonService.dutyCardList());
}
......
......@@ -150,14 +150,14 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
}
public List<Map<String, Object>> dutyCardCount(String bizOrgCode)
public List<Map<String, Object>> dutyCardCount()
throws ParseException {
return dynamicFormInstanceMapper.dutyCardCount( bizOrgCode);
return dynamicFormInstanceMapper.dutyCardCount();
}
public List<Map<String, Object>> dutyCardList( String bizOrgCode)
public List<Map<String, Object>> dutyCardList()
throws ParseException {
return dynamicFormInstanceMapper.dutyCardList(bizOrgCode);
return dynamicFormInstanceMapper.dutyCardList();
}
private void fillDutyShiftData(String beginDate, String endDate, Map<String, Object> m) throws ParseException {
......
......@@ -155,4 +155,17 @@ public class EmergencyController extends AbstractBaseController {
return iEmergencyService.selectAlarmAnalysis(bizOrgCode, startDate, endDate);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("火灾自动报警系统告警分析-饼图")
@GetMapping(value = "/selectAlarmAnalysisCount")
public List<Map<String, Object>> selectAlarmAnalysisCount(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode,
@RequestParam(value = "startDate") String startDate,
@RequestParam(value = "endDate") String endDate) {
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
}
return iEmergencyService.selectAlarmAnalysisCount(bizOrgCode, startDate, endDate);
}
}
......@@ -18,14 +18,17 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.DateTimeUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -458,7 +461,7 @@ public class SupervisionConfigureController extends AbstractBaseController {
@RequestMapping(value = "/selectPressureMonth", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "统计当月稳压泵启停", produces = "application/json;charset=UTF-8", notes = "统计当月稳压泵启停")
public ResponseModel selectPressureMonth(@RequestParam("bizOrgCode") String bizOrgCode) {
public ResponseModel selectPressureMonth(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
String startDay = df.format(new Date());
Calendar calendar = Calendar.getInstance();
......@@ -483,10 +486,14 @@ public class SupervisionConfigureController extends AbstractBaseController {
}
// 稳压泵信息
List<Map<String, Object>> pressurePumps = fireFightingSystemMapper.selectAllPressurePumpInfo(bizOrgCode);
ArrayList<Map<String, Object>> names = new ArrayList<>();
// x轴数据
List<Map<String, Object>> data = fireFightingSystemMapper.selectAllDays();
for (Map<String, Object> pressurePump : pressurePumps) {
HashMap<String, Object> bar = new HashMap<>();
bar.put("name", pressurePump.get("name"));
bar.put("id", pressurePump.get("id"));
names.add(bar);
String prefix = null;
String suffix = null;
String iotCode = pressurePump.get("iot_code").toString();
......@@ -510,6 +517,7 @@ public class SupervisionConfigureController extends AbstractBaseController {
List<Map<String, String>> list = (List<Map<String, String>>) JSONArray.parse(json1);
List<Map<String, String>> collect = list.stream().filter(t -> (t.containsKey("time") && t.get("time").substring(0, 10).equals(item.get("date")))).collect(Collectors.toList());
map.put("value", collect.size());
map.put("id", pressurePump.get("id"));
if (item.containsKey("yData")) {
List<Map<String, Object>> yData1 = (List<Map<String, Object>>) item.get("yData");
yData1.add(map);
......@@ -521,6 +529,93 @@ public class SupervisionConfigureController extends AbstractBaseController {
}
}
}
return CommonResponseUtil.success(data);
HashMap<String, Object> result = new HashMap<>();
result.put("names", names);
result.put("data", data);
return CommonResponseUtil.success(result);
}
@PersonIdentify
@RequestMapping(value = "/selectPressureDetails", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "稳压泵详情", produces = "application/json;charset=UTF-8", notes = "稳压泵详情")
public ResponseModel selectPressureDetails(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
List<Map<String, Object>> pressurePumps = fireFightingSystemMapper.selectPressureDetails(bizOrgCode);
return CommonResponseUtil.success(pressurePumps);
}
@PersonIdentify
@RequestMapping(value = "/selectPipePressureDetail", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "管网压力详情", produces = "application/json;charset=UTF-8", notes = "管网压力详情")
public ResponseModel selectPipePressureDetail(@RequestParam(value = "equipmentSpecificId") String equipmentSpecificId) {
Map<String, Object> map = fireFightingSystemMapper.selectEquipmentSpecificById(equipmentSpecificId);
if (ObjectUtils.isEmpty(map) || ObjectUtils.isEmpty(map.get("iot_code"))) {
return CommonResponseUtil.success(null);
}
String iotCode = map.get("iot_code").toString();
String prefix = null;
String suffix = null;
if (iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
throw new BadRequest("装备物联编码错误,请确认!");
}
String now = LocalDateTimeUtils.getNow();
ResponseModel mounthEntity = null;
try {
mounthEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), now.substring(0, 10) + " 00:00:00", now.substring(0, 10) + " 23:59:59", prefix, suffix, "FHS_PipePressureDetector_PipePressure");
} catch (Exception e) {
e.printStackTrace();
}
List<Map<String, String>> result = new ArrayList<>();
if (200 == mounthEntity.getStatus()) {
String json1 = JSON.toJSONString(mounthEntity.getResult());
List<Map<String, String>> list = (List<Map<String, String>>) JSONArray.parse(json1);
Collections.reverse(list);
if (!CollectionUtils.isEmpty(list) && list.size() > 30) {
for (int i = 0; i <= 29; i++) {
result.add(list.get(i));
}
} else {
result.addAll(list);
}
}
result.stream().map(item -> {
if (!ObjectUtils.isEmpty(item.get("time"))) {
item.put("time", change(String.valueOf(item.get("time"))));
}
return item;
}).collect(Collectors.toList());
return CommonResponseUtil.success(result);
}
private String change(String time) {
//进行转化时区
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.US);
Date myDate = null;
try {
myDate = dateFormat.parse(time.replace("Z", "+0000"));
} catch (ParseException e) {
e.printStackTrace();
}
//转换为年月日时分秒
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String format = df.format(myDate);
return format;
}
}
......@@ -63,4 +63,6 @@ public interface EmergencyMapper extends BaseMapper{
List<Map<String, Object>> selectAlarmAnalysis(@Param("bizOrgCode") String bizOrgCode, @Param("startDate")String startDate, @Param("endDate")String endDate);
List<Map<String, Object>> selectAlarmAnalysisCount(@Param("bizOrgCode") String bizOrgCode, @Param("startDate")String startDate, @Param("endDate")String endDate);
}
......@@ -643,4 +643,9 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<Map<String, Object>> selectAllDays();
List<Map<String, Object>> getEquip();
List<Map<String, Object>> selectPressureDetails(@Param("bizOrgCode") String bizOrgCode);
Map<String, Object> selectEquipmentSpecificById(@Param("id") String id);
}
......@@ -35,4 +35,6 @@ public interface IEmergencyService {
Page<Map<String, Object>> selectPressureFlow(Page<Map<String, Object>> page, String bizOrgCode);
List<Map<String, Object>> selectAlarmAnalysis(String bizOrgCode, String startDate, String endDate);
List<Map<String, Object>> selectAlarmAnalysisCount(String bizOrgCode, String startDate, String endDate);
}
......@@ -92,4 +92,9 @@ public class EmergencyServiceImpl implements IEmergencyService {
public List<Map<String, Object>> selectAlarmAnalysis(String bizOrgCode, String startDate, String endDate) {
return emergencyMapper.selectAlarmAnalysis(bizOrgCode, startDate, endDate);
}
@Override
public List<Map<String, Object>> selectAlarmAnalysisCount(String bizOrgCode, String startDate, String endDate) {
return emergencyMapper.selectAlarmAnalysisCount(bizOrgCode, startDate, endDate);
}
}
package com.yeejoin.amos.knowledgebase.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -80,6 +81,20 @@ public class DocLibraryResource {
return ResponseHelper.buildResponse(page);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "知识库卡片信息")
@RequestMapping(value = "/card", method = RequestMethod.GET)
public ResponseModel<Object> queryDocCard(HttpServletRequest request,
@RequestParam(value = "offset") Integer offset,
@RequestParam(value = "end") Integer end,
@RequestParam(value = "filterByCollection") String filterByCollection,
@RequestParam(value = "directoryId", required = false) Long directoryId,
@RequestParam(value = "docTitle", required = false) String docTitle,
@RequestParam(value = "createTimeLeft", required = false) String createTimeLeft,
@RequestParam(value = "createTimeRight", required = false) String createTimeRight) {
return ResponseHelper.buildResponse(docLibraryService.queryCardList());
}
/**
* 收藏文档
*
......
......@@ -29,6 +29,10 @@ public interface DocContentMapper extends BaseMapper<KnowledgeDocContent> {
List<Map<String,Object>> queryDocBaseInfoList(Map<String, Object> paramMap);
List<Map<String,Object>> queryDocCardList();
List<Map<String,Object>> queryCardCount();
int queryDocBaseInfoTotal(Map<String, Object> paramMap);
List<Long> getAllPublishedDocIds();
......
......@@ -181,6 +181,15 @@ public class DocLibraryService {
return page;
}
public Map<String,Object> queryCardList(){
List<Map<String, Object>> content = docContentService.getBaseMapper().queryDocCardList();
List<Map<String, Object>> countMap = docContentService.getBaseMapper().queryCardCount();
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("content",content);
countMap.forEach(e->resultMap.put(e.get("directoryName").toString(),e.get("num")));
}
private void addExtraFieldsAndFilters(Map<String, Object> paramsMap, Map<String, String[]> requestMap) {
List<KnowledgeDynamicsOptionModel> optionModels = dynamicsOptionService.queryByFunctional(RequestContext.getAppKey(), DynamicsFunctional.DOC_BASEINFO.name());
if (ValidationUtil.isEmpty(optionModels)) {
......
......@@ -408,9 +408,9 @@
(
SELECT
COUNT(
DISTINCT (
wespa.equipment_specific_id
)
)
FROM
wl_equipment_specific_alarm_log wespa
......@@ -423,9 +423,9 @@
(
SELECT
COUNT(
DISTINCT (
wespa.equipment_specific_id
)
)
FROM
wl_equipment_specific_alarm_log wespa
......@@ -438,9 +438,9 @@
(
SELECT
COUNT(
DISTINCT (
wespa.equipment_specific_id
)
)
FROM
wl_equipment_specific_alarm_log wespa
......@@ -465,5 +465,57 @@
ORDER BY
temp.date
</select>
<select id="selectAlarmAnalysisCount" resultType="java.util.Map">
SELECT
(
SELECT
COUNT(
wespa.equipment_specific_id
)
FROM
wl_equipment_specific_alarm_log wespa
WHERE
wespa.equipment_specific_index_key LIKE concat('%', 'Fault')
AND wespa.equipment_specific_index_value = 'true'
AND wespa.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND wespa.create_date BETWEEN #{startDate}
AND #{endDate}
) AS faultNum,
(
SELECT
COUNT(
wespa.equipment_specific_id
)
FROM
wl_equipment_specific_alarm_log wespa
WHERE
wespa.equipment_specific_index_key LIKE concat('%', 'FireAlarm')
AND wespa.equipment_specific_index_value = 'true'
AND wespa.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND wespa.create_date BETWEEN #{startDate}
AND #{endDate}
) AS fireAlarmNum,
(
SELECT
COUNT(
wespa.equipment_specific_id
)
FROM
wl_equipment_specific_alarm_log wespa
WHERE
wespa.equipment_specific_index_key LIKE concat('%', 'Shield')
AND wespa.equipment_specific_index_value = 'true'
AND wespa.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND wespa.create_date BETWEEN #{startDate}
AND #{endDate}
) AS shieldNum
</select>
</mapper>
......@@ -5602,7 +5602,6 @@
order by temp.date
</select>
<select id="getEquip" resultType="java.util.Map">
SELECT
spe.id,
......@@ -5629,4 +5628,50 @@
GROUP BY det.`code`
</select>
<select id="selectPressureDetails" resultType="java.util.Map">
SELECT
ed.`name`,
concat_ws('-', ws.full_name, ed.area) area,
es.iot_code as iotCode,
es.id,
(
SELECT
DATE_FORMAT(wesi.update_date,'%Y-%m-%d %H:%i:%S')
FROM
wl_equipment_specific_index wesi
WHERE
wesi.equipment_specific_id = es.id
AND wesi.equipment_index_key IN ('FHS_PressurePump_Stop')
ORDER BY
wesi.update_date DESC
LIMIT 1
) AS stopTime,
(
SELECT
DATE_FORMAT(wesi.update_date,'%Y-%m-%d %H:%i:%S')
FROM
wl_equipment_specific_index wesi
WHERE
wesi.equipment_specific_id = es.id
AND wesi.equipment_index_key IN ('FHS_PressurePump_Start')
ORDER BY
wesi.update_date DESC
LIMIT 1
) AS startTime
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON es.equipment_detail_id = ed.id
LEFT JOIN wl_warehouse_structure ws ON ws.id = es.warehouse_structure_id
LEFT JOIN wl_equipment_specific_alarm esa ON esa.equipment_specific_id = es.id
WHERE
ed.`code` LIKE '92010800%'
AND es.iot_code IS NOT NULL
AND es.biz_org_code like CONCAT(#{bizOrgCode}, '%')
GROUP BY
es.id
</select>
<select id="selectEquipmentSpecificById" resultType="java.util.Map">
select * from wl_equipment_specific where id = #{id}
</select>
</mapper>
......@@ -3691,5 +3691,18 @@
</sql>
</changeSet>
<changeSet author="tym" id="202301050916">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_data_dictionary" />
<not>
<primaryKeyExists primaryKeyName="sequence_nbr" tableName="cb_data_dictionary"/>
</not>
</preConditions>
<comment>cb_data_dictionary 添加人员类型</comment>
<sql>
REPLACE INTO cb_data_dictionary (`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `extend`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES (1604, '1604', '检修人员', 'DLRYLX', NULL, NULL, NULL, NULL, NULL, NULL, b'0', 4);
</sql>
</changeSet>
</databaseChangeLog>
......@@ -76,7 +76,6 @@
)d LIMIT #{offset},#{length}
</select>
<select id="queryDocBaseInfoList" parameterType="map" resultType="map">
SELECT
SEQUENCE_NBR sequenceNbr, REC_DATE recDate, DOC_STATUS docStatus, CREATE_TIME createTime, USER_ID userId,
......@@ -253,5 +252,72 @@
<select id="getAllPublishedDocIds" resultType="long">
SELECT SEQUENCE_NBR FROM knowledge_doc_content WHERE DOC_STATUS = "PUBLISHED"
</select>
<select id="queryDocCardList" resultType="map">
SELECT
SEQUENCE_NBR sequenceNbr,
REC_DATE recDate,
DOC_STATUS docStatus,
CREATE_TIME createTime,
USER_ID userId,
AUDIT_STATUS auditStatus,
REJECTION_COMMENT rejectionComment,
AUDITOR_USER_ID auditorUserId,
ORG_CODE orgCode,
DOC_TITLE docTitle,
DIRECTORY_ID directoryId,
( SELECT kdc.CATEGORY_NAME FROM knowledge_doc_category kdc WHERE kdc.SEQUENCE_NBR = DIRECTORY_ID ) directoryName,
releaseDate,
excuteDate,
IFNULL( collectNum, 0 ) collectNum,
IFNULL( quoteNum, 0 ) quoteNum,
IFNULL( collect, "UNCOLLECT" ) collect
FROM
knowledge_doc_content doct
LEFT JOIN (
SELECT
INSTANCE_ID,
MAX( CASE FIELD_NAME WHEN 'releaseDate' THEN FIELD_VALUE ELSE NULL END ) AS releaseDate,
MAX( CASE FIELD_NAME WHEN 'excuteDate' THEN FIELD_VALUE ELSE NULL END ) AS excuteDate
FROM
knowledge_dynamics_value
GROUP BY
INSTANCE_ID
) fieldt ON doct.SEQUENCE_NBR = fieldt.INSTANCE_ID
LEFT JOIN ( SELECT ENTITY_ID, COUNT( 1 ) collectNum FROM knowledge_interaction_record WHERE OPERATE_TYPE = "COLLECT" GROUP BY ENTITY_ID ) coll ON doct.SEQUENCE_NBR = coll.ENTITY_ID
LEFT JOIN ( SELECT ENTITY_ID, OPERATE_COUNT quoteNum FROM knowledge_interaction_count WHERE OPERATE_TYPE = "PUBLISH" AND ENTITY_TYPE = "DOC" ) quot ON doct.SEQUENCE_NBR = quot.ENTITY_ID
LEFT JOIN ( SELECT ENTITY_ID, OPERATE_TYPE collect FROM knowledge_interaction_record WHERE OPERATE_TYPE = "COLLECT" AND USER_ID = 3780967 ) favor ON doct.SEQUENCE_NBR = favor.ENTITY_ID
WHERE
DOC_STATUS = 'PUBLISHED'
ORDER BY
directoryName DESC,
create_time DESC
</select>
<select id="queryCardCount" resultType="map">
SELECT
( SELECT kdc.CATEGORY_NAME FROM knowledge_doc_category kdc WHERE kdc.SEQUENCE_NBR = DIRECTORY_ID ) directoryName,
COUNT(SEQUENCE_NBR) as num
FROM
knowledge_doc_content doct
LEFT JOIN (
SELECT
INSTANCE_ID,
MAX( CASE FIELD_NAME WHEN 'releaseDate' THEN FIELD_VALUE ELSE NULL END ) AS releaseDate,
MAX( CASE FIELD_NAME WHEN 'excuteDate' THEN FIELD_VALUE ELSE NULL END ) AS excuteDate
FROM
knowledge_dynamics_value
GROUP BY
INSTANCE_ID
) fieldt ON doct.SEQUENCE_NBR = fieldt.INSTANCE_ID
LEFT JOIN ( SELECT ENTITY_ID, COUNT( 1 ) collectNum FROM knowledge_interaction_record WHERE OPERATE_TYPE = "COLLECT" GROUP BY ENTITY_ID ) coll ON doct.SEQUENCE_NBR = coll.ENTITY_ID
LEFT JOIN ( SELECT ENTITY_ID, OPERATE_COUNT quoteNum FROM knowledge_interaction_count WHERE OPERATE_TYPE = "PUBLISH" AND ENTITY_TYPE = "DOC" ) quot ON doct.SEQUENCE_NBR = quot.ENTITY_ID
LEFT JOIN ( SELECT ENTITY_ID, OPERATE_TYPE collect FROM knowledge_interaction_record WHERE OPERATE_TYPE = "COLLECT" ) favor ON doct.SEQUENCE_NBR = favor.ENTITY_ID
WHERE
DOC_STATUS = 'PUBLISHED'
GROUP BY DIRECTORY_ID
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment