Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
2e45b8f47b
|
@ -28,7 +28,7 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
|
||||||
|
|
||||||
List<ResourceDTO> selectMostPopular(Map<String, Object> selectMap);
|
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,
|
List<ResourceDTO> selectDTOPage(@Param("dto")ResourceDTO resourceDTO,
|
||||||
@Param("pageNum") Integer pageNum,
|
@Param("pageNum") Integer pageNum,
|
||||||
|
|
|
@ -3,6 +3,8 @@ package io.renren.modules.resource.entity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,10 +13,10 @@ import java.util.Date;
|
||||||
* @author dg
|
* @author dg
|
||||||
* @since 1.0 2022-04-13
|
* @since 1.0 2022-04-13
|
||||||
*/
|
*/
|
||||||
//@Data
|
@Data
|
||||||
//@EqualsAndHashCode(callSuper=false)
|
@EqualsAndHashCode(callSuper=false)
|
||||||
@TableName("tb_data_attr")
|
@TableName("tb_data_attr")
|
||||||
public class AttrEntity {
|
public class AttrEntity implements Serializable{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId
|
@TableId
|
||||||
|
|
|
@ -122,10 +122,11 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceDTO selectWithAttrs(Long id) {
|
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<>();
|
QueryWrapper<AttrEntity> wrapper = new QueryWrapper<>();
|
||||||
wrapper.eq("data_resource_id", id)
|
wrapper.eq("data_resource_id", id)
|
||||||
.eq("del_f lag", 0);
|
.eq("del_flag", 0);
|
||||||
List<AttrEntity> attrEntities = attrDao.selectList(wrapper);
|
List<AttrEntity> attrEntities = attrDao.selectList(wrapper);
|
||||||
resourceDTO.setInfoList(attrEntities);
|
resourceDTO.setInfoList(attrEntities);
|
||||||
return resourceDTO;
|
return resourceDTO;
|
||||||
|
|
|
@ -5,8 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.renren.common.service.impl.CrudServiceImpl;
|
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.resource.service.ResourceService;
|
||||||
import io.renren.modules.resourceCar.dao.ResourceCarDao;
|
import io.renren.modules.resourceCar.dao.ResourceCarDao;
|
||||||
import io.renren.modules.resourceCar.dto.ResourceCarDTO;
|
import io.renren.modules.resourceCar.dto.ResourceCarDTO;
|
||||||
|
@ -36,9 +34,6 @@ public class ResourceCarServiceImpl extends CrudServiceImpl<ResourceCarDao, Reso
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ResourceCarDao resourceCarDao;
|
private ResourceCarDao resourceCarDao;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ResourceDao resourceDao;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryWrapper<ResourceCarEntity> getWrapper(Map<String, Object> params){
|
public QueryWrapper<ResourceCarEntity> getWrapper(Map<String, Object> params){
|
||||||
|
@ -46,7 +41,6 @@ public class ResourceCarServiceImpl extends CrudServiceImpl<ResourceCarDao, Reso
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteByIds(JSONObject jsonObject) {
|
public void deleteByIds(JSONObject jsonObject) {
|
||||||
List<Long> ids = jsonObject.getJSONArray("ids").toJavaList(Long.class);
|
List<Long> ids = jsonObject.getJSONArray("ids").toJavaList(Long.class);
|
||||||
|
|
|
@ -88,15 +88,17 @@ public class ResourceCollectionController {
|
||||||
@ApiOperation("删除")
|
@ApiOperation("删除")
|
||||||
@LogOperation("删除")
|
@LogOperation("删除")
|
||||||
//@RequiresPermissions("resourceCollection:resourcecollection:delete")
|
//@RequiresPermissions("resourceCollection:resourcecollection:delete")
|
||||||
public Result delete(@RequestBody Long[] ids){
|
public Result delete(@RequestBody Long[] resourceIds){
|
||||||
//效验数据
|
//效验数据
|
||||||
//AssertUtils.isArrayEmpty(ids, "id");
|
//AssertUtils.isArrayEmpty(ids, "id");
|
||||||
|
|
||||||
resourceCollectionService.deleteByIds(ids);
|
resourceCollectionService.deleteByIds(resourceIds);
|
||||||
|
|
||||||
return new Result();
|
return new Result();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("export")
|
@GetMapping("export")
|
||||||
@ApiOperation("导出")
|
@ApiOperation("导出")
|
||||||
@LogOperation("导出")
|
@LogOperation("导出")
|
||||||
|
|
|
@ -25,4 +25,6 @@ public interface ResourceCollectionDao extends BaseDao<ResourceCollectionEntity>
|
||||||
@Param("pageSize") Integer pageSize);
|
@Param("pageSize") Integer pageSize);
|
||||||
|
|
||||||
Integer delete4Resource(@Param("resourceIds") List<Long> idList);
|
Integer delete4Resource(@Param("resourceIds") List<Long> idList);
|
||||||
|
|
||||||
|
Integer deleteByResourceIds(Long[] ids, Long id);
|
||||||
}
|
}
|
|
@ -3,6 +3,8 @@ package io.renren.modules.resourceCollection.entity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,7 +16,7 @@ import java.util.Date;
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper=false)
|
@EqualsAndHashCode(callSuper=false)
|
||||||
@TableName("tb_resource_collection")
|
@TableName("tb_resource_collection")
|
||||||
public class ResourceCollectionEntity {
|
public class ResourceCollectionEntity implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId
|
@TableId
|
||||||
|
|
|
@ -81,6 +81,7 @@ public class ResourceCollectionServiceImpl extends CrudServiceImpl<ResourceColle
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteByIds(Long[] ids) {
|
public void deleteByIds(Long[] ids) {
|
||||||
resourceCollectionDao.deleteByIds(ids);
|
UserDetail user = SecurityUser.getUser();
|
||||||
|
resourceCollectionDao.deleteByResourceIds(ids, user.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -190,7 +190,7 @@
|
||||||
LIMIT ${pageNum}, ${pageSize}
|
LIMIT ${pageNum}, ${pageSize}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDTOById" resultType="io.renren.modules.resource.dto.ResourceDTO">
|
<select id="selectDTOById" resultMap="resourceDTO">
|
||||||
SELECT
|
SELECT
|
||||||
tdr.*,
|
tdr.*,
|
||||||
tda.*,
|
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 "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, 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
|
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
|
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
|
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}
|
1 = 1 AND del_flag = 0 AND user_id = #{userId}
|
||||||
GROUP BY resource_id) taa2 ON tdr.id = taa2.resource_id
|
GROUP BY id) taa2 ON tdr.id = taa2.resource_id
|
||||||
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
|
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
|
||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
AND tdr.del_flag = 0
|
AND tdr.del_flag = 0
|
||||||
|
|
|
@ -30,16 +30,16 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="delete4Resource">
|
<delete id="deleteByResourceIds">
|
||||||
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 user_id = #{userId}
|
||||||
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>
|
||||||
|
|
||||||
<select id="selectPageWithResource" resultType="io.renren.modules.resourceCollection.dto.ResourceCollectionDTO">
|
<select id="selectPageWithResource" resultType="io.renren.modules.resourceCollection.dto.ResourceCollectionDTO">
|
||||||
select trc.*
|
select trc.*
|
||||||
|
|
Loading…
Reference in New Issue