From 39602c3fbe8925d7404b278fabc4c52996fc06c7 Mon Sep 17 00:00:00 2001 From: dinggang <2498628697@qq.com> Date: Wed, 27 Apr 2022 18:05:47 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=A8=E6=88=B7=E9=A6=96=E9=A1=B5=E5=8F=8A?= =?UTF-8?q?=E4=BA=8C=E7=BA=A7=E6=90=9C=E7=B4=A2=E9=A1=B5=E9=9D=A2=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/renren/modules/resource/dao/ResourceDao.java | 2 +- .../io/renren/modules/resource/entity/AttrEntity.java | 8 +++++--- .../resource/service/impl/ResourceServiceImpl.java | 5 +++-- .../resourceCar/service/impl/ResourceCarServiceImpl.java | 6 ------ .../controller/ResourceCollectionController.java | 6 ++++-- .../resourceCollection/dao/ResourceCollectionDao.java | 2 ++ .../entity/ResourceCollectionEntity.java | 4 +++- .../service/impl/ResourceCollectionServiceImpl.java | 3 ++- .../src/main/resources/mapper/resource/ResourceDao.xml | 8 ++++---- .../mapper/resourceCollection/ResourceCollectionDao.xml | 8 ++++---- 10 files changed, 28 insertions(+), 24 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java b/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java index b5069726..2c9de0fd 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java @@ -28,7 +28,7 @@ public interface ResourceDao extends BaseDao { List selectMostPopular(Map selectMap); - ResourceDTO selectDTOById(Long id); + ResourceDTO selectDTOById(@Param("id") Long id,@Param("userId") Long userId); List selectDTOPage(@Param("dto")ResourceDTO resourceDTO, @Param("pageNum") Integer pageNum, diff --git a/renren-admin/src/main/java/io/renren/modules/resource/entity/AttrEntity.java b/renren-admin/src/main/java/io/renren/modules/resource/entity/AttrEntity.java index 1dbb119b..296d03ec 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/entity/AttrEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/entity/AttrEntity.java @@ -3,6 +3,8 @@ package io.renren.modules.resource.entity; import lombok.Data; import lombok.EqualsAndHashCode; import com.baomidou.mybatisplus.annotation.*; + +import java.io.Serializable; import java.util.Date; /** @@ -11,10 +13,10 @@ import java.util.Date; * @author dg * @since 1.0 2022-04-13 */ -//@Data -//@EqualsAndHashCode(callSuper=false) +@Data +@EqualsAndHashCode(callSuper=false) @TableName("tb_data_attr") -public class AttrEntity { +public class AttrEntity implements Serializable{ private static final long serialVersionUID = 1L; @TableId diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 86100493..38c93172 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -122,10 +122,11 @@ public class ResourceServiceImpl extends CrudServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq("data_resource_id", id) - .eq("del_f lag", 0); + .eq("del_flag", 0); List attrEntities = attrDao.selectList(wrapper); resourceDTO.setInfoList(attrEntities); return resourceDTO; diff --git a/renren-admin/src/main/java/io/renren/modules/resourceCar/service/impl/ResourceCarServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resourceCar/service/impl/ResourceCarServiceImpl.java index ea58dbde..3deea775 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceCar/service/impl/ResourceCarServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceCar/service/impl/ResourceCarServiceImpl.java @@ -5,8 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.renren.common.service.impl.CrudServiceImpl; -import io.renren.modules.resource.dao.ResourceDao; -import io.renren.modules.resource.entity.ResourceEntity; import io.renren.modules.resource.service.ResourceService; import io.renren.modules.resourceCar.dao.ResourceCarDao; import io.renren.modules.resourceCar.dto.ResourceCarDTO; @@ -36,9 +34,6 @@ public class ResourceCarServiceImpl extends CrudServiceImpl getWrapper(Map params){ @@ -46,7 +41,6 @@ public class ResourceCarServiceImpl extends CrudServiceImpl ids = jsonObject.getJSONArray("ids").toJavaList(Long.class); diff --git a/renren-admin/src/main/java/io/renren/modules/resourceCollection/controller/ResourceCollectionController.java b/renren-admin/src/main/java/io/renren/modules/resourceCollection/controller/ResourceCollectionController.java index ddef97c0..647173ae 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceCollection/controller/ResourceCollectionController.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceCollection/controller/ResourceCollectionController.java @@ -88,15 +88,17 @@ public class ResourceCollectionController { @ApiOperation("删除") @LogOperation("删除") //@RequiresPermissions("resourceCollection:resourcecollection:delete") - public Result delete(@RequestBody Long[] ids){ + public Result delete(@RequestBody Long[] resourceIds){ //效验数据 //AssertUtils.isArrayEmpty(ids, "id"); - resourceCollectionService.deleteByIds(ids); + resourceCollectionService.deleteByIds(resourceIds); return new Result(); } + + @GetMapping("export") @ApiOperation("导出") @LogOperation("导出") diff --git a/renren-admin/src/main/java/io/renren/modules/resourceCollection/dao/ResourceCollectionDao.java b/renren-admin/src/main/java/io/renren/modules/resourceCollection/dao/ResourceCollectionDao.java index 6f2136d0..a09e6da4 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceCollection/dao/ResourceCollectionDao.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceCollection/dao/ResourceCollectionDao.java @@ -25,4 +25,6 @@ public interface ResourceCollectionDao extends BaseDao @Param("pageSize") Integer pageSize); Integer delete4Resource(@Param("resourceIds") List idList); + + Integer deleteByResourceIds(Long[] ids, Long id); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resourceCollection/entity/ResourceCollectionEntity.java b/renren-admin/src/main/java/io/renren/modules/resourceCollection/entity/ResourceCollectionEntity.java index 54cea42e..ca8c4b6f 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceCollection/entity/ResourceCollectionEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceCollection/entity/ResourceCollectionEntity.java @@ -3,6 +3,8 @@ package io.renren.modules.resourceCollection.entity; import lombok.Data; import lombok.EqualsAndHashCode; import com.baomidou.mybatisplus.annotation.*; + +import java.io.Serializable; import java.util.Date; /** @@ -14,7 +16,7 @@ import java.util.Date; @Data @EqualsAndHashCode(callSuper=false) @TableName("tb_resource_collection") -public class ResourceCollectionEntity { +public class ResourceCollectionEntity implements Serializable { private static final long serialVersionUID = 1L; @TableId diff --git a/renren-admin/src/main/java/io/renren/modules/resourceCollection/service/impl/ResourceCollectionServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resourceCollection/service/impl/ResourceCollectionServiceImpl.java index 455dbb3e..356293ab 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceCollection/service/impl/ResourceCollectionServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceCollection/service/impl/ResourceCollectionServiceImpl.java @@ -81,6 +81,7 @@ public class ResourceCollectionServiceImpl extends CrudServiceImpl - SELECT tdr.*, tda.*, @@ -207,11 +207,11 @@ LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id LEFT JOIN ( SELECT resource_id, user_id, ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect" FROM tb_resource_collection WHERE - 1 = 1 AND del_flag = 0 AND user_id = #{dto.creator} + 1 = 1 AND del_flag = 0 AND user_id = #{userId} GROUP BY resource_id) trc2 ON tdr.id = trc2.resource_id LEFT JOIN ( SELECT resource_id, user_id, ( CASE approve_status WHEN '通过' THEN 'true' ELSE 'false' END ) AS "applyState" FROM t_ability_application WHERE - 1 = 1 AND del_flag = 0 AND user_id = #{dto.creator} - GROUP BY resource_id) taa2 ON tdr.id = taa2.resource_id + 1 = 1 AND del_flag = 0 AND user_id = #{userId} + GROUP BY id) taa2 ON tdr.id = taa2.resource_id LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id WHERE 1 = 1 AND tdr.del_flag = 0 diff --git a/renren-admin/src/main/resources/mapper/resourceCollection/ResourceCollectionDao.xml b/renren-admin/src/main/resources/mapper/resourceCollection/ResourceCollectionDao.xml index a1553c9b..539622cd 100644 --- a/renren-admin/src/main/resources/mapper/resourceCollection/ResourceCollectionDao.xml +++ b/renren-admin/src/main/resources/mapper/resourceCollection/ResourceCollectionDao.xml @@ -30,16 +30,16 @@ - + update tb_resource_collection set del_flag = 1, - update_date = now() - where 1 = 1 + update_date = NOW() + where 1 = 1 AND user_id = #{userId} and resource_id in #{item} - +