提交 2ab7e32d authored 作者: 任建彩's avatar 任建彩

feat:关联内容

1.resource
上级 5310e1dc
...@@ -131,8 +131,11 @@ public class EbookController { ...@@ -131,8 +131,11 @@ public class EbookController {
} }
@ApiOperation("根据物料号查询是否存在") @ApiOperation("根据物料号查询是否存在")
@GetMapping("/getItemNo") @GetMapping("/getItemNo")
public CallBack<Boolean> getItemNo(String itemNo) { public CallBack<Boolean> getItemNo(String id,String itemNo) {
LambdaQueryWrapper<Book> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Book> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if(StringUtils.isNotBlank(id)){
lambdaQueryWrapper.ne(Book::getId,id);
}
lambdaQueryWrapper.eq(Book::getItemNo,itemNo); lambdaQueryWrapper.eq(Book::getItemNo,itemNo);
List<Book> list = bookservice.list(lambdaQueryWrapper); List<Book> list = bookservice.list(lambdaQueryWrapper);
if(list.size()>0){ if(list.size()>0){
......
...@@ -227,7 +227,7 @@ public class ResourceLibraryController { ...@@ -227,7 +227,7 @@ public class ResourceLibraryController {
ResourceRelation e = new ResourceRelation(); ResourceRelation e = new ResourceRelation();
e.setObjectId(entity.getId()); e.setObjectId(entity.getId());
e.setResourceId(resourceId); e.setResourceId(resourceId);
e.setSort(resourceRelationService.getMaxSort(entity.getId()) + index); e.setSort(resourceRelationService.getMaxSort(entity.getId(),entity.getResourceType()) + index);
e.setCreatedTime(new Date()); e.setCreatedTime(new Date());
e.setResourceType(entity.getResourceType()); e.setResourceType(entity.getResourceType());
e.setCreaterId(tokenManager.getUserId()); e.setCreaterId(tokenManager.getUserId());
...@@ -265,8 +265,8 @@ public class ResourceLibraryController { ...@@ -265,8 +265,8 @@ public class ResourceLibraryController {
@ApiOperation(value = "获取关联资源的最大排序号", notes = "获取资源最大排序号") @ApiOperation(value = "获取关联资源的最大排序号", notes = "获取资源最大排序号")
@GetMapping(value = "/get/sort") @GetMapping(value = "/get/sort")
public CallBack<Integer> getMaxSort(@RequestParam String objectId) { public CallBack<Integer> getMaxSort(@RequestParam String objectId,String resourceType) {
return CallBack.success(resourceRelationService.getMaxSort(objectId)); return CallBack.success(resourceRelationService.getMaxSort(objectId,resourceType));
} }
@ApiOperation(value = "选择弹框中的列表", notes = "资源类型 ") @ApiOperation(value = "选择弹框中的列表", notes = "资源类型 ")
......
...@@ -102,8 +102,8 @@ public interface ResourceRelationMapper extends BaseMapper<ResourceRelation> { ...@@ -102,8 +102,8 @@ public interface ResourceRelationMapper extends BaseMapper<ResourceRelation> {
* *
* @return * @return
*/ */
@Select("SELECT MAX(sort) FROM res_resource_relation WHERE objectId = #{objectId}") @Select("SELECT MAX(sort) FROM res_resource_relation WHERE objectId = #{objectId} and resourceType = #{type}" )
Integer getMaxSort(@Param("objectId") String objectId); Integer getMaxSort(@Param("objectId") String objectId,@Param("type") String type);
/** /**
* 根据直播id查询直播信息 * 根据直播id查询直播信息
......
...@@ -68,7 +68,7 @@ public interface ResourceRelationService extends IService<ResourceRelation> { ...@@ -68,7 +68,7 @@ public interface ResourceRelationService extends IService<ResourceRelation> {
* @param objectId * @param objectId
* @return * @return
*/ */
Integer getMaxSort(String objectId); Integer getMaxSort(String objectId,String type);
/** /**
* 查询直播 * 查询直播
......
...@@ -330,8 +330,8 @@ public class ResourceRelationServiceImpl extends ServiceImpl<ResourceRelationMap ...@@ -330,8 +330,8 @@ public class ResourceRelationServiceImpl extends ServiceImpl<ResourceRelationMap
} }
@Override @Override
public Integer getMaxSort(String objectId) { public Integer getMaxSort(String objectId,String type) {
Integer sort = mapper.getMaxSort(objectId); Integer sort = mapper.getMaxSort(objectId,type);
if (sort == null) { if (sort == null) {
sort = 1; sort = 1;
} else { } else {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论