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

feat:关联内容

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