diff --git a/src/main/java/com/tenlion/twoduty/controller/api/departmentbase/DepartmentBaseController.java b/src/main/java/com/tenlion/twoduty/controller/api/departmentbase/DepartmentBaseController.java index 70e199e..3aca1c1 100644 --- a/src/main/java/com/tenlion/twoduty/controller/api/departmentbase/DepartmentBaseController.java +++ b/src/main/java/com/tenlion/twoduty/controller/api/departmentbase/DepartmentBaseController.java @@ -115,6 +115,10 @@ public class DepartmentBaseController extends DefaultBaseController { break; } } + + + + return list; } diff --git a/src/main/java/com/tenlion/twoduty/pojo/dtos/departmentsynopsis/DepartmentSynopsisDTO.java b/src/main/java/com/tenlion/twoduty/pojo/dtos/departmentsynopsis/DepartmentSynopsisDTO.java index a67a353..755ce38 100644 --- a/src/main/java/com/tenlion/twoduty/pojo/dtos/departmentsynopsis/DepartmentSynopsisDTO.java +++ b/src/main/java/com/tenlion/twoduty/pojo/dtos/departmentsynopsis/DepartmentSynopsisDTO.java @@ -22,6 +22,8 @@ public class DepartmentSynopsisDTO { private String departmentSynopsisId; @ApiModelProperty(name = "departmentSynopsisContent", value = "部门简介内容") private String departmentSynopsisContent; + @ApiModelProperty(name = "departmentSynopsisPhoto", value = "部门宣传照片") + private String departmentSynopsisPhoto; public String getDepartmentId() { return departmentId; @@ -47,5 +49,11 @@ public class DepartmentSynopsisDTO { this.departmentSynopsisContent = departmentSynopsisContent; } + public String getDepartmentSynopsisPhoto() { + return departmentSynopsisPhoto; + } + public void setDepartmentSynopsisPhoto(String departmentSynopsisPhoto) { + this.departmentSynopsisPhoto = departmentSynopsisPhoto; + } } diff --git a/src/main/java/com/tenlion/twoduty/pojo/vos/articlecontent/ArticleContentVO.java b/src/main/java/com/tenlion/twoduty/pojo/vos/articlecontent/ArticleContentVO.java index 53ae37e..babae03 100644 --- a/src/main/java/com/tenlion/twoduty/pojo/vos/articlecontent/ArticleContentVO.java +++ b/src/main/java/com/tenlion/twoduty/pojo/vos/articlecontent/ArticleContentVO.java @@ -35,7 +35,7 @@ public class ArticleContentVO { @ApiModelProperty(name = "articleContentIsPublish", value = "是否发布") private String articleContentIsPublish; @ApiModelProperty(name = "articleContentPublishTime", value = "发布时间") - @CheckEmptyAnnotation(name = "发布时间", verifyType = "datetime") + @CheckEmptyAnnotation(name = "发布时间", verifyType = "date") private String articleContentPublishTime; @ApiModelProperty(name = "articleContentOrderBy", value = "文章排序") @CheckNumberAnnotation(name = "文章排序") diff --git a/src/main/java/com/tenlion/twoduty/pojo/vos/departmentsynopsis/DepartmentSynopsisVO.java b/src/main/java/com/tenlion/twoduty/pojo/vos/departmentsynopsis/DepartmentSynopsisVO.java index 88792e7..2dd5d04 100644 --- a/src/main/java/com/tenlion/twoduty/pojo/vos/departmentsynopsis/DepartmentSynopsisVO.java +++ b/src/main/java/com/tenlion/twoduty/pojo/vos/departmentsynopsis/DepartmentSynopsisVO.java @@ -23,7 +23,8 @@ public class DepartmentSynopsisVO { private String departmentSynopsisId; @ApiModelProperty(name = "departmentSynopsisContent", value = "部门简介内容") private String departmentSynopsisContent; - + @ApiModelProperty(name = "departmentSynopsisPhoto", value = "部门宣传照片") + private String departmentSynopsisPhoto; public String getDepartmentSynopsisId() { return departmentSynopsisId; @@ -49,5 +50,11 @@ public class DepartmentSynopsisVO { this.departmentSynopsisContent = departmentSynopsisContent; } + public String getDepartmentSynopsisPhoto() { + return departmentSynopsisPhoto; + } + public void setDepartmentSynopsisPhoto(String departmentSynopsisPhoto) { + this.departmentSynopsisPhoto = departmentSynopsisPhoto; + } } diff --git a/src/main/java/com/tenlion/twoduty/service/articletype/impl/ArticleTypeServiceImpl.java b/src/main/java/com/tenlion/twoduty/service/articletype/impl/ArticleTypeServiceImpl.java index 1720dc7..9d8a748 100644 --- a/src/main/java/com/tenlion/twoduty/service/articletype/impl/ArticleTypeServiceImpl.java +++ b/src/main/java/com/tenlion/twoduty/service/articletype/impl/ArticleTypeServiceImpl.java @@ -1,6 +1,8 @@ package com.tenlion.twoduty.service.articletype.impl; +import com.tenlion.twoduty.service.articlecontent.IArticleContentService; import ink.wgink.common.base.DefaultBaseService; +import ink.wgink.exceptions.ParamsException; import ink.wgink.module.dictionary.pojo.dtos.DataDTO; import ink.wgink.module.dictionary.service.IDataService; import ink.wgink.pojo.ListPage; @@ -21,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.*; +import java.util.stream.Collectors; /** * @ClassName: ArticleTypeServiceImpl @@ -36,6 +39,8 @@ public class ArticleTypeServiceImpl extends DefaultBaseService implements IArtic private IArticleTypeDao articleTypeDao; @Autowired private IDataService dataService; + @Autowired + private IArticleContentService articleContentService; public List getTypeClassIfDetails(String articleTypeId){ @@ -84,6 +89,15 @@ public class ArticleTypeServiceImpl extends DefaultBaseService implements IArtic @Override public void remove(String token, List ids) { + List myList = ids.stream().distinct().collect(Collectors.toList()); + Map countParams = getHashMap(1); + for (String s : myList) { + countParams.put("articleTypeId",s); + Integer count = articleContentService.count(countParams); + if(count > 0){ + throw new ParamsException("文章目录有发布内容,请先删除内容"); + } + } Map params = getHashMap(2); params.put("articleTypeIds", ids); if (StringUtils.isBlank(token)) { diff --git a/src/main/resources/mybatis/mapper/articlecontent/article-content-mapper.xml b/src/main/resources/mybatis/mapper/articlecontent/article-content-mapper.xml index 5324dea..bfde4f0 100644 --- a/src/main/resources/mybatis/mapper/articlecontent/article-content-mapper.xml +++ b/src/main/resources/mybatis/mapper/articlecontent/article-content-mapper.xml @@ -428,6 +428,10 @@ duty_article_content t1 WHERE t1.is_delete = 0 + + AND + t1.article_type_id = #{articleTypeId} + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/departmentsynopsis/department-synopsis-mapper.xml b/src/main/resources/mybatis/mapper/departmentsynopsis/department-synopsis-mapper.xml index b8c06a4..ea5068b 100644 --- a/src/main/resources/mybatis/mapper/departmentsynopsis/department-synopsis-mapper.xml +++ b/src/main/resources/mybatis/mapper/departmentsynopsis/department-synopsis-mapper.xml @@ -6,6 +6,7 @@ + @@ -36,6 +37,7 @@ department_id, department_synopsis_id, department_synopsis_content, + department_synopsis_photo, creator, gmt_create, modifier, @@ -45,6 +47,7 @@ #{departmentId}, #{departmentSynopsisId}, #{departmentSynopsisContent}, + #{departmentSynopsisPhoto}, #{creator}, #{gmtCreate}, #{modifier}, @@ -86,6 +89,9 @@ SET department_synopsis_content = #{departmentSynopsisContent}, + + + department_synopsis_photo = #{departmentSynopsisPhoto}, gmt_modified = #{gmtModified}, modifier = #{modifier}, @@ -99,6 +105,7 @@ SELECT t1.department_id, t1.department_synopsis_content, + t1.department_synopsis_photo, t1.department_synopsis_id FROM duty_department_synopsis t1 @@ -161,7 +168,8 @@ SELECT t1.department_id, t1.department_synopsis_id, - t1.department_synopsis_content + t1.department_synopsis_content, + t1.department_synopsis_photo FROM duty_department_synopsis t1 WHERE diff --git a/src/main/resources/static/route/departmentsynopsis/save.html b/src/main/resources/static/route/departmentsynopsis/save.html index 490be4c..a6d4a1b 100644 --- a/src/main/resources/static/route/departmentsynopsis/save.html +++ b/src/main/resources/static/route/departmentsynopsis/save.html @@ -23,6 +23,40 @@
+ + +
+ +
+ +
+ +
+
+ +
@@ -118,6 +152,59 @@ } } + // 初始化宣传图片上传 + function initdepartmentSynopsisPhotoUploadFile() { + var files = $('#departmentSynopsisPhoto').val(); + initFileList('departmentSynopsisPhoto', files, function(fileName) { + var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false}); + viewerObj[fileName] = viewer; + }); + + form.on('button(departmentSynopsisPhotoUploadFile)', function(obj) { + var name = this.dataset.name; + var explain = this.dataset.explain; + top.dialog.file({ + type: 'image', + title: '上传'+ explain, + width: '400px', + height: '420px', + maxFileCount: '1', + onClose: function() { + var uploadFileArray = top.dialog.dialogData.uploadFileArray; + if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) { + var files = $('#'+ name).val(); + for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) { + if(files.length > 0) { + files += ','; + } + files += file.data; + } + initFileList(name, files, function(fileName) { + viewerObj[fileName].update(); + }); + } + } + }); + }); + + form.on('button(departmentSynopsisPhotoRemoveFile)', function(obj) { + var name = this.dataset.name; + var id = this.dataset.id; + var files = $('#'+ name).val().replace(id, ''); + files = files.replace(/\,+/g, ','); + if(files.charAt(0) == ',') { + files = files.substring(1); + } + if(files.charAt(files.length - 1) == ',') { + files = files.substring(0, files.length - 1); + } + initFileList(name, files, function(fileName) { + viewerObj[fileName].update(); + }); + }); + } + + // 初始化承诺书富文本 function initDepartmentSynopsisContentText() { var editor = UE.getEditor('departmentSynopsisContent', {autoHeightEnabled: false}); @@ -136,9 +223,10 @@ for(var i in data) { dataFormData[i] = data[i] +''; } - initDepartmentSynopsisContentText(); form.val('dataForm', dataFormData); form.render(null, 'dataForm'); + initDepartmentSynopsisContentText(); + initdepartmentSynopsisPhotoUploadFile(); }, function(code, data) { top.dialog.msg(data.msg); }, function() { diff --git a/src/main/resources/templates/articlecontent/list.html b/src/main/resources/templates/articlecontent/list.html index 78247cb..2b6e5b1 100644 --- a/src/main/resources/templates/articlecontent/list.html +++ b/src/main/resources/templates/articlecontent/list.html @@ -9,6 +9,13 @@ +
@@ -26,6 +33,16 @@
+
+ + @@ -57,11 +74,12 @@ base: 'assets/layuiadmin/' }).extend({ index: 'lib/index' - }).use(['index', 'table', 'laydate', 'common','form'], function() { + }).use(['index', 'table', 'laydate', 'common','form','laytpl'], function() { var $ = layui.$; var $win = $(window); var table = layui.table; var admin = layui.admin; + var laytpl = layui.laytpl; var laydate = layui.laydate; var common = layui.common; var form = layui.form; @@ -183,7 +201,8 @@ where: { keywords: $('#keywords').val(), startTime: $('#startTime').val(), - endTime: $('#endTime').val() + endTime: $('#endTime').val(), + articleTypeId: $('#articleTypeId').val() }, page: { curr: currentPage @@ -291,6 +310,18 @@ } }); + initArticleTypeIdTemplate(); + //初始化文章目录 + function initArticleTypeIdTemplate(){ + top.restAjax.get(top.restAjax.path("api/articletype/list",[]),{},null,function (code,data,args) { + laytpl(document.getElementById('articleTypeIdTemplate').innerHTML).render(data, function(html) { + document.getElementById('articleTypeIdTemplateBox').innerHTML = html; + }); + form.render('select', 'articleTypeIdTemplateBox'); + }); + } + + form.on('switch(isPublish)', function(data){ var checked = data.elem.checked var contentId = data.value; diff --git a/src/main/resources/templates/articlecontent/save.html b/src/main/resources/templates/articlecontent/save.html index 29c0c65..aba31d7 100644 --- a/src/main/resources/templates/articlecontent/save.html +++ b/src/main/resources/templates/articlecontent/save.html @@ -295,7 +295,7 @@ function initArticleContentPublishTimeDateTime() { laydate.render({ elem: '#articleContentPublishTime', - type: 'datetime', + type: 'date', value: '', trigger: 'click' }); diff --git a/src/main/resources/templates/articlecontent/type/list-type.html b/src/main/resources/templates/articlecontent/type/list-type.html index f03a55b..ff94c6f 100644 --- a/src/main/resources/templates/articlecontent/type/list-type.html +++ b/src/main/resources/templates/articlecontent/type/list-type.html @@ -9,6 +9,11 @@ +
@@ -27,6 +32,15 @@
+
+ @@ -58,12 +72,13 @@ base: 'assets/layuiadmin/' }).extend({ index: 'lib/index' - }).use(['index', 'table', 'laydate', 'common','form'], function() { + }).use(['index', 'table', 'laydate', 'common','form','laytpl'], function() { var $ = layui.$; var $win = $(window); var table = layui.table; var admin = layui.admin; var laydate = layui.laydate; + var laytpl = layui.laytpl; var common = layui.common; var form = layui.form; var resizeTimeout = null; @@ -187,7 +202,8 @@ where: { keywords: $('#keywords').val(), startTime: $('#startTime').val(), - endTime: $('#endTime').val() + endTime: $('#endTime').val(), + articleClassifyId:$("#articleClassifyId").val() }, page: { curr: currentPage @@ -295,6 +311,26 @@ } } }); + initArticleTypeName(); + + function initArticleTypeName(){ + top.restAjax.get(top.restAjax.path("api/articlecontent/getArticleType/{articleTypeId}",[$("#articleTypeId").val()]),{},null,function (code,data,args) { + if('show'== data.classIfIsShow){ + $('#articleClassifyIdTemplateBox').removeClass("layui-hide") + initArticleClassifyIdTemplate(data.classIfId) + } + }); + } + + //初始化文章分类 + function initArticleClassifyIdTemplate(dataParentId){ + top.restAjax.get(top.restAjax.path("api/data/listallbyparentid/{dataParentId}",[dataParentId]),{},null,function (code,data,args) { + laytpl(document.getElementById('articleClassifyIdTemplate').innerHTML).render(data, function(html) { + document.getElementById('articleClassifyIdTemplateBox').innerHTML = html; + }); + form.render('select', 'articleClassifyIdTemplateBox'); + }); + } form.on('switch(isPublish)', function(data){ diff --git a/src/main/resources/templates/articlecontent/type/save-type.html b/src/main/resources/templates/articlecontent/type/save-type.html index 84edfee..0752821 100644 --- a/src/main/resources/templates/articlecontent/type/save-type.html +++ b/src/main/resources/templates/articlecontent/type/save-type.html @@ -297,7 +297,7 @@ function initArticleContentPublishTimeDateTime() { laydate.render({ elem: '#articleContentPublishTime', - type: 'datetime', + type: 'date', value: '', trigger: 'click' }); diff --git a/src/main/resources/templates/articlecontent/type/update-type.html b/src/main/resources/templates/articlecontent/type/update-type.html index 927ad11..281a982 100644 --- a/src/main/resources/templates/articlecontent/type/update-type.html +++ b/src/main/resources/templates/articlecontent/type/update-type.html @@ -295,7 +295,7 @@ function initArticleContentPublishTimeDateTime() { laydate.render({ elem: '#articleContentPublishTime', - type: 'datetime', + type: 'date', value: '', trigger: 'click' }); diff --git a/src/main/resources/templates/articlecontent/update.html b/src/main/resources/templates/articlecontent/update.html index 78b3ab9..1c67594 100644 --- a/src/main/resources/templates/articlecontent/update.html +++ b/src/main/resources/templates/articlecontent/update.html @@ -297,7 +297,7 @@ function initArticleContentPublishTimeDateTime() { laydate.render({ elem: '#articleContentPublishTime', - type: 'datetime', + type: 'date', value: '', trigger: 'click' });