Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
mzyy
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
mzyy
Commits
03c060a3
提交
03c060a3
authored
7月 23, 2019
作者:
yucaiwei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
56b76e89
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
111 行增加
和
3 行删除
+111
-3
DiyTypeController.java
...rqx/resource/bg/controller/diytype/DiyTypeController.java
+62
-0
LabelController.java
...om/zrqx/resource/bg/controller/label/LabelController.java
+49
-3
没有找到文件。
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/diytype/DiyTypeController.java
浏览文件 @
03c060a3
...
...
@@ -29,7 +29,13 @@ import com.zrqx.core.enums.resource.diytype.DiyTypeStatusEnum;
import
com.zrqx.core.exception.BusinessValidateException
;
import
com.zrqx.core.exception.ParameterValidateException
;
import
com.zrqx.core.form.resource.bg.diytype.QueryDiyTypeForm
;
import
com.zrqx.core.model.resource.articlelibrary.ArticleLibraryDiyType
;
import
com.zrqx.core.model.resource.audiolibrary.AudioLibraryDiyType
;
import
com.zrqx.core.model.resource.authorLibrary.AuthorLibraryDiytype
;
import
com.zrqx.core.model.resource.diytype.DiyType
;
import
com.zrqx.core.model.resource.ebook.EbookDiyType
;
import
com.zrqx.core.model.resource.imagelibrary.ImageLibraryDiyType
;
import
com.zrqx.core.model.resource.videolibrary.VideoLibraryDiyTypeRelation
;
import
com.zrqx.core.util.bean.BeanUtils
;
import
com.zrqx.core.util.bean.Copy
;
import
com.zrqx.core.util.datatype.ArrayUtils
;
...
...
@@ -38,7 +44,13 @@ import com.zrqx.core.util.page.PageInfo;
import
com.zrqx.core.util.page.PageParam
;
import
com.zrqx.core.util.response.CallBack
;
import
com.zrqx.core.vo.resource.diytype.DiyTypeVO
;
import
com.zrqx.resource.bg.service.articlelibrary.ArticleLibraryDiyTypeService
;
import
com.zrqx.resource.bg.service.audiolibrary.AudioLibraryDiyTypeService
;
import
com.zrqx.resource.bg.service.authorLibrary.AuthorLibraryDiytypeService
;
import
com.zrqx.resource.bg.service.diytype.DiyTypeService
;
import
com.zrqx.resource.bg.service.ebook.EbookDiyTypeService
;
import
com.zrqx.resource.bg.service.imagelibrary.ImageLibraryService
;
import
com.zrqx.resource.bg.service.videolibrary.VideoLibraryDiyTypeService
;
/**
...
...
@@ -51,6 +63,19 @@ public class DiyTypeController {
@Autowired
private
DiyTypeService
service
;
@Autowired
private
EbookDiyTypeService
ebookDiyTypeService
;
@Autowired
private
ArticleLibraryDiyTypeService
articleLibraryDiyTypeService
;
@Autowired
private
AudioLibraryDiyTypeService
audioLibraryDiyTypeService
;
@Autowired
private
AuthorLibraryDiytypeService
authorLibraryDiytypeService
;
@Autowired
private
VideoLibraryDiyTypeService
videoLibraryDiyTypeService
;
@Autowired
private
ImageLibraryService
imageLibraryService
;
@ApiOperation
(
value
=
"新增自定义分类"
,
notes
=
"新增一个"
)
@PostMapping
(
value
=
ResourceRequestPath
.
SAVE
)
...
...
@@ -132,6 +157,8 @@ public class DiyTypeController {
if
(!
service
.
deleteByExample
(
example
)){
throw
new
BusinessValidateException
(
"操作失败"
);
}
// 将数据内容中已经关联的分类一并删除
this
.
deleteAllResourceDiyType
(
id
);
return
CallBack
.
success
(
true
);
}
...
...
@@ -291,4 +318,39 @@ public class DiyTypeController {
tree
(
list
,
voList
);
return
voList
;
}
/**
* 删除分类时需要将资源数据内容中已经关联的分类一并删除
* @param ids
* @return
* @author ycw
* @date: 2019年6月19日 上午11:40:04
*/
private
boolean
deleteAllResourceDiyType
(
List
<
String
>
ids
){
// 图书
Example
example
=
new
Example
(
EbookDiyType
.
class
);
example
.
createCriteria
().
andIn
(
"diytypeid"
,
ids
);
ebookDiyTypeService
.
deleteByExample
(
example
);
// 文章
example
=
new
Example
(
ArticleLibraryDiyType
.
class
);
example
.
createCriteria
().
andIn
(
"dtid"
,
ids
);
articleLibraryDiyTypeService
.
deleteByExample
(
example
);
// 音频
example
=
new
Example
(
AudioLibraryDiyType
.
class
);
example
.
createCriteria
().
andIn
(
"dtid"
,
ids
);
audioLibraryDiyTypeService
.
deleteByExample
(
example
);
// 作者
example
=
new
Example
(
AuthorLibraryDiytype
.
class
);
example
.
createCriteria
().
andIn
(
"diytypeId"
,
ids
);
authorLibraryDiytypeService
.
deleteByExample
(
example
);
// 视频
example
=
new
Example
(
VideoLibraryDiyTypeRelation
.
class
);
example
.
createCriteria
().
andIn
(
"dtid"
,
ids
);
videoLibraryDiyTypeService
.
deleteByExample
(
example
);
// 图片
example
=
new
Example
(
ImageLibraryDiyType
.
class
);
example
.
createCriteria
().
andIn
(
"dtid"
,
ids
);
imageLibraryService
.
deleteByExample
(
example
);
return
true
;
}
}
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/label/LabelController.java
浏览文件 @
03c060a3
...
...
@@ -16,10 +16,15 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
tk.mybatis.mapper.entity.Example
;
import
com.zrqx.core.constant.resource.ResourceRequestPath
;
import
com.zrqx.core.exception.BusinessValidateException
;
import
com.zrqx.core.form.resource.bg.label.SaveUpdateLabelContentForm
;
import
com.zrqx.core.form.resource.bg.label.SaveUpdateLabelForm
;
import
com.zrqx.core.model.resource.articlelibrary.ArticleLibraryLabelContentDiyType
;
import
com.zrqx.core.model.resource.authorLibrary.AuthorLibraryLabelContentDiyType
;
import
com.zrqx.core.model.resource.ebook.EbookLabelContentDiyType
;
import
com.zrqx.core.util.page.PageInfo
;
import
com.zrqx.core.util.page.PageParam
;
import
com.zrqx.core.util.response.CallBack
;
...
...
@@ -27,6 +32,9 @@ import com.zrqx.core.vo.resource.label.LabelAndContentByDataTypeVO;
import
com.zrqx.core.vo.resource.label.LabelContentDiyTypeVO
;
import
com.zrqx.core.vo.resource.label.LabelListVO
;
import
com.zrqx.core.vo.resource.label.LabelOneVO
;
import
com.zrqx.resource.bg.service.articlelibrary.ArticleLibraryLabelContentDiyTypeService
;
import
com.zrqx.resource.bg.service.authorLibrary.AuthorLibraryLabelContentDiyTypeService
;
import
com.zrqx.resource.bg.service.ebook.EbookLabelContentDiyTypeService
;
import
com.zrqx.resource.bg.service.label.LabelContentDiyTypeService
;
import
com.zrqx.resource.bg.service.label.LabelDataTypeService
;
import
com.zrqx.resource.bg.service.label.LabelService
;
...
...
@@ -45,6 +53,13 @@ public class LabelController {
private
LabelDataTypeService
adrService
;
@Autowired
private
LabelContentDiyTypeService
labelContentDiyTypeService
;
@Autowired
private
EbookLabelContentDiyTypeService
ebookLabelContentDiyTypeService
;
@Autowired
private
ArticleLibraryLabelContentDiyTypeService
articleLibraryLabelContentDiyTypeService
;
@Autowired
private
AuthorLibraryLabelContentDiyTypeService
authorLibraryLabelContentDiyTypeService
;
@ApiOperation
(
value
=
"查询标签"
,
notes
=
"根据ID查询"
)
@GetMapping
(
value
=
ResourceRequestPath
.
GET_OID
)
...
...
@@ -88,13 +103,19 @@ public class LabelController {
@ApiOperation
(
value
=
"删除标签"
,
notes
=
"删除标签"
)
@PostMapping
(
value
=
ResourceRequestPath
.
DELETE_OID
)
public
CallBack
<
Boolean
>
delete
(
@PathVariable
Integer
oid
)
{
return
CallBack
.
success
(
service
.
batchDelete
(
Arrays
.
asList
(
oid
)));
if
(
service
.
batchDelete
(
Arrays
.
asList
(
oid
))){
this
.
deleteAllResourceLabelOrContent
(
Arrays
.
asList
(
oid
),
"labelId"
);
}
return
CallBack
.
success
(
true
);
}
@ApiOperation
(
value
=
"批量删除标签"
,
notes
=
"批量删除标签"
)
@PostMapping
(
value
=
ResourceRequestPath
.
BATCH
+
ResourceRequestPath
.
DELETE
)
public
CallBack
<
Boolean
>
deleteByIds
(
@RequestBody
List
<
Integer
>
ids
)
{
return
CallBack
.
success
(
service
.
batchDelete
(
ids
));
if
(
service
.
batchDelete
(
ids
)){
this
.
deleteAllResourceLabelOrContent
(
ids
,
"labelId"
);
}
return
CallBack
.
success
(
true
);
}
@ApiOperation
(
value
=
"查询标签内容"
,
notes
=
"根据标签id查询列表"
)
...
...
@@ -124,7 +145,32 @@ public class LabelController {
@ApiOperation
(
value
=
"批量删除标签内容"
,
notes
=
"批量删除"
)
@PostMapping
(
value
=
ResourceRequestPath
.
CONTENT
+
ResourceRequestPath
.
DELETE
)
public
CallBack
<
Boolean
>
delete
(
@RequestBody
List
<
Integer
>
ids
)
{
return
CallBack
.
success
(
labelContentDiyTypeService
.
batchDelete
(
ids
));
if
(
labelContentDiyTypeService
.
batchDelete
(
ids
)){
this
.
deleteAllResourceLabelOrContent
(
ids
,
"labelContentDiyTypeId"
);
}
return
CallBack
.
success
(
true
);
}
/**
* 删除分类时需要将资源数据内容中已经关联的分类一并删除
* @param ids
* @return
* @author ycw
* @date: 2019年7月23日 上午10:40:04
*/
private
boolean
deleteAllResourceLabelOrContent
(
List
<
Integer
>
ids
,
String
field
){
// 医著
Example
example
=
new
Example
(
EbookLabelContentDiyType
.
class
);
example
.
createCriteria
().
andIn
(
field
,
ids
);
ebookLabelContentDiyTypeService
.
deleteByExample
(
example
);
// 文章
example
=
new
Example
(
ArticleLibraryLabelContentDiyType
.
class
);
example
.
createCriteria
().
andIn
(
field
,
ids
);
articleLibraryLabelContentDiyTypeService
.
deleteByExample
(
example
);
// 作者
example
=
new
Example
(
AuthorLibraryLabelContentDiyType
.
class
);
example
.
createCriteria
().
andIn
(
field
,
ids
);
authorLibraryLabelContentDiyTypeService
.
deleteByExample
(
example
);
return
true
;
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论