Compare commits

...

2 Commits

Author SHA1 Message Date
wangliwen 99bb41556d 按条件出条件总数 2022-06-27 19:58:24 +08:00
wangliwen 7288012bf6 资源表sql 中 规避使用 * 进行查询 2022-06-27 19:42:02 +08:00
3 changed files with 170 additions and 12 deletions

View File

@ -37,6 +37,8 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
@Param("orderField") String orderField,
@Param("orderType") String orderType);
Long selectDTOPageCount(@Param("dto") ResourceDTO resourceDTO);
List<Map> selectApplyArea(Long userId);
/**
@ -49,6 +51,7 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
/**
* 介入部门数目
*
* @return
*/
Long countAllDept();
@ -113,13 +116,21 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
List<Map> selectResourceNumAsType(Map<String, Object> params);
Integer selectResourceCarNum(Map params);
Integer selectResourceCollectionNum(Map params);
Integer selectResourceBrowseNum(Map params);
Integer selectResourceRelNum(Map params);
Integer selectResourceShare(Map params);
// List<Map<String,Object>> selectDeptList(Map params);
List<Map<String,Object>> selectResurceCarDetails(Map params);
List<Map<String,Object>> applicationAreaCapabilityList(Map params);
List<Map<String,Object>> applicationUsedAreaCapabilityList(Map params);
List<Map<String,Object>> applicationAreaCapabilityUseList(Map params);
// List<Map<String,Object>> selectDeptList(Map params);
List<Map<String, Object>> selectResurceCarDetails(Map params);
List<Map<String, Object>> applicationAreaCapabilityList(Map params);
List<Map<String, Object>> applicationUsedAreaCapabilityList(Map params);
List<Map<String, Object>> applicationAreaCapabilityUseList(Map params);
}

View File

