Răsfoiți Sursa

Merge branch 'dev' of http://94.191.59.107:3000/wukai/lzga-doc into dev

yxc 2 ani în urmă
părinte
comite
7bf51aeacd

+ 17 - 20
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/controller/DocTagController.java

@@ -4,6 +4,8 @@ import java.util.List;
 import java.io.IOException;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
+
+import com.jjt.common.security.utils.SecurityUtils;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
@@ -24,14 +26,13 @@ import com.jjt.common.core.web.page.TableDataInfo;
 
 /**
  * 文档标签Controller
- * 
+ *
  * @author wukai
- * @date 2023-03-27
+ * @date 2023-04-24
  */
 @RestController
 @RequestMapping("/tag")
-public class DocTagController extends BaseController
-{
+public class DocTagController extends BaseController {
     @Resource
     private IDocTagService docTagService;
 
@@ -40,9 +41,9 @@ public class DocTagController extends BaseController
      */
     @RequiresPermissions("doc:tag:list")
     @GetMapping("/list")
-    public TableDataInfo list(DocTag docTag)
-    {
+    public TableDataInfo list(DocTag docTag) {
         startPage();
+        docTag.setCreater(SecurityUtils.getUserId());
         List<DocTag> list = docTagService.selectDocTagList(docTag);
         return getDataTable(list);
     }
@@ -53,8 +54,7 @@ public class DocTagController extends BaseController
     @RequiresPermissions("doc:tag:export")
     @Log(title = "文档标签", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, DocTag docTag)
-    {
+    public void export(HttpServletResponse response, DocTag docTag) {
         List<DocTag> list = docTagService.selectDocTagList(docTag);
         ExcelUtil<DocTag> util = new ExcelUtil<DocTag>(DocTag.class);
         util.exportExcel(response, list, "文档标签数据");
@@ -64,10 +64,9 @@ public class DocTagController extends BaseController
      * 获取文档标签详细信息
      */
     @RequiresPermissions("doc:tag:query")
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
-        return success(docTagService.selectDocTagById(id));
+    @GetMapping(value = "/{tagId}")
+    public AjaxResult getInfo(@PathVariable("tagId") Long tagId) {
+        return success(docTagService.selectDocTagByTagId(tagId));
     }
 
     /**
@@ -76,8 +75,8 @@ public class DocTagController extends BaseController
     @RequiresPermissions("doc:tag:add")
     @Log(title = "文档标签", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody DocTag docTag)
-    {
+    public AjaxResult add(@RequestBody DocTag docTag) {
+        docTag.setCreater(SecurityUtils.getUserId());
         return toAjax(docTagService.insertDocTag(docTag));
     }
 
@@ -87,8 +86,7 @@ public class DocTagController extends BaseController
     @RequiresPermissions("doc:tag:edit")
     @Log(title = "文档标签", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody DocTag docTag)
-    {
+    public AjaxResult edit(@RequestBody DocTag docTag) {
         return toAjax(docTagService.updateDocTag(docTag));
     }
 
@@ -97,9 +95,8 @@ public class DocTagController extends BaseController
      */
     @RequiresPermissions("doc:tag:remove")
     @Log(title = "文档标签", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
-        return toAjax(docTagService.deleteDocTagByIds(ids));
+    @DeleteMapping("/{tagIds}")
+    public AjaxResult remove(@PathVariable Long[] tagIds) {
+        return toAjax(docTagService.deleteDocTagByTagIds(tagIds));
     }
 }

+ 105 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/controller/DocTagRelaController.java

@@ -0,0 +1,105 @@
+package com.jjt.doc.controller;
+
+import java.util.List;
+import java.io.IOException;
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.jjt.common.log.annotation.Log;
+import com.jjt.common.log.enums.BusinessType;
+import com.jjt.common.security.annotation.RequiresPermissions;
+import com.jjt.doc.domain.DocTagRela;
+import com.jjt.doc.service.IDocTagRelaService;
+import com.jjt.common.core.web.controller.BaseController;
+import com.jjt.common.core.web.domain.AjaxResult;
+import com.jjt.common.core.utils.poi.ExcelUtil;
+import com.jjt.common.core.web.page.TableDataInfo;
+
+/**
+ * 文档标签关系Controller
+ * 
+ * @author wukai
+ * @date 2023-04-24
+ */
+@RestController
+@RequestMapping("/tagRela")
+public class DocTagRelaController extends BaseController
+{
+    @Resource
+    private IDocTagRelaService docTagRelaService;
+
+    /**
+     * 查询文档标签关系列表
+     */
+    @RequiresPermissions("doc:tagRela:list")
+    @GetMapping("/list")
+    public TableDataInfo list(DocTagRela docTagRela)
+    {
+        startPage();
+        List<DocTagRela> list = docTagRelaService.selectDocTagRelaList(docTagRela);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出文档标签关系列表
+     */
+    @RequiresPermissions("doc:tagRela:export")
+    @Log(title = "文档标签关系", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, DocTagRela docTagRela)
+    {
+        List<DocTagRela> list = docTagRelaService.selectDocTagRelaList(docTagRela);
+        ExcelUtil<DocTagRela> util = new ExcelUtil<DocTagRela>(DocTagRela.class);
+        util.exportExcel(response, list, "文档标签关系数据");
+    }
+
+    /**
+     * 获取文档标签关系详细信息
+     */
+    @RequiresPermissions("doc:tagRela:query")
+    @GetMapping(value = "/{docId}")
+    public AjaxResult getInfo(@PathVariable("docId") Long docId)
+    {
+        return success(docTagRelaService.selectDocTagRelaByDocId(docId));
+    }
+
+    /**
+     * 新增文档标签关系
+     */
+    @RequiresPermissions("doc:tagRela:add")
+    @Log(title = "文档标签关系", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody DocTagRela docTagRela)
+    {
+        return toAjax(docTagRelaService.insertDocTagRela(docTagRela));
+    }
+
+    /**
+     * 修改文档标签关系
+     */
+    @RequiresPermissions("doc:tagRela:edit")
+    @Log(title = "文档标签关系", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody DocTagRela docTagRela)
+    {
+        return toAjax(docTagRelaService.updateDocTagRela(docTagRela));
+    }
+
+    /**
+     * 删除文档标签关系
+     */
+    @RequiresPermissions("doc:tagRela:remove")
+    @Log(title = "文档标签关系", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{docIds}")
+    public AjaxResult remove(@PathVariable Long[] docIds)
+    {
+        return toAjax(docTagRelaService.deleteDocTagRelaByDocIds(docIds));
+    }
+}

+ 14 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/domain/DocInfo.java

@@ -8,6 +8,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
 import com.jjt.common.core.annotation.Excel;
 import com.jjt.common.core.web.domain.BaseEntity;
 
+import java.util.List;
+
 /**
  * 文档基本信息对象 doc_info
  *
@@ -88,6 +90,10 @@ public class DocInfo extends BaseEntity {
      */
     @Excel(name = "文档创建年份;文档创建年份,分表用")
     private Long createYear;
+    /**
+     * 文档标签
+     */
+    private List<DocTag> tagList;
 
     /**
      * 逻辑删除标志;1/非1
@@ -97,6 +103,14 @@ public class DocInfo extends BaseEntity {
     @TableField(exist = false)
     private Long dirId;
 
+    public List<DocTag> getTagList() {
+        return tagList;
+    }
+
+    public void setTagList(List<DocTag> tagList) {
+        this.tagList = tagList;
+    }
+
     public Long getDirId() {
         return dirId;
     }

+ 21 - 21
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/domain/DocTag.java

@@ -9,53 +9,53 @@ import com.jjt.common.core.web.domain.BaseEntity;
  * 文档标签对象 doc_tag
  * 
  * @author wukai
- * @date 2023-03-27
+ * @date 2023-04-24
  */
 public class DocTag extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
 
-    /** 主键ID */
-    private Long id;
-
-    /** 文档ID */
-    @Excel(name = "文档ID")
-    private Long docId;
+    /** 标签ID */
+    private Long tagId;
 
     /** 标签名称 */
     @Excel(name = "标签名称")
     private String tagName;
 
+    /** 创建人ID */
+    @Excel(name = "创建人ID")
+    private Long creater;
+
     /** 逻辑删除标志;1/非1 */
     @Excel(name = "逻辑删除标志;1/非1")
     private String isDel;
 
-    public void setId(Long id) 
+    public void setTagId(Long tagId) 
     {
-        this.id = id;
+        this.tagId = tagId;
     }
 
-    public Long getId() 
+    public Long getTagId() 
     {
-        return id;
+        return tagId;
     }
-    public void setDocId(Long docId) 
+    public void setTagName(String tagName) 
     {
-        this.docId = docId;
+        this.tagName = tagName;
     }
 
-    public Long getDocId() 
+    public String getTagName() 
     {
-        return docId;
+        return tagName;
     }
-    public void setTagName(String tagName) 
+    public void setCreater(Long creater) 
     {
-        this.tagName = tagName;
+        this.creater = creater;
     }
 
-    public String getTagName() 
+    public Long getCreater() 
     {
-        return tagName;
+        return creater;
     }
     public void setIsDel(String isDel) 
     {
@@ -70,9 +70,9 @@ public class DocTag extends BaseEntity
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("docId", getDocId())
+            .append("tagId", getTagId())
             .append("tagName", getTagName())
+            .append("creater", getCreater())
             .append("createBy", getCreateBy())
             .append("createTime", getCreateTime())
             .append("updateBy", getUpdateBy())

+ 64 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/domain/DocTagRela.java

@@ -0,0 +1,64 @@
+package com.jjt.doc.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.jjt.common.core.annotation.Excel;
+import com.jjt.common.core.web.domain.BaseEntity;
+
+/**
+ * 文档标签关系对象 doc_tag_rela
+ *
+ * @author wukai
+ * @date 2023-04-24
+ */
+public class DocTagRela extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 文档ID
+     */
+    private Long docId;
+
+    /**
+     * 标签ID
+     */
+    private Long tagId;
+
+    /**
+     * 文档年份
+     */
+    private Long docYear;
+
+    public void setDocId(Long docId) {
+        this.docId = docId;
+    }
+
+    public Long getDocId() {
+        return docId;
+    }
+
+    public void setTagId(Long tagId) {
+        this.tagId = tagId;
+    }
+
+    public Long getTagId() {
+        return tagId;
+    }
+
+    public void setDocYear(Long docYear) {
+        this.docYear = docYear;
+    }
+
+    public Long getDocYear() {
+        return docYear;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("docId", getDocId())
+                .append("tagId", getTagId())
+                .append("docYear", getDocYear())
+                .toString();
+    }
+}

+ 24 - 16
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/mapper/DocTagMapper.java

@@ -1,27 +1,27 @@
 package com.jjt.doc.mapper;
 
 import java.util.List;
+
 import com.jjt.doc.domain.DocTag;
 
 /**
  * 文档标签Mapper接口
- * 
+ *
  * @author wukai
- * @date 2023-03-27
+ * @date 2023-04-24
  */
-public interface DocTagMapper 
-{
+public interface DocTagMapper {
     /**
      * 查询文档标签
-     * 
-     * @param id 文档标签主键
+     *
+     * @param tagId 文档标签主键
      * @return 文档标签
      */
-    public DocTag selectDocTagById(Long id);
+    public DocTag selectDocTagByTagId(Long tagId);
 
     /**
      * 查询文档标签列表
-     * 
+     *
      * @param docTag 文档标签
      * @return 文档标签集合
      */
@@ -29,7 +29,7 @@ public interface DocTagMapper
 
     /**
      * 新增文档标签
-     * 
+     *
      * @param docTag 文档标签
      * @return 结果
      */
@@ -37,7 +37,7 @@ public interface DocTagMapper
 
     /**
      * 修改文档标签
-     * 
+     *
      * @param docTag 文档标签
      * @return 结果
      */
@@ -45,17 +45,25 @@ public interface DocTagMapper
 
     /**
      * 删除文档标签
-     * 
-     * @param id 文档标签主键
+     *
+     * @param tagId 文档标签主键
      * @return 结果
      */
-    public int deleteDocTagById(Long id);
+    public int deleteDocTagByTagId(Long tagId);
 
     /**
      * 批量删除文档标签
-     * 
-     * @param ids 需要删除的数据主键集合
+     *
+     * @param tagIds 需要删除的数据主键集合
      * @return 结果
      */
-    public int deleteDocTagByIds(Long[] ids);
+    public int deleteDocTagByTagIds(Long[] tagIds);
+
+    /**
+     * 通过docId查询标签列表
+     *
+     * @param docId
+     * @return
+     */
+    public List<DocTag> selectDocTagList4docId(Long docId);
 }

+ 62 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/mapper/DocTagRelaMapper.java

@@ -0,0 +1,62 @@
+package com.jjt.doc.mapper;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jjt.doc.domain.DocTagRela;
+
+/**
+ * 文档标签关系Mapper接口
+ *
+ * @author wukai
+ * @date 2023-04-24
+ */
+public interface DocTagRelaMapper extends BaseMapper<DocTagRela> {
+    /**
+     * 查询文档标签关系
+     *
+     * @param docId 文档标签关系主键
+     * @return 文档标签关系
+     */
+    public DocTagRela selectDocTagRelaByDocId(Long docId);
+
+    /**
+     * 查询文档标签关系列表
+     *
+     * @param docTagRela 文档标签关系
+     * @return 文档标签关系集合
+     */
+    public List<DocTagRela> selectDocTagRelaList(DocTagRela docTagRela);
+
+    /**
+     * 新增文档标签关系
+     *
+     * @param docTagRela 文档标签关系
+     * @return 结果
+     */
+    public int insertDocTagRela(DocTagRela docTagRela);
+
+    /**
+     * 修改文档标签关系
+     *
+     * @param docTagRela 文档标签关系
+     * @return 结果
+     */
+    public int updateDocTagRela(DocTagRela docTagRela);
+
+    /**
+     * 删除文档标签关系
+     *
+     * @param docId 文档标签关系主键
+     * @return 结果
+     */
+    public int deleteDocTagRelaByDocId(Long docId);
+
+    /**
+     * 批量删除文档标签关系
+     *
+     * @param docIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteDocTagRelaByDocIds(Long[] docIds);
+}

+ 61 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/IDocTagRelaService.java

@@ -0,0 +1,61 @@
+package com.jjt.doc.service;
+
+import java.util.List;
+import com.jjt.doc.domain.DocTagRela;
+
+/**
+ * 文档标签关系Service接口
+ * 
+ * @author wukai
+ * @date 2023-04-24
+ */
+public interface IDocTagRelaService 
+{
+    /**
+     * 查询文档标签关系
+     * 
+     * @param docId 文档标签关系主键
+     * @return 文档标签关系
+     */
+    public DocTagRela selectDocTagRelaByDocId(Long docId);
+
+    /**
+     * 查询文档标签关系列表
+     * 
+     * @param docTagRela 文档标签关系
+     * @return 文档标签关系集合
+     */
+    public List<DocTagRela> selectDocTagRelaList(DocTagRela docTagRela);
+
+    /**
+     * 新增文档标签关系
+     * 
+     * @param docTagRela 文档标签关系
+     * @return 结果
+     */
+    public int insertDocTagRela(DocTagRela docTagRela);
+
+    /**
+     * 修改文档标签关系
+     * 
+     * @param docTagRela 文档标签关系
+     * @return 结果
+     */
+    public int updateDocTagRela(DocTagRela docTagRela);
+
+    /**
+     * 批量删除文档标签关系
+     * 
+     * @param docIds 需要删除的文档标签关系主键集合
+     * @return 结果
+     */
+    public int deleteDocTagRelaByDocIds(Long[] docIds);
+
+    /**
+     * 删除文档标签关系信息
+     * 
+     * @param docId 文档标签关系主键
+     * @return 结果
+     */
+    public int deleteDocTagRelaByDocId(Long docId);
+}

+ 7 - 7
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/IDocTagService.java

@@ -7,17 +7,17 @@ import com.jjt.doc.domain.DocTag;
  * 文档标签Service接口
  * 
  * @author wukai
- * @date 2023-03-27
+ * @date 2023-04-24
  */
 public interface IDocTagService 
 {
     /**
      * 查询文档标签
      * 
-     * @param id 文档标签主键
+     * @param tagId 文档标签主键
      * @return 文档标签
      */
-    public DocTag selectDocTagById(Long id);
+    public DocTag selectDocTagByTagId(Long tagId);
 
     /**
      * 查询文档标签列表
@@ -46,16 +46,16 @@ public interface IDocTagService
     /**
      * 批量删除文档标签
      * 
-     * @param ids 需要删除的文档标签主键集合
+     * @param tagIds 需要删除的文档标签主键集合
      * @return 结果
      */
-    public int deleteDocTagByIds(Long[] ids);
+    public int deleteDocTagByTagIds(Long[] tagIds);
 
     /**
      * 删除文档标签信息
      * 
-     * @param id 文档标签主键
+     * @param tagId 文档标签主键
      * @return 结果
      */
-    public int deleteDocTagById(Long id);
+    public int deleteDocTagByTagId(Long tagId);
 }

+ 38 - 6
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/impl/DocInfoServiceImpl.java

@@ -8,21 +8,21 @@ import java.net.URL;
 import java.util.*;
 import java.util.function.Function;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.jjt.common.core.utils.DateUtils;
 import com.jjt.common.core.utils.FileContentUtils;
 import com.jjt.common.core.utils.StringUtils;
 import com.jjt.common.core.utils.file.FileTypeUtils;
 import com.jjt.common.core.utils.uuid.Seq;
 import com.jjt.common.security.utils.SecurityUtils;
-import com.jjt.doc.domain.DocInfoDir;
-import com.jjt.doc.domain.DocVersion;
-import com.jjt.doc.domain.EsDocInfo;
+import com.jjt.doc.domain.*;
+import com.jjt.doc.mapper.DocTagMapper;
+import com.jjt.doc.mapper.DocTagRelaMapper;
 import com.jjt.doc.service.*;
 import com.jjt.system.api.RemoteFileService;
 import org.apache.commons.io.FilenameUtils;
 import org.springframework.stereotype.Service;
 import com.jjt.doc.mapper.DocInfoMapper;
-import com.jjt.doc.domain.DocInfo;
 
 import javax.annotation.Resource;
 
@@ -44,6 +44,10 @@ public class DocInfoServiceImpl implements IDocInfoService {
     private IDocVersionService docVersionService;
     @Resource
     private IDocInfoDirService infoDirService;
+    @Resource
+    private DocTagMapper tagMapper;
+    @Resource
+    private DocTagRelaMapper tagRelaMapper;
 
     /**
      * 查询文档基本信息
@@ -75,7 +79,11 @@ public class DocInfoServiceImpl implements IDocInfoService {
      */
     @Override
     public List<DocInfo> selectDocInfoList(DocInfo docInfo) {
-        return docInfoMapper.selectDocInfoListDir(docInfo);
+        List<DocInfo> list = docInfoMapper.selectDocInfoListDir(docInfo);
+        for (DocInfo info : list) {
+            info.setTagList(tagMapper.selectDocTagList4docId(info.getDocId()));
+        }
+        return list;
     }
 
     /**
@@ -131,6 +139,8 @@ public class DocInfoServiceImpl implements IDocInfoService {
             docInfo.setDocType(ext);
 
             docInfoMapper.updateDocInfo(docInfo);
+
+            insertDocTag(docInfo);
             return re;
         } catch (Exception e) {
             e.printStackTrace();
@@ -138,6 +148,28 @@ public class DocInfoServiceImpl implements IDocInfoService {
         return 0;
     }
 
+    //插入文档标签
+    private void insertDocTag(DocInfo docInfo) {
+        //先删除文档标签再重新插入
+        QueryWrapper<DocTagRela> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("doc_id", docInfo.getDocId());
+        tagRelaMapper.delete(queryWrapper);
+
+        //插入文档标签
+        for (DocTag tag : docInfo.getTagList()) {
+            if (tag.getTagId() == null || tag.getTagId() == 0L) {
+                //如果没有tagId,则在tag列表中插入一条记录
+                tag.setCreater(docInfo.getOwner());
+                tagMapper.insertDocTag(tag);
+            }
+            DocTagRela tagRela = new DocTagRela();
+            tagRela.setTagId(tag.getTagId());
+            tagRela.setDocId(docInfo.getDocId());
+            tagRela.setDocYear(docInfo.getCreateYear());
+            tagRelaMapper.insertDocTagRela(tagRela);
+        }
+    }
+
     /**
      * 修改文档基本信息
      *
@@ -146,7 +178,7 @@ public class DocInfoServiceImpl implements IDocInfoService {
      */
     @Override
     public int updateDocInfo(DocInfo docInfo) {
-
+        insertDocTag(docInfo);
         return docInfoMapper.updateDocInfo(docInfo);
     }
 

+ 93 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/impl/DocTagRelaServiceImpl.java

@@ -0,0 +1,93 @@
+package com.jjt.doc.service.impl;
+
+import java.util.List;
+import org.springframework.stereotype.Service;
+import com.jjt.doc.mapper.DocTagRelaMapper;
+import com.jjt.doc.domain.DocTagRela;
+import javax.annotation.Resource;
+import com.jjt.doc.service.IDocTagRelaService;
+
+/**
+ * 文档标签关系Service业务层处理
+ *
+ * @author wukai
+ * @date 2023-04-24
+ */
+@Service
+public class DocTagRelaServiceImpl implements IDocTagRelaService
+{
+    @Resource
+    private DocTagRelaMapper docTagRelaMapper;
+
+    /**
+     * 查询文档标签关系
+     *
+     * @param docId 文档标签关系主键
+     * @return 文档标签关系
+     */
+    @Override
+    public DocTagRela selectDocTagRelaByDocId(Long docId)
+    {
+        return docTagRelaMapper.selectDocTagRelaByDocId(docId);
+    }
+
+    /**
+     * 查询文档标签关系列表
+     *
+     * @param docTagRela 文档标签关系
+     * @return 文档标签关系
+     */
+    @Override
+    public List<DocTagRela> selectDocTagRelaList(DocTagRela docTagRela)
+    {
+        return docTagRelaMapper.selectDocTagRelaList(docTagRela);
+    }
+
+    /**
+     * 新增文档标签关系
+     *
+     * @param docTagRela 文档标签关系
+     * @return 结果
+     */
+    @Override
+    public int insertDocTagRela(DocTagRela docTagRela)
+    {
+        return docTagRelaMapper.insertDocTagRela(docTagRela);
+    }
+
+    /**
+     * 修改文档标签关系
+     *
+     * @param docTagRela 文档标签关系
+     * @return 结果
+     */
+    @Override
+    public int updateDocTagRela(DocTagRela docTagRela)
+    {
+        return docTagRelaMapper.updateDocTagRela(docTagRela);
+    }
+
+    /**
+     * 批量删除文档标签关系
+     *
+     * @param docIds 需要删除的文档标签关系主键
+     * @return 结果
+     */
+    @Override
+    public int deleteDocTagRelaByDocIds(Long[] docIds)
+    {
+        return docTagRelaMapper.deleteDocTagRelaByDocIds(docIds);
+    }
+
+    /**
+     * 删除文档标签关系信息
+     *
+     * @param docId 文档标签关系主键
+     * @return 结果
+     */
+    @Override
+    public int deleteDocTagRelaByDocId(Long docId)
+    {
+        return docTagRelaMapper.deleteDocTagRelaByDocId(docId);
+    }
+}

+ 17 - 21
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/impl/DocTagServiceImpl.java

@@ -1,35 +1,36 @@
 package com.jjt.doc.service.impl;
 
 import java.util.List;
+
 import com.jjt.common.core.utils.DateUtils;
 import org.springframework.stereotype.Service;
 import com.jjt.doc.mapper.DocTagMapper;
 import com.jjt.doc.domain.DocTag;
+
 import javax.annotation.Resource;
+
 import com.jjt.doc.service.IDocTagService;
 
 /**
  * 文档标签Service业务层处理
  *
  * @author wukai
- * @date 2023-03-27
+ * @date 2023-04-24
  */
 @Service
-public class DocTagServiceImpl implements IDocTagService
-{
+public class DocTagServiceImpl implements IDocTagService {
     @Resource
     private DocTagMapper docTagMapper;
 
     /**
      * 查询文档标签
      *
-     * @param id 文档标签主键
+     * @param tagId 文档标签主键
      * @return 文档标签
      */
     @Override
-    public DocTag selectDocTagById(Long id)
-    {
-        return docTagMapper.selectDocTagById(id);
+    public DocTag selectDocTagByTagId(Long tagId) {
+        return docTagMapper.selectDocTagByTagId(tagId);
     }
 
     /**
@@ -39,8 +40,7 @@ public class DocTagServiceImpl implements IDocTagService
      * @return 文档标签
      */
     @Override
-    public List<DocTag> selectDocTagList(DocTag docTag)
-    {
+    public List<DocTag> selectDocTagList(DocTag docTag) {
         return docTagMapper.selectDocTagList(docTag);
     }
 
@@ -51,8 +51,7 @@ public class DocTagServiceImpl implements IDocTagService
      * @return 结果
      */
     @Override
-    public int insertDocTag(DocTag docTag)
-    {
+    public int insertDocTag(DocTag docTag) {
         docTag.setCreateTime(DateUtils.getNowDate());
         return docTagMapper.insertDocTag(docTag);
     }
@@ -64,8 +63,7 @@ public class DocTagServiceImpl implements IDocTagService
      * @return 结果
      */
     @Override
-    public int updateDocTag(DocTag docTag)
-    {
+    public int updateDocTag(DocTag docTag) {
         docTag.setUpdateTime(DateUtils.getNowDate());
         return docTagMapper.updateDocTag(docTag);
     }
@@ -73,24 +71,22 @@ public class DocTagServiceImpl implements IDocTagService
     /**
      * 批量删除文档标签
      *
-     * @param ids 需要删除的文档标签主键
+     * @param tagIds 需要删除的文档标签主键
      * @return 结果
      */
     @Override
-    public int deleteDocTagByIds(Long[] ids)
-    {
-        return docTagMapper.deleteDocTagByIds(ids);
+    public int deleteDocTagByTagIds(Long[] tagIds) {
+        return docTagMapper.deleteDocTagByTagIds(tagIds);
     }
 
     /**
      * 删除文档标签信息
      *
-     * @param id 文档标签主键
+     * @param tagId 文档标签主键
      * @return 结果
      */
     @Override
-    public int deleteDocTagById(Long id)
-    {
-        return docTagMapper.deleteDocTagById(id);
+    public int deleteDocTagByTagId(Long tagId) {
+        return docTagMapper.deleteDocTagByTagId(tagId);
     }
 }

+ 61 - 42
lzga-modules/lzga-doc/src/main/resources/mapper/doc/DocTagMapper.xml

@@ -1,73 +1,90 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.jjt.doc.mapper.DocTagMapper">
-    
+
     <resultMap type="DocTag" id="DocTagResult">
-        <result property="id"    column="ID"    />
-        <result property="docId"    column="DOC_ID"    />
-        <result property="tagName"    column="TAG_NAME"    />
-        <result property="createBy"    column="CREATE_BY"    />
-        <result property="createTime"    column="CREATE_TIME"    />
-        <result property="updateBy"    column="UPDATE_BY"    />
-        <result property="updateTime"    column="UPDATE_TIME"    />
-        <result property="remark"    column="REMARK"    />
-        <result property="isDel"    column="IS_DEL"    />
+        <result property="tagId" column="TAG_ID"/>
+        <result property="tagName" column="TAG_NAME"/>
+        <result property="creater" column="CREATER"/>
+        <result property="createBy" column="CREATE_BY"/>
+        <result property="createTime" column="CREATE_TIME"/>
+        <result property="updateBy" column="UPDATE_BY"/>
+        <result property="updateTime" column="UPDATE_TIME"/>
+        <result property="remark" column="REMARK"/>
+        <result property="isDel" column="IS_DEL"/>
     </resultMap>
 
     <sql id="selectDocTagVo">
-        select ID, DOC_ID, TAG_NAME, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, REMARK, IS_DEL from doc_tag
+        select TAG_ID,
+               TAG_NAME,
+               CREATER,
+               CREATE_BY,
+               CREATE_TIME,
+               UPDATE_BY,
+               UPDATE_TIME,
+               REMARK,
+               IS_DEL
+        from doc_tag
     </sql>
 
     <select id="selectDocTagList" parameterType="DocTag" resultMap="DocTagResult">
         <include refid="selectDocTagVo"/>
-        <where>  
-            <if test="docId != null "> and DOC_ID = #{docId}</if>
-            <if test="tagName != null  and tagName != ''"> and TAG_NAME like concat('%', #{tagName}, '%')</if>
-            <if test="createBy != null "> and CREATE_BY = #{createBy}</if>
-            <if test="createTime != null "> and CREATE_TIME = #{createTime}</if>
-            <if test="updateBy != null "> and UPDATE_BY = #{updateBy}</if>
-            <if test="updateTime != null "> and UPDATE_TIME = #{updateTime}</if>
-            <if test="remark != null  and remark != ''"> and REMARK = #{remark}</if>
-            <if test="isDel != null  and isDel != ''"> and IS_DEL = #{isDel}</if>
+        <where>
+            <if test="tagName != null  and tagName != ''">and TAG_NAME like concat('%', #{tagName}, '%')</if>
+            <if test="creater != null ">and CREATER = #{creater}</if>
+            <if test="createBy != null  and createBy != ''">and CREATE_BY = #{createBy}</if>
+            <if test="createTime != null ">and CREATE_TIME = #{createTime}</if>
+            <if test="updateBy != null  and updateBy != ''">and UPDATE_BY = #{updateBy}</if>
+            <if test="updateTime != null ">and UPDATE_TIME = #{updateTime}</if>
+            <if test="remark != null  and remark != ''">and REMARK = #{remark}</if>
+            <if test="isDel != null  and isDel != ''">and IS_DEL = #{isDel}</if>
         </where>
     </select>
-    
-    <select id="selectDocTagById" parameterType="Long" resultMap="DocTagResult">
+
+    <select id="selectDocTagByTagId" parameterType="Long" resultMap="DocTagResult">
         <include refid="selectDocTagVo"/>
-        where ID = #{id}
+        where TAG_ID = #{tagId}
+    </select>
+
+    <select id="selectDocTagList4docId" parameterType="Long" resultType="com.jjt.doc.domain.DocTag">
+        select a.*
+        from doc_tag a,
+             doc_tag_rela b
+        where a.tag_id = b.tag_id
+          and b.doc_id = #{docId}
     </select>
-        
-    <insert id="insertDocTag" parameterType="DocTag" useGeneratedKeys="true" keyProperty="id">
+
+    <insert id="insertDocTag" parameterType="DocTag" useGeneratedKeys="true" keyProperty="tagId">
         insert into doc_tag
         <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="docId != null">DOC_ID,</if>
-            <if test="tagName != null">TAG_NAME,</if>
+            <if test="tagName != null and tagName != ''">TAG_NAME,</if>
+            <if test="creater != null">CREATER,</if>
             <if test="createBy != null">CREATE_BY,</if>
             <if test="createTime != null">CREATE_TIME,</if>
             <if test="updateBy != null">UPDATE_BY,</if>
             <if test="updateTime != null">UPDATE_TIME,</if>
             <if test="remark != null">REMARK,</if>
             <if test="isDel != null">IS_DEL,</if>
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="docId != null">#{docId},</if>
-            <if test="tagName != null">#{tagName},</if>
+            <if test="tagName != null and tagName != ''">#{tagName},</if>
+            <if test="creater != null">#{creater},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="remark != null">#{remark},</if>
             <if test="isDel != null">#{isDel},</if>
-         </trim>
+        </trim>
     </insert>
 
     <update id="updateDocTag" parameterType="DocTag">
         update doc_tag
         <trim prefix="SET" suffixOverrides=",">
-            <if test="docId != null">DOC_ID = #{docId},</if>
-            <if test="tagName != null">TAG_NAME = #{tagName},</if>
+            <if test="tagName != null and tagName != ''">TAG_NAME = #{tagName},</if>
+            <if test="creater != null">CREATER = #{creater},</if>
             <if test="createBy != null">CREATE_BY = #{createBy},</if>
             <if test="createTime != null">CREATE_TIME = #{createTime},</if>
             <if test="updateBy != null">UPDATE_BY = #{updateBy},</if>
@@ -75,17 +92,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="remark != null">REMARK = #{remark},</if>
             <if test="isDel != null">IS_DEL = #{isDel},</if>
         </trim>
-        where ID = #{id}
+        where TAG_ID = #{tagId}
     </update>
 
-    <delete id="deleteDocTagById" parameterType="Long">
-        delete from doc_tag where ID = #{id}
+    <delete id="deleteDocTagByTagId" parameterType="Long">
+        delete
+        from doc_tag
+        where TAG_ID = #{tagId}
     </delete>
 
-    <delete id="deleteDocTagByIds" parameterType="String">
-        delete from doc_tag where ID in 
-        <foreach item="id" collection="array" open="(" separator="," close=")">
-            #{id}
+    <delete id="deleteDocTagByTagIds" parameterType="String">
+        delete from doc_tag where TAG_ID in
+        <foreach item="tagId" collection="array" open="(" separator="," close=")">
+            #{tagId}
         </foreach>
     </delete>
 </mapper>

+ 61 - 0
lzga-modules/lzga-doc/src/main/resources/mapper/doc/DocTagRelaMapper.xml

@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jjt.doc.mapper.DocTagRelaMapper">
+    
+    <resultMap type="DocTagRela" id="DocTagRelaResult">
+        <result property="docId"    column="DOC_ID"    />
+        <result property="tagId"    column="TAG_ID"    />
+        <result property="docYear"    column="DOC_YEAR"    />
+    </resultMap>
+
+    <sql id="selectDocTagRelaVo">
+        select DOC_ID, TAG_ID, DOC_YEAR from doc_tag_rela
+    </sql>
+
+    <select id="selectDocTagRelaList" parameterType="DocTagRela" resultMap="DocTagRelaResult">
+        <include refid="selectDocTagRelaVo"/>
+        <where>  
+        </where>
+    </select>
+    
+    <select id="selectDocTagRelaByDocId" parameterType="Long" resultMap="DocTagRelaResult">
+        <include refid="selectDocTagRelaVo"/>
+        where DOC_ID = #{docId}
+    </select>
+        
+    <insert id="insertDocTagRela" parameterType="DocTagRela">
+        insert into doc_tag_rela
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="docId != null">DOC_ID,</if>
+            <if test="tagId != null">TAG_ID,</if>
+            <if test="docYear != null">DOC_YEAR,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="docId != null">#{docId},</if>
+            <if test="tagId != null">#{tagId},</if>
+            <if test="docYear != null">#{docYear},</if>
+         </trim>
+    </insert>
+
+    <update id="updateDocTagRela" parameterType="DocTagRela">
+        update doc_tag_rela
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="tagId != null">TAG_ID = #{tagId},</if>
+            <if test="docYear != null">DOC_YEAR = #{docYear},</if>
+        </trim>
+        where DOC_ID = #{docId}
+    </update>
+
+    <delete id="deleteDocTagRelaByDocId" parameterType="Long">
+        delete from doc_tag_rela where DOC_ID = #{docId}
+    </delete>
+
+    <delete id="deleteDocTagRelaByDocIds" parameterType="String">
+        delete from doc_tag_rela where DOC_ID in 
+        <foreach item="docId" collection="array" open="(" separator="," close=")">
+            #{docId}
+        </foreach>
+    </delete>
+</mapper>

+ 4 - 4
lzga-ui/src/api/doc/tag.js

@@ -10,9 +10,9 @@ export function listTag(query) {
 }
 
 // 查询文档标签详细
-export function getTag(id) {
+export function getTag(tagId) {
   return request({
-    url: '/doc/tag/' + id,
+    url: '/doc/tag/' + tagId,
     method: 'get'
   })
 }
@@ -36,9 +36,9 @@ export function updateTag(data) {
 }
 
 // 删除文档标签
-export function delTag(id) {
+export function delTag(tagId) {
   return request({
-    url: '/doc/tag/' + id,
+    url: '/doc/tag/' + tagId,
     method: 'delete'
   })
 }

+ 20 - 6
lzga-ui/src/views/doc/info/index.vue

@@ -61,9 +61,10 @@
           <el-table-column label="标签" align="center" prop="tagName" />
           <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
             <template slot-scope="scope">
-              <el-button size="mini" type="text" icon="el-icon-view" @click="handleShare(scope.row)">分享</el-button>
-              <el-button size="mini" type="text" icon="el-icon-download"
-                @click="handleDownload(scope.row)">下载</el-button>
+              <el-button size="mini" type="text" icon="el-icon-view" @click="handleShare(scope.row)"
+                v-if="checkLevel(scope.row,'share')">分享</el-button>
+              <el-button size="mini" type="text" icon="el-icon-download" @click="handleDownload(scope.row)"
+                v-if="checkLevel(scope.row,'download')">下载</el-button>
               <el-button size="mini" type="text" icon="el-icon-view" @click="handlePreview(scope.row)">预览</el-button>
               <el-button size="mini" type="text" icon="el-icon-view" @click="handleEdit(scope.row)">在线编辑</el-button>
               <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
@@ -394,9 +395,22 @@
       },
       /**处理文档级别数据*/
       fileLevelData(row, col, value) {
-        const obj=this.levelOptions.find(level => level.levelId == value);
-        return obj.levelName;
+        try {
+          const obj = this.levelOptions.find(level => level.levelId == row.docLevel);
+          return obj.levelName;
+        } catch (e) {}
+      },
+      /**根据文件级别,设置是否显示*/
+      checkLevel(row, role) {
+        try {
+          const obj = this.levelOptions.find(level => level.levelId == row.docLevel);
+          if (obj.levelRole.indexOf(role) != -1) {
+            return true;
+          } else {
+            return false;
+          }
+        } catch (e) {}
       }
     }
   };
-</script>
+</script>

+ 173 - 247
lzga-ui/src/views/doc/tag/index.vue

@@ -1,69 +1,31 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="文档ID" prop="docId">
-        <el-input
-          v-model="queryParams.docId"
-          placeholder="请输入文档ID"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
       <el-form-item label="标签名称" prop="tagName">
-        <el-input
-          v-model="queryParams.tagName"
-          placeholder="请输入标签名称"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.tagName" placeholder="请输入标签名称" clearable @keyup.enter.native="handleQuery" />
       </el-form-item>
       <el-form-item label="创建人" prop="createBy">
-        <el-input
-          v-model="queryParams.createBy"
-          placeholder="请输入创建人"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.createBy" placeholder="请输入创建人" clearable @keyup.enter.native="handleQuery" />
       </el-form-item>
       <el-form-item label="创建时间" prop="createTime">
-        <el-date-picker clearable
-          v-model="queryParams.createTime"
-          type="date"
-          value-format="yyyy-MM-dd"
+        <el-date-picker clearable v-model="queryParams.createTime" type="date" value-format="yyyy-MM-dd"
           placeholder="请选择创建时间">
         </el-date-picker>
       </el-form-item>
       <el-form-item label="更新人" prop="updateBy">
-        <el-input
-          v-model="queryParams.updateBy"
-          placeholder="请输入更新人"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.updateBy" placeholder="请输入更新人" clearable @keyup.enter.native="handleQuery" />
       </el-form-item>
       <el-form-item label="更新时间" prop="updateTime">
-        <el-date-picker clearable
-          v-model="queryParams.updateTime"
-          type="date"
-          value-format="yyyy-MM-dd"
+        <el-date-picker clearable v-model="queryParams.updateTime" type="date" value-format="yyyy-MM-dd"
           placeholder="请选择更新时间">
         </el-date-picker>
       </el-form-item>
       <el-form-item label="备注" prop="remark">
-        <el-input
-          v-model="queryParams.remark"
-          placeholder="请输入备注"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.remark" placeholder="请输入备注" clearable @keyup.enter.native="handleQuery" />
       </el-form-item>
       <el-form-item label="逻辑删除标志;1/非1" prop="isDel">
-        <el-input
-          v-model="queryParams.isDel"
-          placeholder="请输入逻辑删除标志;1/非1"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.isDel" placeholder="请输入逻辑删除标志;1/非1" clearable
+          @keyup.enter.native="handleQuery" />
       </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@@ -73,54 +35,27 @@
 
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
-        <el-button
-          type="primary"
-          plain
-          icon="el-icon-plus"
-          size="mini"
-          @click="handleAdd"
-          v-hasPermi="['doc:tag:add']"
-        >新增</el-button>
+        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
+          v-hasPermi="['doc:tag:add']">新增</el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button
-          type="success"
-          plain
-          icon="el-icon-edit"
-          size="mini"
-          :disabled="single"
-          @click="handleUpdate"
-          v-hasPermi="['doc:tag:edit']"
-        >修改</el-button>
+        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
+          v-hasPermi="['doc:tag:edit']">修改</el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button
-          type="danger"
-          plain
-          icon="el-icon-delete"
-          size="mini"
-          :disabled="multiple"
-          @click="handleDelete"
-          v-hasPermi="['doc:tag:remove']"
-        >删除</el-button>
+        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
+          v-hasPermi="['doc:tag:remove']">删除</el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button
-          type="warning"
-          plain
-          icon="el-icon-download"
-          size="mini"
-          @click="handleExport"
-          v-hasPermi="['doc:tag:export']"
-        >导出</el-button>
+        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
+          v-hasPermi="['doc:tag:export']">导出</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
     <el-table v-loading="loading" :data="tagList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="主键ID" align="center" prop="id" />
-      <el-table-column label="文档ID" align="center" prop="docId" />
+      <el-table-column label="标签ID" align="center" prop="tagId" />
       <el-table-column label="标签名称" align="center" prop="tagName" />
       <el-table-column label="创建人" align="center" prop="createBy" />
       <el-table-column label="创建时间" align="center" prop="createTime" width="180">
@@ -138,38 +73,20 @@
       <el-table-column label="逻辑删除标志;1/非1" align="center" prop="isDel" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            v-hasPermi="['doc:tag:edit']"
-          >修改</el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['doc:tag:remove']"
-          >删除</el-button>
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
+            v-hasPermi="['doc:tag:edit']">修改</el-button>
+          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
+            v-hasPermi="['doc:tag:remove']">删除</el-button>
         </template>
       </el-table-column>
     </el-table>
-    
-    <pagination
-      v-show="total>0"
-      :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
-      @pagination="getList"
-    />
+
+    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
+      @pagination="getList" />
 
     <!-- 添加或修改文档标签对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="文档ID" prop="docId">
-          <el-input v-model="form.docId" placeholder="请输入文档ID" />
-        </el-form-item>
         <el-form-item label="标签名称" prop="tagName">
           <el-input v-model="form.tagName" placeholder="请输入标签名称" />
         </el-form-item>
@@ -189,151 +106,160 @@
 </template>
 
 <script>
-import { listTag, getTag, delTag, addTag, updateTag } from "@/api/doc/tag";
+  import {
+    listTag,
+    getTag,
+    delTag,
+    addTag,
+    updateTag
+  } from "@/api/doc/tag";
 
-export default {
-  name: "Tag",
-  data() {
-    return {
-      // 遮罩层
-      loading: true,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
-      // 显示搜索条件
-      showSearch: true,
-      // 总条数
-      total: 0,
-      // 文档标签表格数据
-      tagList: [],
-      // 弹出层标题
-      title: "",
-      // 是否显示弹出层
-      open: false,
-      // 查询参数
-      queryParams: {
-        pageNum: 1,
-        pageSize: 10,
-        docId: null,
-        tagName: null,
-        createBy: null,
-        createTime: null,
-        updateBy: null,
-        updateTime: null,
-        remark: null,
-        isDel: null
-      },
-      // 表单参数
-      form: {},
-      // 表单校验
-      rules: {
-      }
-    };
-  },
-  created() {
-    this.getList();
-  },
-  methods: {
-    /** 查询文档标签列表 */
-    getList() {
-      this.loading = true;
-      listTag(this.queryParams).then(response => {
-        this.tagList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
-    },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
-    },
-    // 表单重置
-    reset() {
-      this.form = {
-        id: null,
-        docId: null,
-        tagName: null,
-        createBy: null,
-        createTime: null,
-        updateBy: null,
-        updateTime: null,
-        remark: null,
-        isDel: null
+  export default {
+    name: "Tag",
+    data() {
+      return {
+        // 遮罩层
+        loading: true,
+        // 选中数组
+        ids: [],
+        // 非单个禁用
+        single: true,
+        // 非多个禁用
+        multiple: true,
+        // 显示搜索条件
+        showSearch: true,
+        // 总条数
+        total: 0,
+        // 文档标签表格数据
+        tagList: [],
+        // 弹出层标题
+        title: "",
+        // 是否显示弹出层
+        open: false,
+        // 查询参数
+        queryParams: {
+          pageNum: 1,
+          pageSize: 10,
+          tagName: null,
+          createBy: null,
+          createTime: null,
+          updateBy: null,
+          updateTime: null,
+          remark: null,
+          isDel: null
+        },
+        // 表单参数
+        form: {},
+        // 表单校验
+        rules: {
+          tagName: [{
+            required: true,
+            message: "标签名称不能为空",
+            trigger: "blur"
+          }],
+        }
       };
-      this.resetForm("form");
     },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1;
+    created() {
       this.getList();
     },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
-    },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.id)
-      this.single = selection.length!==1
-      this.multiple = !selection.length
-    },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加文档标签";
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const id = row.id || this.ids
-      getTag(id).then(response => {
-        this.form = response.data;
+    methods: {
+      /** 查询文档标签列表 */
+      getList() {
+        this.loading = true;
+        listTag(this.queryParams).then(response => {
+          this.tagList = response.rows;
+          this.total = response.total;
+          this.loading = false;
+        });
+      },
+      // 取消按钮
+      cancel() {
+        this.open = false;
+        this.reset();
+      },
+      // 表单重置
+      reset() {
+        this.form = {
+          tagId: null,
+          tagName: null,
+          createBy: null,
+          createTime: null,
+          updateBy: null,
+          updateTime: null,
+          remark: null,
+          isDel: null
+        };
+        this.resetForm("form");
+      },
+      /** 搜索按钮操作 */
+      handleQuery() {
+        this.queryParams.pageNum = 1;
+        this.getList();
+      },
+      /** 重置按钮操作 */
+      resetQuery() {
+        this.resetForm("queryForm");
+        this.handleQuery();
+      },
+      // 多选框选中数据
+      handleSelectionChange(selection) {
+        this.ids = selection.map(item => item.tagId)
+        this.single = selection.length !== 1
+        this.multiple = !selection.length
+      },
+      /** 新增按钮操作 */
+      handleAdd() {
+        this.reset();
         this.open = true;
-        this.title = "修改文档标签";
-      });
-    },
-    /** 提交按钮 */
-    submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.id != null) {
-            updateTag(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addTag(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
+        this.title = "添加文档标签";
+      },
+      /** 修改按钮操作 */
+      handleUpdate(row) {
+        this.reset();
+        const tagId = row.tagId || this.ids
+        getTag(tagId).then(response => {
+          this.form = response.data;
+          this.open = true;
+          this.title = "修改文档标签";
+        });
+      },
+      /** 提交按钮 */
+      submitForm() {
+        this.$refs["form"].validate(valid => {
+          if (valid) {
+            if (this.form.tagId != null) {
+              updateTag(this.form).then(response => {
+                this.$modal.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              });
+            } else {
+              addTag(this.form).then(response => {
+                this.$modal.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              });
+            }
           }
-        }
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const ids = row.id || this.ids;
-      this.$modal.confirm('是否确认删除文档标签编号为"' + ids + '"的数据项?').then(function() {
-        return delTag(ids);
-      }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("删除成功");
-      }).catch(() => {});
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download('doc/tag/export', {
-        ...this.queryParams
-      }, `tag_${new Date().getTime()}.xlsx`)
+        });
+      },
+      /** 删除按钮操作 */
+      handleDelete(row) {
+        const tagIds = row.tagId || this.ids;
+        this.$modal.confirm('是否确认删除文档标签编号为"' + tagIds + '"的数据项?').then(function() {
+          return delTag(tagIds);
+        }).then(() => {
+          this.getList();
+          this.$modal.msgSuccess("删除成功");
+        }).catch(() => {});
+      },
+      /** 导出按钮操作 */
+      handleExport() {
+        this.download('doc/tag/export', {
+          ...this.queryParams
+        }, `tag_${new Date().getTime()}.xlsx`)
+      }
     }
-  }
-};
-</script>
+  };
+</script>