Merge remote-tracking branch 'origin/master'

This commit is contained in:
wangliwen 2022-04-27 18:44:08 +08:00
commit 2e45b8f47b
10 changed files with 28 additions and 24 deletions

View File

@ -28,7 +28,7 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
List<ResourceDTO> selectMostPopular(Map<String, Object> selectMap);
ResourceDTO selectDTOById(Long id);
ResourceDTO selectDTOById(@Param("id") Long id,@Param("userId") Long userId);
List<ResourceDTO> selectDTOPage(@Param("dto")ResourceDTO resourceDTO,
@Param("pageNum") Integer pageNum,

View File

@ -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

View File

@ -122,7 +122,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
public ResourceDTO selectWithAttrs(Long id) {
ResourceDTO resourceDTO = resourceDao.selectDTOById(id);
Long userId = SecurityUser.getUser().getId();
ResourceDTO resourceDTO = resourceDao.selectDTOById(id, userId);
QueryWrapper<AttrEntity> wrapper = new QueryWrapper<>();
wrapper.eq("data_resource_id", id)
.eq("del_flag", 0);

View File

@ -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;
@ -37,16 +35,12 @@ public class ResourceCarServiceImpl extends CrudServiceImpl<ResourceCarDao, Reso
@Autowired
private ResourceCarDao resourceCarDao;
@Autowired
private ResourceDao resourceDao;
@Override
public QueryWrapper<ResourceCarEntity> getWrapper(Map<String, Object> params){
QueryWrapper<ResourceCarEntity> wrapper = new QueryWrapper<>();
return wrapper;
}
@Override
public void deleteByIds(JSONObject jsonObject) {
List<Long> ids = jsonObject.getJSONArray("ids").toJavaList(Long.class);

View File

@ -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("导出")

View File

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

View File

@ -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

View File

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

View File

@ -190,7 +190,7 @@
LIMIT ${pageNum}, ${pageSize}
</select>
<select id="selectDTOById" resultType="io.renren.modules.resource.dto.ResourceDTO">
<select id="selectDTOById" resultMap="resourceDTO">
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

View File

@ -30,16 +30,16 @@
</foreach>
</update>
<update id="delete4Resource">
<delete id="deleteByResourceIds">
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
<foreach collection="resourceIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
</delete>
<select id="selectPageWithResource" resultType="io.renren.modules.resourceCollection.dto.ResourceCollectionDTO">
select trc.*