Commit 25ebaacd authored by 李秀明's avatar 李秀明

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

parents 0ec7035d 7474492a
......@@ -24,12 +24,13 @@ import java.util.Properties;
@Intercepts({
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}),
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class}),
}
}
)
public class PluginInterceptor implements Interceptor {
/**
* 进行拦截的时候要执行的方法
*
* @param invocation
* @return
* @throws Throwable
......@@ -62,19 +63,19 @@ public class PluginInterceptor implements Interceptor {
//获取到原始sql语句
String sql = boundSql.getSql();
if("com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper.selectPersonListCount".equals(id) ||
if ("com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper.selectPersonListCount".equals(id) ||
"com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper.selectPersonList".equals(id)) {
HashMap par = new HashMap();
if(parameter instanceof HashMap) {
par = (HashMap)((HashMap<?, ?>) parameter).get("map");
if (parameter instanceof HashMap) {
par = (HashMap) ((HashMap<?, ?>) parameter).get("map");
}
LinkedHashMap<String,String> fieldsValue = (LinkedHashMap<String, String>) par.get("fieldsValue");
LinkedHashMap<String, String> fieldsValue = (LinkedHashMap<String, String>) par.get("fieldsValue");
Iterator<String> iterator = fieldsValue.keySet().stream().iterator();
while (iterator.hasNext()) {
String next = iterator.next();
sql = sql.replaceFirst("item",next).replaceFirst("ietmValue", new StringBuffer().append("'").append(fieldsValue.get(next)).append("'").toString());
sql = sql.replaceFirst("item", next).replaceFirst("ietmValue", new StringBuffer().append("'").append(fieldsValue.get(next)).append("'").toString());
}
//通过反射修改sql语句
......
......@@ -45,76 +45,60 @@
GROUP BY s.duty_date) b) as maxShiftNumDay
</select>
<select id="bankViewData" resultType="java.util.Map">
SELECT
S1.*,
SELECT S1.*,
S2.name as shiftName
from
(SELECT
s.shift_id as shiftId,
from (SELECT s.shift_id as shiftId,
GROUP_CONCAT(i.field_value) AS userName
FROM
cb_duty_person_shift s,
FROM cb_duty_person_shift s,
cb_duty_shift ds,
cb_dynamic_form_instance i
WHERE
s.instance_id = i.instance_id
WHERE s.instance_id = i.instance_id
AND ds.sequence_nbr = s.shift_id
AND i.field_code = 'userName'
AND s.duty_date = #{dutyDate}
AND s.shift_id is not null
AND s.app_key = #{appKey}
and i.group_code =#{groupCode}
GROUP BY
s.shift_id
and i.group_code = #{groupCode}
GROUP BY s.shift_id
) S1,
cb_duty_shift S2
where
s1.shiftId = s2.sequence_nbr
where s1.shiftId = s2.sequence_nbr
</select>
<select id="stationViewData" resultType="java.util.Map">
select
i.field_value as postTypeName,
select i.field_value as postTypeName,
count(1) as total
from
cb_duty_person_shift s,
from cb_duty_person_shift s,
cb_dynamic_form_instance i
where
s.instance_id = i.instance_id
where s.instance_id = i.instance_id
and i.field_code = 'postTypeName'
AND s.duty_date = #{dutyDate}
AND s.shift_id is not null
AND s.app_key = #{appKey}
and i.group_code =#{groupCode}
and i.group_code = #{groupCode}
GROUP BY i.field_value
</select>
<select id="newStationViewData" resultType="java.util.Map">
select
i.field_value as postTypeName,
select i.field_value as postTypeName,
count(1) as total
from
cb_duty_person_shift s,
from cb_duty_person_shift s,
cb_dynamic_form_instance i
where
s.instance_id = i.instance_id
where s.instance_id = i.instance_id
and i.field_code = 'postTypeName'
AND s.duty_date = #{dutyDate}
AND s.shift_id is not null
and i.group_code =#{groupCode}
and i.group_code = #{groupCode}
GROUP BY i.field_value
</select>
<select id="newStationViewDataByFieldCode" resultType="java.util.Map">
select
i.field_value as postTypeName,
select i.field_value as postTypeName,
count(1) as total
from
cb_duty_person_shift s,
from cb_duty_person_shift s,
cb_dynamic_form_instance i
where
s.instance_id = i.instance_id
where s.instance_id = i.instance_id
and i.field_code = #{fieldCode}
AND s.duty_date = #{dutyDate}
AND s.shift_id is not null
and i.group_code =#{groupCode}
and i.group_code = #{groupCode}
AND i.field_value is not null
AND i.field_value != ''
GROUP BY i.field_value
......@@ -124,7 +108,8 @@
i.field_value AS postTypeName,
count( 1 ) AS total,
d.`code`,
MAX( CASE d.`code` WHEN '1601' THEN 'firePerson' WHEN '1602' THEN 'opsPerson' WHEN '1603' THEN 'securityPerson' WHEN '1604' THEN 'overhaulPerson' ELSE 'otherPerson' END ) AS postType
MAX( CASE d.`code` WHEN '1601' THEN 'firePerson' WHEN '1602' THEN 'opsPerson' WHEN '1603' THEN 'securityPerson'
WHEN '1604' THEN 'overhaulPerson' ELSE 'otherPerson' END ) AS postType
FROM
cb_duty_person_shift s,
cb_dynamic_form_instance i
......@@ -196,15 +181,15 @@
b.id
</select>
<select id="genRangeDate" resultType="map">
SELECT
DATE_FORMAT(DATE( DATE_ADD( #{beginDate}, INTERVAL @s DAY )),'%Y-%m-%d') AS date,
SELECT DATE_FORMAT(DATE( DATE_ADD( #{beginDate}, INTERVAL @s DAY)), '%Y-%m-%d') AS date,
@s := @s + 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 0 ) temp
WHERE
@s <![CDATA[<=]]>
DATEDIFF(#{endDate},#{beginDate})
DATEDIFF(#{endDate}
, #{beginDate})
</select>
......@@ -236,7 +221,7 @@
and cd.field_value !='消防车驾驶员'
</if>
AND cd.instance_id IN
<foreach collection ='instanceIds' item='instanceId' index='index' open="(" close= ")" separator=",">
<foreach collection='instanceIds' item='instanceId' index='index' open="(" close=")" separator=",">
#{instanceId}
</foreach>
GROUP BY
......@@ -244,7 +229,7 @@
</select>
<select id='getEquipmentForSpecifyDate' resultType='map'>
select * from (
select * from (
SELECT
MAX(
CASE
......@@ -290,7 +275,7 @@ select * from (
where cd.group_code =#{groupCode} and cds.instance_id is not null and
cd.is_delete=0
group by cd.instance_id
) result
) result
<if test="groupByName != null and groupByName!='' and groupByName=='result.carId'">
group by result.carId
</if>
......@@ -303,7 +288,7 @@ select * from (
</select>
<select id='getNewEquipmentForSpecifyDate' resultType='map'>
select * from (
select * from (
SELECT
MAX(
CASE
......@@ -339,7 +324,7 @@ select * from (
where cd.group_code =#{groupCode} and cds.instance_id is not null and
cd.is_delete=0
group by cd.instance_id
) result
) result
<if test="groupByName != null and groupByName!='' and groupByName=='result.deptId'">
group by result.deptId
</if>
......@@ -347,23 +332,17 @@ select * from (
<select id='getInstanceIdForSpecifyDateAndEquipment'
resultType='map'>
SELECT
GROUP_CONCAT(cd.instance_id) as instanceIds
FROM
cb_dynamic_form_instance cd
SELECT GROUP_CONCAT(cd.instance_id) as instanceIds
FROM cb_dynamic_form_instance cd
LEFT JOIN (
SELECT
dp.instance_id,
SELECT dp.instance_id,
ds.`name`
FROM
cb_duty_person_shift dp
FROM cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
dp.duty_date = #{dutyDate}
WHERE dp.duty_date = #{dutyDate}
AND dp.is_delete = 0
) cds ON cd.instance_id = cds.instance_id
WHERE
cd.group_code = #{groupCode}
WHERE cd.group_code = #{groupCode}
AND cds.instance_id IS NOT NULL
AND cd.is_delete = 0
AND cd.field_value = #{targetId}
......@@ -371,7 +350,7 @@ select * from (
<select id='getEquipmentOperator' resultType='map'>
SELECT
result.userName
FROM
FROM
(
SELECT
MAX(
......@@ -405,20 +384,20 @@ FROM
AND cds.instance_id IS NOT NULL
AND cd.is_delete = 0
AND cd.instance_id IN
<foreach collection ='instanceIds' item='instanceId' index='index' open="(" close= ")" separator=",">
<foreach collection='instanceIds' item='instanceId' index='index' open="(" close=")" separator=",">
#{instanceId}
</foreach>
) result
WHERE
WHERE
result.postTypeName = #{operator} and result.name =#{duty}
</select>
<select id ='getPositionStaffDutyForSpecifyDate' resultType="map">
<select id='getPositionStaffDutyForSpecifyDate' resultType="map">
SELECT
GROUP_CONCAT(ss.userName) AS userName,
ss.postTypeName
FROM
FROM
(
SELECT
MAX(
......@@ -450,7 +429,7 @@ FROM
cb_dynamic_form_instance cd
WHERE
cd.instance_id in
<foreach collection ='instanceIds' item='instanceId' index='index' open="(" close= ")" separator=",">
<foreach collection='instanceIds' item='instanceId' index='index' open="(" close=")" separator=",">
#{instanceId}
</foreach>
AND cd.group_code = #{groupCode}
......@@ -458,7 +437,7 @@ FROM
GROUP BY
cd.instance_id
) ss
<!-- LEFT JOIN (
<!-- LEFT JOIN (
SELECT
dp.instance_id,
ds.`name`
......@@ -469,72 +448,58 @@ FROM
dp.duty_date = #{dutyDate}
AND dp.is_delete = 0
AND NAME IS NOT NULL
) cds ON ss.instance_id = cds.instance_id
WHERE
) cds ON ss.instance_id = cds.instance_id
WHERE
cds.NAME =#{duty} -->
GROUP BY
GROUP BY
ss.postTypeName
</select>
<select id='getDutyForSpecifyDate' resultType="map">
SELECT
ds.`name`
FROM
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
dp.duty_date = #{dutyDate}
AND dp.is_delete = 0
AND NAME IS NOT NULL
GROUP BY
NAME
</select>
<select id='getDutyForSpecifyDate' resultType="map">
SELECT ds.`name`
FROM cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE dp.duty_date = #{dutyDate}
AND dp.is_delete = 0
AND NAME IS NOT NULL
GROUP BY NAME
</select>
<select id='getFireTeamBySequenceNbr' resultType="map">
SELECT
name
FROM
cb_fire_team
WHERE
sequence_nbr = #{sequenceNbr} and is_delete=0
<select id='getFireTeamBySequenceNbr' resultType="map">
SELECT name
FROM cb_fire_team
WHERE sequence_nbr = #{sequenceNbr}
and is_delete = 0
</select>
</select>
<select id='getFirstAidCompanyId' resultType="string">
SELECT
sequence_nbr
FROM
cb_org_usr a
WHERE
a.is_delete = 0
AND
a.biz_org_name = '消防救援保障部'
SELECT sequence_nbr
FROM cb_org_usr a
WHERE a.is_delete = 0
AND a.biz_org_name = '消防救援保障部'
</select>
<select id='getFirstAidForTypeCodeAndCompanyId' resultType="map">
SELECT
cft.name,
<select id='getFirstAidForTypeCodeAndCompanyId' resultType="map">
SELECT cft.name,
cft.sequence_nbr
FROM
cb_fire_team cft
WHERE
cft.is_delete = 0
AND cft.type_code = (
SELECT
CODE
FROM
cb_data_dictionary cd
WHERE
cd.name = '企(事)业单位医疗救援队(站)'
FROM cb_fire_team cft
WHERE cft.is_delete = 0
AND cft.type_code = (
SELECT CODE
FROM cb_data_dictionary cd
WHERE cd.name = '企(事)业单位医疗救援队(站)'
AND cd.type = 'XFJGLX'
)
)
AND cft.company = #{company}
</select>
</select>
<select id='queryByCompanyId' resultType="map">
select biz_org_name as bizOrgName,sequence_nbr sequenceNbr,field_value as telephone, amosUserId,companyName from (
select orgUsr.biz_org_name,i.field_value,orgUsr.sequence_nbr,orgUsr.amos_org_id amosUserId, cou1.biz_org_name companyName
select biz_org_name as bizOrgName,sequence_nbr sequenceNbr,field_value as telephone, amosUserId,companyName from
(
select orgUsr.biz_org_name,i.field_value,orgUsr.sequence_nbr,orgUsr.amos_org_id amosUserId, cou1.biz_org_name
companyName
from (select * from cb_org_usr cou where is_delete = 0 ) orgUsr
left join cb_org_usr cou1 on orgUsr.parent_id = cou1.sequence_nbr
left join cb_dynamic_form_instance i on orgUsr.sequence_nbr =
......@@ -560,24 +525,38 @@ AND cft.type_code = (
<select id='queryByCompanyNew' resultType="map">
select biz_org_name as bizOrgName,sequence_nbr sequenceNbr,field_value as telephone, amosUserId,companyName from (
select orgUsr.biz_org_name,i.field_value,orgUsr.sequence_nbr,orgUsr.amos_org_id amosUserId, cou1.biz_org_name companyName
from (select * from cb_org_usr cou where is_delete = 0 ) orgUsr
select biz_org_name as bizOrgName, sequence_nbr sequenceNbr, field_value as telephone, amosUserId, companyName
from (
select orgUsr.biz_org_name,
i.field_value,
orgUsr.sequence_nbr,
orgUsr.amos_org_id amosUserId,
cou1.biz_org_name companyName
from (select * from cb_org_usr cou where is_delete = 0) orgUsr
left join cb_org_usr cou1 on orgUsr.parent_id = cou1.sequence_nbr
left join cb_dynamic_form_instance i on orgUsr.sequence_nbr =
i.instance_id where i.field_code = 'telephone') as d
i.instance_id
where i.field_code = 'telephone') as d
where d.sequence_nbr in (
select userId from (
select cb.duty_date,a.deptId,c.userId from cb_duty_person_shift cb
left join (select i.instance_id id1 ,if(i.field_code = 'deptId',
i.field_value, null) as 'deptId' from cb_dynamic_form_instance i
where i.field_code = 'deptId' and i.field_value is not null) a
select userId
from (
select cb.duty_date, a.deptId, c.userId
from cb_duty_person_shift cb
left join (select i.instance_id id1,
if(i.field_code = 'deptId',
i.field_value, null) as 'deptId'
from cb_dynamic_form_instance i
where i.field_code = 'deptId'
and i.field_value is not null) a
on cb.instance_id = a.id1
left join (select i.instance_id id3 ,if(i.field_code = 'userId',
i.field_value, null) as 'userId' from cb_dynamic_form_instance i
where i.field_code = 'userId' and i.field_value is not null) c
left join (select i.instance_id id3,
if(i.field_code = 'userId',
i.field_value, null) as 'userId'
from cb_dynamic_form_instance i
where i.field_code = 'userId'
and i.field_value is not null) c
on cb.instance_id = c.id3
where to_days(cb.duty_date) = to_days(now()) and
a.deptId in ( select sequence_nbr from cb_org_usr cou where biz_org_name = #{bizOrgName})) r )
where to_days(cb.duty_date) = to_days(now())
and a.deptId in (select sequence_nbr from cb_org_usr cou where biz_org_name = #{bizOrgName})) r)
</select>
</mapper>
......@@ -33,18 +33,24 @@
( SELECT
v.`instance_id`,
max(case v.field_code when 'personNumber' then IFNULL(v.field_value_label,v.field_value) end) personNumber,
max(case v.field_code when 'certificatesTypeCode' then IFNULL(v.field_value_label,v.field_value) end) certificatesTypeCode,
max(case v.field_code when 'certificatesTypeCode' then IFNULL(v.field_value_label,v.field_value) end)
certificatesTypeCode,
max(case v.field_code when 'gender' then IFNULL(v.field_value_label,v.field_value) end) gender,
max(case v.field_code when 'certificatesNumber' then IFNULL(v.field_value_label,v.field_value) end) certificatesNumber,
max(case v.field_code when 'certificatesNumber' then IFNULL(v.field_value_label,v.field_value) end)
certificatesNumber,
max(case v.field_code when 'telephone' then IFNULL(v.field_value_label,v.field_value) end) telephone,
max(case v.field_code when 'state' then IFNULL(v.field_value_label,v.field_value) end) state,
max(case v.field_code when 'safetyTraining' then IFNULL(v.field_value_label,v.field_value) end) safetyTraining,
max(case v.field_code when 'administrativePositionCode' then IFNULL(v.field_value_label,v.field_value) end) administrativePositionCode,
max(case v.field_code when 'internalPositionCode' then IFNULL(v.field_value_label,v.field_value) end) internalPositionCode,
max(case v.field_code when 'fireManagementPostCode' then IFNULL(v.field_value_label,v.field_value) end) fireManagementPostCode,
max(case v.field_code when 'administrativePositionCode' then IFNULL(v.field_value_label,v.field_value) end)
administrativePositionCode,
max(case v.field_code when 'internalPositionCode' then IFNULL(v.field_value_label,v.field_value) end)
internalPositionCode,
max(case v.field_code when 'fireManagementPostCode' then IFNULL(v.field_value_label,v.field_value) end)
fireManagementPostCode,
max(case v.field_code when 'fireManagementPostCode' then v.field_value end) fireManagementPost,
max(case v.field_code when 'positionType' then IFNULL(v.field_value,v.field_value_label) end) positionType,
max(case v.field_code when 'certificateType' then IFNULL(v.field_value_label,v.field_value) end) certificateType,
max(case v.field_code when 'certificateType' then IFNULL(v.field_value_label,v.field_value) end)
certificateType,
max(case v.field_code when 'holdingTime' then IFNULL(v.field_value_label,v.field_value) end) holdingTime,
max(case v.field_code when 'auditCycle' then IFNULL(v.field_value_label,v.field_value) end) auditCycle,
max(case v.field_code when 'personImg' then IFNULL(v.field_value_label,v.field_value) end) personImg,
......@@ -129,8 +135,10 @@
u.person_status personStatus,
u.rec_date recDate,
(select biz_org_name from cb_org_usr where sequence_nbr = u.parent_id) as companyName,
(SELECT IFNULL(SUM(IF(aqr.SOURCE = 'patrol', 1, 0)), 0) FROM dl_amos_idx_biz.idx_access_qrcode_record aqr WHERE aqr.buss_id = u.sequence_nbr ) as 'patrol',
(SELECT IFNULL(SUM(IF(aqr.SOURCE != 'patrol', 1, 0)), 0) FROM dl_amos_idx_biz.idx_access_qrcode_record aqr WHERE aqr.buss_id = u.sequence_nbr ) as 'other',
(SELECT IFNULL(SUM(IF(aqr.SOURCE = 'patrol', 1, 0)), 0) FROM dl_amos_idx_biz.idx_access_qrcode_record aqr WHERE
aqr.buss_id = u.sequence_nbr ) as 'patrol',
(SELECT IFNULL(SUM(IF(aqr.SOURCE != 'patrol', 1, 0)), 0) FROM dl_amos_idx_biz.idx_access_qrcode_record aqr WHERE
aqr.buss_id = u.sequence_nbr ) as 'other',
g.*
FROM
cb_org_usr u
......@@ -139,20 +147,27 @@
( SELECT
v.`instance_id`,
max(case v.field_code when 'personNumber' then IFNULL(v.field_value_label,v.field_value) end) personNumber,
max(case v.field_code when 'certificatesTypeCode' then IFNULL(v.field_value_label,v.field_value) end) certificatesTypeCode,
max(case v.field_code when 'certificatesTypeCode' then IFNULL(v.field_value_label,v.field_value) end)
certificatesTypeCode,
max(case v.field_code when 'gender' then IFNULL(v.field_value_label,v.field_value) end) gender,
max(case v.field_code when 'certificatesNumber' then IFNULL(v.field_value_label,v.field_value) end) certificatesNumber,
max(case v.field_code when 'certificatesNumber' then IFNULL(v.field_value_label,v.field_value) end)
certificatesNumber,
max(case v.field_code when 'telephone' then IFNULL(v.field_value_label,v.field_value) end) telephone,
max(case v.field_code when 'stateCode' then IFNULL(v.field_value_label,v.field_value) end) state,
max(case v.field_code when 'safetyTraining' then IFNULL(v.field_value_label,v.field_value) end) safetyTraining,
max(case v.field_code when 'administrativePositionCode' then IFNULL(v.field_value_label,v.field_value) end) administrativePositionCode,
max(case v.field_code when 'internalPositionCode' then IFNULL(v.field_value_label,v.field_value) end) internalPositionCode,
max(case v.field_code when 'fireManagementPostCode' then IFNULL(v.field_value_label,v.field_value) end) fireManagementPostCode,
max(case v.field_code when 'administrativePositionCode' then IFNULL(v.field_value_label,v.field_value) end)
administrativePositionCode,
max(case v.field_code when 'internalPositionCode' then IFNULL(v.field_value_label,v.field_value) end)
internalPositionCode,
max(case v.field_code when 'fireManagementPostCode' then IFNULL(v.field_value_label,v.field_value) end)
fireManagementPostCode,
max(case v.field_code when 'fireManagementPostCode' then v.field_value end) fireManagementPost,
max(case v.field_code when 'fireManagementPostCode' then IFNULL(v.field_value_label,'其他') end) fireManagementPostName,
max(case v.field_code when 'fireManagementPostCode' then IFNULL(v.field_value_label,'其他') end)
fireManagementPostName,
max(case v.field_code when 'positionType' then IFNULL(v.field_value,v.field_value_label) end) positionType,
max(case v.field_code when 'positionType' then IFNULL(v.field_value_label,'其他') end) positionTypeName,
max(case v.field_code when 'certificateType' then IFNULL(v.field_value_label,v.field_value) end) certificateType,
max(case v.field_code when 'certificateType' then IFNULL(v.field_value_label,v.field_value) end)
certificateType,
max(case v.field_code when 'holdingTime' then IFNULL(v.field_value_label,v.field_value) end) holdingTime,
max(case v.field_code when 'auditCycle' then IFNULL(v.field_value_label,v.field_value) end) auditCycle,
max(case v.field_code when 'personImg' then IFNULL(v.field_value_label,v.field_value) end) personImg,
......@@ -248,7 +263,8 @@
u.biz_org_name bizOrgName,
u.biz_org_code bizOrgCode,
<if test="fields != null">
<foreach collection="fields" item="item" separator=",">MAX(case f.field_code when #{item} then IFNULL(v.field_value_label, v.field_value)
<foreach collection="fields" item="item" separator=",">MAX(case f.field_code when #{item} then
IFNULL(v.field_value_label, v.field_value)
end) as #{item}
</foreach>
</if>
......@@ -364,8 +380,7 @@
</select>
<select id="selectOrgUsrList" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto">
SELECT DISTINCT
cb_org_usr.sequence_nbr ,
SELECT DISTINCT cb_org_usr.sequence_nbr,
cb_org_usr.biz_org_name,
cb_org_usr.biz_org_code,
cb_org_usr.amos_org_id,
......@@ -375,11 +390,11 @@
cb_org_usr.build_id,
cb_org_usr.parent_id,
cb_contract.sequence_nbr as contract_id
FROM
cb_org_usr
LEFT JOIN cb_contract on cb_org_usr.sequence_nbr = cb_contract.signed_company_id and cb_contract.company_id = #{seq}
WHERE
cb_org_usr.sequence_nbr IN ( SELECT DISTINCT signed_company_id FROM cb_contract WHERE company_id = #{seq} and is_delete = 0 )
FROM cb_org_usr
LEFT JOIN cb_contract on cb_org_usr.sequence_nbr = cb_contract.signed_company_id and
cb_contract.company_id = #{seq}
WHERE cb_org_usr.sequence_nbr IN
(SELECT DISTINCT signed_company_id FROM cb_contract WHERE company_id = #{seq} and is_delete = 0)
AND cb_org_usr.biz_org_type = "COMPANY"
AND cb_org_usr.is_delete = 0
</select>
......@@ -398,7 +413,8 @@
Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) AS distance,
case when cks_d.count is null then 0 else cks_d.count end as keySiteNum
FROM important_companys a left join (
SELECT cks.belong_id ,count(cks.belong_id) count from cb_key_site cks where cks.is_delete=0 GROUP BY cks.belong_id
SELECT cks.belong_id ,count(cks.belong_id) count from cb_key_site cks where cks.is_delete=0 GROUP BY
cks.belong_id
)cks_d
on a.id=cks_d.belong_id
where a.longitude is not null and a.latitude is not null and a.keySiteCompany = 1
......@@ -421,38 +437,39 @@
</select>
<select id="getOrgUsrzhDto" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrzhDto">
SELECT
a.biz_org_name bizOrgName,
SELECT a.biz_org_name bizOrgName,
a.build_name buildName,
a.build_id buildId,
c.keySiteCount keySiteCount,
( SELECT v.biz_org_name FROM cb_org_usr v WHERE v.sequence_nbr = a.parent_id ) parentName,
max( CASE b.field_code WHEN 'businessCategory' THEN b.field_value_label ELSE "" END ) AS 'businessCategory',
max( CASE b.field_code WHEN 'companyFemaleEmployees' THEN b.field_value ELSE "" END ) AS 'companyFemaleEmployees',
max( CASE b.field_code WHEN 'companyLocation' THEN b.field_value ELSE "" END ) AS 'companyLocation',
max( CASE b.field_code WHEN 'companyMaleEmployees' THEN b.field_value ELSE "" END ) AS 'companyMaleEmployees',
max( CASE b.field_code WHEN 'companyNature' THEN b.field_value_label ELSE "" END ) AS 'companyNature',
max( CASE b.field_code WHEN 'companyPhone' THEN b.field_value ELSE "" END ) AS 'companyPhone',
max( CASE b.field_code WHEN 'companyPhoto' THEN b.field_value ELSE "" END ) AS 'companyPhoto',
max( CASE b.field_code WHEN 'managementType' THEN b.field_value_label ELSE "" END ) AS 'managementType'
FROM
cb_org_usr a
(SELECT v.biz_org_name FROM cb_org_usr v WHERE v.sequence_nbr = a.parent_id) parentName,
max(CASE b.field_code
WHEN 'businessCategory' THEN b.field_value_label
ELSE "" END) AS 'businessCategory',
max(CASE b.field_code
WHEN 'companyFemaleEmployees' THEN b.field_value
ELSE "" END) AS 'companyFemaleEmployees',
max(CASE b.field_code WHEN 'companyLocation' THEN b.field_value ELSE "" END) AS 'companyLocation',
max(CASE b.field_code
WHEN 'companyMaleEmployees' THEN b.field_value
ELSE "" END) AS 'companyMaleEmployees',
max(CASE b.field_code WHEN 'companyNature' THEN b.field_value_label ELSE "" END) AS 'companyNature',
max(CASE b.field_code WHEN 'companyPhone' THEN b.field_value ELSE "" END) AS 'companyPhone',
max(CASE b.field_code WHEN 'companyPhoto' THEN b.field_value ELSE "" END) AS 'companyPhoto',
max(CASE b.field_code WHEN 'managementType' THEN b.field_value_label ELSE "" END) AS 'managementType'
FROM cb_org_usr a
LEFT JOIN cb_dynamic_form_instance b ON a.sequence_nbr = b.instance_id
LEFT JOIN (select belong_id belongId , count(*) keySiteCount from cb_key_site group by belong_id) c on c.belongId = a.sequence_nbr
WHERE
a.biz_org_name = #{bizOrgName}
LEFT JOIN (select belong_id belongId, count(*) keySiteCount from cb_key_site group by belong_id) c
on c.belongId = a.sequence_nbr
WHERE a.biz_org_name = #{bizOrgName}
</select>
<select id="getCompanyAndCountDepartment" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrTreeDto">
<select id="getCompanyAndCountDepartment" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrTreeDto">
SELECT
result_main.sequenceNbr AS sequenceNbr,
SELECT result_main.sequenceNbr AS sequenceNbr,
result_main.bizOrgName AS bizOrgName,
result_main.parentId AS parentId,
result_main.num1 + result_main.num2 AS num
FROM
(
SELECT
CASE
FROM (
SELECT CASE
WHEN result1.num IS NULL THEN
0
ELSE
......@@ -467,10 +484,8 @@ FROM
result1.sequenceNbr,
result1.bizOrgName,
result1.parentId
FROM
(
SELECT
company_sur.sequence_nbr AS sequenceNbr,
FROM (
SELECT company_sur.sequence_nbr AS sequenceNbr,
company_sur.biz_org_name AS bizOrgName,
company_sur.parent_id AS parentId,
CASE
......@@ -479,33 +494,24 @@ FROM
ELSE
keysite_sur.num
END AS num
FROM
(
SELECT
company.sequence_nbr,
FROM (
SELECT company.sequence_nbr,
company.parent_id,
company.biz_org_name
FROM
cb_org_usr company
WHERE
company.biz_org_type = 'COMPANY'
FROM cb_org_usr company
WHERE company.biz_org_type = 'COMPANY'
AND company.is_delete = FALSE
) company_sur
LEFT JOIN (
SELECT
keysite.belong_id,
SELECT keysite.belong_id,
COUNT(keysite.belong_id) AS num
FROM
cb_key_site keysite
WHERE
keysite.is_delete = FALSE
GROUP BY
keysite.belong_id
FROM cb_key_site keysite
WHERE keysite.is_delete = FALSE
GROUP BY keysite.belong_id
) keysite_sur ON company_sur.sequence_nbr = keysite_sur.belong_id
) result1
LEFT JOIN (
SELECT
company_sur.sequence_nbr AS sequenceNbr,
LEFT JOIN (
SELECT company_sur.sequence_nbr AS sequenceNbr,
company_sur.biz_org_name AS bizOrgName,
company_sur.parent_id AS parentId,
CASE
......@@ -514,40 +520,29 @@ LEFT JOIN (
ELSE
keysite_sur.num
END AS num
FROM
(
SELECT
company.sequence_nbr,
FROM (
SELECT company.sequence_nbr,
company.parent_id,
company.biz_org_name
FROM
cb_org_usr company
WHERE
company.biz_org_type = 'COMPANY'
FROM cb_org_usr company
WHERE company.biz_org_type = 'COMPANY'
AND company.is_delete = FALSE
) company_sur
LEFT JOIN (
SELECT
keysite.belong_id,
SELECT keysite.belong_id,
COUNT(keysite.belong_id) AS num
FROM
cb_key_site keysite
WHERE
keysite.is_delete = FALSE
GROUP BY
keysite.belong_id
FROM cb_key_site keysite
WHERE keysite.is_delete = FALSE
GROUP BY keysite.belong_id
) keysite_sur ON company_sur.sequence_nbr = keysite_sur.belong_id
) result2 ON result1.sequenceNbr = result2.parentId
) result2 ON result1.sequenceNbr = result2.parentId
) result_main
GROUP BY
result_main.sequenceNbr
</select>
GROUP BY result_main.sequenceNbr
</select>
<select id="getparent" resultType="Map">
SELECT important_companys.id ,important_companys.name
SELECT important_companys.id, important_companys.name
FROM important_companys
......@@ -781,7 +776,7 @@ GROUP BY
</if>
</select>
<select id="getCompanyAndKeySite" resultType="com.yeejoin.amos.boot.module.common.api.dto.CheckObjectDto" >
<select id="getCompanyAndKeySite" resultType="com.yeejoin.amos.boot.module.common.api.dto.CheckObjectDto">
SELECT
company_sur.sequence_nbr as sequenceNbr,
......@@ -789,9 +784,11 @@ GROUP BY
company_sur.biz_org_code as bizOrgCode,
company_sur.parent_id as parentId,
company_sur.biz_org_type as bizOrgType,
-- cb.field_value_label,
(SELECT field_value_label FROM cb_dynamic_form_instance as cb WHERE company_sur.sequence_nbr = cb.instance_id AND field_code = 'companyNature' ) as companyNature,
(SELECT field_value_label FROM cb_dynamic_form_instance as cb WHERE company_sur.sequence_nbr = cb.instance_id AND field_code = 'businessCategory' ) as managementType,
-- cb.field_value_label,
(SELECT field_value_label FROM cb_dynamic_form_instance as cb WHERE company_sur.sequence_nbr = cb.instance_id
AND field_code = 'companyNature' ) as companyNature,
(SELECT field_value_label FROM cb_dynamic_form_instance as cb WHERE company_sur.sequence_nbr = cb.instance_id
AND field_code = 'businessCategory' ) as managementType,
CASE
WHEN keysite_sur.num IS NULL THEN
0
......@@ -826,9 +823,10 @@ GROUP BY
GROUP BY
keysite.belong_id
) keysite_sur ON company_sur.sequence_nbr = keysite_sur.belong_id
-- LEFT JOIN cb_dynamic_form_instance as cb ON company_sur.sequence_nbr = cb.instance_id where field_code = 'companyNature'
-- LEFT JOIN cb_dynamic_form_instance as cb ON company_sur.sequence_nbr = cb.instance_id where field_code =
'companyNature'
</select>
</select>
<!--BUG2657 导出选中单位及子单位人员数据 by kongfm-->
<select id="exportPersonToExcelByParentId" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrExcelDto">
......@@ -879,48 +877,43 @@ GROUP BY
<select id="amosIdExistTeam" resultType="int">
SELECT count(*) AS num FROM cb_firefighters WHERE amos_user_id = #{amosId} and is_delete = 0;
SELECT count(*) AS num
FROM cb_firefighters
WHERE amos_user_id = #{amosId}
and is_delete = 0;
</select>
<update id="updatelistByParentId">
UPDATE cb_org_usr
SET biz_org_code=replace(biz_org_code,#{code},#{codex})
SET biz_org_code=replace(biz_org_code, #{code}, #{codex})
WHERE biz_org_code like concat(#{code}, '%');
</update>
<update id="updatePersonStatus">
update cb_org_usr set person_status = #{status} where sequence_nbr = #{id}
update cb_org_usr
set person_status = #{status}
where sequence_nbr = #{id}
</update>
<select id ='getPersonSimpleDetail' resultType='Map'>
SELECT
person.biz_org_name as name,
<select id='getPersonSimpleDetail' resultType='Map'>
SELECT person.biz_org_name as name,
cdf.field_value as phone
FROM
(
SELECT
sequence_nbr,
FROM (
SELECT sequence_nbr,
biz_org_name
FROM
cb_org_usr
WHERE
biz_org_type = 'PERSON'
FROM cb_org_usr
WHERE biz_org_type = 'PERSON'
AND is_delete = 0
) person
LEFT JOIN (
SELECT
field_value,
LEFT JOIN (
SELECT field_value,
instance_id
FROM
cb_dynamic_form_instance
WHERE
group_code = '246'
FROM cb_dynamic_form_instance
WHERE group_code = '246'
AND field_code = 'telephone'
) cdf ON person.sequence_nbr = cdf.instance_id
) cdf ON person.sequence_nbr = cdf.instance_id
</select>
<select id="countDeptByCompanyId" resultType="java.util.Map">
SELECT (SELECT count(1)
......@@ -931,7 +924,7 @@ LEFT JOIN (
sequence_nbr
FROM cb_org_usr t1
WHERE sequence_nbr IN
<foreach collection ='companyIdList' item='companyId' index='index' open="(" close= ")" separator=",">
<foreach collection='companyIdList' item='companyId' index='index' open="(" close=")" separator=",">
#{companyId}
</foreach>
</select>
......@@ -939,14 +932,17 @@ LEFT JOIN (
<select id="queryCompanyId" resultType="map">
select d.*,cbo.biz_org_name companyName from (
select cou.biz_org_name bizOrgName,cou.sequence_nbr sequenceNbr ,cou .parent_id parentId,
a.fireManagementPostCode, b.telephone,cou.amos_org_id amosUserId from ( select * from cb_org_usr cou where is_delete = 0 ) cou
a.fireManagementPostCode, b.telephone,cou.amos_org_id amosUserId from ( select * from cb_org_usr cou where
is_delete = 0 ) cou
left join (select i.instance_id id1 ,if(i.field_code = 'fireManagementPostCode',
i.field_value, null) as 'fireManagementPostCode' from cb_dynamic_form_instance i where i.field_code = 'fireManagementPostCode'
i.field_value, null) as 'fireManagementPostCode' from cb_dynamic_form_instance i where i.field_code =
'fireManagementPostCode'
and i.field_value_label is not null) a on cou .sequence_nbr = a.id1
left join (select i.instance_id id2,if(i.field_code = 'telephone',
i.field_value, null) as 'telephone' from cb_dynamic_form_instance i where i.field_code = 'telephone'
and i.field_value is not null) b on cou .sequence_nbr = b.id2
) d left join cb_org_usr cbo on cbo.sequence_nbr = d.parentId where d.parentId in (select sequence_nbr from cb_org_usr cou where biz_org_name = #{bizOrgName})
) d left join cb_org_usr cbo on cbo.sequence_nbr = d.parentId where d.parentId in (select sequence_nbr from
cb_org_usr cou where biz_org_name = #{bizOrgName})
and (d.fireManagementPostCode in
<foreach item="item" index="index" collection="codes" open="(" separator="," close=")">
#{item}
......@@ -955,16 +951,30 @@ LEFT JOIN (
</select>
<select id="queryCompanyIdNew" resultType="map">
select d.*,cbo.biz_org_name companyName from (
select cou.biz_org_name bizOrgName,cou.sequence_nbr sequenceNbr ,cou .parent_id parentId,
a.administrativePositionCode, b.telephone, cou.amos_org_id amosUserId from ( select * from cb_org_usr cou where is_delete = 0 ) cou
left join (select i.instance_id id1 ,if(i.field_code = 'administrativePositionCode',
i.field_value_label, null) as 'administrativePositionCode' from cb_dynamic_form_instance i where i.field_code = 'administrativePositionCode'
and i.field_value_label is not null) a on cou .sequence_nbr = a.id1
inner join (select i.instance_id id2,if(i.field_code = 'telephone',
i.field_value, null) as 'telephone' from cb_dynamic_form_instance i where i.field_code = 'telephone'
and i.field_value is not null) b on cou .sequence_nbr = b.id2
) d left join cb_org_usr cbo on cbo.sequence_nbr = d.parentId where d.parentId in (select sequence_nbr from cb_org_usr cou where biz_org_name = #{bizOrgName})
select d.*, cbo.biz_org_name companyName
from (
select cou.biz_org_name bizOrgName,
cou.sequence_nbr sequenceNbr,
cou.parent_id parentId,
a.administrativePositionCode,
b.telephone,
cou.amos_org_id amosUserId
from (select * from cb_org_usr cou where is_delete = 0) cou
left join (select i.instance_id id1,
if(i.field_code = 'administrativePositionCode',
i.field_value_label, null) as 'administrativePositionCode'
from cb_dynamic_form_instance i
where i.field_code = 'administrativePositionCode'
and i.field_value_label is not null) a on cou.sequence_nbr = a.id1
inner join (select i.instance_id id2,
if(i.field_code = 'telephone',
i.field_value, null) as 'telephone'
from cb_dynamic_form_instance i
where i.field_code = 'telephone'
and i.field_value is not null) b on cou.sequence_nbr = b.id2
) d
left join cb_org_usr cbo on cbo.sequence_nbr = d.parentId
where d.parentId in (select sequence_nbr from cb_org_usr cou where biz_org_name = #{bizOrgName})
</select>
......@@ -1008,48 +1018,48 @@ LEFT JOIN (
</where>
</select>
<select id="equipCompanyExport" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT
*
FROM
cb_org_usr
WHERE is_delete = false AND biz_org_code LIKE CONCAT(#{bizOrgCode}, '%') AND( biz_org_type = 'COMPANY' || biz_org_type = 'DEPARTMENT')
SELECT *
FROM cb_org_usr
WHERE is_delete = false
AND biz_org_code LIKE CONCAT(#{bizOrgCode}, '%')
AND (biz_org_type = 'COMPANY' || biz_org_type = 'DEPARTMENT')
</select>
<select id="companyDeptListWithPersonCount"
resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT
usr.*,
(select count(1) from cb_org_usr u where u.biz_org_type = 'PERSON' and u.is_delete = false and u.biz_org_code like CONCAT(usr.biz_org_code,'%')) as total
FROM
cb_org_usr usr
where
(usr.biz_org_type = 'COMPANY' OR usr.biz_org_type = 'DEPARTMENT')
SELECT usr.*,
(select count(1)
from cb_org_usr u
where u.biz_org_type = 'PERSON'
and u.is_delete = false
and u.biz_org_code like CONCAT(usr.biz_org_code, '%')) as total
FROM cb_org_usr usr
where (usr.biz_org_type = 'COMPANY' OR usr.biz_org_type = 'DEPARTMENT')
and usr.is_delete = false
</select>
<select id="companyDeptListWithPersonCountNew"
resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT
usr.*,
(select count(1) from cb_org_usr u where u.biz_org_type = 'PERSON' and u.is_delete = false and u.biz_org_code like CONCAT(usr.biz_org_code,'%')) as total
FROM
cb_org_usr usr
where
(usr.biz_org_type = 'COMPANY' OR usr.biz_org_type = 'DEPARTMENT') and usr.biz_org_code like concat (#{bizOrgCode},'%')
SELECT usr.*,
(select count(1)
from cb_org_usr u
where u.biz_org_type = 'PERSON'
and u.is_delete = false
and u.biz_org_code like CONCAT(usr.biz_org_code, '%')) as total
FROM cb_org_usr usr
where (usr.biz_org_type = 'COMPANY' OR usr.biz_org_type = 'DEPARTMENT')
and usr.biz_org_code like concat(#{bizOrgCode}, '%')
and usr.is_delete = false
</select>
<select id="companyTreeByUser"
resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT
usr.*
FROM
cb_org_usr usr
where
(usr.biz_org_type = 'COMPANY' OR usr.biz_org_type = 'DEPARTMENT')
SELECT usr.*
FROM cb_org_usr usr
where (usr.biz_org_type = 'COMPANY' OR usr.biz_org_type = 'DEPARTMENT')
and usr.is_delete = false
and usr.biz_org_code like CONCAT(#{bizOrgCode},'%')
and usr.biz_org_code like CONCAT(#{bizOrgCode}, '%')
</select>
<select id="listByOrgTypes" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
......@@ -1069,16 +1079,21 @@ LEFT JOIN (
</select>
<select id="selectPersonone" resultType="Map">
select group_concat( CONCAT( u.biz_org_name,' ',
IFNULL((select c.field_value from cb_dynamic_form_instance c where field_code='telephone' and c.instance_id=u.sequence_nbr),"")
select group_concat(CONCAT(u.biz_org_name, ' ',
IFNULL((select c.field_value
from cb_dynamic_form_instance c
where field_code = 'telephone' and c.instance_id = u.sequence_nbr), "")
)) name
from cb_org_usr u LEFT JOIN
cb_dynamic_form_instance g on g.instance_id=u.sequence_nbr
where u.biz_org_type='PERSON' and g.field_code='fireManagementPostCode' and g.field_value_label =#{name} and u.parent_id=#{id}
from cb_org_usr u
LEFT JOIN
cb_dynamic_form_instance g on g.instance_id = u.sequence_nbr
where u.biz_org_type = 'PERSON'
and g.field_code = 'fireManagementPostCode'
and g.field_value_label = #{name}
and u.parent_id = #{id}
</select>
</select>
<select id="getParentList" resultType="java.lang.String">
select getParentList(#{id}) as id;
......@@ -1103,7 +1118,8 @@ LEFT JOIN (
CONCAT(
u.biz_org_name,
' ',
IFNULL(( SELECT c.field_value FROM cb_dynamic_form_instance c WHERE field_code = 'telephone' AND c.instance_id = u.sequence_nbr ), "" )
IFNULL(( SELECT c.field_value FROM cb_dynamic_form_instance c WHERE field_code = 'telephone' AND c.instance_id =
u.sequence_nbr ), "" )
)) uname
FROM
cb_org_usr u
......@@ -1117,7 +1133,8 @@ LEFT JOIN (
#{item}
</foreach>;
</select>
<select id="checkCertificatesNumber" resultType="com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance">
<select id="checkCertificatesNumber"
resultType="com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance">
SELECT
*
FROM
......@@ -1187,21 +1204,26 @@ LEFT JOIN (
cfp.fire_management_post,
cft.type_code,
cf.certificate_number certificatesNumber,
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'personNumber' AND dfi.instance_id = u.sequence_nbr ) AS employee_number,
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'telephone' AND dfi.instance_id = u.sequence_nbr ) AS telephone,
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'personNumber' AND dfi.instance_id
= u.sequence_nbr ) AS employee_number,
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'telephone' AND dfi.instance_id =
u.sequence_nbr ) AS telephone,
( CASE WHEN cfp.post_qualification IS NULL or cfp.post_qualification = '' THEN 0 ELSE 1 END ) AS is_certificate,
IF
(
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'peopleType' AND dfi.instance_id = u.sequence_nbr ) = 1601,
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'peopleType' AND dfi.instance_id =
u.sequence_nbr ) = 1601,
1,
IF
(
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'peopleType' AND dfi.instance_id = u.sequence_nbr ) = 1602,
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'peopleType' AND dfi.instance_id =
u.sequence_nbr ) = 1602,
0,
2
)
) AS is_firefighters,
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'personImg' AND dfi.instance_id = u.sequence_nbr ) AS personImg,
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'personImg' AND dfi.instance_id =
u.sequence_nbr ) AS personImg,
cfp.job_title
FROM
cb_org_usr u
......@@ -1218,86 +1240,74 @@ LEFT JOIN (
</select>
<select id="companyTreeByUserToPatrolRoute" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT
usr.*,
(select count(1) from cb_org_usr u where u.biz_org_type = 'PERSON' and u.is_delete = false and u.biz_org_code like CONCAT(usr.biz_org_code,'%')) as total
FROM
cb_org_usr usr
where
(usr.biz_org_type = 'COMPANY' OR usr.biz_org_type = 'DEPARTMENT') and usr.biz_org_code like concat (#{bizOrgCode},'%')
SELECT usr.*,
(select count(1)
from cb_org_usr u
where u.biz_org_type = 'PERSON'
and u.is_delete = false
and u.biz_org_code like CONCAT(usr.biz_org_code, '%')) as total
FROM cb_org_usr usr
where (usr.biz_org_type = 'COMPANY' OR usr.biz_org_type = 'DEPARTMENT')
and usr.biz_org_code like concat(#{bizOrgCode}, '%')
and usr.is_delete = false
</select>
<select id="companyUserTreeByUserAndType"
resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT
usr.*
FROM
cb_org_usr usr
where
usr.is_delete = false
and usr.biz_org_code like CONCAT(#{bizOrgCode},'%')
SELECT usr.*
FROM cb_org_usr usr
where usr.is_delete = false
and usr.biz_org_code like CONCAT(#{bizOrgCode}, '%')
</select>
<select id="companyUserTreeByUserAndTypeALL"
resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT
usr.*
FROM
cb_org_usr usr
where
usr.is_delete = false
and usr.biz_org_code like CONCAT(#{bizorgcode},'%')
SELECT usr.*
FROM cb_org_usr usr
where usr.is_delete = false
and usr.biz_org_code like CONCAT(#{bizorgcode}, '%')
GROUP BY biz_org_name
</select>
<select id="getUserByPeopleTypeCount" resultType="Integer">
select
count(*)
select count(*)
from (
SELECT
DISTINCT
u.sequence_nbr sequenceNbr,
SELECT DISTINCT u.sequence_nbr sequenceNbr,
u.biz_org_name bizOrgName,
g.telephone,
g.positionType
FROM
cb_org_usr u
FROM cb_org_usr u
LEFT JOIN
( SELECT
v.`instance_id`,
max(case v.field_code when 'telephone' then IFNULL(v.field_value,'') end) telephone,
max(case v.field_code when 'positionType' then IFNULL(v.field_value_label,'') end) positionType,
max(case v.field_code when 'peopleType' then IFNULL(v.field_value,'') end) peopleType
FROM
`cb_dynamic_form_instance` v
WHERE
v.group_code = 246
GROUP BY
v.`instance_id`
(SELECT v.`instance_id`,
max(case v.field_code when 'telephone' then IFNULL(v.field_value, '') end) telephone,
max(case v.field_code
when 'positionType' then IFNULL(v.field_value_label, '') end) positionType,
max(case v.field_code when 'peopleType' then IFNULL(v.field_value, '') end) peopleType
FROM `cb_dynamic_form_instance` v
WHERE v.group_code = 246
GROUP BY v.`instance_id`
) g
on u.sequence_nbr = g.instance_id
where
u.biz_org_type = 'person'
AND
u.is_delete = 0
and g.peopleType=1601
where u.biz_org_type = 'person'
AND u.is_delete = 0
and g.peopleType = 1601
GROUP BY
u.sequence_nbr
GROUP BY u.sequence_nbr
order by u.rec_date desc
)a where a.sequenceNbr is not null
) a
where a.sequenceNbr is not null
</select>
<select id="getUserByPeopleType" resultType="Map">
SET @rownum = #{map.pageNum};
select
@rownum := @rownum + 1 AS rownum,
a.* from (
SET
@rownum =
#{map.pageNum};
select @rownum := @rownum + 1 AS rownum,
a.*
from (
SELECT
DISTINCT
u.sequence_nbr sequenceNbr,
......@@ -1309,9 +1319,9 @@ LEFT JOIN (
LEFT JOIN
( SELECT
v.`instance_id`,
max(case v.field_code when 'telephone' then IFNULL(v.field_value,'') end) telephone,
max(case v.field_code when 'positionType' then IFNULL(v.field_value_label,'') end) positionType,
max(case v.field_code when 'peopleType' then IFNULL(v.field_value,'') end) peopleType
max (case v.field_code when 'telephone' then IFNULL(v.field_value, '') end) telephone,
max (case v.field_code when 'positionType' then IFNULL(v.field_value_label, '') end) positionType,
max (case v.field_code when 'peopleType' then IFNULL(v.field_value, '') end) peopleType
FROM
`cb_dynamic_form_instance` v
WHERE
......@@ -1328,12 +1338,16 @@ LEFT JOIN (
GROUP BY
u.sequence_nbr
order by u.rec_date desc
)a where a.sequenceNbr is not null
LIMIT #{map.pageNum}, #{map.pageSize}
) a
where a.sequenceNbr is not null
LIMIT #{map.pageNum}
, #{map.pageSize}
</select>
<select id="selectStaticFire" resultType="java.util.Map">
SELECT count( postName ) as num,( count( postName )/( SELECT count(*) AS count FROM cb_org_usr a WHERE is_delete = 0 AND biz_org_type = 'PERSON'
AND biz_org_code like concat(#{bizOrgCode}, '%')
SELECT count(postName) as num,
(count(postName) /
(SELECT count(*) AS count FROM cb_org_usr a WHERE is_delete = 0 AND biz_org_type = 'PERSON'
AND biz_org_code like concat( #{bizOrgCode} , '%')
))* 100 AS percent, postName
FROM
(
......@@ -1350,12 +1364,12 @@ LEFT JOIN (
LEFT JOIN (
SELECT
v.`instance_id`,
max( CASE v.field_code WHEN 'fireManagementPostCode' THEN IFNULL( v.field_value_label, v.field_value ) END ) fireManagementPostCode,
max( CASE v.field_code WHEN 'fireManagementPostCode' THEN v.field_value END ) fireManagementPost,
max( CASE v.field_code WHEN 'fireManagementPostCode' THEN v.field_value_label END ) fireManagementPostName,
max( CASE v.field_code WHEN 'positionType' THEN IFNULL( v.field_value, v.field_value_label ) END ) positionType,
max( CASE v.field_code WHEN 'positionType' THEN v.field_value_label END ) positionTypeName,
max( CASE v.field_code WHEN 'peopleType' THEN v.field_value END ) peopleType
max ( CASE v.field_code WHEN 'fireManagementPostCode' THEN IFNULL( v.field_value_label, v.field_value ) END ) fireManagementPostCode,
max ( CASE v.field_code WHEN 'fireManagementPostCode' THEN v.field_value END ) fireManagementPost,
max ( CASE v.field_code WHEN 'fireManagementPostCode' THEN v.field_value_label END ) fireManagementPostName,
max ( CASE v.field_code WHEN 'positionType' THEN IFNULL( v.field_value, v.field_value_label ) END ) positionType,
max ( CASE v.field_code WHEN 'positionType' THEN v.field_value_label END ) positionTypeName,
max ( CASE v.field_code WHEN 'peopleType' THEN v.field_value END ) peopleType
FROM
`cb_dynamic_form_instance` v
WHERE
......@@ -1383,8 +1397,10 @@ LEFT JOIN (
postName
</select>
<select id="selectStaticYw" resultType="java.util.Map">
SELECT count( postName ) as num, (count( postName )/( SELECT count(*) AS count FROM cb_org_usr a WHERE is_delete = 0 AND biz_org_type = 'PERSON'
AND biz_org_code like concat(#{bizOrgCode}, '%')
SELECT count(postName) as num,
(count(postName) /
(SELECT count(*) AS count FROM cb_org_usr a WHERE is_delete = 0 AND biz_org_type = 'PERSON'
AND biz_org_code like concat( #{bizOrgCode} , '%')
))* 100 AS percent, postName
FROM
(
......@@ -1401,9 +1417,9 @@ LEFT JOIN (
LEFT JOIN (
SELECT
v.`instance_id`,
max( CASE v.field_code WHEN 'positionType' THEN v.field_value END ) positionType,
max( CASE v.field_code WHEN 'positionType' THEN v.field_value_label END ) positionTypeName,
max( CASE v.field_code WHEN 'peopleType' THEN v.field_value END ) peopleType
max ( CASE v.field_code WHEN 'positionType' THEN v.field_value END ) positionType,
max ( CASE v.field_code WHEN 'positionType' THEN v.field_value_label END ) positionTypeName,
max ( CASE v.field_code WHEN 'peopleType' THEN v.field_value END ) peopleType
FROM
`cb_dynamic_form_instance` v
WHERE
......@@ -1432,42 +1448,38 @@ LEFT JOIN (
</select>
<select id="getPersonType" resultType="Map">
SELECT
dfi.field_value_label AS peopleType
FROM
cb_org_usr u
SELECT dfi.field_value_label AS peopleType
FROM cb_org_usr u
LEFT JOIN cb_dynamic_form_instance dfi ON dfi.instance_id = u.sequence_nbr
WHERE
u.is_delete = FALSE
WHERE u.is_delete = FALSE
AND u.amos_org_id IS NOT NULL
AND dfi.field_value = #{typeCode}
AND dfi.field_code = 'peopleType'
limit 1
AND dfi.field_code = 'peopleType' limit 1
</select>
<select id="reportResult" resultType="java.util.Map">
SELECT
*
FROM
(
SELECT
*
FROM
(
SELECT
person.biz_org_name AS NAME,
SELECT *
FROM (
SELECT *
FROM (
SELECT person.biz_org_name AS NAME,
person.biz_org_code AS bizOrgCode,
person.parent_id AS parentId,
cdf.field_value AS peopleType
FROM
( SELECT sequence_nbr, biz_org_name, biz_org_code, parent_id FROM cb_org_usr WHERE biz_org_type = 'PERSON' AND is_delete = 0 AND biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND rec_date >= #{startTime} AND #{endTime} >= rec_date ) person
LEFT JOIN ( SELECT field_value, instance_id FROM cb_dynamic_form_instance WHERE group_code = '246' AND field_code = 'peopleType' ) cdf ON person.sequence_nbr = cdf.instance_id
FROM (SELECT sequence_nbr, biz_org_name, biz_org_code, parent_id
FROM cb_org_usr
WHERE biz_org_type = 'PERSON'
AND is_delete = 0
AND biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND rec_date >= #{startTime}
AND #{endTime} >= rec_date) person
LEFT JOIN (SELECT field_value, instance_id
FROM cb_dynamic_form_instance
WHERE group_code = '246' AND field_code = 'peopleType') cdf
ON person.sequence_nbr = cdf.instance_id
) AS a
WHERE
a.peopleType IS NOT NULL
WHERE a.peopleType IS NOT NULL
AND a.peopleType = '1601'
) AS a
GROUP BY
parentId
GROUP BY parentId
</select>
</mapper>
......@@ -22,12 +22,13 @@ import java.util.Properties;
@Intercepts({
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}),
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class}),
}
}
)
public class PluginInterceptor implements Interceptor {
/**
* 进行拦截的时候要执行的方法
*
* @param invocation
* @return
* @throws Throwable
......@@ -60,11 +61,11 @@ public class PluginInterceptor implements Interceptor {
//获取到原始sql语句
String sql = boundSql.getSql();
if("com.yeejoin.equipmanage.mapper.FormInstanceMapper.queryForMapList".equals(id)) {
if ("com.yeejoin.equipmanage.mapper.FormInstanceMapper.queryForMapList".equals(id)) {
//执行结果
HashMap<String,String> par = new LinkedHashMap<>();
if(parameter instanceof HashMap) {
par = (HashMap<String, String>)((HashMap<?, ?>) parameter).get("params");
HashMap<String, String> par = new LinkedHashMap<>();
if (parameter instanceof HashMap) {
par = (HashMap<String, String>) ((HashMap<?, ?>) parameter).get("params");
}
......@@ -72,7 +73,7 @@ public class PluginInterceptor implements Interceptor {
while (iterator.hasNext()) {
String next = iterator.next();
sql = sql.replace("item",next);
sql = sql.replace("item", next);
}
//通过反射修改sql语句
......
......@@ -6,48 +6,48 @@
<result column="fieldValue" property="fieldValue"/>
<result column="groupType" property="groupType"/>
</resultMap>
<!-- <select id="queryInstancePage" resultType="map">-->
<!-- select-->
<!-- d.*-->
<!-- from-->
<!-- (-->
<!-- select-->
<!-- i.INSTANCE_ID instanceId,-->
<!-- i.GROUP_CODE groupCode,-->
<!-- <foreach collection="fieldNames" item="value" index="key" separator=",">-->
<!-- MAX(CASE WHEN i.FIELD_NAME = #{key} THEN i.FIELD_VALUE END) as #{key}-->
<!-- </foreach>-->
<!-- from-->
<!-- wl_form_instance i-->
<!-- where i.GROUP_CODE = #{groupCode}-->
<!-- GROUP by-->
<!-- i.INSTANCE_ID)d-->
<!-- <if test="params != null and params.size() > 0">-->
<!-- where-->
<!-- 1=1-->
<!-- <foreach collection="params" index="key" item="value" separator="">-->
<!-- <choose>-->
<!-- <when test="fieldNames[key] == 'like' and value !=null and value !=''">-->
<!-- and d.item like concat('%',#{value},'%')-->
<!-- </when>-->
<!-- <when test="fieldNames[key] == 'eq' and value !=null and value !=''">-->
<!-- and d.item = #{value}-->
<!-- </when>-->
<!-- </choose>-->
<!-- </foreach>-->
<!-- </if>-->
<!-- order by instanceId desc-->
<!-- </select>-->
<!-- <select id="queryInstancePage" resultType="map">-->
<!-- select-->
<!-- d.*-->
<!-- from-->
<!-- (-->
<!-- select-->
<!-- i.INSTANCE_ID instanceId,-->
<!-- i.GROUP_CODE groupCode,-->
<!-- <foreach collection="fieldNames" item="value" index="key" separator=",">-->
<!-- MAX(CASE WHEN i.FIELD_NAME = #{key} THEN i.FIELD_VALUE END) as #{key}-->
<!-- </foreach>-->
<!-- from-->
<!-- wl_form_instance i-->
<!-- where i.GROUP_CODE = #{groupCode}-->
<!-- GROUP by-->
<!-- i.INSTANCE_ID)d-->
<!-- <if test="params != null and params.size() > 0">-->
<!-- where-->
<!-- 1=1-->
<!-- <foreach collection="params" index="key" item="value" separator="">-->
<!-- <choose>-->
<!-- <when test="fieldNames[key] == 'like' and value !=null and value !=''">-->
<!-- and d.item like concat('%',#{value},'%')-->
<!-- </when>-->
<!-- <when test="fieldNames[key] == 'eq' and value !=null and value !=''">-->
<!-- and d.item = #{value}-->
<!-- </when>-->
<!-- </choose>-->
<!-- </foreach>-->
<!-- </if>-->
<!-- order by instanceId desc-->
<!-- </select>-->
<select id="getChildListdate" resultType="map">
SELECT getChildListdate ( #{id} ) ids
SELECT getChildListdate(#{id}) ids
</select>
<update id="updateListChild" >
<update id="updateListChild">
UPDATE wl_form_instance set field_value =#{value}
where wl_form_instance.group_type in('building','room','floor')
<if test ="ids != null and ids.size()>0">
<if test="ids != null and ids.size()>0">
and wl_form_instance.instance_id in
<foreach collection="ids" index="index" item="id" open="(" close=")" separator=",">
#{id}
......@@ -57,7 +57,6 @@
</update>
<select id="queryForMapList" resultType="map">
select
d.*
......@@ -272,43 +271,27 @@
sa.instanceId DESC
</select>
<select id="findDetailByInstanceId" resultType="java.util.LinkedHashMap">
SELECT
a.field_label AS `key`,
SELECT a.field_label AS `key`,
a.field_value AS `value`
FROM
`wl_form_instance` a
WHERE
a.instance_id = #{instanceId}
AND
a.field_label != '父级id'
FROM `wl_form_instance` a
WHERE a.instance_id = #{instanceId}
AND a.field_label != '父级id'
ORDER BY a.group_column_id
</select>
<select id="findByInstanceId" resultType="java.util.LinkedHashMap">
SELECT
fi.NAME AS '建筑名称',
fi.dutyUser AS '负责人',
fi.buildType AS '建筑结构',
fi.dutyUserPhone AS '负责人电话',
fi.buildUseType AS '使用性质',
fi.structureType AS '结构类型',
fi.address AS '详细地址'
FROM
(
SELECT
a.instance_id,
MAX( CASE WHEN a.field_name = 'name' THEN a.field_value END ) AS NAME,
MAX( CASE WHEN a.field_name = 'dutyUser' THEN a.field_value END ) AS dutyUser,
MAX( CASE WHEN a.field_name = 'buildType' THEN a.field_value END ) AS buildType,
MAX( CASE WHEN a.field_name = 'dutyUserPhone' THEN a.field_value END ) AS dutyUserPhone,
MAX( CASE WHEN a.field_name = 'buildUseType' THEN a.field_value END ) AS buildUseType,
MAX( CASE WHEN a.field_name = 'structureType' THEN a.field_value END ) AS structureType,
MAX( CASE WHEN a.field_name = 'address' THEN a.field_value END ) AS address
FROM
`wl_form_instance` a
WHERE
a.instance_id = #{instanceId}
GROUP BY
a.instance_id
SELECT fi.NAME AS '建筑名称', fi.dutyUser AS '负责人', fi.buildType AS '建筑结构', fi.dutyUserPhone AS '负责人电话', fi.buildUseType AS '使用性质', fi.structureType AS '结构类型', fi.address AS '详细地址'
FROM (
SELECT a.instance_id,
MAX(CASE WHEN a.field_name = 'name' THEN a.field_value END) AS NAME,
MAX(CASE WHEN a.field_name = 'dutyUser' THEN a.field_value END) AS dutyUser,
MAX(CASE WHEN a.field_name = 'buildType' THEN a.field_value END) AS buildType,
MAX(CASE WHEN a.field_name = 'dutyUserPhone' THEN a.field_value END) AS dutyUserPhone,
MAX(CASE WHEN a.field_name = 'buildUseType' THEN a.field_value END) AS buildUseType,
MAX(CASE WHEN a.field_name = 'structureType' THEN a.field_value END) AS structureType,
MAX(CASE WHEN a.field_name = 'address' THEN a.field_value END) AS address
FROM `wl_form_instance` a
WHERE a.instance_id = #{instanceId}
GROUP BY a.instance_id
) fi
</select>
<select id="getFormInstanceById" resultType="java.util.Map">
......@@ -346,7 +329,8 @@
GROUP BY
a.instance_id
) sa
LEFT JOIN ( SELECT wlv.source_id, count( wlv.source_id ) AS total FROM `wl_video_source` wlv GROUP BY wlv.source_id ) b ON b.source_id = sa.instanceId
LEFT JOIN ( SELECT wlv.source_id, count( wlv.source_id ) AS total FROM `wl_video_source` wlv GROUP BY
wlv.source_id ) b ON b.source_id = sa.instanceId
union all
select
123456789123456789 as instanceId,
......@@ -419,8 +403,7 @@
biz_org_code,
biz_org_name,
source_id)
VALUES(
#{instanceId},
VALUES (#{instanceId},
#{code},
#{name},
#{address},
......@@ -432,23 +415,28 @@
#{instanceId})
</insert>
<select id="getStuctureName" resultType="String">
select full_name from wl_warehouse_structure
select full_name
from wl_warehouse_structure
where id = #{id}
</select>
<select id="getStuName" resultType="String">
select name from wl_warehouse_structure
select name
from wl_warehouse_structure
where id = #{id}
</select>
<select id="getStructureParentId" resultType="Long">
select parent_id from wl_warehouse_structure
select parent_id
from wl_warehouse_structure
where id = #{id}
</select>
<delete id="deleteStuById">
DELETE FROM wl_warehouse_structure WHERE id = #{id}
DELETE
FROM wl_warehouse_structure
WHERE id = #{id}
</delete>
<update id="updateStr">
update wl_warehouse_structure
set name = #{name} ,
set name = #{name},
full_name = #{fullName},
parent_id = #{parentId},
code = #{code},
......@@ -458,18 +446,23 @@
</update>
<update id="updateFormFieldValue">
update wl_form_instance
set
field_value = #{value}
where instance_id = #{id} AND field_name = #{name}
set field_value = #{value}
where instance_id = #{id}
AND field_name = #{name}
</update>
<update id="updateStrFullName">
update wl_warehouse_structure
set full_name=replace(full_name,#{name},#{fullName})
where
id in (
select instance_id from wl_form_instance where field_name = 'parentId' and field_value = #{id}
set full_name=replace(full_name, #{name}, #{fullName})
where id in (
select instance_id
from wl_form_instance
where field_name = 'parentId'
and field_value = #{id}
union all
select instance_id from wl_form_instance where field_name = 'parentId' and field_value in (
select instance_id
from wl_form_instance
where field_name = 'parentId'
and field_value in (
select instance_id from wl_form_instance where field_name = 'parentId' and field_value = #{id}
)
)
......@@ -482,8 +475,8 @@
</update>
<select id="getChildrenNotIsRiskList" resultType="com.yeejoin.equipmanage.common.entity.dto.BuildIsRiskDTO">
select * from (SELECT
a.instance_id AS instanceId,
select *
from (SELECT a.instance_id AS instanceId,
MAX(
CASE
WHEN a.field_name = 'parentId' THEN
......@@ -496,10 +489,11 @@
a.field_value
END
) AS isRisk
FROM
`wl_form_instance` a
GROUP BY
a.instance_id) sa where sa.parentId = #{instanceId} and sa.isRisk = 'false' and sa.isRisk is not null
FROM `wl_form_instance` a
GROUP BY a.instance_id) sa
where sa.parentId = #{instanceId}
and sa.isRisk = 'false'
and sa.isRisk is not null
</select>
<update id="clearRegionBind">
UPDATE
......@@ -512,101 +506,95 @@
''
END
)
WHERE
instance_id = #{instanceId} and (field_name = 'isRisk' or field_name = 'riskPointId')
WHERE instance_id = #{instanceId}
and (field_name = 'isRisk' or field_name = 'riskPointId')
</update>
<select id="getParentId" resultType="map">
select
*
from
wl_warehouse_structure
where
parent_id = #{parentId}
select *
from wl_warehouse_structure
where parent_id = #{parentId}
</select>
<select id="getIdAndType" resultType="hashmap">
select
ins.field_value as id,
select ins.field_value as id,
inst.group_code as type,
str.full_name as address
from
wl_form_instance as ins
from wl_form_instance as ins
left join wl_form_instance as inst on ins.field_value = inst.instance_id
left join wl_warehouse_structure as str on ins.instance_id = str.source_id
where ins.instance_id =#{id}
and ins.field_name ='parentId'
where ins.instance_id = #{id}
and ins.field_name = 'parentId'
group by ins.field_value
</select>
<!-- // 需求958 导出模板需要列表获取建筑 by kongfm 2021-09-15-->
<select id="getAllBuilding" resultType="hashmap">
select * from (SELECT
a.instance_id AS instanceId,
select *
from (SELECT a.instance_id AS instanceId,
a.group_code AS groupCode,
a.group_type AS groupType,
a.field_value AS fieldValue,
a.field_label AS fieldLabel,
MAX(CASE WHEN a.field_name = 'parentId' THEN a.field_value END) AS parentId,
MAX(CASE WHEN a.field_name = 'name' THEN a.field_value END)AS buildName
FROM
`wl_form_instance` a
MAX(CASE WHEN a.field_name = 'name' THEN a.field_value END) AS buildName
FROM `wl_form_instance` a
where a.group_type = 'building'
GROUP BY
a.instance_id) sa
GROUP BY a.instance_id) sa
ORDER BY sa.instanceId DESC
</select>
<select id="getBuildingToLongitudeAndLatitude" resultType="hashmap">
SELECT
max(CASe WHEN field_name = 'latitude' THEN field_value end ) AS latitude,
max(CASe WHEN field_name = 'longitude' THEN field_value end ) AS longitude
FROM
wl_form_instance
WHERE
instance_id = #{instanceId}
</select>
<!--<select id="getBuildVideoCount" resultType="hashmap">-->
<!-- SELECT-->
<!-- wlv.source_id AS buildId,-->
<!-- count( wlv.source_id ) AS total-->
<!-- FROM-->
<!-- `wl_video_source` wlv-->
<!-- GROUP BY-->
<!-- wlv.source_id-->
<!--</select>-->
<select id="getBuildVideoCount" resultType="hashmap">
SELECT
b.instanceId AS buildId,
COUNT( vs.video_id ) AS total
FROM
get_building_tree b
JOIN wl_video_source vs ON FIND_IN_SET( b.instanceId, vs.parent_source_ids )
<select id="getBuildingToLongitudeAndLatitude" resultType="hashmap">
SELECT max(CASe WHEN field_name = 'latitude' THEN field_value end) AS latitude,
max(CASe WHEN field_name = 'longitude' THEN field_value end) AS longitude
FROM wl_form_instance
WHERE instance_id = #{instanceId}
</select>
<!--<select id="getBuildVideoCount" resultType="hashmap">-->
<!-- SELECT-->
<!-- wlv.source_id AS buildId,-->
<!-- count( wlv.source_id ) AS total-->
<!-- FROM-->
<!-- `wl_video_source` wlv-->
<!-- GROUP BY-->
<!-- wlv.source_id-->
<!--</select>-->
<select id="getBuildVideoCount" resultType="hashmap">
SELECT b.instanceId AS buildId,
COUNT(vs.video_id) AS total
FROM get_building_tree b
JOIN wl_video_source vs ON FIND_IN_SET(b.instanceId, vs.parent_source_ids)
JOIN wl_video v on v.id = vs.video_id
GROUP BY
b.instanceId
</select>
<update id ="updateFormInstanceByInstanceAndFieldName">
GROUP BY b.instanceId
</select>
<update id="updateFormInstanceByInstanceAndFieldName">
UPDATE wl_form_instance
SET field_value = #{value}
WHERE
instance_id =#{instanceId}
AND field_name =#{name}
UPDATE wl_form_instance
SET field_value = #{value}
WHERE instance_id = #{instanceId}
AND field_name = #{name}
</update>
</update>
<select id="selectChildListdate" resultType="java.lang.String">
SELECT distinct a.instance_id FROM
(select instance_id ,field_value from wl_form_instance where group_type in('building','room','floor') and field_name='parentId') a
WHERE a.field_value = #{id} union all SELECT distinct b.instance_id FROM
(select instance_id ,field_value from wl_form_instance where group_type in('building','room','floor') and field_name='parentId') b
WHERE b.field_value in (SELECT distinct c.instance_id FROM
(select instance_id ,field_value from wl_form_instance where group_type in('building','room','floor') and field_name='parentId') c
SELECT distinct a.instance_id
FROM (select instance_id, field_value
from wl_form_instance
where group_type in ('building', 'room', 'floor')
and field_name = 'parentId') a
WHERE a.field_value = #{id}
union all
SELECT distinct b.instance_id
FROM (select instance_id, field_value
from wl_form_instance
where group_type in ('building', 'room', 'floor')
and field_name = 'parentId') b
WHERE b.field_value in (SELECT distinct c.instance_id
FROM (select instance_id, field_value
from wl_form_instance
where group_type in ('building', 'room', 'floor')
and field_name = 'parentId') c
WHERE c.field_value = #{id})
</select>
......@@ -648,9 +636,14 @@ AND field_name =#{name}
<select id="queryVideoCountByBizOrgCode" resultType="java.lang.Long">
select count(1) from wl_video where biz_org_code like concat(#{bizOrgCode}, '%')
select count(1)
from wl_video
where biz_org_code like concat(#{bizOrgCode}, '%')
</select>
<select id="selectParentBuildId" resultType="java.lang.String">
SELECT instance_id FROM `wl_form_instance` f where f.field_name = 'code' and f.field_value = #{code}
SELECT instance_id
FROM `wl_form_instance` f
where f.field_name = 'code'
and f.field_value = #{code}
</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