Commit 0f3bcc55 authored by KeYong's avatar KeYong

Merge branch 'develop_dl_bugfix' of http://36.40.66.175:5000/moa/amos-boot-biz…

Merge branch 'develop_dl_bugfix' of http://36.40.66.175:5000/moa/amos-boot-biz into develop_dl_bugfix
parents c724a94c b4b9ec61
package com.yeejoin.amos.boot.module.common.api.interceptor;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.plugin.*;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Component;
import org.springframework.util.ReflectionUtils;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Properties;
@Component
// 标志该类是一个拦截器
// {@Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})}
@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
*/
public Object intercept(Invocation invocation) throws Throwable {
System.out.println("====intercept======");
Object[] args = invocation.getArgs();
MappedStatement mappedStatement = (MappedStatement) args[0];
Object parameter = args[1];
RowBounds rowBounds = (RowBounds) args[2];
ResultHandler resultHandler = (ResultHandler) args[3];
Executor executor = (Executor) invocation.getTarget();
CacheKey cacheKey;
BoundSql boundSql;
//由于逻辑关系,只会进入一次
if (args.length == 4) {
//4 个参数时
boundSql = mappedStatement.getBoundSql(parameter);
cacheKey = executor.createCacheKey(mappedStatement, parameter, rowBounds, boundSql);
} else {
//6 个参数时
cacheKey = (CacheKey) args[4];
boundSql = (BoundSql) args[5];
}
//id为执行的mapper方法的全路径名,如com.metro.dao.UserMapper.insertUser
String id = mappedStatement.getId();
//获取到原始sql语句
String sql = boundSql.getSql();
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");
}
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语句
Field field = boundSql.getClass().getDeclaredField("sql");
ReflectionUtils.makeAccessible(field);
field.set(boundSql, sql);
return executor.query(mappedStatement, parameter, rowBounds, resultHandler, cacheKey, boundSql);
} else {
return invocation.proceed();
}
}
public Object plugin(Object target) {
System.out.println("-----------------------------plugin-------------------------");
return Plugin.wrap(target, this);
}
public void setProperties(Properties properties) {
System.out.println("====setProperties======");
}
}
\ No newline at end of file
...@@ -45,76 +45,60 @@ ...@@ -45,76 +45,60 @@
GROUP BY s.duty_date) b) as maxShiftNumDay GROUP BY s.duty_date) b) as maxShiftNumDay
</select> </select>
<select id="bankViewData" resultType="java.util.Map"> <select id="bankViewData" resultType="java.util.Map">
SELECT SELECT S1.*,
S1.*,
S2.name as shiftName S2.name as shiftName
from from (SELECT s.shift_id as shiftId,
(SELECT
s.shift_id as shiftId,
GROUP_CONCAT(i.field_value) AS userName GROUP_CONCAT(i.field_value) AS userName
FROM FROM cb_duty_person_shift s,
cb_duty_person_shift s,
cb_duty_shift ds, cb_duty_shift ds,
cb_dynamic_form_instance i cb_dynamic_form_instance i
WHERE WHERE s.instance_id = i.instance_id
s.instance_id = i.instance_id
AND ds.sequence_nbr = s.shift_id AND ds.sequence_nbr = s.shift_id
AND i.field_code = 'userName' AND i.field_code = 'userName'
AND s.duty_date = #{dutyDate} AND s.duty_date = #{dutyDate}
AND s.shift_id is not null AND s.shift_id is not null
AND s.app_key = #{appKey} AND s.app_key = #{appKey}
and i.group_code =#{groupCode} and i.group_code = #{groupCode}
GROUP BY GROUP BY s.shift_id
s.shift_id
) S1, ) S1,
cb_duty_shift S2 cb_duty_shift S2
where where s1.shiftId = s2.sequence_nbr
s1.shiftId = s2.sequence_nbr
</select> </select>
<select id="stationViewData" resultType="java.util.Map"> <select id="stationViewData" resultType="java.util.Map">
select select i.field_value as postTypeName,
i.field_value as postTypeName,
count(1) as total count(1) as total
from from cb_duty_person_shift s,
cb_duty_person_shift s,
cb_dynamic_form_instance i cb_dynamic_form_instance i
where where s.instance_id = i.instance_id
s.instance_id = i.instance_id
and i.field_code = 'postTypeName' and i.field_code = 'postTypeName'
AND s.duty_date = #{dutyDate} AND s.duty_date = #{dutyDate}
AND s.shift_id is not null AND s.shift_id is not null
AND s.app_key = #{appKey} AND s.app_key = #{appKey}
and i.group_code =#{groupCode} and i.group_code = #{groupCode}
GROUP BY i.field_value GROUP BY i.field_value
</select> </select>
<select id="newStationViewData" resultType="java.util.Map"> <select id="newStationViewData" resultType="java.util.Map">
select select i.field_value as postTypeName,
i.field_value as postTypeName,
count(1) as total count(1) as total
from from cb_duty_person_shift s,
cb_duty_person_shift s,
cb_dynamic_form_instance i cb_dynamic_form_instance i
where where s.instance_id = i.instance_id
s.instance_id = i.instance_id
and i.field_code = 'postTypeName' and i.field_code = 'postTypeName'
AND s.duty_date = #{dutyDate} AND s.duty_date = #{dutyDate}
AND s.shift_id is not null AND s.shift_id is not null
and i.group_code =#{groupCode} and i.group_code = #{groupCode}
GROUP BY i.field_value GROUP BY i.field_value
</select> </select>
<select id="newStationViewDataByFieldCode" resultType="java.util.Map"> <select id="newStationViewDataByFieldCode" resultType="java.util.Map">
select select i.field_value as postTypeName,
i.field_value as postTypeName,
count(1) as total count(1) as total
from from cb_duty_person_shift s,
cb_duty_person_shift s,
cb_dynamic_form_instance i cb_dynamic_form_instance i
where where s.instance_id = i.instance_id
s.instance_id = i.instance_id
and i.field_code = #{fieldCode} and i.field_code = #{fieldCode}
AND s.duty_date = #{dutyDate} AND s.duty_date = #{dutyDate}
AND s.shift_id is not null 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 is not null
AND i.field_value != '' AND i.field_value != ''
GROUP BY i.field_value GROUP BY i.field_value
...@@ -124,7 +108,8 @@ ...@@ -124,7 +108,8 @@
i.field_value AS postTypeName, i.field_value AS postTypeName,
count( 1 ) AS total, count( 1 ) AS total,
d.`code`, 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 FROM
cb_duty_person_shift s, cb_duty_person_shift s,
cb_dynamic_form_instance i cb_dynamic_form_instance i
...@@ -196,15 +181,15 @@ ...@@ -196,15 +181,15 @@
b.id b.id
</select> </select>
<select id="genRangeDate" resultType="map"> <select id="genRangeDate" resultType="map">
SELECT SELECT DATE_FORMAT(DATE( DATE_ADD( #{beginDate}, INTERVAL @s DAY)), '%Y-%m-%d') AS date,
DATE_FORMAT(DATE( DATE_ADD( #{beginDate}, INTERVAL @s DAY )),'%Y-%m-%d') AS date,
@s := @s + 1 AS `index` @s := @s + 1 AS `index`
FROM FROM
mysql.help_topic, mysql.help_topic,
( SELECT @s := 0 ) temp ( SELECT @s := 0 ) temp
WHERE WHERE
@s <![CDATA[<=]]> @s <![CDATA[<=]]>
DATEDIFF(#{endDate},#{beginDate}) DATEDIFF(#{endDate}
, #{beginDate})
</select> </select>
...@@ -236,7 +221,7 @@ ...@@ -236,7 +221,7 @@
and cd.field_value !='消防车驾驶员' and cd.field_value !='消防车驾驶员'
</if> </if>
AND cd.instance_id IN 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} #{instanceId}
</foreach> </foreach>
GROUP BY GROUP BY
...@@ -244,7 +229,7 @@ ...@@ -244,7 +229,7 @@
</select> </select>
<select id='getEquipmentForSpecifyDate' resultType='map'> <select id='getEquipmentForSpecifyDate' resultType='map'>
select * from ( select * from (
SELECT SELECT
MAX( MAX(
CASE CASE
...@@ -290,14 +275,20 @@ select * from ( ...@@ -290,14 +275,20 @@ select * from (
where cd.group_code =#{groupCode} and cds.instance_id is not null and where cd.group_code =#{groupCode} and cds.instance_id is not null and
cd.is_delete=0 cd.is_delete=0
group by cd.instance_id group by cd.instance_id
) result ) result
<if test="groupByName != null and groupByName!='' "> <if test="groupByName != null and groupByName!='' and groupByName=='result.carId'">
group by ${groupByName} group by result.carId
</if>
<if test="groupByName != null and groupByName!='' and groupByName=='result.fireFightingId'">
group by result.fireFightingId
</if>
<if test="groupByName != null and groupByName!='' and groupByName=='result.firstAidId'">
group by result.firstAidId
</if> </if>
</select> </select>
<select id='getNewEquipmentForSpecifyDate' resultType='map'> <select id='getNewEquipmentForSpecifyDate' resultType='map'>
select * from ( select * from (
SELECT SELECT
MAX( MAX(
CASE CASE
...@@ -333,31 +324,25 @@ select * from ( ...@@ -333,31 +324,25 @@ select * from (
where cd.group_code =#{groupCode} and cds.instance_id is not null and where cd.group_code =#{groupCode} and cds.instance_id is not null and
cd.is_delete=0 cd.is_delete=0
group by cd.instance_id group by cd.instance_id
) result ) result
<if test="groupByName != null and groupByName!='' "> <if test="groupByName != null and groupByName!='' and groupByName=='result.deptId'">
group by ${groupByName} group by result.deptId
</if> </if>
</select> </select>
<select id='getInstanceIdForSpecifyDateAndEquipment' <select id='getInstanceIdForSpecifyDateAndEquipment'
resultType='map'> resultType='map'>
SELECT SELECT GROUP_CONCAT(cd.instance_id) as instanceIds
GROUP_CONCAT(cd.instance_id) as instanceIds FROM cb_dynamic_form_instance cd
FROM
cb_dynamic_form_instance cd
LEFT JOIN ( LEFT JOIN (
SELECT SELECT dp.instance_id,
dp.instance_id,
ds.`name` ds.`name`
FROM FROM cb_duty_person_shift dp
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE WHERE dp.duty_date = #{dutyDate}
dp.duty_date = #{dutyDate}
AND dp.is_delete = 0 AND dp.is_delete = 0
) cds ON cd.instance_id = cds.instance_id ) cds ON cd.instance_id = cds.instance_id
WHERE WHERE cd.group_code = #{groupCode}
cd.group_code = #{groupCode}
AND cds.instance_id IS NOT NULL AND cds.instance_id IS NOT NULL
AND cd.is_delete = 0 AND cd.is_delete = 0
AND cd.field_value = #{targetId} AND cd.field_value = #{targetId}
...@@ -365,7 +350,7 @@ select * from ( ...@@ -365,7 +350,7 @@ select * from (
<select id='getEquipmentOperator' resultType='map'> <select id='getEquipmentOperator' resultType='map'>
SELECT SELECT
result.userName result.userName
FROM FROM
( (
SELECT SELECT
MAX( MAX(
...@@ -399,20 +384,20 @@ FROM ...@@ -399,20 +384,20 @@ FROM
AND cds.instance_id IS NOT NULL AND cds.instance_id IS NOT NULL
AND cd.is_delete = 0 AND cd.is_delete = 0
AND cd.instance_id IN 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} #{instanceId}
</foreach> </foreach>
) result ) result
WHERE WHERE
result.postTypeName = #{operator} and result.name =#{duty} result.postTypeName = #{operator} and result.name =#{duty}
</select> </select>
<select id ='getPositionStaffDutyForSpecifyDate' resultType="map"> <select id='getPositionStaffDutyForSpecifyDate' resultType="map">
SELECT SELECT
GROUP_CONCAT(ss.userName) AS userName, GROUP_CONCAT(ss.userName) AS userName,
ss.postTypeName ss.postTypeName
FROM FROM
( (
SELECT SELECT
MAX( MAX(
...@@ -444,7 +429,7 @@ FROM ...@@ -444,7 +429,7 @@ FROM
cb_dynamic_form_instance cd cb_dynamic_form_instance cd
WHERE WHERE
cd.instance_id in 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} #{instanceId}
</foreach> </foreach>
AND cd.group_code = #{groupCode} AND cd.group_code = #{groupCode}
...@@ -452,7 +437,7 @@ FROM ...@@ -452,7 +437,7 @@ FROM
GROUP BY GROUP BY
cd.instance_id cd.instance_id
) ss ) ss
<!-- LEFT JOIN ( <!-- LEFT JOIN (
SELECT SELECT
dp.instance_id, dp.instance_id,
ds.`name` ds.`name`
...@@ -463,72 +448,58 @@ FROM ...@@ -463,72 +448,58 @@ FROM
dp.duty_date = #{dutyDate} dp.duty_date = #{dutyDate}
AND dp.is_delete = 0 AND dp.is_delete = 0
AND NAME IS NOT NULL AND NAME IS NOT NULL
) cds ON ss.instance_id = cds.instance_id ) cds ON ss.instance_id = cds.instance_id
WHERE WHERE
cds.NAME =#{duty} --> cds.NAME =#{duty} -->
GROUP BY GROUP BY
ss.postTypeName ss.postTypeName
</select> </select>
<select id='getDutyForSpecifyDate' resultType="map"> <select id='getDutyForSpecifyDate' resultType="map">
SELECT SELECT ds.`name`
ds.`name` FROM cb_duty_person_shift dp
FROM LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
cb_duty_person_shift dp WHERE dp.duty_date = #{dutyDate}
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr AND dp.is_delete = 0
WHERE AND NAME IS NOT NULL
dp.duty_date = #{dutyDate} GROUP BY NAME
AND dp.is_delete = 0 </select>
AND NAME IS NOT NULL
GROUP BY
NAME
</select>
<select id='getFireTeamBySequenceNbr' resultType="map"> <select id='getFireTeamBySequenceNbr' resultType="map">
SELECT SELECT name
name FROM cb_fire_team
FROM WHERE sequence_nbr = #{sequenceNbr}
cb_fire_team and is_delete = 0
WHERE
sequence_nbr = #{sequenceNbr} and is_delete=0
</select> </select>
<select id='getFirstAidCompanyId' resultType="string"> <select id='getFirstAidCompanyId' resultType="string">
SELECT SELECT sequence_nbr
sequence_nbr FROM cb_org_usr a
FROM WHERE a.is_delete = 0
cb_org_usr a AND a.biz_org_name = '消防救援保障部'
WHERE
a.is_delete = 0
AND
a.biz_org_name = '消防救援保障部'
</select> </select>
<select id='getFirstAidForTypeCodeAndCompanyId' resultType="map"> <select id='getFirstAidForTypeCodeAndCompanyId' resultType="map">
SELECT SELECT cft.name,
cft.name,
cft.sequence_nbr cft.sequence_nbr
FROM FROM cb_fire_team cft
cb_fire_team cft WHERE cft.is_delete = 0
WHERE AND cft.type_code = (
cft.is_delete = 0 SELECT CODE
AND cft.type_code = ( FROM cb_data_dictionary cd
SELECT WHERE cd.name = '企(事)业单位医疗救援队(站)'
CODE
FROM
cb_data_dictionary cd
WHERE
cd.name = '企(事)业单位医疗救援队(站)'
AND cd.type = 'XFJGLX' AND cd.type = 'XFJGLX'
) )
AND cft.company = #{company} AND cft.company = #{company}
</select> </select>
<select id='queryByCompanyId' resultType="map"> <select id='queryByCompanyId' resultType="map">
select biz_org_name as bizOrgName,sequence_nbr sequenceNbr,field_value as telephone, amosUserId,companyName from ( 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 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 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_org_usr cou1 on orgUsr.parent_id = cou1.sequence_nbr
left join cb_dynamic_form_instance i on orgUsr.sequence_nbr = left join cb_dynamic_form_instance i on orgUsr.sequence_nbr =
...@@ -554,24 +525,38 @@ AND cft.type_code = ( ...@@ -554,24 +525,38 @@ AND cft.type_code = (
<select id='queryByCompanyNew' resultType="map"> <select id='queryByCompanyNew' resultType="map">
select biz_org_name as bizOrgName,sequence_nbr sequenceNbr,field_value as telephone, amosUserId,companyName from ( select biz_org_name as bizOrgName, sequence_nbr sequenceNbr, field_value as telephone, amosUserId, companyName
select orgUsr.biz_org_name,i.field_value,orgUsr.sequence_nbr,orgUsr.amos_org_id amosUserId, cou1.biz_org_name companyName from (
from (select * from cb_org_usr cou where is_delete = 0 ) orgUsr 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_org_usr cou1 on orgUsr.parent_id = cou1.sequence_nbr
left join cb_dynamic_form_instance i on orgUsr.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 ( where d.sequence_nbr in (
select userId from ( select userId
select cb.duty_date,a.deptId,c.userId from cb_duty_person_shift cb from (
left join (select i.instance_id id1 ,if(i.field_code = 'deptId', select cb.duty_date, a.deptId, c.userId
i.field_value, null) as 'deptId' from cb_dynamic_form_instance i from cb_duty_person_shift cb
where i.field_code = 'deptId' and i.field_value is not null) a 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 on cb.instance_id = a.id1
left join (select i.instance_id id3 ,if(i.field_code = 'userId', left join (select i.instance_id id3,
i.field_value, null) as 'userId' from cb_dynamic_form_instance i if(i.field_code = 'userId',
where i.field_code = 'userId' and i.field_value is not null) c 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 on cb.instance_id = c.id3
where to_days(cb.duty_date) = to_days(now()) and where to_days(cb.duty_date) = to_days(now())
a.deptId in ( select sequence_nbr from cb_org_usr cou where biz_org_name = #{bizOrgName})) r ) and a.deptId in (select sequence_nbr from cb_org_usr cou where biz_org_name = #{bizOrgName})) r)
</select> </select>
</mapper> </mapper>
...@@ -33,18 +33,24 @@ ...@@ -33,18 +33,24 @@
( SELECT ( SELECT
v.`instance_id`, 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 '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 '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 '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 '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 '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 'administrativePositionCode' then IFNULL(v.field_value_label,v.field_value) end)
max(case v.field_code when 'internalPositionCode' then IFNULL(v.field_value_label,v.field_value) end) internalPositionCode, administrativePositionCode,
max(case v.field_code when 'fireManagementPostCode' then IFNULL(v.field_value_label,v.field_value) end) fireManagementPostCode, 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 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 '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 '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 '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, max(case v.field_code when 'personImg' then IFNULL(v.field_value_label,v.field_value) end) personImg,
...@@ -110,10 +116,8 @@ ...@@ -110,10 +116,8 @@
<foreach collection="map.fieldsValue.keys" item="item"> <foreach collection="map.fieldsValue.keys" item="item">
<if test="item != 'bizOrgName'"> <if test="item != 'bizOrgName'">
AND a.${item} = #{map.fieldsValue[#{item}]} AND a.item = ietmValue
</if> </if>
</foreach> </foreach>
</if> </if>
</select> </select>
...@@ -131,8 +135,10 @@ ...@@ -131,8 +135,10 @@
u.person_status personStatus, u.person_status personStatus,
u.rec_date recDate, u.rec_date recDate,
(select biz_org_name from cb_org_usr where sequence_nbr = u.parent_id) as companyName, (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
(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', 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.* g.*
FROM FROM
cb_org_usr u cb_org_usr u
...@@ -141,20 +147,27 @@ ...@@ -141,20 +147,27 @@
( SELECT ( SELECT
v.`instance_id`, 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 '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 '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 '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 '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 '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 'administrativePositionCode' then IFNULL(v.field_value_label,v.field_value) end)
max(case v.field_code when 'internalPositionCode' then IFNULL(v.field_value_label,v.field_value) end) internalPositionCode, administrativePositionCode,
max(case v.field_code when 'fireManagementPostCode' then IFNULL(v.field_value_label,v.field_value) end) fireManagementPostCode, 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 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,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 '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 '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 '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, max(case v.field_code when 'personImg' then IFNULL(v.field_value_label,v.field_value) end) personImg,
...@@ -218,7 +231,7 @@ ...@@ -218,7 +231,7 @@
<if test="map.fieldsValue != null"> <if test="map.fieldsValue != null">
<foreach collection="map.fieldsValue.keys" item="item"> <foreach collection="map.fieldsValue.keys" item="item">
<if test="item != 'bizOrgName'"> <if test="item != 'bizOrgName'">
AND a.${item} = #{map.fieldsValue[#{item}]} AND a.item = ietmValue
</if> </if>
</foreach> </foreach>
</if> </if>
...@@ -250,8 +263,9 @@ ...@@ -250,8 +263,9 @@
u.biz_org_name bizOrgName, u.biz_org_name bizOrgName,
u.biz_org_code bizOrgCode, u.biz_org_code bizOrgCode,
<if test="fields != null"> <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
end) ${item} IFNULL(v.field_value_label, v.field_value)
end) as #{item}
</foreach> </foreach>
</if> </if>
FROM FROM
...@@ -366,8 +380,7 @@ ...@@ -366,8 +380,7 @@
</select> </select>
<select id="selectOrgUsrList" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto"> <select id="selectOrgUsrList" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto">
SELECT DISTINCT SELECT DISTINCT cb_org_usr.sequence_nbr,
cb_org_usr.sequence_nbr ,
cb_org_usr.biz_org_name, cb_org_usr.biz_org_name,
cb_org_usr.biz_org_code, cb_org_usr.biz_org_code,
cb_org_usr.amos_org_id, cb_org_usr.amos_org_id,
...@@ -377,11 +390,11 @@ ...@@ -377,11 +390,11 @@
cb_org_usr.build_id, cb_org_usr.build_id,
cb_org_usr.parent_id, cb_org_usr.parent_id,
cb_contract.sequence_nbr as contract_id cb_contract.sequence_nbr as contract_id
FROM FROM cb_org_usr
cb_org_usr LEFT JOIN cb_contract on cb_org_usr.sequence_nbr = cb_contract.signed_company_id and
LEFT JOIN cb_contract on cb_org_usr.sequence_nbr = cb_contract.signed_company_id and cb_contract.company_id = #{seq} cb_contract.company_id = #{seq}
WHERE WHERE cb_org_usr.sequence_nbr IN
cb_org_usr.sequence_nbr IN ( SELECT DISTINCT signed_company_id FROM cb_contract WHERE company_id = #{seq} and is_delete = 0 ) (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.biz_org_type = "COMPANY"
AND cb_org_usr.is_delete = 0 AND cb_org_usr.is_delete = 0
</select> </select>
...@@ -400,7 +413,8 @@ ...@@ -400,7 +413,8 @@
Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) AS distance, 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 case when cks_d.count is null then 0 else cks_d.count end as keySiteNum
FROM important_companys a left join ( 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 )cks_d
on a.id=cks_d.belong_id on a.id=cks_d.belong_id
where a.longitude is not null and a.latitude is not null and a.keySiteCompany = 1 where a.longitude is not null and a.latitude is not null and a.keySiteCompany = 1
...@@ -423,38 +437,39 @@ ...@@ -423,38 +437,39 @@
</select> </select>
<select id="getOrgUsrzhDto" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrzhDto"> <select id="getOrgUsrzhDto" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrzhDto">
SELECT SELECT a.biz_org_name bizOrgName,
a.biz_org_name bizOrgName,
a.build_name buildName, a.build_name buildName,
a.build_id buildId, a.build_id buildId,
c.keySiteCount keySiteCount, c.keySiteCount keySiteCount,
( SELECT v.biz_org_name FROM cb_org_usr v WHERE v.sequence_nbr = a.parent_id ) parentName, (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
max( CASE b.field_code WHEN 'companyFemaleEmployees' THEN b.field_value ELSE "" END ) AS 'companyFemaleEmployees', WHEN 'businessCategory' THEN b.field_value_label
max( CASE b.field_code WHEN 'companyLocation' THEN b.field_value ELSE "" END ) AS 'companyLocation', ELSE "" END) AS 'businessCategory',
max( CASE b.field_code WHEN 'companyMaleEmployees' THEN b.field_value ELSE "" END ) AS 'companyMaleEmployees', max(CASE b.field_code
max( CASE b.field_code WHEN 'companyNature' THEN b.field_value_label ELSE "" END ) AS 'companyNature', WHEN 'companyFemaleEmployees' THEN b.field_value
max( CASE b.field_code WHEN 'companyPhone' THEN b.field_value ELSE "" END ) AS 'companyPhone', ELSE "" END) AS 'companyFemaleEmployees',
max( CASE b.field_code WHEN 'companyPhoto' THEN b.field_value ELSE "" END ) AS 'companyPhoto', max(CASE b.field_code WHEN 'companyLocation' THEN b.field_value ELSE "" END) AS 'companyLocation',
max( CASE b.field_code WHEN 'managementType' THEN b.field_value_label ELSE "" END ) AS 'managementType' max(CASE b.field_code
FROM WHEN 'companyMaleEmployees' THEN b.field_value
cb_org_usr a 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 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 LEFT JOIN (select belong_id belongId, count(*) keySiteCount from cb_key_site group by belong_id) c
WHERE on c.belongId = a.sequence_nbr
a.biz_org_name = #{bizOrgName} WHERE a.biz_org_name = #{bizOrgName}
</select> </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 SELECT result_main.sequenceNbr AS sequenceNbr,
result_main.sequenceNbr AS sequenceNbr,
result_main.bizOrgName AS bizOrgName, result_main.bizOrgName AS bizOrgName,
result_main.parentId AS parentId, result_main.parentId AS parentId,
result_main.num1 + result_main.num2 AS num result_main.num1 + result_main.num2 AS num
FROM FROM (
( SELECT CASE
SELECT
CASE
WHEN result1.num IS NULL THEN WHEN result1.num IS NULL THEN
0 0
ELSE ELSE
...@@ -469,10 +484,8 @@ FROM ...@@ -469,10 +484,8 @@ FROM
result1.sequenceNbr, result1.sequenceNbr,
result1.bizOrgName, result1.bizOrgName,
result1.parentId result1.parentId
FROM FROM (
( SELECT company_sur.sequence_nbr AS sequenceNbr,
SELECT
company_sur.sequence_nbr AS sequenceNbr,
company_sur.biz_org_name AS bizOrgName, company_sur.biz_org_name AS bizOrgName,
company_sur.parent_id AS parentId, company_sur.parent_id AS parentId,
CASE CASE
...@@ -481,33 +494,24 @@ FROM ...@@ -481,33 +494,24 @@ FROM
ELSE ELSE
keysite_sur.num keysite_sur.num
END AS num END AS num
FROM FROM (
( SELECT company.sequence_nbr,
SELECT
company.sequence_nbr,
company.parent_id, company.parent_id,
company.biz_org_name company.biz_org_name
FROM FROM cb_org_usr company
cb_org_usr company WHERE company.biz_org_type = 'COMPANY'
WHERE
company.biz_org_type = 'COMPANY'
AND company.is_delete = FALSE AND company.is_delete = FALSE
) company_sur ) company_sur
LEFT JOIN ( LEFT JOIN (
SELECT SELECT keysite.belong_id,
keysite.belong_id,
COUNT(keysite.belong_id) AS num COUNT(keysite.belong_id) AS num
FROM FROM cb_key_site keysite
cb_key_site keysite WHERE keysite.is_delete = FALSE
WHERE GROUP BY keysite.belong_id
keysite.is_delete = FALSE
GROUP BY
keysite.belong_id
) keysite_sur ON company_sur.sequence_nbr = keysite_sur.belong_id ) keysite_sur ON company_sur.sequence_nbr = keysite_sur.belong_id
) result1 ) result1
LEFT JOIN ( LEFT JOIN (
SELECT SELECT company_sur.sequence_nbr AS sequenceNbr,
company_sur.sequence_nbr AS sequenceNbr,
company_sur.biz_org_name AS bizOrgName, company_sur.biz_org_name AS bizOrgName,
company_sur.parent_id AS parentId, company_sur.parent_id AS parentId,
CASE CASE
...@@ -516,40 +520,29 @@ LEFT JOIN ( ...@@ -516,40 +520,29 @@ LEFT JOIN (
ELSE ELSE
keysite_sur.num keysite_sur.num
END AS num END AS num
FROM FROM (
( SELECT company.sequence_nbr,
SELECT
company.sequence_nbr,
company.parent_id, company.parent_id,
company.biz_org_name company.biz_org_name
FROM FROM cb_org_usr company
cb_org_usr company WHERE company.biz_org_type = 'COMPANY'
WHERE
company.biz_org_type = 'COMPANY'
AND company.is_delete = FALSE AND company.is_delete = FALSE
) company_sur ) company_sur
LEFT JOIN ( LEFT JOIN (
SELECT SELECT keysite.belong_id,
keysite.belong_id,
COUNT(keysite.belong_id) AS num COUNT(keysite.belong_id) AS num
FROM FROM cb_key_site keysite
cb_key_site keysite WHERE keysite.is_delete = FALSE
WHERE GROUP BY keysite.belong_id
keysite.is_delete = FALSE
GROUP BY
keysite.belong_id
) keysite_sur ON company_sur.sequence_nbr = keysite_sur.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 ) result_main
GROUP BY GROUP BY result_main.sequenceNbr
result_main.sequenceNbr </select>
</select>
<select id="getparent" resultType="Map"> <select id="getparent" resultType="Map">
SELECT important_companys.id ,important_companys.name SELECT important_companys.id, important_companys.name
FROM important_companys FROM important_companys
...@@ -783,7 +776,7 @@ GROUP BY ...@@ -783,7 +776,7 @@ GROUP BY
</if> </if>
</select> </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 SELECT
company_sur.sequence_nbr as sequenceNbr, company_sur.sequence_nbr as sequenceNbr,
...@@ -791,9 +784,11 @@ GROUP BY ...@@ -791,9 +784,11 @@ GROUP BY
company_sur.biz_org_code as bizOrgCode, company_sur.biz_org_code as bizOrgCode,
company_sur.parent_id as parentId, company_sur.parent_id as parentId,
company_sur.biz_org_type as bizOrgType, company_sur.biz_org_type as bizOrgType,
-- cb.field_value_label, -- 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
(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, 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 CASE
WHEN keysite_sur.num IS NULL THEN WHEN keysite_sur.num IS NULL THEN
0 0
...@@ -828,9 +823,10 @@ GROUP BY ...@@ -828,9 +823,10 @@ GROUP BY
GROUP BY GROUP BY
keysite.belong_id keysite.belong_id
) keysite_sur ON company_sur.sequence_nbr = keysite_sur.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--> <!--BUG2657 导出选中单位及子单位人员数据 by kongfm-->
<select id="exportPersonToExcelByParentId" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrExcelDto"> <select id="exportPersonToExcelByParentId" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrExcelDto">
...@@ -881,48 +877,43 @@ GROUP BY ...@@ -881,48 +877,43 @@ GROUP BY
<select id="amosIdExistTeam" resultType="int"> <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> </select>
<update id="updatelistByParentId"> <update id="updatelistByParentId">
UPDATE cb_org_usr 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}, '%'); WHERE biz_org_code like concat(#{code}, '%');
</update> </update>
<update id="updatePersonStatus"> <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> </update>
<select id ='getPersonSimpleDetail' resultType='Map'> <select id='getPersonSimpleDetail' resultType='Map'>
SELECT SELECT person.biz_org_name as name,
person.biz_org_name as name,
cdf.field_value as phone cdf.field_value as phone
FROM FROM (
( SELECT sequence_nbr,
SELECT
sequence_nbr,
biz_org_name biz_org_name
FROM FROM cb_org_usr
cb_org_usr WHERE biz_org_type = 'PERSON'
WHERE
biz_org_type = 'PERSON'
AND is_delete = 0 AND is_delete = 0
) person ) person
LEFT JOIN ( LEFT JOIN (
SELECT SELECT field_value,
field_value,
instance_id instance_id
FROM FROM cb_dynamic_form_instance
cb_dynamic_form_instance WHERE group_code = '246'
WHERE
group_code = '246'
AND field_code = 'telephone' AND field_code = 'telephone'
) cdf ON person.sequence_nbr = cdf.instance_id ) cdf ON person.sequence_nbr = cdf.instance_id
</select> </select>
<select id="countDeptByCompanyId" resultType="java.util.Map"> <select id="countDeptByCompanyId" resultType="java.util.Map">
SELECT (SELECT count(1) SELECT (SELECT count(1)
...@@ -933,7 +924,7 @@ LEFT JOIN ( ...@@ -933,7 +924,7 @@ LEFT JOIN (
sequence_nbr sequence_nbr
FROM cb_org_usr t1 FROM cb_org_usr t1
WHERE sequence_nbr IN 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} #{companyId}
</foreach> </foreach>
</select> </select>
...@@ -941,14 +932,17 @@ LEFT JOIN ( ...@@ -941,14 +932,17 @@ LEFT JOIN (
<select id="queryCompanyId" resultType="map"> <select id="queryCompanyId" resultType="map">
select d.*,cbo.biz_org_name companyName from ( select d.*,cbo.biz_org_name companyName from (
select cou.biz_org_name bizOrgName,cou.sequence_nbr sequenceNbr ,cou .parent_id parentId, 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', 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 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', 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' 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 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 and (d.fireManagementPostCode in
<foreach item="item" index="index" collection="codes" open="(" separator="," close=")"> <foreach item="item" index="index" collection="codes" open="(" separator="," close=")">
#{item} #{item}
...@@ -957,16 +951,30 @@ LEFT JOIN ( ...@@ -957,16 +951,30 @@ LEFT JOIN (
</select> </select>
<select id="queryCompanyIdNew" resultType="map"> <select id="queryCompanyIdNew" resultType="map">
select d.*,cbo.biz_org_name companyName from ( select d.*, cbo.biz_org_name companyName
select cou.biz_org_name bizOrgName,cou.sequence_nbr sequenceNbr ,cou .parent_id parentId, from (
a.administrativePositionCode, b.telephone, cou.amos_org_id amosUserId from ( select * from cb_org_usr cou where is_delete = 0 ) cou select cou.biz_org_name bizOrgName,
left join (select i.instance_id id1 ,if(i.field_code = 'administrativePositionCode', cou.sequence_nbr sequenceNbr,
i.field_value_label, null) as 'administrativePositionCode' from cb_dynamic_form_instance i where i.field_code = 'administrativePositionCode' cou.parent_id parentId,
and i.field_value_label is not null) a on cou .sequence_nbr = a.id1 a.administrativePositionCode,
inner join (select i.instance_id id2,if(i.field_code = 'telephone', b.telephone,
i.field_value, null) as 'telephone' from cb_dynamic_form_instance i where i.field_code = 'telephone' cou.amos_org_id amosUserId
and i.field_value is not null) b on cou .sequence_nbr = b.id2 from (select * from cb_org_usr cou where is_delete = 0) cou
) 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}) 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> </select>
...@@ -1010,48 +1018,48 @@ LEFT JOIN ( ...@@ -1010,48 +1018,48 @@ LEFT JOIN (
</where> </where>
</select> </select>
<select id="equipCompanyExport" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr"> <select id="equipCompanyExport" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT SELECT *
* FROM cb_org_usr
FROM WHERE is_delete = false
cb_org_usr AND biz_org_code LIKE CONCAT(#{bizOrgCode}, '%')
WHERE is_delete = false AND biz_org_code LIKE CONCAT(#{bizOrgCode}, '%') AND( biz_org_type = 'COMPANY' || biz_org_type = 'DEPARTMENT') AND (biz_org_type = 'COMPANY' || biz_org_type = 'DEPARTMENT')
</select> </select>
<select id="companyDeptListWithPersonCount" <select id="companyDeptListWithPersonCount"
resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr"> resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT SELECT usr.*,
usr.*, (select count(1)
(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 u
FROM where u.biz_org_type = 'PERSON'
cb_org_usr usr and u.is_delete = false
where and u.biz_org_code like CONCAT(usr.biz_org_code, '%')) as total
(usr.biz_org_type = 'COMPANY' OR usr.biz_org_type = 'DEPARTMENT') FROM cb_org_usr usr
where (usr.biz_org_type = 'COMPANY' OR usr.biz_org_type = 'DEPARTMENT')
and usr.is_delete = false and usr.is_delete = false
</select> </select>
<select id="companyDeptListWithPersonCountNew" <select id="companyDeptListWithPersonCountNew"
resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr"> resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT SELECT usr.*,
usr.*, (select count(1)
(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 u
FROM where u.biz_org_type = 'PERSON'
cb_org_usr usr and u.is_delete = false
where and u.biz_org_code like CONCAT(usr.biz_org_code, '%')) as total
(usr.biz_org_type = 'COMPANY' OR usr.biz_org_type = 'DEPARTMENT') and usr.biz_org_code like concat (#{bizOrgCode},'%') 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 and usr.is_delete = false
</select> </select>
<select id="companyTreeByUser" <select id="companyTreeByUser"
resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr"> resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT SELECT usr.*
usr.* FROM cb_org_usr usr
FROM where (usr.biz_org_type = 'COMPANY' OR usr.biz_org_type = 'DEPARTMENT')
cb_org_usr usr
where
(usr.biz_org_type = 'COMPANY' OR usr.biz_org_type = 'DEPARTMENT')
and usr.is_delete = false and usr.is_delete = false
and usr.biz_org_code like CONCAT(#{bizOrgCode},'%') and usr.biz_org_code like CONCAT(#{bizOrgCode}, '%')
</select> </select>
<select id="listByOrgTypes" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr"> <select id="listByOrgTypes" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
...@@ -1071,16 +1079,21 @@ LEFT JOIN ( ...@@ -1071,16 +1079,21 @@ LEFT JOIN (
</select> </select>
<select id="selectPersonone" resultType="Map"> <select id="selectPersonone" resultType="Map">
select group_concat( CONCAT( u.biz_org_name,' ', 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),"") IFNULL((select c.field_value
from cb_dynamic_form_instance c
where field_code = 'telephone' and c.instance_id = u.sequence_nbr), "")
)) name )) name
from cb_org_usr u LEFT JOIN from cb_org_usr u
cb_dynamic_form_instance g on g.instance_id=u.sequence_nbr LEFT JOIN
where u.biz_org_type='PERSON' and g.field_code='fireManagementPostCode' and g.field_value_label =#{name} and u.parent_id=#{id} 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 id="getParentList" resultType="java.lang.String">
select getParentList(#{id}) as id; select getParentList(#{id}) as id;
...@@ -1105,7 +1118,8 @@ LEFT JOIN ( ...@@ -1105,7 +1118,8 @@ LEFT JOIN (
CONCAT( CONCAT(
u.biz_org_name, 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 )) uname
FROM FROM
cb_org_usr u cb_org_usr u
...@@ -1119,7 +1133,8 @@ LEFT JOIN ( ...@@ -1119,7 +1133,8 @@ LEFT JOIN (
#{item} #{item}
</foreach>; </foreach>;
</select> </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 SELECT
* *
FROM FROM
...@@ -1189,21 +1204,26 @@ LEFT JOIN ( ...@@ -1189,21 +1204,26 @@ LEFT JOIN (
cfp.fire_management_post, cfp.fire_management_post,
cft.type_code, cft.type_code,
cf.certificate_number certificatesNumber, 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 = 'personNumber' AND dfi.instance_id
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'telephone' AND dfi.instance_id = u.sequence_nbr ) AS telephone, = 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, ( CASE WHEN cfp.post_qualification IS NULL or cfp.post_qualification = '' THEN 0 ELSE 1 END ) AS is_certificate,
IF 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, 1,
IF 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, 0,
2 2
) )
) AS is_firefighters, ) 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 cfp.job_title
FROM FROM
cb_org_usr u cb_org_usr u
...@@ -1220,86 +1240,74 @@ LEFT JOIN ( ...@@ -1220,86 +1240,74 @@ LEFT JOIN (
</select> </select>
<select id="companyTreeByUserToPatrolRoute" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr"> <select id="companyTreeByUserToPatrolRoute" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT SELECT usr.*,
usr.*, (select count(1)
(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 u
FROM where u.biz_org_type = 'PERSON'
cb_org_usr usr and u.is_delete = false
where and u.biz_org_code like CONCAT(usr.biz_org_code, '%')) as total
(usr.biz_org_type = 'COMPANY' OR usr.biz_org_type = 'DEPARTMENT') and usr.biz_org_code like concat (#{bizOrgCode},'%') 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 and usr.is_delete = false
</select> </select>
<select id="companyUserTreeByUserAndType" <select id="companyUserTreeByUserAndType"
resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr"> resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT SELECT usr.*
usr.* FROM cb_org_usr usr
FROM where usr.is_delete = false
cb_org_usr usr and usr.biz_org_code like CONCAT(#{bizOrgCode}, '%')
where
usr.is_delete = false
and usr.biz_org_code like CONCAT(#{bizOrgCode},'%')
</select> </select>
<select id="companyUserTreeByUserAndTypeALL" <select id="companyUserTreeByUserAndTypeALL"
resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr"> resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT SELECT usr.*
usr.* FROM cb_org_usr usr
FROM where usr.is_delete = false
cb_org_usr usr and usr.biz_org_code like CONCAT(#{bizorgcode}, '%')
where
usr.is_delete = false
and usr.biz_org_code like CONCAT(#{bizorgcode},'%')
GROUP BY biz_org_name GROUP BY biz_org_name
</select> </select>
<select id="getUserByPeopleTypeCount" resultType="Integer"> <select id="getUserByPeopleTypeCount" resultType="Integer">
select select count(*)
count(*)
from ( from (
SELECT SELECT DISTINCT u.sequence_nbr sequenceNbr,
DISTINCT
u.sequence_nbr sequenceNbr,
u.biz_org_name bizOrgName, u.biz_org_name bizOrgName,
g.telephone, g.telephone,
g.positionType g.positionType
FROM FROM cb_org_usr u
cb_org_usr u
LEFT JOIN LEFT JOIN
( SELECT (SELECT v.`instance_id`,
v.`instance_id`, max(case v.field_code when 'telephone' then IFNULL(v.field_value, '') end) telephone,
max(case v.field_code when 'telephone' then IFNULL(v.field_value,'') end) telephone, max(case v.field_code
max(case v.field_code when 'positionType' then IFNULL(v.field_value_label,'') end) positionType, 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 'peopleType' then IFNULL(v.field_value, '') end) peopleType
FROM FROM `cb_dynamic_form_instance` v
`cb_dynamic_form_instance` v WHERE v.group_code = 246
WHERE GROUP BY v.`instance_id`
v.group_code = 246
GROUP BY
v.`instance_id`
) g ) g
on u.sequence_nbr = g.instance_id on u.sequence_nbr = g.instance_id
where where u.biz_org_type = 'person'
u.biz_org_type = 'person' AND u.is_delete = 0
AND and g.peopleType = 1601
u.is_delete = 0
and g.peopleType=1601
GROUP BY GROUP BY u.sequence_nbr
u.sequence_nbr
order by u.rec_date desc order by u.rec_date desc
)a where a.sequenceNbr is not null ) a
where a.sequenceNbr is not null
</select> </select>
<select id="getUserByPeopleType" resultType="Map"> <select id="getUserByPeopleType" resultType="Map">
SET @rownum = #{map.pageNum}; SET
select @rownum =
@rownum := @rownum + 1 AS rownum, #{map.pageNum};
a.* from ( select @rownum := @rownum + 1 AS rownum,
a.*
from (
SELECT SELECT
DISTINCT DISTINCT
u.sequence_nbr sequenceNbr, u.sequence_nbr sequenceNbr,
...@@ -1311,9 +1319,9 @@ LEFT JOIN ( ...@@ -1311,9 +1319,9 @@ LEFT JOIN (
LEFT JOIN LEFT JOIN
( SELECT ( SELECT
v.`instance_id`, v.`instance_id`,
max(case v.field_code when 'telephone' then IFNULL(v.field_value,'') end) telephone, 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 '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 'peopleType' then IFNULL(v.field_value, '') end) peopleType
FROM FROM
`cb_dynamic_form_instance` v `cb_dynamic_form_instance` v
WHERE WHERE
...@@ -1330,12 +1338,16 @@ LEFT JOIN ( ...@@ -1330,12 +1338,16 @@ LEFT JOIN (
GROUP BY GROUP BY
u.sequence_nbr u.sequence_nbr
order by u.rec_date desc order by u.rec_date desc
)a where a.sequenceNbr is not null ) a
LIMIT #{map.pageNum}, #{map.pageSize} where a.sequenceNbr is not null
LIMIT #{map.pageNum}
, #{map.pageSize}
</select> </select>
<select id="selectStaticFire" resultType="java.util.Map"> <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' SELECT count(postName) as num,
AND biz_org_code like concat(#{bizOrgCode}, '%') (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 ))* 100 AS percent, postName
FROM FROM
( (
...@@ -1352,12 +1364,12 @@ LEFT JOIN ( ...@@ -1352,12 +1364,12 @@ LEFT JOIN (
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
v.`instance_id`, 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 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 END ) fireManagementPost,
max( CASE v.field_code WHEN 'fireManagementPostCode' THEN v.field_value_label END ) fireManagementPostName, 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 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 '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 'peopleType' THEN v.field_value END ) peopleType
FROM FROM
`cb_dynamic_form_instance` v `cb_dynamic_form_instance` v
WHERE WHERE
...@@ -1385,8 +1397,10 @@ LEFT JOIN ( ...@@ -1385,8 +1397,10 @@ LEFT JOIN (
postName postName
</select> </select>
<select id="selectStaticYw" resultType="java.util.Map"> <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' SELECT count(postName) as num,
AND biz_org_code like concat(#{bizOrgCode}, '%') (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 ))* 100 AS percent, postName
FROM FROM
( (
...@@ -1403,9 +1417,9 @@ LEFT JOIN ( ...@@ -1403,9 +1417,9 @@ LEFT JOIN (
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
v.`instance_id`, 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 END ) positionType,
max( CASE v.field_code WHEN 'positionType' THEN v.field_value_label END ) positionTypeName, 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 'peopleType' THEN v.field_value END ) peopleType
FROM FROM
`cb_dynamic_form_instance` v `cb_dynamic_form_instance` v
WHERE WHERE
...@@ -1434,42 +1448,38 @@ LEFT JOIN ( ...@@ -1434,42 +1448,38 @@ LEFT JOIN (
</select> </select>
<select id="getPersonType" resultType="Map"> <select id="getPersonType" resultType="Map">
SELECT SELECT dfi.field_value_label AS peopleType
dfi.field_value_label AS peopleType FROM cb_org_usr u
FROM
cb_org_usr u
LEFT JOIN cb_dynamic_form_instance dfi ON dfi.instance_id = u.sequence_nbr LEFT JOIN cb_dynamic_form_instance dfi ON dfi.instance_id = u.sequence_nbr
WHERE WHERE u.is_delete = FALSE
u.is_delete = FALSE
AND u.amos_org_id IS NOT NULL AND u.amos_org_id IS NOT NULL
AND dfi.field_value = #{typeCode} AND dfi.field_value = #{typeCode}
AND dfi.field_code = 'peopleType' AND dfi.field_code = 'peopleType' limit 1
limit 1
</select> </select>
<select id="reportResult" resultType="java.util.Map"> <select id="reportResult" resultType="java.util.Map">
SELECT SELECT *
* FROM (
FROM SELECT *
( FROM (
SELECT SELECT person.biz_org_name AS NAME,
*
FROM
(
SELECT
person.biz_org_name AS NAME,
person.biz_org_code AS bizOrgCode, person.biz_org_code AS bizOrgCode,
person.parent_id AS parentId, person.parent_id AS parentId,
cdf.field_value AS peopleType cdf.field_value AS peopleType
FROM FROM (SELECT sequence_nbr, biz_org_name, biz_org_code, parent_id
( 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}, '%') FROM cb_org_usr
AND rec_date >= #{startTime} AND #{endTime} >= rec_date ) person WHERE biz_org_type = '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 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 ) AS a
WHERE WHERE a.peopleType IS NOT NULL
a.peopleType IS NOT NULL
AND a.peopleType = '1601' AND a.peopleType = '1601'
) AS a ) AS a
GROUP BY GROUP BY parentId
parentId
</select> </select>
</mapper> </mapper>
package com.yeejoin.equipmanage.common.interceptor;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.plugin.*;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Component;
import org.springframework.util.ReflectionUtils;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Properties;
@Component
// 标志该类是一个拦截器
// {@Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})}
@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
*/
public Object intercept(Invocation invocation) throws Throwable {
System.out.println("====intercept======");
Object[] args = invocation.getArgs();
MappedStatement mappedStatement = (MappedStatement) args[0];
Object parameter = args[1];
RowBounds rowBounds = (RowBounds) args[2];
ResultHandler resultHandler = (ResultHandler) args[3];
Executor executor = (Executor) invocation.getTarget();
CacheKey cacheKey;
BoundSql boundSql;
//由于逻辑关系,只会进入一次
if (args.length == 4) {
//4 个参数时
boundSql = mappedStatement.getBoundSql(parameter);
cacheKey = executor.createCacheKey(mappedStatement, parameter, rowBounds, boundSql);
} else {
//6 个参数时
cacheKey = (CacheKey) args[4];
boundSql = (BoundSql) args[5];
}
//id为执行的mapper方法的全路径名,如com.metro.dao.UserMapper.insertUser
String id = mappedStatement.getId();
//获取到原始sql语句
String sql = boundSql.getSql();
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");
}
Iterator<String> iterator = par.keySet().stream().iterator();
while (iterator.hasNext()) {
String next = iterator.next();
sql = sql.replace("item", next);
}
//通过反射修改sql语句
Field field = boundSql.getClass().getDeclaredField("sql");
ReflectionUtils.makeAccessible(field);
field.set(boundSql, sql);
return executor.query(mappedStatement, parameter, rowBounds, resultHandler, cacheKey, boundSql);
} else {
return invocation.proceed();
}
}
public Object plugin(Object target) {
System.out.println("-----------------------------plugin-------------------------");
return Plugin.wrap(target, this);
}
public void setProperties(Properties properties) {
System.out.println("====setProperties======");
}
}
\ No newline at end of file
...@@ -1170,10 +1170,9 @@ public class OrgUsrController extends BaseController { ...@@ -1170,10 +1170,9 @@ public class OrgUsrController extends BaseController {
//9891 按照测试要求转成人员管理信息且按换流站过滤 //9891 按照测试要求转成人员管理信息且按换流站过滤
List<Map> map = new ArrayList<>(); List<Map> map = new ArrayList<>();
objects.stream().forEach(e->{
// 权限处理 // 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey); PermissionInterceptorContext.setDataAuthRule(authKey);
objects.stream().forEach(e->{
OrgUsr orgUsr = orgUsrMapper.queryByUserId(Long.valueOf(e.get("userId").toString())); OrgUsr orgUsr = orgUsrMapper.queryByUserId(Long.valueOf(e.get("userId").toString()));
if (!ObjectUtils.isEmpty(orgUsr) && orgUsr.getBizOrgCode().startsWith(bizOrgCode)){ if (!ObjectUtils.isEmpty(orgUsr) && orgUsr.getBizOrgCode().startsWith(bizOrgCode)){
e.put("realName",orgUsr.getBizOrgName()); e.put("realName",orgUsr.getBizOrgName());
......
...@@ -182,6 +182,8 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa ...@@ -182,6 +182,8 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
String[] instanceIds = instanceId.split(","); String[] instanceIds = instanceId.split(",");
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
// 获取当前装备ID下的排版数据 // 获取当前装备ID下的排版数据
List<Map<String, Object>> specifyDateList = dutyPersonShiftMapper.getPositionStaffDutyForSpecifyDate(dutyDay, List<Map<String, Object>> specifyDateList = dutyPersonShiftMapper.getPositionStaffDutyForSpecifyDate(dutyDay,
this.getGroupCode(), instanceIds,null, fieldCode); this.getGroupCode(), instanceIds,null, fieldCode);
......
...@@ -17,15 +17,15 @@ import java.util.Map; ...@@ -17,15 +17,15 @@ import java.util.Map;
*/ */
public interface IFormInstanceService extends IService<FormInstance> { public interface IFormInstanceService extends IService<FormInstance> {
/** // /**
* 分页查询 // * 分页查询
* // *
* @param groupCode 分组编号 // * @param groupCode 分组编号
* @param current 当前页 // * @param current 当前页
* @param size 页面大小 // * @param size 页面大小
* @return Page // * @return Page
*/ // */
Page<Map<String, Object>> queryForInstancePage(String groupCode, long current, long size); // Page<Map<String, Object>> queryForInstancePage(String groupCode, long current, long size);
/** /**
* 创建 * 创建
......
...@@ -387,10 +387,10 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -387,10 +387,10 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Override @Override
@Transactional(rollbackFor = {Exception.class, BaseException.class}) @Transactional(rollbackFor = {Exception.class, BaseException.class})
public Object updateForm(Long instanceId, String orgCode, Map<String, Object> map, String groupCode) { public Object updateForm(Long instanceId, String orgCode, Map<String, Object> map, String groupCode) {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKeyEnable);
if (StringUtil.isNotEmpty(groupCode)) { if (StringUtil.isNotEmpty(groupCode)) {
map.keySet().forEach(x -> { map.keySet().forEach(x -> {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKeyEnable);
formInstanceMapper.updateFormFieldValue(instanceId, x, String.valueOf(map.get(x))); formInstanceMapper.updateFormFieldValue(instanceId, x, String.valueOf(map.get(x)));
}); });
return CommonResponseUtil.success(); return CommonResponseUtil.success();
......
...@@ -379,8 +379,6 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -379,8 +379,6 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Value("${equipment.pressurepump.start}") @Value("${equipment.pressurepump.start}")
private String pressurePumpStart; private String pressurePumpStart;
@Value("${auth-key-auth-enabled:}")
private String authKey;
private StockBill buildStockBills(EquipmentSpecific equipmentSpecific, ReginParams reginParams, AgencyUserModel agencyUserModel) { private StockBill buildStockBills(EquipmentSpecific equipmentSpecific, ReginParams reginParams, AgencyUserModel agencyUserModel) {
StockBill stockBill = new StockBill(); StockBill stockBill = new StockBill();
......
...@@ -361,37 +361,37 @@ public class FormInstanceServiceImpl extends ServiceImpl<FormInstanceMapper, For ...@@ -361,37 +361,37 @@ public class FormInstanceServiceImpl extends ServiceImpl<FormInstanceMapper, For
return formInstanceMapper.getFormInstanceById(instanceId); return formInstanceMapper.getFormInstanceById(instanceId);
} }
@Override // @Override
public Page queryForInstancePage(String groupCode, long current, long size) { // public Page queryForInstancePage(String groupCode, long current, long size) {
List<FormGroupColumn> optionList = iFormGroupColumnService.queryByGroup(groupCode); // List<FormGroupColumn> optionList = iFormGroupColumnService.queryByGroup(groupCode);
Map<String, String[]> parameterMap = request.getParameterMap(); // Map<String, String[]> parameterMap = request.getParameterMap();
//说明:parameterMap 为静态map 不可修改,所以需要深拷贝 // //说明:parameterMap 为静态map 不可修改,所以需要深拷贝
Map<String, String[]> localMap = new HashMap<>(); // Map<String, String[]> localMap = new HashMap<>();
localMap.putAll(parameterMap); // localMap.putAll(parameterMap);
localMap.remove("current"); // localMap.remove("current");
localMap.remove("size"); // localMap.remove("size");
Map<String, String> params = new HashMap<>(); // Map<String, String> params = new HashMap<>();
if (!ValidationUtil.isEmpty(localMap)) { // if (!ValidationUtil.isEmpty(localMap)) {
for (String key : localMap.keySet()) { // for (String key : localMap.keySet()) {
if (!ValidationUtil.isEmpty(localMap.get(key))) { // if (!ValidationUtil.isEmpty(localMap.get(key))) {
params.put(key, localMap.get(key)[0]); // params.put(key, localMap.get(key)[0]);
} // }
} // }
} // }
Page page = new Page(); // Page page = new Page();
page.setCurrent(current); // page.setCurrent(current);
page.setSize(size); // page.setSize(size);
Map<String, Object> fieldNames = Bean.listToMap(optionList, "fieldName", "queryStrategy", FormGroupColumn.class); // Map<String, Object> fieldNames = Bean.listToMap(optionList, "fieldName", "queryStrategy", FormGroupColumn.class);
Page<Map<String, Object>> resultList = this.getBaseMapper().queryInstancePage(page, groupCode, fieldNames, params); // Page<Map<String, Object>> resultList = this.getBaseMapper().queryInstancePage(page, groupCode, fieldNames, params);
if (!ValidationUtil.isEmpty(resultList)) { // if (!ValidationUtil.isEmpty(resultList)) {
for (FormGroupColumn optionModel : optionList) { // for (FormGroupColumn optionModel : optionList) {
for (Map<String, Object> instanceMap : resultList.getRecords()) { // for (Map<String, Object> instanceMap : resultList.getRecords()) {
instanceMap.put(optionModel.getFieldName(), this.dataTypeProcess(optionModel.getFieldName(), instanceMap.get(optionModel.getFieldName()), optionModel.getDataType(), instanceMap)); // instanceMap.put(optionModel.getFieldName(), this.dataTypeProcess(optionModel.getFieldName(), instanceMap.get(optionModel.getFieldName()), optionModel.getDataType(), instanceMap));
} // }
} // }
} // }
return resultList; // return resultList;
} // }
@Override @Override
public List<Map<String, Object>> queryForMapList(String groupCode, Map<String, String> params) { public List<Map<String, Object>> queryForMapList(String groupCode, Map<String, String> params) {
......
package com.yeejoin.amos.knowledgebase.interceptor;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.plugin.*;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Component;
import org.springframework.util.ReflectionUtils;
import java.lang.reflect.Field;
import java.util.*;
@Component
// 标志该类是一个拦截器
// {@Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})}
@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
*/
public Object intercept(Invocation invocation) throws Throwable {
System.out.println("====intercept======");
Object[] args = invocation.getArgs();
MappedStatement mappedStatement = (MappedStatement) args[0];
Object parameter = args[1];
RowBounds rowBounds = (RowBounds) args[2];
ResultHandler resultHandler = (ResultHandler) args[3];
Executor executor = (Executor) invocation.getTarget();
CacheKey cacheKey;
BoundSql boundSql;
//由于逻辑关系,只会进入一次
if (args.length == 4) {
//4 个参数时
boundSql = mappedStatement.getBoundSql(parameter);
cacheKey = executor.createCacheKey(mappedStatement, parameter, rowBounds, boundSql);
} else {
//6 个参数时
cacheKey = (CacheKey) args[4];
boundSql = (BoundSql) args[5];
}
//id为执行的mapper方法的全路径名,如com.metro.dao.UserMapper.insertUser
String id = mappedStatement.getId();
//获取到原始sql语句
String sql = boundSql.getSql();
if("com.yeejoin.amos.knowledgebase.face.orm.dao.DocContentMapper.queryDocBaseInfoList".equals(id)) {
//执行结果
HashMap<String,Object> par = new LinkedHashMap<>();
if(parameter instanceof HashMap) {
par = (HashMap<String, Object>) parameter;
}
List<String> extraFields = (ArrayList< String>) par.get("extraFields");
List<String> extraStrFilters = (ArrayList<String>) par.get("extraStrFilters");
for (String field : extraFields) {
sql = sql.replaceFirst("_field", field);
}
for (String filter : extraStrFilters) {
sql = sql.replaceFirst("_str", filter);
}
//通过反射修改sql语句
Field field = boundSql.getClass().getDeclaredField("sql");
ReflectionUtils.makeAccessible(field);
field.set(boundSql, sql);
return executor.query(mappedStatement, parameter, rowBounds, resultHandler, cacheKey, boundSql);
} else {
return invocation.proceed();
}
}
public Object plugin(Object target) {
System.out.println("-----------------------------plugin-------------------------");
return Plugin.wrap(target, this);
}
public void setProperties(Properties properties) {
System.out.println("====setProperties======");
}
}
\ No newline at end of file
...@@ -49,9 +49,8 @@ public class AmoCCSApplication { ...@@ -49,9 +49,8 @@ public class AmoCCSApplication {
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource", environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId))); Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment); application.setEnvironment(environment);
ConfigurableApplicationContext context = SpringApplication.run(AmoCCSApplication.class, args); application.run();
Environment env = context.getEnvironment(); String appName = environment.getProperty("spring.application.name");
String appName = env.getProperty("spring.application.name");
logger.info( logger.info(
"\n----------------------------------------------------------\n\t" "\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n" + "Application {} is running!\n"
......
...@@ -70,10 +70,9 @@ public class AmostEquipApplication { ...@@ -70,10 +70,9 @@ public class AmostEquipApplication {
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource", environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId))); Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment); application.setEnvironment(environment);
ConfigurableApplicationContext context = SpringApplication.run(AmostEquipApplication.class, args); application.run();
String appName = environment.getProperty("spring.application.name");
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String appName = env.getProperty("spring.application.name");
logger.info( logger.info(
"\n----------------------------------------------------------\n\t" "\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n" + "Application {} is running!\n"
......
...@@ -6,48 +6,48 @@ ...@@ -6,48 +6,48 @@
<result column="fieldValue" property="fieldValue"/> <result column="fieldValue" property="fieldValue"/>
<result column="groupType" property="groupType"/> <result column="groupType" property="groupType"/>
</resultMap> </resultMap>
<select id="queryInstancePage" resultType="map"> <!-- <select id="queryInstancePage" resultType="map">-->
select <!-- select-->
d.* <!-- d.*-->
from <!-- from-->
( <!-- (-->
select <!-- select-->
i.INSTANCE_ID instanceId, <!-- i.INSTANCE_ID instanceId,-->
i.GROUP_CODE groupCode, <!-- i.GROUP_CODE groupCode,-->
<foreach collection="fieldNames" item="value" index="key" separator=","> <!-- <foreach collection="fieldNames" item="value" index="key" separator=",">-->
MAX(CASE WHEN i.FIELD_NAME = #{key} THEN i.FIELD_VALUE END) as #{key} <!-- MAX(CASE WHEN i.FIELD_NAME = #{key} THEN i.FIELD_VALUE END) as #{key}-->
</foreach> <!-- </foreach>-->
from <!-- from-->
wl_form_instance i <!-- wl_form_instance i-->
where i.GROUP_CODE = #{groupCode} <!-- where i.GROUP_CODE = #{groupCode}-->
GROUP by <!-- GROUP by-->
i.INSTANCE_ID)d <!-- i.INSTANCE_ID)d-->
<if test="params != null and params.size() > 0"> <!-- <if test="params != null and params.size() > 0">-->
where <!-- where-->
1=1 <!-- 1=1-->
<foreach collection="params" index="key" item="value" separator=""> <!-- <foreach collection="params" index="key" item="value" separator="">-->
<choose> <!-- <choose>-->
<when test="fieldNames[key] == 'like' and value !=null and value !=''"> <!-- <when test="fieldNames[key] == 'like' and value !=null and value !=''">-->
and d.${key} like concat('%',#{value},'%') <!-- and d.item like concat('%',#{value},'%')-->
</when> <!-- </when>-->
<when test="fieldNames[key] == 'eq' and value !=null and value !=''"> <!-- <when test="fieldNames[key] == 'eq' and value !=null and value !=''">-->
and d.${key} = #{value} <!-- and d.item = #{value}-->
</when> <!-- </when>-->
</choose> <!-- </choose>-->
</foreach> <!-- </foreach>-->
</if> <!-- </if>-->
order by instanceId desc <!-- order by instanceId desc-->
</select> <!-- </select>-->
<select id="getChildListdate" resultType="map"> <select id="getChildListdate" resultType="map">
SELECT getChildListdate ( #{id} ) ids SELECT getChildListdate(#{id}) ids
</select> </select>
<update id="updateListChild" > <update id="updateListChild">
UPDATE wl_form_instance set field_value =#{value} UPDATE wl_form_instance set field_value =#{value}
where wl_form_instance.group_type in('building','room','floor') 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 and wl_form_instance.instance_id in
<foreach collection="ids" index="index" item="id" open="(" close=")" separator=","> <foreach collection="ids" index="index" item="id" open="(" close=")" separator=",">
#{id} #{id}
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
</update> </update>
<select id="queryForMapList" resultType="map"> <select id="queryForMapList" resultType="map">
select select
d.* d.*
...@@ -80,10 +79,10 @@ ...@@ -80,10 +79,10 @@
<foreach collection="params" index="key" item="value" separator=""> <foreach collection="params" index="key" item="value" separator="">
<choose> <choose>
<when test="fieldNames[key] == 'like' and value !=null and value !=''"> <when test="fieldNames[key] == 'like' and value !=null and value !=''">
AND d.${key} like concat('%',#{value},'%') AND d.item like concat('%',#{value},'%')
</when> </when>
<when test="fieldNames[key] == 'eq' and value !=null and value !=''"> <when test="fieldNames[key] == 'eq' and value !=null and value !=''">
AND d.${key} = #{value} AND d.item = #{value}
</when> </when>
</choose> </choose>
...@@ -272,43 +271,27 @@ ...@@ -272,43 +271,27 @@
sa.instanceId DESC sa.instanceId DESC
</select> </select>
<select id="findDetailByInstanceId" resultType="java.util.LinkedHashMap"> <select id="findDetailByInstanceId" resultType="java.util.LinkedHashMap">
SELECT SELECT a.field_label AS `key`,
a.field_label AS `key`,
a.field_value AS `value` a.field_value AS `value`
FROM FROM `wl_form_instance` a
`wl_form_instance` a WHERE a.instance_id = #{instanceId}
WHERE AND a.field_label != '父级id'
a.instance_id = #{instanceId}
AND
a.field_label != '父级id'
ORDER BY a.group_column_id ORDER BY a.group_column_id
</select> </select>
<select id="findByInstanceId" resultType="java.util.LinkedHashMap"> <select id="findByInstanceId" resultType="java.util.LinkedHashMap">
SELECT SELECT fi.NAME AS '建筑名称', fi.dutyUser AS '负责人', fi.buildType AS '建筑结构', fi.dutyUserPhone AS '负责人电话', fi.buildUseType AS '使用性质', fi.structureType AS '结构类型', fi.address AS '详细地址'
fi.NAME AS '建筑名称', FROM (
fi.dutyUser AS '负责人', SELECT a.instance_id,
fi.buildType AS '建筑结构', MAX(CASE WHEN a.field_name = 'name' THEN a.field_value END) AS NAME,
fi.dutyUserPhone AS '负责人电话', MAX(CASE WHEN a.field_name = 'dutyUser' THEN a.field_value END) AS dutyUser,
fi.buildUseType AS '使用性质', MAX(CASE WHEN a.field_name = 'buildType' THEN a.field_value END) AS buildType,
fi.structureType AS '结构类型', MAX(CASE WHEN a.field_name = 'dutyUserPhone' THEN a.field_value END) AS dutyUserPhone,
fi.address AS '详细地址' MAX(CASE WHEN a.field_name = 'buildUseType' THEN a.field_value END) AS buildUseType,
FROM 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
SELECT FROM `wl_form_instance` a
a.instance_id, WHERE a.instance_id = #{instanceId}
MAX( CASE WHEN a.field_name = 'name' THEN a.field_value END ) AS NAME, GROUP BY a.instance_id
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 ) fi
</select> </select>
<select id="getFormInstanceById" resultType="java.util.Map"> <select id="getFormInstanceById" resultType="java.util.Map">
...@@ -346,7 +329,8 @@ ...@@ -346,7 +329,8 @@
GROUP BY GROUP BY
a.instance_id a.instance_id
) sa ) 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 union all
select select
123456789123456789 as instanceId, 123456789123456789 as instanceId,
...@@ -419,8 +403,7 @@ ...@@ -419,8 +403,7 @@
biz_org_code, biz_org_code,
biz_org_name, biz_org_name,
source_id) source_id)
VALUES( VALUES (#{instanceId},
#{instanceId},
#{code}, #{code},
#{name}, #{name},
#{address}, #{address},
...@@ -432,23 +415,28 @@ ...@@ -432,23 +415,28 @@
#{instanceId}) #{instanceId})
</insert> </insert>
<select id="getStuctureName" resultType="String"> <select id="getStuctureName" resultType="String">
select full_name from wl_warehouse_structure select full_name
from wl_warehouse_structure
where id = #{id} where id = #{id}
</select> </select>
<select id="getStuName" resultType="String"> <select id="getStuName" resultType="String">
select name from wl_warehouse_structure select name
from wl_warehouse_structure
where id = #{id} where id = #{id}
</select> </select>
<select id="getStructureParentId" resultType="Long"> <select id="getStructureParentId" resultType="Long">
select parent_id from wl_warehouse_structure select parent_id
from wl_warehouse_structure
where id = #{id} where id = #{id}
</select> </select>
<delete id="deleteStuById"> <delete id="deleteStuById">
DELETE FROM wl_warehouse_structure WHERE id = #{id} DELETE
FROM wl_warehouse_structure
WHERE id = #{id}
</delete> </delete>
<update id="updateStr"> <update id="updateStr">
update wl_warehouse_structure update wl_warehouse_structure
set name = #{name} , set name = #{name},
full_name = #{fullName}, full_name = #{fullName},
parent_id = #{parentId}, parent_id = #{parentId},
code = #{code}, code = #{code},
...@@ -458,18 +446,23 @@ ...@@ -458,18 +446,23 @@
</update> </update>
<update id="updateFormFieldValue"> <update id="updateFormFieldValue">
update wl_form_instance update wl_form_instance
set set field_value = #{value}
field_value = #{value} where instance_id = #{id}
where instance_id = #{id} AND field_name = #{name} AND field_name = #{name}
</update> </update>
<update id="updateStrFullName"> <update id="updateStrFullName">
update wl_warehouse_structure update wl_warehouse_structure
set full_name=replace(full_name,#{name},#{fullName}) set full_name=replace(full_name, #{name}, #{fullName})
where where id in (
id in ( select instance_id
select instance_id from wl_form_instance where field_name = 'parentId' and field_value = #{id} from wl_form_instance
where field_name = 'parentId'
and field_value = #{id}
union all 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} select instance_id from wl_form_instance where field_name = 'parentId' and field_value = #{id}
) )
) )
...@@ -482,8 +475,8 @@ ...@@ -482,8 +475,8 @@
</update> </update>
<select id="getChildrenNotIsRiskList" resultType="com.yeejoin.equipmanage.common.entity.dto.BuildIsRiskDTO"> <select id="getChildrenNotIsRiskList" resultType="com.yeejoin.equipmanage.common.entity.dto.BuildIsRiskDTO">
select * from (SELECT select *
a.instance_id AS instanceId, from (SELECT a.instance_id AS instanceId,
MAX( MAX(
CASE CASE
WHEN a.field_name = 'parentId' THEN WHEN a.field_name = 'parentId' THEN
...@@ -496,10 +489,11 @@ ...@@ -496,10 +489,11 @@
a.field_value a.field_value
END END
) AS isRisk ) AS isRisk
FROM FROM `wl_form_instance` a
`wl_form_instance` a GROUP BY a.instance_id) sa
GROUP BY where sa.parentId = #{instanceId}
a.instance_id) sa where sa.parentId = #{instanceId} and sa.isRisk = 'false' and sa.isRisk is not null and sa.isRisk = 'false'
and sa.isRisk is not null
</select> </select>
<update id="clearRegionBind"> <update id="clearRegionBind">
UPDATE UPDATE
...@@ -512,101 +506,95 @@ ...@@ -512,101 +506,95 @@
'' ''
END END
) )
WHERE WHERE instance_id = #{instanceId}
instance_id = #{instanceId} and (field_name = 'isRisk' or field_name = 'riskPointId') and (field_name = 'isRisk' or field_name = 'riskPointId')
</update> </update>
<select id="getParentId" resultType="map"> <select id="getParentId" resultType="map">
select select *
* from wl_warehouse_structure
from where parent_id = #{parentId}
wl_warehouse_structure
where
parent_id = #{parentId}
</select> </select>
<select id="getIdAndType" resultType="hashmap"> <select id="getIdAndType" resultType="hashmap">
select select ins.field_value as id,
ins.field_value as id,
inst.group_code as type, inst.group_code as type,
str.full_name as address str.full_name as address
from from wl_form_instance as ins
wl_form_instance as ins
left join wl_form_instance as inst on ins.field_value = inst.instance_id 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 left join wl_warehouse_structure as str on ins.instance_id = str.source_id
where ins.instance_id =#{id} where ins.instance_id = #{id}
and ins.field_name ='parentId' and ins.field_name = 'parentId'
group by ins.field_value group by ins.field_value
</select> </select>
<!-- // 需求958 导出模板需要列表获取建筑 by kongfm 2021-09-15--> <!-- // 需求958 导出模板需要列表获取建筑 by kongfm 2021-09-15-->
<select id="getAllBuilding" resultType="hashmap"> <select id="getAllBuilding" resultType="hashmap">
select * from (SELECT select *
a.instance_id AS instanceId, from (SELECT a.instance_id AS instanceId,
a.group_code AS groupCode, a.group_code AS groupCode,
a.group_type AS groupType, a.group_type AS groupType,
a.field_value AS fieldValue, a.field_value AS fieldValue,
a.field_label AS fieldLabel, 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 = 'parentId' THEN a.field_value END) AS parentId,
MAX(CASE WHEN a.field_name = 'name' THEN a.field_value END)AS buildName MAX(CASE WHEN a.field_name = 'name' THEN a.field_value END) AS buildName
FROM FROM `wl_form_instance` a
`wl_form_instance` a
where a.group_type = 'building' where a.group_type = 'building'
GROUP BY GROUP BY a.instance_id) sa
a.instance_id) sa
ORDER BY sa.instanceId DESC ORDER BY sa.instanceId DESC
</select> </select>
<select id="getBuildingToLongitudeAndLatitude" resultType="hashmap"> <select id="getBuildingToLongitudeAndLatitude" resultType="hashmap">
SELECT SELECT max(CASe WHEN field_name = 'latitude' THEN field_value end) AS latitude,
max(CASe WHEN field_name = 'latitude' THEN field_value end ) AS latitude, max(CASe WHEN field_name = 'longitude' THEN field_value end) AS longitude
max(CASe WHEN field_name = 'longitude' THEN field_value end ) AS longitude FROM wl_form_instance
FROM WHERE instance_id = #{instanceId}
wl_form_instance </select>
WHERE <!--<select id="getBuildVideoCount" resultType="hashmap">-->
instance_id = #{instanceId} <!-- SELECT-->
</select> <!-- wlv.source_id AS buildId,-->
<!--<select id="getBuildVideoCount" resultType="hashmap">--> <!-- count( wlv.source_id ) AS total-->
<!-- SELECT--> <!-- FROM-->
<!-- wlv.source_id AS buildId,--> <!-- `wl_video_source` wlv-->
<!-- count( wlv.source_id ) AS total--> <!-- GROUP BY-->
<!-- FROM--> <!-- wlv.source_id-->
<!-- `wl_video_source` wlv--> <!--</select>-->
<!-- GROUP BY--> <select id="getBuildVideoCount" resultType="hashmap">
<!-- wlv.source_id--> SELECT b.instanceId AS buildId,
<!--</select>--> COUNT(vs.video_id) AS total
<select id="getBuildVideoCount" resultType="hashmap"> FROM get_building_tree b
SELECT JOIN wl_video_source vs ON FIND_IN_SET(b.instanceId, vs.parent_source_ids)
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 JOIN wl_video v on v.id = vs.video_id
GROUP BY GROUP BY b.instanceId
b.instanceId </select>
</select> <update id="updateFormInstanceByInstanceAndFieldName">
<update id ="updateFormInstanceByInstanceAndFieldName">
UPDATE wl_form_instance UPDATE wl_form_instance
SET field_value = #{value} SET field_value = #{value}
WHERE WHERE instance_id = #{instanceId}
instance_id =#{instanceId} AND field_name = #{name}
AND field_name =#{name}
</update> </update>
<select id="selectChildListdate" resultType="java.lang.String"> <select id="selectChildListdate" resultType="java.lang.String">
SELECT distinct a.instance_id FROM SELECT distinct a.instance_id
FROM (select instance_id, field_value
(select instance_id ,field_value from wl_form_instance where group_type in('building','room','floor') and field_name='parentId') a from wl_form_instance
WHERE a.field_value = #{id} union all SELECT distinct b.instance_id FROM where group_type in ('building', 'room', 'floor')
and field_name = 'parentId') a
(select instance_id ,field_value from wl_form_instance where group_type in('building','room','floor') and field_name='parentId') b WHERE a.field_value = #{id}
WHERE b.field_value in (SELECT distinct c.instance_id FROM union all
SELECT distinct b.instance_id
(select instance_id ,field_value from wl_form_instance where group_type in('building','room','floor') and field_name='parentId') c 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}) WHERE c.field_value = #{id})
</select> </select>
...@@ -648,9 +636,14 @@ AND field_name =#{name} ...@@ -648,9 +636,14 @@ AND field_name =#{name}
<select id="queryVideoCountByBizOrgCode" resultType="java.lang.Long"> <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>
<select id="selectParentBuildId" resultType="java.lang.String"> <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> </select>
</mapper> </mapper>
...@@ -79,10 +79,9 @@ public class FireAutoSysApplication implements ApplicationContextAware { ...@@ -79,10 +79,9 @@ public class FireAutoSysApplication implements ApplicationContextAware {
Collections.singletonMap("security-random-int", randomClientId))); Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment); application.setEnvironment(environment);
logger.info("start Service.........."); logger.info("start Service..........");
ConfigurableApplicationContext context = SpringApplication.run(FireAutoSysApplication.class, args); application.run();
String appName = environment.getProperty("spring.application.name");
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String appName = env.getProperty("spring.application.name");
logger.info( logger.info(
"\n----------------------------------------------------------\n\t" "\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n" + "Application {} is running!\n"
......
...@@ -58,10 +58,10 @@ public class AmosJcsApplication { ...@@ -58,10 +58,10 @@ public class AmosJcsApplication {
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource", environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId))); Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment); application.setEnvironment(environment);
ConfigurableApplicationContext context = SpringApplication.run(AmosJcsApplication.class, args); ConfigurableApplicationContext run = application.run();
Environment env = context.getEnvironment(); String appName = environment.getProperty("spring.application.name");
delKey(env, context);// 添加全部清空redis缓存的方法 2021-09-09
String appName = env.getProperty("spring.application.name"); delKey(environment, run);// 添加全部清空redis缓存的方法 2021-09-09
logger.info( logger.info(
"\n----------------------------------------------------------\n\t" "\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n" + "Application {} is running!\n"
......
...@@ -48,10 +48,11 @@ public class KnowledgebaseApplication { ...@@ -48,10 +48,11 @@ public class KnowledgebaseApplication {
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource", environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId))); Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment); application.setEnvironment(environment);
ConfigurableApplicationContext context = new SpringApplicationBuilder(KnowledgebaseApplication.class).web(WebApplicationType.SERVLET).run(args); ConfigurableApplicationContext run = application.run();
String appName = environment.getProperty("spring.application.name");
// ConfigurableApplicationContext context = new SpringApplicationBuilder(KnowledgebaseApplication.class).web(WebApplicationType.SERVLET).run(args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String appName = env.getProperty("spring.application.name");
logger.info( logger.info(
"\n----------------------------------------------------------\n\t" "\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n" + "Application {} is running!\n"
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
(SELECT kdc.CATEGORY_NAME FROM knowledge_doc_category kdc WHERE kdc.SEQUENCE_NBR = DIRECTORY_ID) directoryName, (SELECT kdc.CATEGORY_NAME FROM knowledge_doc_category kdc WHERE kdc.SEQUENCE_NBR = DIRECTORY_ID) directoryName,
<if test="extraFields != null and extraFields.size > 0"> <if test="extraFields != null and extraFields.size > 0">
<foreach collection="extraFields" item="_field" > <foreach collection="extraFields" item="_field" >
${_field}, _field,
</foreach> </foreach>
</if> </if>
IFNULL(collectNum, 0) collectNum, IFNULL(quoteNum, 0) quoteNum, IFNULL(collect, "UNCOLLECT") collect IFNULL(collectNum, 0) collectNum, IFNULL(quoteNum, 0) quoteNum, IFNULL(collect, "UNCOLLECT") collect
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
ORG_CODE LIKE CONCAT(#{permissionFilters.orgCode}, "%") ORG_CODE LIKE CONCAT(#{permissionFilters.orgCode}, "%")
AND AUDIT_STATUS IN AND AUDIT_STATUS IN
<foreach collection="permissionFilters.auditStatusList" item="auditStatus" open="(" close=")" separator=", "> <foreach collection="permissionFilters.auditStatusList" item="auditStatus" open="(" close=")" separator=", ">
${auditStatus} #{auditStatus}
</foreach> </foreach>
) )
</if> </if>
...@@ -166,7 +166,7 @@ ...@@ -166,7 +166,7 @@
</if> </if>
<if test="extraStrFilters != null and extraStrFilters.size > 0"> <if test="extraStrFilters != null and extraStrFilters.size > 0">
<foreach collection="extraStrFilters" item="str"> <foreach collection="extraStrFilters" item="str">
AND ${str} AND _str
</foreach> </foreach>
</if> </if>
</where> </where>
......
...@@ -79,9 +79,8 @@ public class LatentDangerApplication { ...@@ -79,9 +79,8 @@ public class LatentDangerApplication {
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource", environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId))); Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment); application.setEnvironment(environment);
ConfigurableApplicationContext context = SpringApplication.run(LatentDangerApplication.class, args); application.run();
Environment env = context.getEnvironment(); String appName = environment.getProperty("spring.application.name");
String appName = env.getProperty("spring.application.name");
logger.info( logger.info(
"\n----------------------------------------------------------\n\t" "\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n" + "Application {} is running!\n"
......
...@@ -77,10 +77,9 @@ public class MaintenanceApplication { ...@@ -77,10 +77,9 @@ public class MaintenanceApplication {
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource", environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId))); Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment); application.setEnvironment(environment);
ConfigurableApplicationContext context = SpringApplication.run(MaintenanceApplication.class, args); application.run();
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); String appName = environment.getProperty("spring.application.name");
String appName = env.getProperty("spring.application.name");
logger.info( logger.info(
"\n----------------------------------------------------------\n\t" "\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n" + "Application {} is running!\n"
......
...@@ -93,10 +93,9 @@ public class PatrolApplication { ...@@ -93,10 +93,9 @@ public class PatrolApplication {
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource", environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId))); Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment); application.setEnvironment(environment);
ConfigurableApplicationContext context = SpringApplication.run(PatrolApplication.class, args); application.run();
String appName = environment.getProperty("spring.application.name");
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String appName = env.getProperty("spring.application.name");
logger.info( logger.info(
"\n----------------------------------------------------------\n\t" "\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n" + "Application {} is running!\n"
......
...@@ -77,7 +77,7 @@ public class StartPrecontrolService { ...@@ -77,7 +77,7 @@ public class StartPrecontrolService {
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource", environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId))); Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment); application.setEnvironment(environment);
SpringApplication.run(StartPrecontrolService.class, args).getEnvironment(); application.run();
log.info("swagger:--->http://localhost:8060/precontrol/swagger-ui.html"); log.info("swagger:--->http://localhost:8060/precontrol/swagger-ui.html");
} }
......
...@@ -83,10 +83,9 @@ public class SupervisionApplication { ...@@ -83,10 +83,9 @@ public class SupervisionApplication {
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource", environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId))); Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment); application.setEnvironment(environment);
ConfigurableApplicationContext context = SpringApplication.run(SupervisionApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); application.run();
String appName = env.getProperty("spring.application.name"); String appName = environment.getProperty("spring.application.name");
logger.info( logger.info(
"\n----------------------------------------------------------\n\t" "\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n" + "Application {} is running!\n"
......
...@@ -49,10 +49,8 @@ public class AmosBootUtilsMessageApplication { ...@@ -49,10 +49,8 @@ public class AmosBootUtilsMessageApplication {
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource", environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId))); Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment); application.setEnvironment(environment);
ConfigurableApplicationContext context = SpringApplication.run(AmosBootUtilsMessageApplication.class, args); application.run();
String appName = environment.getProperty("spring.application.name");
Environment env = context.getEnvironment();
String appName = env.getProperty("spring.application.name");
logger.info( logger.info(
"\n----------------------------------------------------------\n\t" "\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n" + "Application {} is running!\n"
......
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