@ -247,7 +247,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
if (resourceDTO.getInfoList().isEmpty()) {
List<ResourceDTO> resourceDTOS = resourceDao.selectDTOPage(resourceDTO, (pageNum - 1) * pageSize, pageSize, orderField, orderType);
resultPage.setRecords(resourceDTOS);
resultPage.setTotal(resourceDao.selectDTOPage(resourceDTO, 0, 100000, orderField, orderType).size());
resultPage.setTotal(resourceDao.selectDTOPageCount(resourceDTO));
} else {
List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType);
int j = Math.min(pageNum * pageSize, resourceDTOS.size());
@ -313,7 +313,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
if (resourceDTO.getInfoList().isEmpty()) {
List<ResourceDTO> resourceDTOS = resourceDao.selectDTOPage(resourceDTO, (pageNum - 1) * pageSize, pageSize, orderField, orderType);
resultPage.setRecords(resourceDTOS);
resultPage.setTotal(resourceDao.selectDTOPage(resourceDTO, 0, 100000, orderField, orderType).size());
resultPage.setTotal(resourceDao.selectDTOPageCount(resourceDTO));
} else {
List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType);
int j = Math.min(pageNum * pageSize, resourceDTOS.size());
@ -750,7 +750,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
}
@Override
public List<Map<String, Object>> applicationAreaCapabilityUseList(Map params){
public List<Map<String, Object>> applicationAreaCapabilityUseList(Map params) {
return resourceDao.applicationAreaCapabilityUseList(params);
}

View File

@ -105,7 +105,36 @@
<select id="selectWithAttrs" resultMap="resourceDTO">
SELECT
DISTINCT tdr.*,
DISTINCT tdr.id,
tdr.`type`,
tdr.`name`,
tdr.description,
tdr.link,
tdr.api_method_type,
tdr.api_url,
tdr.group_id,
tdr.dept_id,
tdr.dept_contacts,
tdr.dept_phone,
tdr.share_type,
tdr.share_mode,
tdr.share_condition,
tdr.district_id,
tdr.visits,
tdr.del_flag,
tdr.creator,
tdr.create_date,
tdr.updater,
tdr.update_date,
tdr.note1,
tdr.note2,
tdr.note3,
tdr.note4,
tdr.note5,
tdr.enclosure,
tdr.undercarriage_reason,
tdr.undercarriage_user_name,
tdr.info_list,
IFNULL(taa2.approve_status, '未申请') AS "applyState",
IFNULL(trs.score, 0 ) AS "score",
IFNULL(taa.applyCount, 0 ) AS "applyCount",
@ -193,7 +222,36 @@
<select id="selectMostPopular" resultType="io.renren.modules.resource.dto.ResourceDTO">
SELECT
tdr.*,
tdr.id,
tdr.`type`,
tdr.`name`,
tdr.description,
tdr.link,
tdr.api_method_type,
tdr.api_url,
tdr.group_id,
tdr.dept_id,
tdr.dept_contacts,
tdr.dept_phone,
tdr.share_type,
tdr.share_mode,
tdr.share_condition,
tdr.district_id,
tdr.visits,
tdr.del_flag,
tdr.creator,
tdr.create_date,
tdr.updater,
tdr.update_date,
tdr.note1,
tdr.note2,
tdr.note3,
tdr.note4,
tdr.note5,
tdr.enclosure,
tdr.undercarriage_reason,
tdr.undercarriage_user_name,
tdr.info_list,
IFNULL(trs.score, 0 ) AS "score",
IFNULL(taa.applyCount, 0 ) AS "applyCount",
IFNULL(trc.collectCount, 0) AS "collectCount",
@ -252,7 +310,36 @@
<!-- AND tdr.id = #{id}-->
SELECT
tdr.*,
tdr.id,
tdr.`type`,
tdr.`name`,
tdr.description,
tdr.link,
tdr.api_method_type,
tdr.api_url,
tdr.group_id,
tdr.dept_id,
tdr.dept_contacts,
tdr.dept_phone,
tdr.share_type,
tdr.share_mode,
tdr.share_condition,
tdr.district_id,
tdr.visits,
tdr.del_flag,
tdr.creator,
tdr.create_date,
tdr.updater,
tdr.update_date,
tdr.note1,
tdr.note2,
tdr.note3,
tdr.note4,
tdr.note5,
tdr.enclosure,
tdr.undercarriage_reason,
tdr.undercarriage_user_name,
tdr.info_list,
IFNULL( trs.score, 0 ) AS "score",
IFNULL( taa.applyCount, 0 ) AS "applyCount",
IFNULL( trc.collectCount, 0 ) AS "collectCount",
@ -292,7 +379,36 @@
<select id="selectDTOPage" resultType="io.renren.modules.resource.dto.ResourceDTO">
SELECT
tdr.*,
tdr.id,
tdr.`type`,
tdr.`name`,
tdr.description,
tdr.link,
tdr.api_method_type,
tdr.api_url,
tdr.group_id,
tdr.dept_id,
tdr.dept_contacts,
tdr.dept_phone,
tdr.share_type,
tdr.share_mode,
tdr.share_condition,
tdr.district_id,
tdr.visits,
tdr.del_flag,
tdr.creator,
tdr.create_date,
tdr.updater,
tdr.update_date,
tdr.note1,
tdr.note2,
tdr.note3,
tdr.note4,
tdr.note5,
tdr.enclosure,
tdr.undercarriage_reason,
tdr.undercarriage_user_name,
tdr.info_list,
IFNULL(trs.score, 0 ) AS "score",
IFNULL(taa.applyCount, 0 ) AS "applyCount",
IFNULL(trc.collectCount, 0) AS "collectCount",
@ -342,6 +458,37 @@
ORDER BY ${orderField} ${orderType}
LIMIT ${pageNum}, ${pageSize}
</select>
<select id="selectDTOPageCount" resultType="java.lang.Long">
SELECT
COUNT(DISTINCT tdr.id)
FROM
tb_data_resource tdr
WHERE
1 = 1
AND tdr.del_flag = 0
<if test="dto.name != null and dto.name != ''">
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE)
<!--AND tdr.name LIKE CONCAT('%',#{dto.name},'%') -->
</if>
<if test="dto.type != null and dto.type != ''">
AND tdr.type = #{dto.type}
</if>
<if test="dto.districtId != null and dto.districtId != ''">
AND tdr.district_id = #{dto.districtId}
</if>
<if test="null != dto.deptIds and dto.deptIds.size > 0">
AND tdr.dept_id IN
<foreach collection="dto.deptIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="dto.shareCondition != null and dto.shareCondition != ''">
AND tdr.share_condition = #{dto.shareCondition}
</if>
<if test="dto.deptId != null and dto.deptId != ''">
AND tdr.dept_id = #{dto.deptId}
</if>
</select>
<select id="selectApplyArea" resultType="java.util.Map">
SELECT