Commit bad6be36 by wangchunyang

长春相关查询做独立分割修改

parent 801ef378
...@@ -77,6 +77,7 @@ public class MurderManagementServiceImpl { ...@@ -77,6 +77,7 @@ public class MurderManagementServiceImpl {
@ApiOperation(value = "重点人员列表查询", desc = "") @ApiOperation(value = "重点人员列表查询", desc = "")
public Page<KeyPerson> findKeyPersonList(Page<KeyPerson> page) { public Page<KeyPerson> findKeyPersonList(Page<KeyPerson> page) {
String changchunMark = DataScopeUtil.isChanChun(page.getParams().get("_user")) ? "_changchun" : "";
Map<String, Object> user = (Map<String, Object>) page.getParams().get("_user"); Map<String, Object> user = (Map<String, Object>) page.getParams().get("_user");
if (user != null) { if (user != null) {
Map<String, String> pos = DataScopeUtil.getPosition(user); Map<String, String> pos = DataScopeUtil.getPosition(user);
...@@ -86,7 +87,7 @@ public class MurderManagementServiceImpl { ...@@ -86,7 +87,7 @@ public class MurderManagementServiceImpl {
setMap.put("scope_area_id", pos.get("area_id")); setMap.put("scope_area_id", pos.get("area_id"));
page.getParams().put("_scope", setMap); page.getParams().put("_scope", setMap);
} }
Page<KeyPerson> keyPersonList = commonService.findPage(nameSpace + "findKeyPersonList", page); Page<KeyPerson> keyPersonList = commonService.findPage(nameSpace + "findKeyPersonList" + changchunMark, page);
for (KeyPerson keyPerson : keyPersonList.getResults()) { for (KeyPerson keyPerson : keyPersonList.getResults()) {
keyPerson.setKeyPersonHighlyConcernedRel(commonService.findList(nameSpace + "findKeyPersonHighlyConcernedRelListByKeyPersonId", keyPerson)); keyPerson.setKeyPersonHighlyConcernedRel(commonService.findList(nameSpace + "findKeyPersonHighlyConcernedRelListByKeyPersonId", keyPerson));
} }
...@@ -95,7 +96,14 @@ public class MurderManagementServiceImpl { ...@@ -95,7 +96,14 @@ public class MurderManagementServiceImpl {
@ApiOperation(value = "重点人员数据导出", desc = "") @ApiOperation(value = "重点人员数据导出", desc = "")
public void findKeyPersonListExport(KeyPerson keyPerson,HttpServletResponse response) throws IOException { public void findKeyPersonListExport(KeyPerson keyPerson,HttpServletResponse response) throws IOException {
List<KeyPerson> keyPersonList = commonService.findList(nameSpace + "findKeyPersonListExport", keyPerson); String changchunMark = DataScopeUtil.isChanChun(keyPerson.get_user()) ? "_changchun" : "";
User _user = keyPerson.get_user();
if (_user != null) {
Map<String, String> pos = DataScopeUtil.getPosition(_user);
keyPerson.setScopeAreaId(pos.get("grade"));
keyPerson.setScopeAreaId(pos.get("area_id"));
}
List<KeyPerson> keyPersonList = commonService.findList(nameSpace + "findKeyPersonListExport" + changchunMark, keyPerson);
if(keyPersonList==null || keyPersonList.size()==0){ if(keyPersonList==null || keyPersonList.size()==0){
throw new CustomException("暂无数据!"); throw new CustomException("暂无数据!");
} }
......
...@@ -259,25 +259,11 @@ ...@@ -259,25 +259,11 @@
group by risk_level group by risk_level
</select> </select>
<select id="doStatusAllCount" parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson"
resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson">
SELECT
SUM(CASE WHEN history.is_overdue = '0' THEN 1 ELSE 0 END) AS doneCount,
SUM(CASE WHEN history.is_overdue = '1' THEN 1 ELSE 0 END) AS todoCount
FROM
jl_key_person
LEFT JOIN jl_key_person_rating_history history
ON jl_key_person.id = history.key_person_id
AND history.rating_dict_type = #{sysType}
AND history.is_history = '1'
AND history.do_status = '0'
</select>
<select id="findKeyPersonList" parameterType="page" resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson"> <select id="findKeyPersonList" parameterType="page" resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson">
select a.* select a.*
from (select jl_key_person.id as id, from (select jl_key_person.id as id,
jl_key_person.name as name, jl_key_person.name as name,
jl_key_person.sys_type as sysType, sys_type as sysType,
cast(AES_DECRYPT(FROM_BASE64(card_no),'*#id#') as char) cardNo, cast(AES_DECRYPT(FROM_BASE64(card_no),'*#id#') as char) cardNo,
registered_residence as registeredResidence, registered_residence as registeredResidence,
phone, phone,
...@@ -294,11 +280,11 @@ ...@@ -294,11 +280,11 @@
letters_visits_type lettersVisitsType, letters_visits_type lettersVisitsType,
folk, folk,
involving_conflicts_disputes as involvingConflictsDisputes, involving_conflicts_disputes as involvingConflictsDisputes,
jl_key_person.region as region, region as region,
jl_key_person.city_id as cityId, city_id as cityId,
jl_key_person.area_id as areaId, area_id as areaId,
jl_key_person.street_id as streetId, street_id as streetId,
jl_key_person.community_id as communityId, community_id as communityId,
community.name communityName, community.name communityName,
jl_key_person.remarks as remarks, jl_key_person.remarks as remarks,
hazard_assessment_level as hazardAssessmentLevel, hazard_assessment_level as hazardAssessmentLevel,
...@@ -318,102 +304,21 @@ ...@@ -318,102 +304,21 @@
jl_key_person.create_date as createDate, jl_key_person.create_date as createDate,
jl_key_person.update_date as updateDate, jl_key_person.update_date as updateDate,
jl_key_person.create_user as createUser, jl_key_person.create_user as createUser,
jl_key_person.update_user as updateUser, jl_key_person.update_user as updateUser
summary.rating_type as ratingType,
rating_dict.label as ratingTypeName,
summary.rating as rating,
DATE_FORMAT(history.plan_start_data,'%Y-%m-%d') planStartData,
DATE_FORMAT(history.plan_end_data,'%Y-%m-%d') planEndData,
DATE_FORMAT(history.overdue_date,'%Y-%m-%d') overdueDate,
DATE_FORMAT(summary.rating_time,'%Y-%m-%d %T') ratingTime,
case
when history.id is null then 1
when curdate() &gt;= history.plan_start_data
and curdate() &lt;= history.plan_end_data
then 1
else 0
end as canClick,
history.id as historyId,
summary.id as summaryId,
case when history.do_status = '1' then 1 when history.do_status = '2' then 2 else '0' end as doStatus,
CASE
WHEN DATEDIFF(history.plan_end_data, CURDATE()) &lt; 0 THEN 0
ELSE DATEDIFF(history.plan_end_data, CURDATE())
END AS remainDays,
history.is_overdue as isOverdue,
<choose>
<when test="params._scope.scope_grade == '3'.toString()">
case when jl_key_person_rating_dual_person.id is not null and jl_key_person.city_id = #{params._scope.scope_area_id}
and jl_key_person.city_id != jl_key_person_rating_dual_person.city_id then '1' else '0' end as dualPersonBelong,
</when>
<when test="params._scope.scope_grade == '4'.toString()">
case when jl_key_person_rating_dual_person.id is not null and jl_key_person.area_id = #{params._scope.scope_area_id}
and jl_key_person.area_id != jl_key_person_rating_dual_person.area_id then '1' else '0' end as dualPersonBelong,
</when>
<when test="params._scope.scope_grade == '5'.toString()">
case when jl_key_person_rating_dual_person.id is not null and jl_key_person.street_id = #{params._scope.scope_area_id}
and jl_key_person.street_id != jl_key_person_rating_dual_person.street_id then '1' else '0' end as dualPersonBelong,
</when>
<when test="params._scope.scope_grade == '6'.toString()">
case when jl_key_person_rating_dual_person.id is not null and jl_key_person.community_id = #{params._scope.scope_area_id}
and jl_key_person.community_id != jl_key_person_rating_dual_person.community_id then '1' else '0' end as dualPersonBelong,
</when>
<otherwise>
'0' as dualPersonBelong,
</otherwise>
</choose>
<choose>
<when test="params._scope.scope_grade == '3'.toString()">
case when jl_key_person_rating_dual_person.city_id = #{params._scope.scope_area_id} then '1' else '0' end as dualPerson
</when>
<when test="params._scope.scope_grade == '4'.toString()">
case when jl_key_person_rating_dual_person.area_id = #{params._scope.scope_area_id} then '1' else '0' end as dualPerson
</when>
<when test="params._scope.scope_grade == '5'.toString()">
case when jl_key_person_rating_dual_person.street_id = #{params._scope.scope_area_id} then '1' else '0' end as dualPerson
</when>
<when test="params._scope.scope_grade == '6'.toString()">
case when jl_key_person_rating_dual_person.community_id = #{params._scope.scope_area_id} then '1' else '0' end as dualPerson
</when>
<otherwise>
'0' as dualPerson
</otherwise>
</choose>
from jl_key_person from jl_key_person
left join sys_area city on jl_key_person.city_id = city.code left join sys_area city on jl_key_person.city_id = city.code
left join sys_area area on jl_key_person.area_id = area.code left join sys_area area on jl_key_person.area_id = area.code
left join sys_area street on jl_key_person.street_id = street.code left join sys_area street on jl_key_person.street_id = street.code
left join sys_area community on jl_key_person.community_id = community.code left join sys_area community on jl_key_person.community_id = community.code
left join jl_key_person_rating_history history on jl_key_person.id = history.key_person_id and history.rating_dict_type = #{params.sysType} and history.is_history = '1'
left join jl_key_person_rating_summary summary on jl_key_person.id = summary.key_person_id and summary.rating_dict_type = #{params.sysType} and summary.is_history = '1'
left join sys_dict rating_dict on rating_dict.type = 'rating_level' and rating_dict.del_flag = '0' and rating_dict.value = summary.rating_type
left join jl_key_person_rating_dual_person on jl_key_person.id = jl_key_person_rating_dual_person.key_person_id
<where> 1=1 <where> 1=1
<if test="params.involvingConflictsDisputes != null and params.involvingConflictsDisputes != ''"> <if test="params.involvingConflictsDisputes != null and params.involvingConflictsDisputes != ''">
and involving_conflicts_disputes like concat('%',#{params.involvingConflictsDisputes},'%') and involving_conflicts_disputes like concat('%',#{params.involvingConflictsDisputes},'%')
</if> </if>
<if test="params.ratingLevel != null and params.ratingLevel != ''">
and summary.rating_type like concat('%',#{params.ratingLevel},'%')
</if>
<!-- 处理doStatus=0的情况:查询do_status为null -->
<if test="params.doStatus != null and params.doStatus == 0">
and history.do_status is null
</if>
<!-- 处理doStatus=1的情况:模糊查询do_status包含1 -->
<if test="params.doStatus != null and params.doStatus == 1">
and history.do_status like concat('%',#{params.doStatus},'%')
</if>
<if test="params.doStatus != null and params.doStatus == 2">
and history.do_status like concat('%',#{params.doStatus},'%')
</if>
<if test="params.isOverdue != null and params.isOverdue != ''">
and history.is_overdue like concat('%',#{params.isOverdue},'%')
</if>
<if test="params.name != null and params.name != ''"> <if test="params.name != null and params.name != ''">
and jl_key_person.name like concat('%',#{params.name},'%') and jl_key_person.name like concat('%',#{params.name},'%')
</if> </if>
<if test="params.sysType != null and params.sysType != ''"> <if test="params.sysType != null and params.sysType != ''">
and jl_key_person.sys_type = #{params.sysType} and sys_type = #{params.sysType}
</if> </if>
<if test="params.cardNo != null and params.cardNo != ''"> <if test="params.cardNo != null and params.cardNo != ''">
<!--and card_no like concat('%',#{params.cardNo},'%')--> <!--and card_no like concat('%',#{params.cardNo},'%')-->
...@@ -497,24 +402,6 @@ ...@@ -497,24 +402,6 @@
<if test="params._user.company_grade == '6'.toString()"> <if test="params._user.company_grade == '6'.toString()">
AND community_id = #{params._user.company_id} AND community_id = #{params._user.company_id}
</if>--> </if>-->
<if test="params.isChangChun == true">
<!-- 数据范围 -->
<choose>
<when test="params._scope.scope_grade == '3'.toString()">
AND jl_key_person.city_id = #{params._scope.scope_area_id}
</when>
<when test="params._scope.scope_grade == '4'.toString()">
AND jl_key_person.area_id = #{params._scope.scope_area_id}
</when>
<when test="params._scope.scope_grade == '5'.toString()">
AND jl_key_person.street_id = #{params._scope.scope_area_id}
</when>
<when test="params._scope.scope_grade == '6'.toString()">
AND jl_key_person.community_id = #{params._scope.scope_area_id}
</when>
</choose>
</if>
<if test="params.isChangChun == false">
<if test="params._user.company_grade != '2'.toString()"> <if test="params._user.company_grade != '2'.toString()">
and ( and (
create_user=#{params._user.id} create_user=#{params._user.id}
...@@ -525,7 +412,6 @@ ...@@ -525,7 +412,6 @@
) )
) )
</if> </if>
</if>
<if test="params.cityId!=null and params.cityId!=''"> <if test="params.cityId!=null and params.cityId!=''">
AND city_id = #{params.cityId} AND city_id = #{params.cityId}
...@@ -542,42 +428,13 @@ ...@@ -542,42 +428,13 @@
<if test="params.distCard != null and params.distCard !=''"> <if test="params.distCard != null and params.distCard !=''">
AND card_no IN (SELECT card_no FROM jl_key_person AND card_no IN (SELECT card_no FROM jl_key_person
<where> <where>
sys_type = #{params.sysType}
<if test="params.isChangChun == true">
<!-- 数据范围 -->
<choose>
<when test="params._scope.scope_grade == '3'.toString()">
AND (jl_key_person.city_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where city_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person.id))
</when>
<when test="params._scope.scope_grade == '4'.toString()">
AND (jl_key_person.area_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where area_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person.id))
</when>
<when test="params._scope.scope_grade == '5'.toString()">
AND (jl_key_person.street_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where street_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person.id))
</when>
<when test="params._scope.scope_grade == '6'.toString()">
AND (jl_key_person.community_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person.id))
</when>
</choose>
</if>
<if test="params.isChangChun == false">
<if test="params._user.company_grade != '2'.toString()"> <if test="params._user.company_grade != '2'.toString()">
and ( and (
create_user=#{params._user.id} create_user=#{params._user.id}
or create_user in ( or create_user in (
select id from sys_user where company_id in ( select id from sys_user where company_id in (
select id from sys_office where parent_ids LIKE CONCAT('%', #{params._user.company_id}, '%') and del_flag='0' select id from sys_office where parent_ids LIKE CONCAT('%', #{params._user.company_id}, '%') and del_flag='0'
) and del_flag='0' ) and del_flag='0' ) )
)
or jl_key_person.id in (select key_person_id from jl_key_person_rating_dual_person
where city_id = #{params._scope.scope_area_id} or area_id = #{params._scope.scope_area_id}
or street_id = #{params._scope.scope_area_id} or community_id = #{params._scope.scope_area_id})
)
</if>
</if> </if>
</where> </where>
GROUP BY card_no HAVING COUNT(1) > 1) GROUP BY card_no HAVING COUNT(1) > 1)
...@@ -2322,6 +2179,22 @@ ...@@ -2322,6 +2179,22 @@
order by update_date desc order by update_date desc
</select> </select>
<!-- 2025-10-27开始修改的内容 ===================================================================== -->
<select id="doStatusAllCount" parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson"
resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson">
SELECT
SUM(CASE WHEN history.is_overdue = '0' THEN 1 ELSE 0 END) AS doneCount,
SUM(CASE WHEN history.is_overdue = '1' THEN 1 ELSE 0 END) AS todoCount
FROM
jl_key_person
LEFT JOIN jl_key_person_rating_history history
ON jl_key_person.id = history.key_person_id
AND history.rating_dict_type = #{sysType}
AND history.is_history = '1'
AND history.do_status = '0'
</select>
<select id="getUserLoginInfo" parameterType="java.lang.String" resultType="map"> <select id="getUserLoginInfo" parameterType="java.lang.String" resultType="map">
SELECT SELECT
su.id, su.id,
...@@ -2584,4 +2457,443 @@ ...@@ -2584,4 +2457,443 @@
</where> </where>
group by jl_key_person.city_id order by jl_key_person.city_id group by jl_key_person.city_id order by jl_key_person.city_id
</select> </select>
<select id="findKeyPersonList_changchun" parameterType="page" resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson">
select a.*
from (select jl_key_person.id as id,
jl_key_person.name as name,
jl_key_person.sys_type as sysType,
cast(AES_DECRYPT(FROM_BASE64(card_no),'*#id#') as char) cardNo,
registered_residence as registeredResidence,
phone,
responsible_company_by_assistance as responsibleCompanyByAssistance,
responsible_person_by_assistance as responsiblePersonByAssistance,
responsible_company_by_key_personnel as responsibleCompanyByKeyPersonnel,
responsible_person_key_personnel as responsiblePersonKeyPersonnel,
responsible_person as responsiblePerson,
responsible_company as responsibleCompany,
sex,
address,
criminal_tendency as criminalTendency,
criminal_tendency_situation as criminalTendencySituation,
letters_visits_type lettersVisitsType,
folk,
involving_conflicts_disputes as involvingConflictsDisputes,
jl_key_person.region as region,
jl_key_person.city_id as cityId,
jl_key_person.area_id as areaId,
jl_key_person.street_id as streetId,
jl_key_person.community_id as communityId,
community.name communityName,
jl_key_person.remarks as remarks,
hazard_assessment_level as hazardAssessmentLevel,
city.name cityName,
area.name areaName,
street.name streetName,
city.sort as sort1,
area.sort as sort2,
street.sort as sort3,
related_person_name as relatedPersonName,
related_person_relation relatedPersonRelation,
related_person_phone as relatedPersonPhone,
related_person_address as relatedPersonAddress,
control_company_supervisor as controlCompanySupervisor,
control_company_supervisor_person as controlCompanySupervisorPerson,
risk_level as riskLevel,
jl_key_person.create_date as createDate,
jl_key_person.update_date as updateDate,
jl_key_person.create_user as createUser,
jl_key_person.update_user as updateUser,
summary.rating_type as ratingType,
rating_dict.label as ratingTypeName,
summary.rating as rating,
DATE_FORMAT(history.plan_start_data,'%Y-%m-%d') planStartData,
DATE_FORMAT(history.plan_end_data,'%Y-%m-%d') planEndData,
DATE_FORMAT(history.overdue_date,'%Y-%m-%d') overdueDate,
DATE_FORMAT(summary.rating_time,'%Y-%m-%d %T') ratingTime,
case
when history.id is null then 1
when curdate() &gt;= history.plan_start_data
and curdate() &lt;= history.plan_end_data
then 1
else 0
end as canClick,
history.id as historyId,
summary.id as summaryId,
case when history.do_status = '1' then 1 when history.do_status = '2' then 2 else '0' end as doStatus,
CASE
WHEN DATEDIFF(history.plan_end_data, CURDATE()) &lt; 0 THEN 0
ELSE DATEDIFF(history.plan_end_data, CURDATE())
END AS remainDays,
history.is_overdue as isOverdue,
<choose>
<when test="params._scope.scope_grade == '3'.toString()">
case when jl_key_person_rating_dual_person.id is not null and jl_key_person.city_id = #{params._scope.scope_area_id}
and jl_key_person.city_id != jl_key_person_rating_dual_person.city_id then '1' else '0' end as dualPersonBelong,
</when>
<when test="params._scope.scope_grade == '4'.toString()">
case when jl_key_person_rating_dual_person.id is not null and jl_key_person.area_id = #{params._scope.scope_area_id}
and jl_key_person.area_id != jl_key_person_rating_dual_person.area_id then '1' else '0' end as dualPersonBelong,
</when>
<when test="params._scope.scope_grade == '5'.toString()">
case when jl_key_person_rating_dual_person.id is not null and jl_key_person.street_id = #{params._scope.scope_area_id}
and jl_key_person.street_id != jl_key_person_rating_dual_person.street_id then '1' else '0' end as dualPersonBelong,
</when>
<when test="params._scope.scope_grade == '6'.toString()">
case when jl_key_person_rating_dual_person.id is not null and jl_key_person.community_id = #{params._scope.scope_area_id}
and jl_key_person.community_id != jl_key_person_rating_dual_person.community_id then '1' else '0' end as dualPersonBelong,
</when>
<otherwise>
'0' as dualPersonBelong,
</otherwise>
</choose>
<choose>
<when test="params._scope.scope_grade == '3'.toString()">
case when jl_key_person_rating_dual_person.city_id = #{params._scope.scope_area_id} then '1' else '0' end as dualPerson
</when>
<when test="params._scope.scope_grade == '4'.toString()">
case when jl_key_person_rating_dual_person.area_id = #{params._scope.scope_area_id} then '1' else '0' end as dualPerson
</when>
<when test="params._scope.scope_grade == '5'.toString()">
case when jl_key_person_rating_dual_person.street_id = #{params._scope.scope_area_id} then '1' else '0' end as dualPerson
</when>
<when test="params._scope.scope_grade == '6'.toString()">
case when jl_key_person_rating_dual_person.community_id = #{params._scope.scope_area_id} then '1' else '0' end as dualPerson
</when>
<otherwise>
'0' as dualPerson
</otherwise>
</choose>
from jl_key_person
left join sys_area city on jl_key_person.city_id = city.code
left join sys_area area on jl_key_person.area_id = area.code
left join sys_area street on jl_key_person.street_id = street.code
left join sys_area community on jl_key_person.community_id = community.code
left join jl_key_person_rating_history history on jl_key_person.id = history.key_person_id and history.rating_dict_type = #{params.sysType} and history.is_history = '1'
left join jl_key_person_rating_summary summary on jl_key_person.id = summary.key_person_id and summary.rating_dict_type = #{params.sysType} and summary.is_history = '1'
left join sys_dict rating_dict on rating_dict.type = 'rating_level' and rating_dict.del_flag = '0' and rating_dict.value = summary.rating_type
left join jl_key_person_rating_dual_person on jl_key_person.id = jl_key_person_rating_dual_person.key_person_id
<where> 1=1
<if test="params.involvingConflictsDisputes != null and params.involvingConflictsDisputes != ''">
and involving_conflicts_disputes like concat('%',#{params.involvingConflictsDisputes},'%')
</if>
<if test="params.ratingLevel != null and params.ratingLevel != ''">
and summary.rating_type like concat('%',#{params.ratingLevel},'%')
</if>
<!-- 处理doStatus=0的情况:查询do_status为null -->
<if test="params.doStatus != null and params.doStatus == 0">
and history.do_status is null
</if>
<!-- 处理doStatus=1的情况:模糊查询do_status包含1 -->
<if test="params.doStatus != null and params.doStatus == 1">
and history.do_status like concat('%',#{params.doStatus},'%')
</if>
<if test="params.doStatus != null and params.doStatus == 2">
and history.do_status like concat('%',#{params.doStatus},'%')
</if>
<if test="params.isOverdue != null and params.isOverdue != ''">
and history.is_overdue like concat('%',#{params.isOverdue},'%')
</if>
<if test="params.name != null and params.name != ''">
and jl_key_person.name like concat('%',#{params.name},'%')
</if>
<if test="params.sysType != null and params.sysType != ''">
and jl_key_person.sys_type = #{params.sysType}
</if>
<if test="params.cardNo != null and params.cardNo != ''">
<!--and card_no like concat('%',#{params.cardNo},'%')-->
and card_no like concat('%',TO_BASE64(AES_ENCRYPT(#{params.cardNo},'*#id#')),'%')
</if>
<if test="params.registeredResidence != null and params.registeredResidence != ''">
and registered_residence = #{params.registeredResidence}
</if>
<if test="params.phone != null and params.phone != ''">
and phone like concat('%',#{params.phone},'%')
</if>
<if test="params.hazardAssessmentLevel != null and params.hazardAssessmentLevel != ''">
and hazard_assessment_level like concat('%',#{params.hazardAssessmentLevel},'%')
</if>
<if test="params.responsibleCompanyByAssistance != null and params.responsibleCompanyByAssistance != ''">
and responsible_company_by_assistance like concat('%',#{params.responsibleCompanyByAssistance},'%')
</if>
<if test="params.responsiblePersonByAssistance != null and params.responsiblePersonByAssistance != ''">
and responsible_person_by_assistance like concat('%',#{params.responsiblePersonByAssistance},'%')
</if>
<if test="params.responsibleCompanyByKeyPersonnel != null and params.responsibleCompanyByKeyPersonnel != ''">
and responsible_company_by_key_personnel like concat('%',#{params.responsibleCompanyByKeyPersonnel},'%')
</if>
<if test="params.responsiblePersonKeyPersonnel != null and params.responsiblePersonKeyPersonnel != ''">
and responsible_person_key_personnel like concat('%',#{params.responsiblePersonKeyPersonnel},'%')
</if>
<if test="params.responsiblePerson != null and params.responsiblePerson != ''">
and responsible_person like concat('%',#{params.responsiblePerson},'%')
</if>
<if test="params.responsibleCompany != null and params.responsibleCompany != ''">
and responsible_company like concat('%',#{params.responsibleCompany},'%')
</if>
<if test="params.sex != null and params.sex != ''">
and sex = #{params.sex}
</if>
<if test="params.address != null and params.address != ''">
and address = #{params.address}
</if>
<if test="params.criminalTendency != null and params.criminalTendency != ''">
and criminal_tendency = #{params.criminalTendency}
</if>
<if test="params.criminalTendencySituation != null and params.criminalTendencySituation != ''">
and criminal_tendency_situation = #{params.criminalTendencySituation}
</if>
<if test="params.lettersVisitsType != null and params.lettersVisitsType != ''">
and letters_visits_type = #{params.lettersVisitsType}
</if>
<if test="params.folk != null and params.folk != ''">
and folk = #{params.folk}
</if>
<if test="params.relatedPersonName != null and params.relatedPersonName != ''">
and related_person_name = #{params.relatedPersonName}
</if>
<if test="params.relatedPersonRelation != null and params.relatedPersonRelation != ''">
and related_person_relation = #{params.relatedPersonRelation}
</if>
<if test="params.relatedPersonPhone != null and params.relatedPersonPhone != ''">
and related_person_phone = #{params.relatedPersonPhone}
</if>
<if test="params.relatedPersonAddress != null and params.relatedPersonAddress != ''">
and related_person_address = #{params.relatedPersonAddress}
</if>
<if test="params.controlCompanySupervisor != null and params.controlCompanySupervisor != ''">
and control_company_supervisor = #{params.controlCompanySupervisor}
</if>
<if test="params.controlCompanySupervisorPerson != null and params.controlCompanySupervisorPerson != ''">
and control_company_supervisor_person = #{params.controlCompanySupervisorPerson}
</if>
<if test="params.riskLevel != null and params.riskLevel != ''">
and risk_level = #{params.riskLevel}
</if>
<if test="params.cityId!=null and params.cityId!=''">
AND jl_key_person.city_id = #{params.cityId}
</if>
<if test="params.areaId!=null and params.areaId!=''">
AND jl_key_person.area_id = #{params.areaId}
</if>
<if test="params.streetId!=null and params.streetId!=''">
AND jl_key_person.street_id = #{params.streetId}
</if>
<if test="params.communityId!=null and params.communityId!=''">
AND jl_key_person.community_id = #{params.communityId}
</if>
<!-- 数据范围 -->
<choose>
<when test="params._scope.scope_grade == '3'.toString()">
AND jl_key_person.city_id = #{params._scope.scope_area_id}
</when>
<when test="params._scope.scope_grade == '4'.toString()">
AND jl_key_person.area_id = #{params._scope.scope_area_id}
</when>
<when test="params._scope.scope_grade == '5'.toString()">
AND jl_key_person.street_id = #{params._scope.scope_area_id}
</when>
<when test="params._scope.scope_grade == '6'.toString()">
AND jl_key_person.community_id = #{params._scope.scope_area_id}
</when>
</choose>
<if test="params.distCard != null and params.distCard !=''">
AND card_no IN (SELECT card_no FROM jl_key_person
<where>
sys_type = #{params.sysType}
<!-- 数据范围 -->
<choose>
<when test="params._scope.scope_grade == '3'.toString()">
AND (jl_key_person.city_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where city_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person.id))
</when>
<when test="params._scope.scope_grade == '4'.toString()">
AND (jl_key_person.area_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where area_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person.id))
</when>
<when test="params._scope.scope_grade == '5'.toString()">
AND (jl_key_person.street_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where street_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person.id))
</when>
<when test="params._scope.scope_grade == '6'.toString()">
AND (jl_key_person.community_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person.id))
</when>
</choose>
</where>
GROUP BY card_no HAVING COUNT(1) > 1)
</if>
</where>
) a
<if test="params.distCard == null or params.distCard ==''">
order by a.cardNo DESC, a.sort1, a.sort2, a.sort3
</if>
<if test="params.distCard != null and params.distCard !=''">
order by a.sort1, a.sort2, a.sort3, a.cardNo
</if>
</select>
<select id="findKeyPersonListExport_changchun" parameterType="page" resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson">
select
@rownum := @rownum + 1 AS xuhao,
a.*
from
(select jl_key_person.id as id,
jl_key_person.name as name,
sys_type as sysType,
<!--card_no cardNo,-->
cast(AES_DECRYPT(FROM_BASE64(card_no),'*#id#') as char) cardNo,
registered_residence as registeredResidence,
phone,
responsible_company_by_assistance as responsibleCompanyByAssistance,
responsible_person_by_assistance as responsiblePersonByAssistance,
responsible_company_by_key_personnel as responsibleCompanyByKeyPersonnel,
responsible_person_key_personnel as responsiblePersonKeyPersonnel,
responsible_person as responsiblePerson,
responsible_company as responsibleCompany,
<!--sex,-->
case sex when '1' then '男' when '2' then '女' end as sex,
address,
<!--criminal_tendency as criminalTendency,-->
case criminal_tendency when '1' then '有' when '2' then '无' end as criminalTendency,
(select group_concat(highly_concerned_situation) from jl_key_person_highly_concerned_rel where key_person_id=jl_key_person.id) as highly_concerned_situation,
criminal_tendency_situation as criminalTendencySituation,
letters_visits_type lettersVisitsType,
folk,
involving_conflicts_disputes as involvingConflictsDisputes,
city_id as cityId,
area_id as areaId,
street_id as streetId,
community_id as communityId,
community.name communityName,
jl_key_person.remarks as remarks,
hazard_assessment_level as hazardAssessmentLevel,
city.name cityName,
area.name areaName,
street.name streetName,
city.sort as sort1,
area.sort as sort2,
street.sort as sort3,
related_person_name as relatedPersonName,
related_person_relation relatedPersonRelation,
related_person_phone as relatedPersonPhone,
related_person_address as relatedPersonAddress,
control_company_supervisor as controlCompanySupervisor,
control_company_supervisor_person as controlCompanySupervisorPerson,
risk_level as riskLevel,
jl_key_person.create_date as createDate,
jl_key_person.update_date as updateDate,
jl_key_person.create_user as createUser,
jl_key_person.update_user as updateUser
from jl_key_person
left join sys_area city on jl_key_person.city_id = city.code
left join sys_area area on jl_key_person.area_id = area.code
left join sys_area street on jl_key_person.street_id = street.code
left join sys_area community on jl_key_person.community_id = community.code
<where> 1=1
<if test="involvingConflictsDisputes != null and involvingConflictsDisputes != ''">
and involving_conflicts_disputes like concat('%',#{involvingConflictsDisputes},'%')
</if>
<if test="name != null and name != ''">
and jl_key_person.name like concat('%',#{name},'%')
</if>
<if test="sysType != null and sysType != ''">
and sys_type = #{sysType}
</if>
<if test="cardNo != null and cardNo != ''">
and card_no like concat('%',#{cardNo},'%')
</if>
<if test="registeredResidence != null and registeredResidence != ''">
and registered_residence = #{registeredResidence}
</if>
<if test="phone != null and phone != ''">
and phone like concat('%',#{phone},'%')
</if>
<if test="hazardAssessmentLevel != null and hazardAssessmentLevel != ''">
and hazard_assessment_level like concat('%',#{hazardAssessmentLevel},'%')
</if>
<if test="responsibleCompanyByAssistance != null and responsibleCompanyByAssistance != ''">
and responsible_company_by_assistance like concat('%',#{responsibleCompanyByAssistance},'%')
</if>
<if test="responsiblePersonByAssistance != null and responsiblePersonByAssistance != ''">
and responsible_person_by_assistance like concat('%',#{responsiblePersonByAssistance},'%')
</if>
<if test="responsibleCompanyByKeyPersonnel != null and responsibleCompanyByKeyPersonnel != ''">
and responsible_company_by_key_personnel like concat('%',#{responsibleCompanyByKeyPersonnel},'%')
</if>
<if test="responsiblePersonKeyPersonnel != null and responsiblePersonKeyPersonnel != ''">
and responsible_person_key_personnel like concat('%',#{responsiblePersonKeyPersonnel},'%')
</if>
<if test="responsiblePerson != null and responsiblePerson != ''">
and responsible_person like concat('%',#{responsiblePerson},'%')
</if>
<if test="responsibleCompany != null and responsibleCompany != ''">
and responsible_company like concat('%',#{responsibleCompany},'%')
</if>
<if test="sex != null and sex != ''">
and sex = #{sex}
</if>
<if test="address != null and address != ''">
and address = #{address}
</if>
<if test="criminalTendency != null and criminalTendency != ''">
and criminal_tendency = #{criminalTendency}
</if>
<if test="criminalTendencySituation != null and criminalTendencySituation != ''">
and criminal_tendency_situation = #{criminalTendencySituation}
</if>
<if test="lettersVisitsType != null and lettersVisitsType != ''">
and letters_visits_type = #{lettersVisitsType}
</if>
<if test="folk != null and folk != ''">
and folk = #{folk}
</if>
<if test="relatedPersonName != null and relatedPersonName != ''">
and related_person_name = #{relatedPersonName}
</if>
<if test="relatedPersonRelation != null and relatedPersonRelation != ''">
and related_person_relation = #{relatedPersonRelation}
</if>
<if test="relatedPersonPhone != null and relatedPersonPhone != ''">
and related_person_phone = #{relatedPersonPhone}
</if>
<if test="relatedPersonAddress != null and relatedPersonAddress != ''">
and related_person_address = #{relatedPersonAddress}
</if>
<if test="controlCompanySupervisor != null and controlCompanySupervisor != ''">
and control_company_supervisor = #{controlCompanySupervisor}
</if>
<if test="controlCompanySupervisorPerson != null and controlCompanySupervisorPerson != ''">
and control_company_supervisor_person = #{controlCompanySupervisorPerson}
</if>
<if test="riskLevel != null and riskLevel != ''">
and risk_level = #{riskLevel}
</if>
<if test="_user.company_grade != '2'.toString()">
and (
create_user=#{_user.id}
or create_user in (
select id from sys_user where company_id in (
select id from sys_office where parent_ids LIKE CONCAT('%', #{_user.company_id}, '%') and del_flag='0'
) and del_flag='0'
)
)
</if>
<if test="cityId!=null and cityId!=''">
AND city_id = #{cityId}
</if>
<if test="areaId!=null and areaId!=''">
AND area_id = #{areaId}
</if>
<if test="streetId!=null and streetId!=''">
AND street_id = #{streetId}
</if>
<if test="communityId!=null and communityId!=''">
AND community_id = #{communityId}
</if>
</where>
) a,
(SELECT @rownum := 0) r
order by a.sort1, a.sort2, a.sort3
</select>
</mapper> </mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论