门户首页及二级搜索页面排序实现

This commit is contained in:
dinggang 2022-04-27 19:01:04 +08:00
parent 2e45b8f47b
commit b5ba97c55f
7 changed files with 34 additions and 38 deletions

View File

@ -17,15 +17,9 @@ import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.Map; import java.util.Map;
/** /**

View File

@ -6,8 +6,6 @@ import io.renren.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.entity.AttrEntity; import io.renren.modules.resource.entity.AttrEntity;
import io.renren.modules.resource.entity.ResourceEntity; import io.renren.modules.resource.entity.ResourceEntity;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**

View File

@ -26,5 +26,5 @@ public interface ResourceCollectionDao extends BaseDao<ResourceCollectionEntity>
Integer delete4Resource(@Param("resourceIds") List<Long> idList); Integer delete4Resource(@Param("resourceIds") List<Long> idList);
Integer deleteByResourceIds(Long[] ids, Long id); Integer deleteByResourceIds(@Param("resourceIds") Long[] resourceIds, @Param("userId") Long userId);
} }

View File

@ -2,7 +2,6 @@ package io.renren.modules.resourceCollection.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import io.renren.common.service.CrudService; import io.renren.common.service.CrudService;
import io.renren.modules.resourceCar.dto.ResourceCarDTO;
import io.renren.modules.resourceCollection.dto.ResourceCollectionDTO; import io.renren.modules.resourceCollection.dto.ResourceCollectionDTO;
import io.renren.modules.resourceCollection.entity.ResourceCollectionEntity; import io.renren.modules.resourceCollection.entity.ResourceCollectionEntity;
@ -19,7 +18,7 @@ public interface ResourceCollectionService extends CrudService<ResourceCollectio
void insertList(List<ResourceCollectionEntity> list); void insertList(List<ResourceCollectionEntity> list);
void deleteByIds(Long[] ids); void deleteByIds(Long[] resourceIds);
IPage<ResourceCollectionDTO> selectPage(Map<String, Object> params); IPage<ResourceCollectionDTO> selectPage(Map<String, Object> params);
} }

View File

@ -80,8 +80,8 @@ public class ResourceCollectionServiceImpl extends CrudServiceImpl<ResourceColle
} }
@Override @Override
public void deleteByIds(Long[] ids) { public void deleteByIds(Long[] resourceIds) {
UserDetail user = SecurityUser.getUser(); UserDetail user = SecurityUser.getUser();
resourceCollectionDao.deleteByResourceIds(ids, user.getId()); resourceCollectionDao.deleteByResourceIds(resourceIds, user.getId());
} }
} }

View File

@ -5,7 +5,6 @@ import io.renren.common.constant.Constant;
import io.renren.common.page.PageData; import io.renren.common.page.PageData;
import io.renren.common.utils.ExcelUtils; import io.renren.common.utils.ExcelUtils;
import io.renren.common.utils.Result; import io.renren.common.utils.Result;
import io.renren.common.validator.AssertUtils;
import io.renren.common.validator.ValidatorUtils; import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup; import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup; import io.renren.common.validator.group.DefaultGroup;
@ -19,7 +18,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
@ -28,7 +26,6 @@ import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* 能力评分表 * 能力评分表
* *
@ -89,9 +86,7 @@ public class ResourceScoreController {
public Result update(@RequestBody ResourceScoreDTO dto){ public Result update(@RequestBody ResourceScoreDTO dto){
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
resourceScoreService.update(dto); resourceScoreService.update(dto);
return new Result(); return new Result();
} }
@ -102,9 +97,7 @@ public class ResourceScoreController {
public Result delete(@RequestBody Long[] ids){ public Result delete(@RequestBody Long[] ids){
//效验数据 //效验数据
//AssertUtils.isArrayEmpty(ids, "id"); //AssertUtils.isArrayEmpty(ids, "id");
resourceScoreService.deleteByIds(ids); resourceScoreService.deleteByIds(ids);
return new Result(); return new Result();
} }

View File

@ -20,44 +20,56 @@
</resultMap> </resultMap>
<update id="deleteByIds"> <update id="deleteByIds">
update tb_resource_collection UPDATE tb_resource_collection
set del_flag = 1, SET del_flag = 1,
update_date = now() update_date = NOW()
where 1 = 1 WHERE 1 = 1
and id in AND id IN
<foreach collection="ids" item="item" open="(" separator="," close=")"> <foreach collection="ids" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</update> </update>
<delete id="deleteByResourceIds"> <update id="delete4Resource">
update tb_resource_collection update tb_resource_collection
set del_flag = 1, set del_flag = 1,
update_date = NOW() update_date = now()
where 1 = 1 AND user_id = #{userId} where 1 = 1
and resource_id in and resource_id in
<foreach collection="resourceIds" item="item" open="(" separator="," close=")"> <foreach collection="resourceIds" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</update>
<delete id="deleteByResourceIds">
UPDATE tb_resource_collection
SET del_flag = 1,
update_date = NOW()
WHERE 1 = 1
AND user_id = #{userId}
AND resource_id in
<foreach collection="resourceIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete> </delete>
<select id="selectPageWithResource" resultType="io.renren.modules.resourceCollection.dto.ResourceCollectionDTO"> <select id="selectPageWithResource" resultType="io.renren.modules.resourceCollection.dto.ResourceCollectionDTO">
select trc.* SELECT trc.*
from tb_resource_collection trc FROM tb_resource_collection trc
<if test="(params.type != null and params.type != '') or (params.name != null and params.name != '')"> <if test="(params.type != null and params.type != '') or (params.name != null and params.name != '')">
left join tb_data_resource tdr on trc.resource_id = tdr.id and tdr.del_flag = 0 LEFT JOIN tb_data_resource tdr ON trc.resource_id = tdr.id AND tdr.del_flag = 0
</if> </if>
where 1 = 1 WHERE 1 = 1
and trc.del_flag = 0 AND trc.del_flag = 0
and user_id = #{params.userId} AND user_id = #{params.userId}
<if test="params.name != null and params.name != ''" > <if test="params.name != null and params.name != ''" >
and tdr.name like CONCAT('%',#{params.name},'%') AND tdr.name LIKE CONCAT('%',#{params.name},'%')
</if> </if>
<if test="params.type != null and params.type != ''"> <if test="params.type != null and params.type != ''">
and tdr.type = #{params.type} AND tdr.type = #{params.type}
</if> </if>
order by trc.update_date desc, trc.create_date desc ORDER BY trc.update_date DESC, trc.create_date DESC
limit ${pageNum}, ${pageSize} LIMIT ${pageNum}, ${pageSize}
</select> </select>
</mapper> </mapper>