Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-10-26 09:44:42 +08:00
commit 6e6f7dfe07
3 changed files with 40 additions and 23 deletions

View File

@ -26,7 +26,9 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
@Cacheable(value = "selectWithAttrs", key = "#p0+'-'+#orderField+'-'+#orderType") @Cacheable(value = "selectWithAttrs", key = "#p0+'-'+#orderField+'-'+#orderType")
List<ResourceDTO> selectWithAttrs(@Param("dto") ResourceDTO resourceDTO, List<ResourceDTO> selectWithAttrs(@Param("dto") ResourceDTO resourceDTO,
@Param("orderField") String orderField, @Param("orderField") String orderField,
@Param("orderType") String orderType); @Param("orderType") String orderType,
@Param("nonChinese") Boolean nonChinese
);
List<Map> selectTypeCount(String type); List<Map> selectTypeCount(String type);
@ -39,7 +41,8 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
@Param("pageSize") Integer pageSize, @Param("pageSize") Integer pageSize,
@Param("orderField") String orderField, @Param("orderField") String orderField,
@Param("orderType") String orderType, @Param("orderType") String orderType,
@Param("ids") List<Long> ids @Param("ids") List<Long> ids,
@Param("nonChinese") Boolean nonChinese
); );
/** /**

View File

@ -404,6 +404,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
resourceDTO.setCreator(SecurityUser.getUser().getId()); resourceDTO.setCreator(SecurityUser.getUser().getId());
Integer pageNum = jsonObject.getInteger("pageNum"); Integer pageNum = jsonObject.getInteger("pageNum");
Integer pageSize = jsonObject.getInteger("pageSize"); Integer pageSize = jsonObject.getInteger("pageSize");
Boolean nonChinese = jsonObject.containsKey("nonChinese") ? jsonObject.getBoolean("nonChinese") : Boolean.FALSE; // 不传默认为中文走全文索引
//默认按上架时间降序排列 //默认按上架时间降序排列
String orderField; String orderField;
if (StringUtils.isBlank(jsonObject.getString("orderField"))) { if (StringUtils.isBlank(jsonObject.getString("orderField"))) {
@ -416,7 +417,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
switch (Constant.ProjectPlace.getByFlag(projectPlace)) { switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
case TSINGTAO: case TSINGTAO:
case BAOTOU: { // 包头青岛 case BAOTOU: { // 包头青岛
resultPage = common(resultPage, selectDTOPageSpecilTotal, resourceDTO, orderField, orderType, pageNum, pageSize); resultPage = common(resultPage, selectDTOPageSpecilTotal, resourceDTO, orderField, orderType, pageNum, pageSize, nonChinese);
} }
break; break;
case TSINGTAO_XHA: { case TSINGTAO_XHA: {
@ -463,7 +464,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} }
} else { // 西海岸普通资源 } else { // 西海岸普通资源
logger.info("西海岸普通"); logger.info("西海岸普通");
resultPage = common(resultPage, selectDTOPageSpecilTotal, resourceDTO, orderField, orderType, pageNum, pageSize); resultPage = common(resultPage, selectDTOPageSpecilTotal, resourceDTO, orderField, orderType, pageNum, pageSize, nonChinese);
} }
} }
break; break;
@ -476,7 +477,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
* 从本库内查询 * 从本库内查询
*/ */
@SneakyThrows @SneakyThrows
private Page<ResourceDTO> common(Page<ResourceDTO> resultPage, List<Map> selectDTOPageSpecilTotal, ResourceDTO resourceDTO, String orderField, String orderType, Integer pageNum, Integer pageSize) { private Page<ResourceDTO> common(Page<ResourceDTO> resultPage, List<Map> selectDTOPageSpecilTotal, ResourceDTO resourceDTO,
String orderField, String orderType, Integer pageNum, Integer pageSize, Boolean nonChinese) {
if (resourceDTO.getInfoList().isEmpty()) { if (resourceDTO.getInfoList().isEmpty()) {
List<ResourceDTO> resourceDTOS; List<ResourceDTO> resourceDTOS;
if (orderField.equals("total")) { // 对总体评价特殊处理 if (orderField.equals("total")) { // 对总体评价特殊处理
@ -514,7 +516,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
}).get(); }).get();
break; break;
} }
resourceDTOS = resourceDao.selectDTOPage(resourceDTO, null, null, null, null, ids); resourceDTOS = resourceDao.selectDTOPage(resourceDTO, null, null, null, null, ids, nonChinese);
if ("DESC".equals(orderType)) { if ("DESC".equals(orderType)) {
resourceDTOS = resourceDTOS.stream().sorted(Comparator.comparing(x -> { resourceDTOS = resourceDTOS.stream().sorted(Comparator.comparing(x -> {
ResourceDTO index = (ResourceDTO) x; ResourceDTO index = (ResourceDTO) x;
@ -544,13 +546,13 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} }
customThreadPool.shutdown(); customThreadPool.shutdown();
} else { // 非总体评价排序时 } else { // 非总体评价排序时
resourceDTOS = resourceDao.selectDTOPage(resourceDTO, (pageNum - 1) * pageSize, pageSize, orderField, orderType, null); resourceDTOS = resourceDao.selectDTOPage(resourceDTO, (pageNum - 1) * pageSize, pageSize, orderField, orderType, null, nonChinese);
} }
resultPage.setRecords(resourceDTOS); resultPage.setRecords(resourceDTOS);
resultPage.setTotal(resourceDao.selectDTOPageCount(resourceDTO)); resultPage.setTotal(resourceDao.selectDTOPageCount(resourceDTO));
} else { } else {
logger.info("排序要求 orderField:{} orderType:{}", orderField, orderType); logger.info("排序要求 orderField:{} orderType:{}", orderField, orderType);
List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType); List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType, nonChinese);
if (resourceDTOS.isEmpty()) { if (resourceDTOS.isEmpty()) {
resultPage.setRecords(new ArrayList<>()); resultPage.setRecords(new ArrayList<>());
resultPage.setTotal(0); resultPage.setTotal(0);

View File

@ -157,9 +157,12 @@
<if test="dto.type != null and dto.type != ''"> <if test="dto.type != null and dto.type != ''">
AND MATCH (tdr.type) AGAINST ( #{dto.type} IN BOOLEAN MODE) AND MATCH (tdr.type) AGAINST ( #{dto.type} IN BOOLEAN MODE)
</if> </if>
<if test="dto.name != null and dto.name != ''"> <if test="dto.name != null and dto.name != '' and nonChinese == false">
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE) AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE)
</if> </if>
<if test="dto.name != null and dto.name != '' and nonChinese == true">
AND tdr.name LIKE CONCAT( '%', #{dto.name}, '%' )
</if>
<if test="dto.districtId != null and dto.districtId != ''"> <if test="dto.districtId != null and dto.districtId != ''">
AND tdr.district_id = #{dto.districtId} AND tdr.district_id = #{dto.districtId}
</if> </if>
@ -210,7 +213,6 @@
<if test="orderField != 'pin_top' and orderField != 'deptSort'"> <if test="orderField != 'pin_top' and orderField != 'deptSort'">
ORDER BY ${orderField} ${orderType} ORDER BY ${orderField} ${orderType}
</if> </if>
</if> </if>
</select> </select>
@ -442,9 +444,12 @@
<if test="dto.type != '赋能案例'"> <if test="dto.type != '赋能案例'">
AND tdr.type != '赋能案例' AND tdr.type != '赋能案例'
</if> </if>
<if test="dto.name != null and dto.name != ''"> <if test="dto.name != null and dto.name != '' and nonChinese == false">
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE) AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE)
</if> </if>
<if test="dto.name != null and dto.name != '' and nonChinese == true">
AND tdr.name LIKE CONCAT( '%', #{dto.name}, '%' )
</if>
<if test="dto.type != null and dto.type != '' "> <if test="dto.type != null and dto.type != '' ">
AND MATCH (tdr.type) AGAINST ( #{dto.type} IN BOOLEAN MODE) AND MATCH (tdr.type) AGAINST ( #{dto.type} IN BOOLEAN MODE)
</if> </if>
@ -1601,7 +1606,8 @@
AND sd.type = #{type} AND sd.type = #{type}
</if> </if>
<if test=" area != null and area != ''"> <if test=" area != null and area != ''">
AND JSON_EXTRACT( info_list, JSON_UNQUOTE( REPLACE ( JSON_SEARCH( info_list, 'all', '应用领域', NULL, '$[*].attrType' ), 'attrType', 'attrValue' ) ) ) LIKE CONCAT( '%', #{area}, '%' ) AND JSON_EXTRACT( info_list, JSON_UNQUOTE( REPLACE ( JSON_SEARCH( info_list, 'all', '应用领域', NULL,
'$[*].attrType' ), 'attrType', 'attrValue' ) ) ) LIKE CONCAT( '%', #{area}, '%' )
</if> </if>
ORDER BY ORDER BY
sd.type, sr.sort, sd.sort, tdr.dept_id, tdr.visitor DESC, tdr.id DESC sd.type, sr.sort, sd.sort, tdr.dept_id, tdr.visitor DESC, tdr.id DESC
@ -1868,7 +1874,8 @@
</select> </select>
<select id="selectCensusResourceTable" resultType="java.util.Map"> <select id="selectCensusResourceTable" resultType="java.util.Map">
SELECT sd.name AS deptName, tdr.name AS resourceName, tdr.type, DATE_FORMAT(tdr.create_date,'%Y-%m-%d %T') AS createDate, SELECT sd.name AS deptName, tdr.name AS resourceName, tdr.type, DATE_FORMAT(tdr.create_date,'%Y-%m-%d %T') AS
createDate,
CASE WHEN (tdr.del_flag=0 OR tdr.del_flag=5) THEN '通过' WHEN tdr.del_flag=6 THEN '不通过' ELSE '审核中' END AS CASE WHEN (tdr.del_flag=0 OR tdr.del_flag=5) THEN '通过' WHEN tdr.del_flag=6 THEN '不通过' ELSE '审核中' END AS
approveStatus, trma.instance_id AS applyNumber approveStatus, trma.instance_id AS applyNumber
FROM (SELECT IF(d.type='组件服务', a.attr_value, d.type) AS type, d.id, d.del_flag, d.dept_id, d.create_date, FROM (SELECT IF(d.type='组件服务', a.attr_value, d.type) AS type, d.id, d.del_flag, d.dept_id, d.create_date,
@ -2179,7 +2186,8 @@
AND sd.type = #{type} AND sd.type = #{type}
</if> </if>
<if test=" area != null and area != ''"> <if test=" area != null and area != ''">
AND JSON_EXTRACT( info_list, JSON_UNQUOTE( REPLACE ( JSON_SEARCH( info_list, 'all', '应用领域', NULL, '$[*].attrType' ), 'attrType', 'attrValue' ) ) ) LIKE CONCAT( '%', #{area}, '%' ) AND JSON_EXTRACT( info_list, JSON_UNQUOTE( REPLACE ( JSON_SEARCH( info_list, 'all', '应用领域', NULL,
'$[*].attrType' ), 'attrType', 'attrValue' ) ) ) LIKE CONCAT( '%', #{area}, '%' )
</if> </if>
</select> </select>
@ -2201,12 +2209,14 @@
1 = 1 1 = 1
AND MATCH ( tdr.type ) AGAINST ( '组件服务' IN BOOLEAN MODE ) AND MATCH ( tdr.type ) AGAINST ( '组件服务' IN BOOLEAN MODE )
AND tdr.del_flag = 0 AND tdr.del_flag = 0
AND tdr.id IN ( SELECT data_resource_id FROM tb_data_attr WHERE attr_type = '组件类型' AND attr_value = #{type} AND del_flag = 0 ) AND tdr.id IN ( SELECT data_resource_id FROM tb_data_attr WHERE attr_type = '组件类型' AND attr_value = #{type}
AND del_flag = 0 )
<if test=" deptType != null and deptType != ''"> <if test=" deptType != null and deptType != ''">
AND sd.type = #{deptType} AND sd.type = #{deptType}
</if> </if>
<if test=" area != null and area != ''"> <if test=" area != null and area != ''">
AND JSON_EXTRACT( info_list, JSON_UNQUOTE( REPLACE ( JSON_SEARCH( info_list, 'all', '应用领域', NULL, '$[*].attrType' ), 'attrType', 'attrValue' ) ) ) LIKE CONCAT( '%', #{area}, '%') AND JSON_EXTRACT( info_list, JSON_UNQUOTE( REPLACE ( JSON_SEARCH( info_list, 'all', '应用领域', NULL,
'$[*].attrType' ), 'attrType', 'attrValue' ) ) ) LIKE CONCAT( '%', #{area}, '%')
</if> </if>
ORDER BY ORDER BY
sd.type, sd.type,
@ -2226,12 +2236,14 @@
1 = 1 1 = 1
AND MATCH ( tdr.type ) AGAINST ( '组件服务' IN BOOLEAN MODE ) AND MATCH ( tdr.type ) AGAINST ( '组件服务' IN BOOLEAN MODE )
AND tdr.del_flag = 0 AND tdr.del_flag = 0
AND tdr.id IN ( SELECT data_resource_id FROM tb_data_attr WHERE attr_type = '组件类型' AND attr_value = #{type} AND del_flag = 0 ) AND tdr.id IN ( SELECT data_resource_id FROM tb_data_attr WHERE attr_type = '组件类型' AND attr_value = #{type}
AND del_flag = 0 )
<if test=" deptType != null and deptType != ''"> <if test=" deptType != null and deptType != ''">
AND sd.type = #{deptType} AND sd.type = #{deptType}
</if> </if>
<if test=" area != null and area != ''"> <if test=" area != null and area != ''">
AND JSON_EXTRACT( info_list, JSON_UNQUOTE( REPLACE ( JSON_SEARCH( info_list, 'all', '应用领域', NULL, '$[*].attrType' ), 'attrType', 'attrValue' ) ) ) LIKE CONCAT( '%', #{area}, '%') AND JSON_EXTRACT( info_list, JSON_UNQUOTE( REPLACE ( JSON_SEARCH( info_list, 'all', '应用领域', NULL,
'$[*].attrType' ), 'attrType', 'attrValue' ) ) ) LIKE CONCAT( '%', #{area}, '%')
</if> </if>
</select> </select>