Merge remote-tracking branch 'origin/master'

This commit is contained in:
wangliwen 2022-04-27 19:09:57 +08:00
commit c7c5f52b1e
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.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
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;
/**

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.ResourceEntity;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**

View File

@ -26,5 +26,5 @@ public interface ResourceCollectionDao extends BaseDao<ResourceCollectionEntity>
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 io.renren.common.service.CrudService;
import io.renren.modules.resourceCar.dto.ResourceCarDTO;
import io.renren.modules.resourceCollection.dto.ResourceCollectionDTO;
import io.renren.modules.resourceCollection.entity.ResourceCollectionEntity;
@ -19,7 +18,7 @@ public interface ResourceCollectionService extends CrudService<ResourceCollectio
void insertList(List<ResourceCollectionEntity> list);
void deleteByIds(Long[] ids);
void deleteByIds(Long[] resourceIds);
IPage<ResourceCollectionDTO> selectPage(Map<String, Object> params);
}

View File

@ -80,8 +80,8 @@ public class ResourceCollectionServiceImpl extends CrudServiceImpl<ResourceColle
}
@Override
public void deleteByIds(Long[] ids) {
public void deleteByIds(Long[] resourceIds) {
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.utils.ExcelUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.AssertUtils;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
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.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
@ -28,7 +26,6 @@ import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 能力评分表
*
@ -89,9 +86,7 @@ public class ResourceScoreController {
public Result update(@RequestBody ResourceScoreDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
resourceScoreService.update(dto);
return new Result();
}
@ -102,9 +97,7 @@ public class ResourceScoreController {
public Result delete(@RequestBody Long[] ids){
//效验数据
//AssertUtils.isArrayEmpty(ids, "id");
resourceScoreService.deleteByIds(ids);
return new Result();
}

View File

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