Merge branch 'master' into docker_package
This commit is contained in:
commit
6e6f7dfe07
|
@ -26,7 +26,9 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
|
|||
@Cacheable(value = "selectWithAttrs", key = "#p0+'-'+#orderField+'-'+#orderType")
|
||||
List<ResourceDTO> selectWithAttrs(@Param("dto") ResourceDTO resourceDTO,
|
||||
@Param("orderField") String orderField,
|
||||
@Param("orderType") String orderType);
|
||||
@Param("orderType") String orderType,
|
||||
@Param("nonChinese") Boolean nonChinese
|
||||
);
|
||||
|
||||
List<Map> selectTypeCount(String type);
|
||||
|
||||
|
@ -39,7 +41,8 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
|
|||
@Param("pageSize") Integer pageSize,
|
||||
@Param("orderField") String orderField,
|
||||
@Param("orderType") String orderType,
|
||||
@Param("ids") List<Long> ids
|
||||
@Param("ids") List<Long> ids,
|
||||
@Param("nonChinese") Boolean nonChinese
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -404,6 +404,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
resourceDTO.setCreator(SecurityUser.getUser().getId());
|
||||
Integer pageNum = jsonObject.getInteger("pageNum");
|
||||
Integer pageSize = jsonObject.getInteger("pageSize");
|
||||
Boolean nonChinese = jsonObject.containsKey("nonChinese") ? jsonObject.getBoolean("nonChinese") : Boolean.FALSE; // 不传默认为中文走全文索引
|
||||
//默认按上架时间降序排列
|
||||
String orderField;
|
||||
if (StringUtils.isBlank(jsonObject.getString("orderField"))) {
|
||||
|
@ -416,7 +417,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
|
||||
case TSINGTAO:
|
||||
case BAOTOU: { // 包头、青岛
|
||||
resultPage = common(resultPage, selectDTOPageSpecilTotal, resourceDTO, orderField, orderType, pageNum, pageSize);
|
||||
resultPage = common(resultPage, selectDTOPageSpecilTotal, resourceDTO, orderField, orderType, pageNum, pageSize, nonChinese);
|
||||
}
|
||||
break;
|
||||
case TSINGTAO_XHA: {
|
||||
|
@ -463,7 +464,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
}
|
||||
} else { // 西海岸普通资源
|
||||
logger.info("西海岸普通");
|
||||
resultPage = common(resultPage, selectDTOPageSpecilTotal, resourceDTO, orderField, orderType, pageNum, pageSize);
|
||||
resultPage = common(resultPage, selectDTOPageSpecilTotal, resourceDTO, orderField, orderType, pageNum, pageSize, nonChinese);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -476,7 +477,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
* 从本库内查询
|
||||
*/
|
||||
@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()) {
|
||||
List<ResourceDTO> resourceDTOS;
|
||||
if (orderField.equals("total")) { // 对总体评价特殊处理
|
||||
|
@ -514,7 +516,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
}).get();
|
||||
break;
|
||||
}
|
||||
resourceDTOS = resourceDao.selectDTOPage(resourceDTO, null, null, null, null, ids);
|
||||
resourceDTOS = resourceDao.selectDTOPage(resourceDTO, null, null, null, null, ids, nonChinese);
|
||||
if ("DESC".equals(orderType)) {
|
||||
resourceDTOS = resourceDTOS.stream().sorted(Comparator.comparing(x -> {
|
||||
ResourceDTO index = (ResourceDTO) x;
|
||||
|
@ -544,13 +546,13 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
}
|
||||
customThreadPool.shutdown();
|
||||
} 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.setTotal(resourceDao.selectDTOPageCount(resourceDTO));
|
||||
} else {
|
||||
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()) {
|
||||
resultPage.setRecords(new ArrayList<>());
|
||||
resultPage.setTotal(0);
|
||||
|
@ -1501,7 +1503,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
List<Map> maps = resourceDao.selectAppList((pageNum - 1) * 9, type, area);
|
||||
maps.forEach(x -> x.put("pic", resourceDao.selectPicByResId(x.get("id").toString())));
|
||||
return new HashMap() {{
|
||||
put("appList",maps);
|
||||
put("appList", maps);
|
||||
put("total", resourceDao.selectAppListCount(type, area));
|
||||
}};
|
||||
}
|
||||
|
|
|
@ -157,9 +157,12 @@
|
|||
<if test="dto.type != null and dto.type != ''">
|
||||
AND MATCH (tdr.type) AGAINST ( #{dto.type} IN BOOLEAN MODE)
|
||||
</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)
|
||||
</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 != ''">
|
||||
AND tdr.district_id = #{dto.districtId}
|
||||
</if>
|
||||
|
@ -210,7 +213,6 @@
|
|||
<if test="orderField != 'pin_top' and orderField != 'deptSort'">
|
||||
ORDER BY ${orderField} ${orderType}
|
||||
</if>
|
||||
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
@ -442,9 +444,12 @@
|
|||
<if test="dto.type != '赋能案例'">
|
||||
AND tdr.type != '赋能案例'
|
||||
</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)
|
||||
</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 != '' ">
|
||||
AND MATCH (tdr.type) AGAINST ( #{dto.type} IN BOOLEAN MODE)
|
||||
</if>
|
||||
|
@ -1601,7 +1606,8 @@
|
|||
AND sd.type = #{type}
|
||||
</if>
|
||||
<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>
|
||||
ORDER BY
|
||||
sd.type, sr.sort, sd.sort, tdr.dept_id, tdr.visitor DESC, tdr.id DESC
|
||||
|
@ -1868,7 +1874,8 @@
|
|||
</select>
|
||||
|
||||
<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
|
||||
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,
|
||||
|
@ -2179,7 +2186,8 @@
|
|||
AND sd.type = #{type}
|
||||
</if>
|
||||
<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>
|
||||
</select>
|
||||
|
||||
|
@ -2201,12 +2209,14 @@
|
|||
1 = 1
|
||||
AND MATCH ( tdr.type ) AGAINST ( '组件服务' IN BOOLEAN MODE )
|
||||
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 )
|
||||
<if test = " deptType != null and deptType != ''">
|
||||
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 != ''">
|
||||
AND sd.type = #{deptType}
|
||||
</if>
|
||||
<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}, '%')
|
||||
<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}, '%')
|
||||
</if>
|
||||
ORDER BY
|
||||
sd.type,
|
||||
|
@ -2226,12 +2236,14 @@
|
|||
1 = 1
|
||||
AND MATCH ( tdr.type ) AGAINST ( '组件服务' IN BOOLEAN MODE )
|
||||
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 )
|
||||
<if test = " deptType != null and deptType != ''">
|
||||
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 != ''">
|
||||
AND sd.type = #{deptType}
|
||||
</if>
|
||||
<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}, '%')
|
||||
<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}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
|
Loading…
Reference in New Issue