Commit b34e5457 authored by suhuiguang's avatar suhuiguang

1.使用登记分页太慢问题处理

parent ece8f24a
...@@ -49,79 +49,157 @@ ...@@ -49,79 +49,157 @@
LEFT JOIN idx_biz_jg_other_info other on re.equ_id = other.RECORD LEFT JOIN idx_biz_jg_other_info other on re.equ_id = other.RECORD
LEFT JOIN idx_biz_jg_supervision_info ibjsi on re.equ_id = ibjsi.RECORD LEFT JOIN idx_biz_jg_supervision_info ibjsi on re.equ_id = ibjsi.RECORD
</sql> </sql>
<sql id="page-list-sub-select">
select
ur.sequence_nbr as sequenceNbr,
ur.audit_status as auditStatus,
date_format(ur.reg_date,'%Y-%m-%d') as regDate,
ur.use_unit_name as useUnitName,
ur.status,
ur.receive_org_name as receiveOrgName,
ur.use_address as place,
ur.instance_id as instanceId,
ur.apply_no as applyNo,
ur.next_execute_ids as nextExecuteIds,
ur.promoter,
ur.use_registration_code as useRegistrationCode,
date_format(ur.audit_pass_date,'%Y-%m-%d') as auditPassDate,
date_format(ur.create_date,'%Y-%m-%d') as createDate,
ur.receive_org_name as receiveOrgName,
ur.next_execute_user_ids as nextExecuteUserIds,
ur.next_task_id as nextTaskId,
ur.create_user_id as createUserId,
ur.rec_date as recDate,
ur.manage_type as manageType,
ur.reg_type as regType,
ur.is_delete,
ur.create_date,
ur.receive_company_code,
ur.use_unit_credit_code,
ur.transfer_to_user_ids,
ur.use_address as fullAddress,
ur.cancel_reason as cancelReason,
(select group_concat(re.equ_id) from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id) as equipId,
(SELECT
group_concat(other.supervisory_code)
from
idx_biz_jg_register_info jri
LEFT JOIN idx_biz_jg_other_info other on jri.RECORD = other.RECORD where jri.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as supervisoryCode ,
(SELECT
group_concat(other.CODE96333)
from
idx_biz_jg_register_info jri
LEFT JOIN idx_biz_jg_other_info other on jri.RECORD = other.RECORD where jri.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as code96333 ,
(SELECT
group_concat(jri.PRODUCT_NAME)
from
idx_biz_jg_register_info jri where jri.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as productName ,
(SELECT
group_concat(DISTINCT jri.EQU_CODE)
from
idx_biz_jg_register_info jri where jri.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as equCode ,
(SELECT
group_concat(DISTINCT jri.EQU_LIST)
from
idx_biz_jg_register_info jri where jri.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as equListCode,
(SELECT
group_concat(DISTINCT jri.EQU_CATEGORY)
from
idx_biz_jg_register_info jri where jri.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as equCategoryCode,
(SELECT
group_concat(DISTINCT jri."EQU_DEFINE")
from
idx_biz_jg_register_info jri where jri.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as equDefineCode,
(SELECT
group_concat(DISTINCT c.name)
from
idx_biz_jg_register_info jri,tz_equipment_category c where jri.EQU_LIST = c.code and jri.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as equListName,
(SELECT
group_concat(DISTINCT c.name)
from
idx_biz_jg_register_info jri,tz_equipment_category c where jri.EQU_CATEGORY = c.code and jri.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as equCategory,
(SELECT
group_concat(DISTINCT c.name)
from
idx_biz_jg_register_info jri,tz_equipment_category c where jri.EQU_DEFINE = c.code and jri.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as equDefine,
(SELECT
group_concat(DISTINCT ibjsi.ORG_BRANCH_NAME)
from
idx_biz_jg_supervision_info ibjsi where ibjsi.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as orgBranchName
from
tzs_jg_use_registration ur
</sql>
<select id="getListPage" resultType="java.util.Map"> <select id="getListPage" resultType="java.util.Map">
<include refid="page-list"/> select
*
from
(
<include refid="page-list-sub-select"/>
)
<where> <where>
ur.is_delete = 0 is_delete = 0
<if test="dto.equList != null and dto.equList != ''"> <if test="dto.equList != null and dto.equList != ''">
and jri. EQU_LIST= #{dto.equList} and equListCode= #{dto.equList}
</if> </if>
<if test="dto.equCategory != null and dto.equCategory != ''"> <if test="dto.equCategory != null and dto.equCategory != ''">
and jri.EQU_CATEGORY = #{dto.equCategory} and equCategoryCode = #{dto.equCategory}
</if> </if>
<if test="dto.equDefine != null and dto.equDefine != ''"> <if test="dto.equDefine != null and dto.equDefine != ''">
and jri.EQU_DEFINE = #{dto.equDefine} and equDefineCode = #{dto.equDefine}
</if> </if>
<if test="dto.status != null and dto.status != ''"> <if test="dto.status != null and dto.status != ''">
and ur.status = #{dto.status} and status = #{dto.status}
</if> </if>
<if test="dto.applicationDate != null"> <if test="dto.applicationDate != null">
and ur.create_date like concat('%',DATE_FORMAT(#{dto.applicationDate},'%Y-%m-%d'),'%') and create_date like concat('%',DATE_FORMAT(#{dto.applicationDate},'%Y-%m-%d'),'%')
</if> </if>
<if test="dto.equCode != null and dto.equCode != ''"> <if test="dto.equCode != null and dto.equCode != ''">
and jri.EQU_CODE like concat('%',#{dto.equCode},'%') and equCode like concat('%',#{dto.equCode},'%')
</if> </if>
<if test="dto.code96333 != null and dto.code96333 != ''"> <if test="dto.code96333 != null and dto.code96333 != ''">
and other.CODE96333 like concat('%',#{dto.code96333},'%') and code96333 like concat('%',#{dto.code96333},'%')
</if> </if>
<if test="dto.supervisoryCode != null and dto.supervisoryCode != ''"> <if test="dto.supervisoryCode != null and dto.supervisoryCode != ''">
and other.supervisory_code like concat('%',#{dto.supervisoryCode},'%') and supervisoryCode like concat('%',#{dto.supervisoryCode},'%')
</if> </if>
<if test="dto.fullAddress != null and dto.fullAddress != ''"> <if test="dto.fullAddress != null and dto.fullAddress != ''">
AND ( AND fullAddress LIKE CONCAT('%', #{dto.fullAddress}, '%')
use."PROVINCE_NAME" LIKE CONCAT('%', #{dto.fullAddress}, '%')
OR use."CITY_NAME" LIKE CONCAT('%', #{dto.fullAddress}, '%')
OR use."COUNTY_NAME" LIKE CONCAT('%', #{dto.fullAddress}, '%')
OR use."STREET_NAME" LIKE CONCAT('%', #{dto.fullAddress}, '%')
)
</if> </if>
<if test="dto.receiveCompanyCode != null and dto.receiveCompanyCode != ''"> <if test="dto.receiveCompanyCode != null and dto.receiveCompanyCode != ''">
AND ur.receive_company_code = #{dto.receiveCompanyCode} AND receive_company_code = #{dto.receiveCompanyCode}
</if> </if>
<if test="dto.useUnitName != null and dto.useUnitName != ''"> <if test="dto.useUnitName != null and dto.useUnitName != ''">
and ur.use_unit_name like concat('%',#{dto.useUnitName},'%') and useUnitName like concat('%',#{dto.useUnitName},'%')
</if> </if>
<if test="dto.applyNo != null and dto.applyNo != ''"> <if test="dto.applyNo != null and dto.applyNo != ''">
and ur.apply_no like concat('%',#{dto.applyNo},'%') and applyNo like concat('%',#{dto.applyNo},'%')
</if> </if>
<if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''"> <if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
and ur.use_registration_code like concat('%',#{dto.useRegistrationCode},'%') and useRegistrationCode like concat('%',#{dto.useRegistrationCode},'%')
</if> </if>
<if test="dto.useUnitCode != null and dto.useUnitCode != ''"> <if test="dto.useUnitCode != null and dto.useUnitCode != ''">
and ur.use_unit_credit_code = #{dto.useUnitCode} and use_unit_credit_code = #{dto.useUnitCode}
</if> </if>
<!-- <if test="roleIds != null and dto.dataType == 'supervision'">-->
<!-- <foreach collection='roleIds' item='role' open='and (' close=')' separator='or'>-->
<!-- instance_status like concat('%',#{role},'%')-->
<!-- </foreach>-->
<!-- </if>-->
<if test="dto.dataType == 'supervision' "> <if test="dto.dataType == 'supervision' ">
AND (ur.receive_company_code = #{dto.receiveCompanyCode} or ur.transfer_to_user_ids LIKE concat ('%', AND (receive_company_code = #{dto.receiveCompanyCode} or transfer_to_user_ids LIKE concat ('%',
#{dto.currentUserId}, '%')) #{dto.currentUserId}, '%'))
AND ur.status <![CDATA[<>]]> '使用单位待提交' AND status <![CDATA[<>]]> '使用单位待提交'
</if> </if>
<if test="dto.dataType == 'company' "> <if test="dto.dataType == 'company' ">
AND (ur.use_unit_credit_code = #{dto.unitCode} or ur.transfer_to_user_ids LIKE concat ('%', AND (use_unit_credit_code = #{dto.unitCode} or transfer_to_user_ids LIKE concat ('%',#{dto.currentUserId}, '%'))
#{dto.currentUserId}, '%'))
</if> </if>
GROUP BY re.equip_transfer_id
</where> </where>
order by order by
<if test="sort != null"> <choose>
ur.${sort.field} ${sort.sortType}, <when test="sort != null">
</if> ${sort.field} ${sort.sortType}
ur.create_date DESC, ur.apply_no DESC </when>
<otherwise>
create_date DESC, applyNo DESC
</otherwise>
</choose>
</select> </select>
<select id="queryRegistrationInIds" resultType="com.yeejoin.amos.boot.module.jg.api.vo.tableDataExportVo.RegistrationVo"> <select id="queryRegistrationInIds" resultType="com.yeejoin.amos.boot.module.jg.api.vo.tableDataExportVo.RegistrationVo">
......
...@@ -114,7 +114,7 @@ public class JgUseRegistrationController extends BaseController { ...@@ -114,7 +114,7 @@ public class JgUseRegistrationController extends BaseController {
Page<Map<String, Object>> list = jgUseRegistrationServiceImpl.getList(dto, sort, page, dto.getRoleIds()); Page<Map<String, Object>> list = jgUseRegistrationServiceImpl.getList(dto, sort, page, dto.getRoleIds());
list.getRecords().forEach(x -> { list.getRecords().forEach(x -> {
x.put("companyType", info.getCompany().getCompanyType()); x.put("companyType", info.getCompany().getCompanyType());
x.put("regTypeDesc", "1".equals(x.get("regType")) ? "历史登记" : "新增登记"); x.put("regType", "1".equals(x.get("regType")) ? "历史登记" : "新增登记");
}); });
return ResponseHelper.buildResponse(list); return ResponseHelper.buildResponse(list);
} }
......
...@@ -2011,6 +2011,30 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2011,6 +2011,30 @@ public class CommonServiceImpl implements ICommonService {
return optionalSortMap.orElse(null); return optionalSortMap.orElse(null);
} }
/**
* 排序字段不转下滑线 排序 :页面列表排序功能支持,将 "字段,ascend" 或 "字段,descend" 转化为对应JSONObject
*
* @param sort "字段,ascend" 或 "字段,descend"
* @return JSONObject
*/
public SortVo sortFieldConversionNoToUnderline(String sort) {
Optional<String> optionalSort = Optional.ofNullable(sort);
Optional<SortVo> optionalSortMap = optionalSort.filter(s -> !s.isEmpty())
.map(s -> {
String[] sortParts = s.split(",");
if (sortParts.length == 2) {
String field = sortParts[0];
String sortSituation = sortParts[1].contains("asc") ? "ASC" : "DESC";
return SortVo.builder()
.field(field)
.sortType(sortSituation)
.build();
}
return null;
});
return optionalSortMap.orElse(null);
}
@Override @Override
public void fightUseFlagGenerate(UseFlagParamDto useFlagParamDto, HttpServletResponse response) { public void fightUseFlagGenerate(UseFlagParamDto useFlagParamDto, HttpServletResponse response) {
Objects.requireNonNull(useFlagParamDto, "参数不能为空"); Objects.requireNonNull(useFlagParamDto, "参数不能为空");
......
...@@ -275,7 +275,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -275,7 +275,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
} }
public Page<Map<String, Object>> getList(JgUseRegistrationDto dto, String sort, Page<Map<String, Object>> page, List<String> roleIds) { public Page<Map<String, Object>> getList(JgUseRegistrationDto dto, String sort, Page<Map<String, Object>> page, List<String> roleIds) {
SortVo sortMap = commonServiceImpl.sortFieldConversion(sort); SortVo sortMap = commonServiceImpl.sortFieldConversionNoToUnderline(sort);
return this.baseMapper.getListPage(page, sortMap, dto, roleIds); return this.baseMapper.getListPage(page, sortMap, dto, roleIds);
} }
......
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