张阿敏 2 éve
szülő
commit
b96c2a052d
54 módosított fájl, 1683 hozzáadás és 341 törlés
  1. 1 1
      Dockerfile
  2. 1 1
      sino-mark-server/pom.xml
  3. 1 1
      sino-mark-server/src/main/java/cn/sino/mark/SinoMarkApplication.java
  4. 2 1
      sino-mark-server/src/main/java/cn/sino/mark/common/config/MarkCorsConfig.java
  5. 21 2
      sino-mark-server/src/main/java/cn/sino/mark/common/enums/ResourceTypeEnum.java
  6. 0 1
      sino-mark-server/src/main/java/cn/sino/mark/common/filter/TokenFilter.java
  7. 1 0
      sino-mark-server/src/main/java/cn/sino/mark/common/log/Log.java
  8. 67 0
      sino-mark-server/src/main/java/cn/sino/mark/common/model/bo/LabelBO.java
  9. 32 0
      sino-mark-server/src/main/java/cn/sino/mark/common/model/bo/ResourceDataBO.java
  10. 5 0
      sino-mark-server/src/main/java/cn/sino/mark/common/model/bo/SysUserBO.java
  11. 7 0
      sino-mark-server/src/main/java/cn/sino/mark/common/model/dto/AddInnerUserDTO.java
  12. 35 0
      sino-mark-server/src/main/java/cn/sino/mark/common/model/dto/AddLabelDTO.java
  13. 44 0
      sino-mark-server/src/main/java/cn/sino/mark/common/model/dto/EditLabelDTO.java
  14. 27 0
      sino-mark-server/src/main/java/cn/sino/mark/common/model/dto/LabelPageDTO.java
  15. 1 4
      sino-mark-server/src/main/java/cn/sino/mark/common/model/dto/MultipartFileDTO.java
  16. 42 0
      sino-mark-server/src/main/java/cn/sino/mark/common/model/vo/DepartmentTreeVO.java
  17. 0 2
      sino-mark-server/src/main/java/cn/sino/mark/common/model/vo/InnerLoginUserVO.java
  18. 33 0
      sino-mark-server/src/main/java/cn/sino/mark/common/model/vo/LabelAllVO.java
  19. 47 0
      sino-mark-server/src/main/java/cn/sino/mark/common/model/vo/LabelInfoVO.java
  20. 47 0
      sino-mark-server/src/main/java/cn/sino/mark/common/model/vo/LabelPageVO.java
  21. 6 0
      sino-mark-server/src/main/java/cn/sino/mark/common/model/vo/UserDetailsVO.java
  22. 7 2
      sino-mark-server/src/main/java/cn/sino/mark/common/model/vo/UserPageVO.java
  23. 0 169
      sino-mark-server/src/main/java/cn/sino/mark/common/source/CardpssResult.java
  24. 4 0
      sino-mark-server/src/main/java/cn/sino/mark/common/utils/ListsUtil.java
  25. 3 0
      sino-mark-server/src/main/java/cn/sino/mark/common/utils/LoginUserUtil.java
  26. 1 3
      sino-mark-server/src/main/java/cn/sino/mark/controller/web/CategoryController.java
  27. 78 0
      sino-mark-server/src/main/java/cn/sino/mark/controller/web/LabelController.java
  28. 0 1
      sino-mark-server/src/main/java/cn/sino/mark/controller/web/ProjectGroupController.java
  29. 6 0
      sino-mark-server/src/main/java/cn/sino/mark/controller/web/SysUserController.java
  30. 24 0
      sino-mark-server/src/main/java/cn/sino/mark/dao/mapper/LabelItemMapper.java
  31. 41 0
      sino-mark-server/src/main/java/cn/sino/mark/dao/mapper/LabelMapper.java
  32. 25 0
      sino-mark-server/src/main/java/cn/sino/mark/dao/mapper/SysDeptMapper.java
  33. 34 0
      sino-mark-server/src/main/java/cn/sino/mark/dao/model/LabelDO.java
  34. 51 0
      sino-mark-server/src/main/java/cn/sino/mark/dao/model/LabelItemDO.java
  35. 85 0
      sino-mark-server/src/main/java/cn/sino/mark/dao/model/SysDeptDO.java
  36. 11 3
      sino-mark-server/src/main/java/cn/sino/mark/dao/model/SysUserDO.java
  37. 171 0
      sino-mark-server/src/main/java/cn/sino/mark/manager/LabelManager.java
  38. 0 2
      sino-mark-server/src/main/java/cn/sino/mark/manager/ResourceManager.java
  39. 12 8
      sino-mark-server/src/main/java/cn/sino/mark/manager/SysUserManager.java
  40. 64 0
      sino-mark-server/src/main/java/cn/sino/mark/service/LabelService.java
  41. 1 0
      sino-mark-server/src/main/java/cn/sino/mark/service/ResourceService.java
  42. 7 0
      sino-mark-server/src/main/java/cn/sino/mark/service/SysUserService.java
  43. 64 0
      sino-mark-server/src/main/java/cn/sino/mark/service/convert/LabelMapStruct.java
  44. 10 0
      sino-mark-server/src/main/java/cn/sino/mark/service/convert/SysUserMapStruct.java
  45. 122 0
      sino-mark-server/src/main/java/cn/sino/mark/service/impl/LabelServiceImpl.java
  46. 151 85
      sino-mark-server/src/main/java/cn/sino/mark/service/impl/ResourceServiceImpl.java
  47. 18 12
      sino-mark-server/src/main/java/cn/sino/mark/service/impl/SysUserServiceImpl.java
  48. 27 0
      sino-mark-server/src/main/resources/application-dev.properties
  49. 2 2
      sino-mark-server/src/main/resources/application.yml
  50. 32 0
      sino-mark-server/src/main/resources/mapper/mark/LabelItemMapper.xml
  51. 85 0
      sino-mark-server/src/main/resources/mapper/mark/LabelMapper.xml
  52. 26 0
      sino-mark-server/src/main/resources/mapper/mark/SysDeptMapper.xml
  53. 44 41
      sino-mark-server/src/main/resources/mapper/mark/SysUserMapper.xml
  54. 57 0
      sino-mark-server/src/main/resources/sql/sino-mark-db-update-20220913.sql

+ 1 - 1
Dockerfile

@@ -8,4 +8,4 @@ RUN chown -R work:work /services/sino-mark/
 
 EXPOSE 8060
 
-CMD ["sh","-c","java $JAVA_OPTS -jar /services/sino-mark/sino-mark.jar"]
+CMD ["sh","-c","java $JAVA_OPTS -jar /services/sino-mark/sino-mark.jar --spring.profiles.active=dev"]

+ 1 - 1
sino-mark-server/pom.xml

@@ -139,7 +139,7 @@
     <dependency>
       <groupId>com.alibaba</groupId>
       <artifactId>fastjson</artifactId>
-      <version>1.2.46</version>
+      <version>1.2.62</version>
     </dependency>
   </dependencies>
 

+ 1 - 1
sino-mark-server/src/main/java/cn/sino/mark/SinoMarkApplication.java

@@ -22,7 +22,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
  * @date 2022/3/15
  */
 @Slf4j
-@EnableApolloConfig
+//@EnableApolloConfig
 @EnableCaching
 @RequiredArgsConstructor
 @EnableTransactionManagement

+ 2 - 1
sino-mark-server/src/main/java/cn/sino/mark/common/config/MarkCorsConfig.java

@@ -17,7 +17,8 @@ public class MarkCorsConfig {
 
     private CorsConfiguration buildConfig() {
         CorsConfiguration corsConfiguration = new CorsConfiguration();
-        corsConfiguration.addAllowedOrigin(origin); // 1
+//        corsConfiguration.addAllowedOrigin(origin); // 1
+        corsConfiguration.addAllowedOrigin("*"); // 1
         corsConfiguration.setAllowCredentials(true);
         corsConfiguration.addAllowedHeader("*"); // 2
         corsConfiguration.addAllowedMethod("*"); // 3

+ 21 - 2
sino-mark-server/src/main/java/cn/sino/mark/common/enums/ResourceTypeEnum.java

@@ -11,7 +11,26 @@ import lombok.Getter;
 @Getter
 public enum ResourceTypeEnum {
 
-    DOC(0, "文本"), PICTURE(1, "图片"),MOVIE(2,"视频");
+
+    /**
+     * 文本
+     */
+    DOC(0, "文本"),
+
+    /**
+     * 图片
+     */
+    PICTURE(1, "图片"),
+
+    /**
+     * 视频
+     */
+    MOVIE(2, "视频"),
+
+    /**
+     * 链接
+     */
+    LINK(3, "链接");
 
     private final Integer value;
     private final String name;
@@ -21,7 +40,7 @@ public enum ResourceTypeEnum {
         this.name = name;
     }
 
-    public static String getName(Integer value){
+    public static String getName(Integer value) {
         for (ResourceTypeEnum posts : ResourceTypeEnum.values()) {
             if (posts.getValue().equals(value)) {
                 return posts.getName();

+ 0 - 1
sino-mark-server/src/main/java/cn/sino/mark/common/filter/TokenFilter.java

@@ -1,6 +1,5 @@
 package cn.sino.mark.common.filter;
 
-import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import cn.sino.mark.common.constants.Constant;
 import cn.sino.mark.common.model.dto.LoginUserDTO;

+ 1 - 0
sino-mark-server/src/main/java/cn/sino/mark/common/log/Log.java

@@ -10,6 +10,7 @@ import cn.sino.mark.common.enums.LogTypeEnum;
  * @className cn.sino.mark.common.log.Log
  * @date 2022/3/30
  */
+@SuppressWarnings({"java:S1700"})
 public class Log {
 
 

+ 67 - 0
sino-mark-server/src/main/java/cn/sino/mark/common/model/bo/LabelBO.java

@@ -0,0 +1,67 @@
+package cn.sino.mark.common.model.bo;
+
+import cn.sino.mark.dao.model.LabelItemDO;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @Description 标签
+ * @Author lgw
+ * @Date 2022/8/16 14:19
+ * @Version 1.0
+ **/
+@Data
+public class LabelBO {
+
+    /**
+     * PK
+     */
+    private Long id;
+
+    /**
+     * 标签名称
+     */
+    private String name;
+
+    /**
+     * 是否删除(0:正常;1:已删除)
+     */
+    private Boolean isDelete;
+
+    /**
+     * 创建人
+     */
+    private Long createBy;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 更新人
+     */
+    private Long updateBy;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+
+    /**
+     * 标签可选项
+     */
+    private String labelItemNames;
+
+    /**
+     * 创建人姓名
+     */
+    private String createName;
+
+    /**
+     * 标签选项
+     */
+    private List<LabelItemDO> labelItems;
+}

+ 32 - 0
sino-mark-server/src/main/java/cn/sino/mark/common/model/bo/ResourceDataBO.java

@@ -0,0 +1,32 @@
+package cn.sino.mark.common.model.bo;
+
+import cn.sino.mark.dao.model.ResourceDataDO;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 资源数据业务对象
+ *
+ * @author zhangamin
+ * @date 2022/9/13
+ */
+@Data
+@Builder()
+@AllArgsConstructor
+@NoArgsConstructor
+public class ResourceDataBO {
+
+    /**
+     * 资源数据
+     */
+    private ResourceDataDO resourceData;
+
+
+    /**
+     * 是否有效
+     */
+    private Boolean isValid;
+
+}

+ 5 - 0
sino-mark-server/src/main/java/cn/sino/mark/common/model/bo/SysUserBO.java

@@ -37,4 +37,9 @@ public class SysUserBO extends SysUserDO {
      * 进行中任务数
      */
     private Integer taskNum;
+
+    /**
+     * 部门名称
+     */
+    private String deptName;
 }

+ 7 - 0
sino-mark-server/src/main/java/cn/sino/mark/common/model/dto/AddInnerUserDTO.java

@@ -45,4 +45,11 @@ public class AddInnerUserDTO {
     @ApiModelProperty("角色")
     @NotEmpty(message = "角色信息不能为空")
     private List<Long> roleIds;
+
+    /**
+     * 部门ID
+     */
+    @ApiModelProperty("部门ID")
+    @NotNull(message = "请选择部门")
+    private Long deptId;
 }

+ 35 - 0
sino-mark-server/src/main/java/cn/sino/mark/common/model/dto/AddLabelDTO.java

@@ -0,0 +1,35 @@
+package cn.sino.mark.common.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import java.util.List;
+
+/**
+ * @Description 标签添加参数
+ * @Author sch
+ * @Date 2022/9/8 14:27
+ **/
+@ApiModel
+@Data
+public class AddLabelDTO {
+    /**
+     * 标签名称
+     */
+    @ApiModelProperty("标签名称")
+    @NotNull(message = "标签名称不能为空")
+    @Size(min = 1, max = 45, message = "标签名称长度在{min}~{max}之间")
+    private String name;
+
+    /**
+     * 标签可选项
+     */
+    @ApiModelProperty("标签可选项")
+    @NotEmpty(message = "至少需要1个可选项")
+    @Size(min = 1, max = 8, message = "选项数量在{min}~{max}之间")
+    private List<String> labelItemNames;
+}

+ 44 - 0
sino-mark-server/src/main/java/cn/sino/mark/common/model/dto/EditLabelDTO.java

@@ -0,0 +1,44 @@
+package cn.sino.mark.common.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import java.util.List;
+
+/**
+ * @Description 编辑标签参数
+ * @Author sch
+ * @Date 2022/9/8 16:50
+ * @Version 1.0
+ **/
+@ApiModel
+@Data
+public class EditLabelDTO {
+    /**
+     * 标签id
+     */
+    @ApiModelProperty("标签id")
+    @NotNull(message = "标签id不能为空")
+    private Long id;
+
+    /**
+     * 标签名称
+     */
+    @ApiModelProperty("标签名称")
+    @NotBlank(message = "标签名称不能为空")
+    @Size(min = 1, max = 45, message = "标签名称长度在{min}~{max}之间")
+    private String name;
+
+    /**
+     * 标签可选项
+     */
+    @ApiModelProperty("标签可选项")
+    @NotEmpty(message = "至少需要1个可选项")
+    @Size(min = 1, max = 8, message = "选项数量在{min}~{max}之间")
+    private List<String> labelItemNames;
+}

+ 27 - 0
sino-mark-server/src/main/java/cn/sino/mark/common/model/dto/LabelPageDTO.java

@@ -0,0 +1,27 @@
+package cn.sino.mark.common.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @Description 标签分页查询参数
+ * @Author sch
+ * @Date 2022/9/8 13:56
+ * @Version 1.0
+ **/
+@ApiModel
+@Data
+public class LabelPageDTO {
+    /**
+     * 标签名称
+     */
+    @ApiModelProperty("标签名称")
+    private String name;
+
+    /**
+     * 页码
+     */
+    @ApiModelProperty("页码")
+    private Integer pageNum;
+}

+ 1 - 4
sino-mark-server/src/main/java/cn/sino/mark/common/model/dto/MultipartFileDTO.java

@@ -76,11 +76,8 @@ public class MultipartFileDTO implements MultipartFile, Serializable {
 
     @Override
     public void transferTo(File dest) throws IOException, IllegalStateException {
-        FileOutputStream fileOutputStream = new FileOutputStream(dest);
-        try {
+        try (FileOutputStream fileOutputStream = new FileOutputStream(dest)) {
             fileOutputStream.write(bytes);
-        } finally {
-            fileOutputStream.close();
         }
     }
 

+ 42 - 0
sino-mark-server/src/main/java/cn/sino/mark/common/model/vo/DepartmentTreeVO.java

@@ -0,0 +1,42 @@
+package cn.sino.mark.common.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 部门树结构
+ *
+ * @author zhangamin
+ * @date 2022/9/14
+ */
+@Data
+@ApiModel
+public class DepartmentTreeVO {
+
+    /**
+     * 部门ID
+     */
+    @ApiModelProperty("部门ID")
+    private Long id;
+
+    /**
+     * 部门名称
+     */
+    @ApiModelProperty("部门名称")
+    private String name;
+
+    /**
+     * 部门描述
+     */
+    @ApiModelProperty("部门描述")
+    private String description;
+
+
+    /**
+     * 上级部门ID
+     */
+    @ApiModelProperty("上级部门ID")
+    private Long parentId;
+
+}

+ 0 - 2
sino-mark-server/src/main/java/cn/sino/mark/common/model/vo/InnerLoginUserVO.java

@@ -1,9 +1,7 @@
 package cn.sino.mark.common.model.vo;
 
-import io.swagger.annotations.ApiModel;
 import lombok.AllArgsConstructor;
 import lombok.Data;
-import lombok.RequiredArgsConstructor;
 
 /**
  * @author sch

+ 33 - 0
sino-mark-server/src/main/java/cn/sino/mark/common/model/vo/LabelAllVO.java

@@ -0,0 +1,33 @@
+package cn.sino.mark.common.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @Description 所有标签
+ * @Author sch
+ * @Date 2022/9/9 17:06
+ * @Version 1.0
+ **/
+@ApiModel
+@Data
+public class LabelAllVO {
+    /**
+     * 标签id
+     */
+    @ApiModelProperty("标签id")
+    private Long id;
+
+    /**
+     * 标签名称
+     */
+    @ApiModelProperty("标签名称")
+    private String name;
+
+    /**
+     * 标签所有选项(/分开)
+     */
+    @ApiModelProperty("标签所有选项(/分开)")
+    private String labelItemNames;
+}

+ 47 - 0
sino-mark-server/src/main/java/cn/sino/mark/common/model/vo/LabelInfoVO.java

@@ -0,0 +1,47 @@
+package cn.sino.mark.common.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Description 标签详情
+ * @Author sch
+ * @Date 2022/9/9 15:16
+ * @Version 1.0
+ **/
+@ApiModel
+@Data
+public class LabelInfoVO {
+    /**
+     * 标签id
+     */
+    @ApiModelProperty("标签id")
+    private Long id;
+
+    /**
+     * 标签名称
+     */
+    @ApiModelProperty("标签名称")
+    private String name;
+
+    /**
+     * 可选项
+     */
+    @ApiModelProperty("可选项")
+    private List<String> labelItemNameList;
+
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty("创建时间")
+    private String createTime;
+
+    /**
+     * 创建人
+     */
+    @ApiModelProperty("创建人")
+    private String createName;
+}

+ 47 - 0
sino-mark-server/src/main/java/cn/sino/mark/common/model/vo/LabelPageVO.java

@@ -0,0 +1,47 @@
+package cn.sino.mark.common.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Description 标签分页
+ * @Author sch
+ * @Date 2022/9/9 14:04
+ * @Version 1.0
+ **/
+@ApiModel
+@Data
+public class LabelPageVO {
+    /**
+     * 标签id
+     */
+    @ApiModelProperty("标签id")
+    private Long id;
+
+    /**
+     * 标签名称
+     */
+    @ApiModelProperty("标签名称")
+    private String name;
+
+    /**
+     * 可选项
+     */
+    @ApiModelProperty("可选项")
+    private List<String> labelItemNames;
+
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty("创建时间")
+    private String createTime;
+
+    /**
+     * 创建人
+     */
+    @ApiModelProperty("创建人")
+    private String createName;
+}

+ 6 - 0
sino-mark-server/src/main/java/cn/sino/mark/common/model/vo/UserDetailsVO.java

@@ -38,4 +38,10 @@ public class UserDetailsVO {
      */
     @ApiModelProperty("角色列表")
     private List<Long> roleIds;
+
+    /**
+     * 部门id
+     */
+    @ApiModelProperty("部门id")
+    private Long deptId;
 }

+ 7 - 2
sino-mark-server/src/main/java/cn/sino/mark/common/model/vo/UserPageVO.java

@@ -1,8 +1,7 @@
 package cn.sino.mark.common.model.vo;
 
-import io.swagger.annotations.*;
-import io.swagger.annotations.*;
 import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 /**
@@ -63,4 +62,10 @@ public class UserPageVO {
     @ApiModelProperty("是否超管")
     private Integer isAdmin;
 
+    /**
+     * 部门名称
+     */
+    @ApiModelProperty("部门名称")
+    private String deptName;
+
 }

+ 0 - 169
sino-mark-server/src/main/java/cn/sino/mark/common/source/CardpssResult.java

@@ -1,169 +0,0 @@
-package cn.sino.mark.common.source;
-
-import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.serializer.SerializerFeature;
-import com.alibaba.fastjson.serializer.ValueFilter;
-import com.google.common.base.Strings;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * 服务统一返回值
- *
- * @author Live.InPast
- * @date 2020/11/23
- */
-public class CardpssResult<T> implements Serializable {
-
-    /**
-     * 成功
-     */
-    public static final String SUCCESS = "00";
-
-    /**
-     * 通用失败(业务异常)
-     */
-    public static final String FAIL = "01";
-
-    /**
-     * 需要登录
-     */
-    public static final String NEED_LOGIN = "1001";
-
-    public final static String ERR_OK_MSG = "执行成功";
-    public final static String ERR_FAIL_MSG = "执行失败";
-
-    /**
-     * 最大整数,超过该数前端将丢失精度
-     */
-    private static final Long MAX_VALUE_TO_STRING = 9007199254740992L;
-
-
-    /**
-     * 操作码
-     * 00 代表成功
-     * XX 代表失败
-     */
-    private String errCode;
-
-    /**
-     * 操作说明
-     */
-    private String errMsg;
-
-    /**
-     * 附加数据
-     */
-    private T data;
-
-    private CardpssResult() {
-    }
-
-    private CardpssResult(String errCode) {
-        this.errCode = errCode;
-    }
-
-    /**
-     * 成功
-     *
-     * @return
-     */
-    public static CardpssResult success() {
-        CardpssResult result = new CardpssResult(SUCCESS);
-        result.errMsg = ERR_OK_MSG;
-        return result;
-    }
-
-    /**
-     * 失败
-     *
-     * @return
-     */
-    public static CardpssResult fail() {
-        CardpssResult result = new CardpssResult(FAIL);
-        result.errMsg = ERR_FAIL_MSG;
-        return result;
-    }
-
-    /**
-     * 失败
-     *
-     * @param errCode 失败码
-     * @return
-     */
-    public static CardpssResult fail(String errCode) {
-        CardpssResult result = new CardpssResult(errCode);
-        result.errMsg = ERR_FAIL_MSG;
-        return result;
-    }
-
-
-    /**
-     * 设置返回结果
-     *
-     * @param errMsg 接口错误提示
-     * @return
-     */
-    public CardpssResult msg(String errMsg) {
-        this.errMsg = errMsg;
-        return this;
-    }
-
-    /**
-     * 设置返回数据
-     *
-     * @return
-     */
-    public CardpssResult data(T data) {
-        this.data = data;
-        return this;
-    }
-
-
-    /**
-     * 构建返回值
-     *
-     * @return
-     */
-    public String build() {
-        if (Strings.isNullOrEmpty(this.errCode)) {
-            this.errCode = FAIL;
-            this.errMsg = ERR_FAIL_MSG;
-        }
-        return JSONObject.toJSONString(this, (ValueFilter) (object, name, value) -> {
-                    if (value instanceof Long &&
-                            ((Long) value).longValue() > MAX_VALUE_TO_STRING) {
-                        return value.toString();
-                    }
-                    if (value instanceof List) {
-                        return ((List) value).stream().map(val -> {
-                            if (val instanceof Long &&
-                                    ((Long) value).longValue() > MAX_VALUE_TO_STRING) {
-                                return val.toString();
-                            }
-                            return val;
-                        }).collect(Collectors.toList());
-                    }
-
-                    return value;
-                }, SerializerFeature.WriteMapNullValue,
-                SerializerFeature.WriteNullListAsEmpty,
-                SerializerFeature.WriteNullStringAsEmpty);
-    }
-
-
-    public String getErrCode() {
-        return errCode;
-    }
-
-    public String getErrMsg() {
-        return errMsg;
-    }
-
-    public T getData() {
-        return data;
-    }
-
-}

+ 4 - 0
sino-mark-server/src/main/java/cn/sino/mark/common/utils/ListsUtil.java

@@ -1,5 +1,8 @@
 package cn.sino.mark.common.utils;
 
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
 import java.util.List;
 import java.util.function.Consumer;
 import java.util.function.Function;
@@ -12,6 +15,7 @@ import java.util.stream.Stream;
  * @author Live.InPast
  * @date 2021/12/31
  */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
 public class ListsUtil {
 
     /**

+ 3 - 0
sino-mark-server/src/main/java/cn/sino/mark/common/utils/LoginUserUtil.java

@@ -3,6 +3,8 @@ package cn.sino.mark.common.utils;
 
 import cn.sino.mark.common.constants.Constant;
 import cn.sino.mark.common.model.dto.LoginUserDTO;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 import org.springframework.security.authentication.AnonymousAuthenticationToken;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
@@ -14,6 +16,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
  * @description 从Spring Security的Context获取登录的用户信息
  * @date 2021/12/22
  */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
 public class LoginUserUtil {
 
     /**

+ 1 - 3
sino-mark-server/src/main/java/cn/sino/mark/controller/web/CategoryController.java

@@ -1,7 +1,5 @@
 package cn.sino.mark.controller.web;
 
-import cn.hutool.json.JSONArray;
-import cn.hutool.json.JSONUtil;
 import cn.sino.common.exception.BizException;
 import cn.sino.common.vo.RestResponseVO;
 import cn.sino.mark.common.model.dto.AddCategoryDTO;
@@ -43,7 +41,7 @@ public class CategoryController {
 
     @ApiOperation("获取分类树快照")
     @GetMapping("/tree-snapshot/{taskId}")
-    public RestResponseVO<List<Object>> treeSnapshot(@PathVariable("taskId")Long taskId) {
+    public RestResponseVO<List<Object>> treeSnapshot(@PathVariable("taskId") Long taskId) {
         return RestResponseVO.success(categoryService.treeSnapshot(taskId));
     }
 

+ 78 - 0
sino-mark-server/src/main/java/cn/sino/mark/controller/web/LabelController.java

@@ -0,0 +1,78 @@
+package cn.sino.mark.controller.web;
+
+import cn.sino.common.base.PageResult;
+import cn.sino.common.vo.RestResponseVO;
+import cn.sino.mark.common.model.dto.AddLabelDTO;
+import cn.sino.mark.common.model.dto.EditLabelDTO;
+import cn.sino.mark.common.model.dto.LabelPageDTO;
+import cn.sino.mark.common.model.vo.LabelAllVO;
+import cn.sino.mark.common.model.vo.LabelInfoVO;
+import cn.sino.mark.common.model.vo.LabelPageVO;
+import cn.sino.mark.service.LabelService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ * @Description 标签接口
+ * @Author sch
+ * @Date 2022/9/8 14:03
+ **/
+@Api(tags = "标签接口")
+@RestController
+@RequestMapping("/label")
+@RequiredArgsConstructor
+public class LabelController {
+    
+    private final LabelService labelService;
+
+    @ApiOperation("添加标签")
+    @PostMapping("/add")
+    @PreAuthorize("hasPermission('add-label')")
+    public RestResponseVO<Void> add(@Valid @RequestBody AddLabelDTO reqDTO) {
+        labelService.addLabel(reqDTO);
+        return RestResponseVO.success();
+    }
+
+    @ApiOperation("编辑标签")
+    @PutMapping("/edit")
+    @PreAuthorize("hasPermission('edit-label')")
+    public RestResponseVO<Void> edit(@Valid @RequestBody EditLabelDTO reqDTO) {
+        labelService.editLabel(reqDTO);
+        return RestResponseVO.success();
+    }
+
+    @ApiOperation("删除标签")
+    @ApiImplicitParam(name = "id", value = "标签id", paramType = "path", dataTypeClass = Long.class, required = true)
+    @DeleteMapping("/delete/{id}")
+    @PreAuthorize("hasPermission('delete-label')")
+    public RestResponseVO<Void> delete(@PathVariable("id") Long id) {
+        labelService.delete(id);
+        return RestResponseVO.success();
+    }
+
+    @ApiOperation("分页查询标签")
+    @PostMapping("/page")
+    public RestResponseVO<PageResult<LabelPageVO>> getPage(@RequestBody LabelPageDTO reqDTO) {
+        return RestResponseVO.success(labelService.getPage(reqDTO));
+    }
+
+    @ApiOperation("查询标签详情")
+    @ApiImplicitParam(name = "id", value = "标签id", paramType = "path", dataTypeClass = Long.class, required = true)
+    @GetMapping("/info/{id}")
+    public RestResponseVO<LabelInfoVO> selectInfo(@PathVariable("id") Long id) {
+        return RestResponseVO.success(labelService.selectInfo(id));
+    }
+
+    @ApiOperation("查询所有标签")
+    @GetMapping("/get-all")
+    public RestResponseVO<List<LabelAllVO>> selectInfo() {
+        return RestResponseVO.success(labelService.selectAll());
+    }
+}

+ 0 - 1
sino-mark-server/src/main/java/cn/sino/mark/controller/web/ProjectGroupController.java

@@ -4,7 +4,6 @@ import cn.sino.common.exception.BizException;
 import cn.sino.common.vo.RestResponseVO;
 import cn.sino.mark.common.model.dto.AddProjectGroupDTO;
 import cn.sino.mark.common.model.dto.ModifyProjectGroupDTO;
-import cn.sino.mark.common.model.vo.CategoryTreeVo;
 import cn.sino.mark.common.model.vo.ProjectGroupTreeVO;
 import cn.sino.mark.service.ProjectGroupService;
 import io.swagger.annotations.Api;

+ 6 - 0
sino-mark-server/src/main/java/cn/sino/mark/controller/web/SysUserController.java

@@ -126,4 +126,10 @@ public class SysUserController {
         return RestResponseVO.success(userService.innerLogin(request));
     }
 
+    @ApiOperation("查询所有内部部门")
+    @GetMapping("/inner/departments")
+    public RestResponseVO<List<DepartmentTreeVO>> allDeptNotTree() {
+        return RestResponseVO.success(userService.getAllDeptNotTree());
+    }
+
 }

+ 24 - 0
sino-mark-server/src/main/java/cn/sino/mark/dao/mapper/LabelItemMapper.java

@@ -0,0 +1,24 @@
+package cn.sino.mark.dao.mapper;
+
+import cn.sino.mark.dao.model.LabelItemDO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+import java.util.List;
+
+/**
+ * 针对表【label_item(标签选项表)】的数据库操作Mapper
+ *
+ * @author zhangamin
+ * @date 2022/8/14
+ */
+public interface LabelItemMapper extends BaseMapper<LabelItemDO> {
+    /**
+     * 批量插入标签选项
+     * @param list
+     */
+    void insertBatch(List<LabelItemDO> list);
+}
+
+
+
+

+ 41 - 0
sino-mark-server/src/main/java/cn/sino/mark/dao/mapper/LabelMapper.java

@@ -0,0 +1,41 @@
+package cn.sino.mark.dao.mapper;
+
+import cn.sino.mark.common.model.bo.LabelBO;
+import cn.sino.mark.common.model.dto.LabelPageDTO;
+import cn.sino.mark.dao.model.LabelDO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.github.pagehelper.Page;
+
+import java.util.List;
+
+/**
+ * 针对表【label(标签表)】的数据库操作Mapper
+ *
+ * @author zhangamin
+ * @date 2022/8/14
+ */
+public interface LabelMapper extends BaseMapper<LabelDO> {
+    /**
+     * 分页查询标签
+     * @param reqDTO 查询参数
+     * @return 分页信息
+     */
+    Page<LabelBO> selectLabelPage(LabelPageDTO reqDTO);
+
+    /**
+     * 查询标签详细信息
+     * @param id 标签id
+     * @return 标签信息
+     */
+    LabelBO selectInfoById(Long id);
+
+    /**
+     * 查询所有标签
+     * @return 标签信息
+     */
+    List<LabelBO> selectAll();
+}
+
+
+
+

+ 25 - 0
sino-mark-server/src/main/java/cn/sino/mark/dao/mapper/SysDeptMapper.java

@@ -0,0 +1,25 @@
+package cn.sino.mark.dao.mapper;
+
+
+import cn.sino.mark.dao.model.SysDeptDO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+import java.util.List;
+
+/**
+ * 部门相关数据操作层
+ *
+ * @author Live.InPast
+ * @date 2022/9/14
+ */
+public interface SysDeptMapper extends BaseMapper<SysDeptDO> {
+
+    /**
+     * 查询所有部门,不是树结构(数据权限展示专用)
+     *
+     * @return 部门列表
+     */
+    List<SysDeptDO> selectAllNotTree();
+
+
+}

+ 34 - 0
sino-mark-server/src/main/java/cn/sino/mark/dao/model/LabelDO.java

@@ -0,0 +1,34 @@
+package cn.sino.mark.dao.model;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.*;
+import lombok.experimental.SuperBuilder;
+
+import java.io.Serializable;
+
+/**
+ * 标签表
+ *
+ * @author zhangamin
+ * @date 2022/8/14
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@SuperBuilder
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName(value = "t_label")
+public class LabelDO extends BaseDO implements Serializable {
+
+    /**
+     * PK
+     */
+    @TableId(type = IdType.ASSIGN_ID)
+    private Long id;
+
+    /**
+     * 标签名称
+     */
+    private String name;
+
+}

+ 51 - 0
sino-mark-server/src/main/java/cn/sino/mark/dao/model/LabelItemDO.java

@@ -0,0 +1,51 @@
+package cn.sino.mark.dao.model;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.time.LocalDateTime;
+
+/**
+ * 标签选项表
+ *
+ * @author zhangamin
+ * @date 2022/8/14
+ */
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName(value = "t_label_item")
+public class LabelItemDO {
+
+    /**
+     * PK
+     */
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 标签ID
+     */
+    private Long labelId;
+
+    /**
+     * 标签选项名称
+     */
+    private String name;
+
+    /**
+     * 排序(时间戳)
+     */
+    private Long sort;
+
+    /**
+     * 创建时间
+     */
+    @TableField(fill = FieldFill.INSERT)
+    private LocalDateTime createTime;
+
+}

+ 85 - 0
sino-mark-server/src/main/java/cn/sino/mark/dao/model/SysDeptDO.java

@@ -0,0 +1,85 @@
+package cn.sino.mark.dao.model;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.time.LocalDateTime;
+
+/**
+ * 系统部门表
+ *
+ * @author zhangamin
+ * @date 2022/8/10
+ */
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName(value = "t_sys_dept")
+public class SysDeptDO {
+
+    /**
+     * PK
+     */
+    @TableId(value = "id", type = IdType.ASSIGN_ID)
+    private Long id;
+
+    /**
+     * 部门名称
+     */
+    private String name;
+
+    /**
+     * 部门描述
+     */
+    private String description;
+
+    /**
+     * 上级部门ID
+     */
+    private Long parentId;
+
+    /**
+     * 排序
+     */
+    private Long sort;
+
+    /**
+     * 部门层级
+     */
+    private Integer level;
+
+    /**
+     * 逻辑删除标识(0:正常;1:已删除)
+     */
+    @TableLogic
+    @TableField(fill = FieldFill.INSERT)
+    private Integer isDelete;
+
+    /**
+     * 创建人
+     */
+    @TableField(fill = FieldFill.INSERT)
+    private Long createBy;
+
+    /**
+     * 创建时间
+     */
+    @TableField(fill = FieldFill.INSERT)
+    private LocalDateTime createTime;
+
+    /**
+     * 更新人
+     */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Long updateBy;
+
+    /**
+     * 更新时间
+     */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private LocalDateTime updateTime;
+}

+ 11 - 3
sino-mark-server/src/main/java/cn/sino/mark/dao/model/SysUserDO.java

@@ -4,12 +4,14 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.experimental.SuperBuilder;
 
 import java.io.Serializable;
 
-import lombok.*;
-import lombok.experimental.SuperBuilder;
-
 
 /**
  * @author zhangamin
@@ -69,4 +71,10 @@ public class SysUserDO extends BaseDO implements Serializable {
     @TableField(value = "user_type")
     private Integer userType;
 
+    /**
+     * 部门ID
+     */
+    @TableField(value = "dept_id")
+    private Long deptId;
+
 }

+ 171 - 0
sino-mark-server/src/main/java/cn/sino/mark/manager/LabelManager.java

@@ -0,0 +1,171 @@
+package cn.sino.mark.manager;
+
+import cn.sino.common.exception.BizException;
+import cn.sino.mark.common.model.bo.LabelBO;
+import cn.sino.mark.common.model.dto.LabelPageDTO;
+import cn.sino.mark.dao.mapper.LabelItemMapper;
+import cn.sino.mark.dao.mapper.LabelMapper;
+import cn.sino.mark.dao.model.LabelDO;
+import cn.sino.mark.dao.model.LabelItemDO;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.github.pagehelper.Page;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 标签管理层实现
+ *
+ * @author zhangamin
+ * @version 2.0 2022/8/15:添加标签相关功能(lgw)
+ * @date 2022/8/8
+ */
+@Component
+@RequiredArgsConstructor
+public class LabelManager {
+
+    private final LabelMapper labelMapper;
+    private final LabelItemMapper labelItemMapper;
+
+
+    /**
+     * 获取页面
+     *
+     * @param reqDTO 请求传输对象
+     * @return {@link Page}<{@link LabelBO}>
+     */
+    public Page<LabelBO> getPage(LabelPageDTO reqDTO) {
+        return labelMapper.selectLabelPage(reqDTO);
+    }
+
+
+    /**
+     * 获取所有
+     *
+     * @return {@link List}<{@link LabelBO}>
+     */
+    public List<LabelBO> getAll() {
+        return labelMapper.selectAll();
+    }
+
+    /**
+     * 添加标签
+     *
+     * @param name           标签名称
+     * @param labelItemNames 标签可选项
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public LabelDO add(String name, List<String> labelItemNames) {
+        LabelDO label = LabelDO.builder().name(name).build();
+        labelMapper.insert(label);
+        addLabelItem(label.getId(), labelItemNames);
+        return label;
+    }
+
+    /**
+     * 编辑标签
+     *
+     * @param label          标签
+     * @param labelItemNames 标签可选项
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public void edit(LabelDO label, List<String> labelItemNames) {
+        labelMapper.updateById(label);
+        deleteLabelItemByLabelId(label.getId());
+        addLabelItem(label.getId(), labelItemNames);
+    }
+
+    /**
+     * 标签可选项添加
+     *
+     * @param labelId        标签
+     * @param labelItemNames 标签可选项
+     */
+    public void addLabelItem(Long labelId, List<String> labelItemNames) {
+        List<LabelItemDO> labelItemList = labelItemNames.stream().map(labelItemName ->
+                LabelItemDO.builder().labelId(labelId).name(labelItemName).sort(System.currentTimeMillis()).build()
+        ).collect(Collectors.toList());
+        labelItemMapper.insertBatch(labelItemList);
+    }
+
+    /**
+     * 标签删除
+     *
+     * @param labelId 标签id
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public void deleteById(Long labelId) {
+        LabelDO label = checkById(labelId);
+        int count = labelMapper.deleteById(label.getId());
+        if (count == 0) {
+            throw new BizException("标签删除失败");
+        }
+        deleteLabelItemByLabelId(label.getId());
+    }
+
+    /**
+     * 标签可选项删除
+     *
+     * @param labelId 标签id
+     */
+    public void deleteLabelItemByLabelId(Long labelId) {
+        QueryWrapper<LabelItemDO> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("label_id", labelId);
+        labelItemMapper.delete(queryWrapper);
+    }
+
+    /**
+     * 根据标签id,校验标签是否存在
+     *
+     * @param id 标签id
+     * @return 标签信息
+     */
+    public LabelDO checkById(Long id) {
+        LabelDO label = labelMapper.selectById(id);
+        if (label == null) {
+            throw new BizException("当前标签不存在");
+        }
+        return label;
+    }
+
+    /**
+     * 根据标签名称查询标签信息
+     *
+     * @param name 标签名称
+     * @return 标签信息
+     */
+    public LabelDO getByName(String name) {
+        QueryWrapper<LabelDO> wrapper = new QueryWrapper<>();
+        wrapper.eq("name", name);
+        return labelMapper.selectOne(wrapper);
+    }
+
+    /**
+     * 获取标签业务对象
+     *
+     * @param labelId 标签ID
+     * @return 标签
+     */
+    public LabelBO getLabelBoById(Long labelId) {
+        LabelBO labelBO = labelMapper.selectInfoById(labelId);
+        if (labelBO == null) {
+            throw new BizException("标签不存在或已删除!");
+        }
+        return labelBO;
+    }
+
+    /**
+     * 获取标签选项
+     *
+     * @param labelId 标签ID
+     * @return 选项列表
+     */
+    public List<LabelItemDO> getItemsByLabelId(Long labelId) {
+        QueryWrapper<LabelItemDO> wrapper = new QueryWrapper<>();
+        wrapper.eq("label_id", labelId);
+        return labelItemMapper.selectList(wrapper);
+    }
+}

+ 0 - 2
sino-mark-server/src/main/java/cn/sino/mark/manager/ResourceManager.java

@@ -12,9 +12,7 @@ import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Component;
 
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import static cn.hutool.core.collection.CollUtil.isEmpty;
 import static cn.hutool.core.collection.CollUtil.isNotEmpty;

+ 12 - 8
sino-mark-server/src/main/java/cn/sino/mark/manager/SysUserManager.java

@@ -3,14 +3,8 @@ package cn.sino.mark.manager;
 import cn.sino.mark.common.constants.Constant;
 import cn.sino.mark.common.model.bo.SysUserBO;
 import cn.sino.mark.common.model.dto.QueryUserPageDTO;
-import cn.sino.mark.dao.mapper.SysPermMapper;
-import cn.sino.mark.dao.mapper.SysRoleMapper;
-import cn.sino.mark.dao.mapper.SysUserMapper;
-import cn.sino.mark.dao.mapper.SysUserRoleMapper;
-import cn.sino.mark.dao.model.SysPermDO;
-import cn.sino.mark.dao.model.SysRoleDO;
-import cn.sino.mark.dao.model.SysUserDO;
-import cn.sino.mark.dao.model.SysUserRoleDO;
+import cn.sino.mark.dao.mapper.*;
+import cn.sino.mark.dao.model.*;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.pagehelper.Page;
 import lombok.RequiredArgsConstructor;
@@ -37,6 +31,7 @@ public class SysUserManager {
     private final SysRoleMapper sysRoleMapper;
     private final SysPermMapper sysPermMapper;
     private final SysUserRoleMapper userRoleMapper;
+    private final SysDeptMapper sysDeptMapper;
 
 
     /**
@@ -187,4 +182,13 @@ public class SysUserManager {
         params.put("user_id", userId);
         userRoleMapper.deleteByMap(params);
     }
+
+    /**
+     * 获取所有部门
+     *
+     * @return {@link List}<{@link SysDeptDO}>
+     */
+    public List<SysDeptDO> getAllDepts() {
+        return sysDeptMapper.selectAllNotTree();
+    }
 }

+ 64 - 0
sino-mark-server/src/main/java/cn/sino/mark/service/LabelService.java

@@ -0,0 +1,64 @@
+package cn.sino.mark.service;
+
+import cn.sino.common.base.PageResult;
+import cn.sino.mark.common.model.dto.AddLabelDTO;
+import cn.sino.mark.common.model.dto.EditLabelDTO;
+import cn.sino.mark.common.model.dto.LabelPageDTO;
+import cn.sino.mark.common.model.vo.LabelAllVO;
+import cn.sino.mark.common.model.vo.LabelInfoVO;
+import cn.sino.mark.common.model.vo.LabelPageVO;
+
+import java.util.List;
+
+/**
+ * 标签业务接口
+ *
+ * @author zhangamin
+ * @date 2022/8/14
+ */
+public interface LabelService {
+
+    /**
+     * 添加标签
+     *
+     * @param reqDTO 添加参数
+     */
+    void addLabel(AddLabelDTO reqDTO);
+
+    /**
+     * 编辑标签
+     *
+     * @param reqDTO 编辑参数
+     */
+    void editLabel(EditLabelDTO reqDTO);
+
+    /**
+     * 删除标签
+     *
+     * @param id 标签id
+     */
+    void delete(Long id);
+
+    /**
+     * 分页查询
+     *
+     * @param reqDTO 参数
+     * @return 返回信息
+     */
+    PageResult<LabelPageVO> getPage(LabelPageDTO reqDTO);
+
+    /**
+     * 查询标签详情
+     *
+     * @param id 标签id
+     * @return 标签信息
+     */
+    LabelInfoVO selectInfo(Long id);
+
+    /**
+     * 查询所以标签
+     *
+     * @return 标签信息
+     */
+    List<LabelAllVO> selectAll();
+}

+ 1 - 0
sino-mark-server/src/main/java/cn/sino/mark/service/ResourceService.java

@@ -78,6 +78,7 @@ public interface ResourceService {
      *
      * @param uploadFile 文件
      * @param resourceId 资源id
+     * @return {@link ImportResourceVO}
      */
     ImportResourceVO analyseResourceV2(MultipartFile uploadFile, Long resourceId);
 

+ 7 - 0
sino-mark-server/src/main/java/cn/sino/mark/service/SysUserService.java

@@ -117,4 +117,11 @@ public interface SysUserService {
      * @return String
      */
     String innerLogin(HttpServletRequest request);
+
+    /**
+     * 查询所有内部部门
+     *
+     * @return 部门列表
+     */
+    List<DepartmentTreeVO> getAllDeptNotTree();
 }

+ 64 - 0
sino-mark-server/src/main/java/cn/sino/mark/service/convert/LabelMapStruct.java

@@ -0,0 +1,64 @@
+package cn.sino.mark.service.convert;
+
+import cn.sino.mark.common.model.bo.LabelBO;
+import cn.sino.mark.common.model.vo.LabelAllVO;
+import cn.sino.mark.common.model.vo.LabelInfoVO;
+import cn.sino.mark.common.model.vo.LabelPageVO;
+import cn.sino.mark.dao.model.LabelItemDO;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.Named;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 标签实体转换
+ *
+ * @author zhangamin
+ * @date 2022/8/14
+ */
+@Mapper(componentModel = "spring")
+public interface LabelMapStruct {
+
+    /**
+     * LabelBO 转 LabelPageResDTO
+     *
+     * @param labelBo {@link LabelBO}
+     * @return {@link LabelPageVO}
+     */
+    @Mapping(target = "labelItemNames", qualifiedByName = "stringToList")
+    @Mapping(target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss")
+    LabelPageVO convertToLabelPageVO(LabelBO labelBo);
+
+    /**
+     * LabelBO 转 LabelInfoResDTO
+     *
+     * @param labelBo {@link LabelBO}
+     * @return {@link LabelInfoVO}
+     */
+    @Mapping(source = "labelItems", target = "labelItemNameList", qualifiedByName = "listToList")
+    @Mapping(target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss")
+    LabelInfoVO convertToLabelInfoVO(LabelBO labelBo);
+
+    /**
+     * labelBo 转 LabelAllResDTO
+     *
+     * @param labelBo {@link LabelBO}
+     * @return {@link LabelAllVO}
+     */
+    LabelAllVO convertToLabelAllResDTO(LabelBO labelBo);
+
+    @Named("listToList")
+    default List<String> listToList(List<LabelItemDO> labelItems) {
+        return labelItems.stream().map(LabelItemDO::getName).collect(Collectors.toList());
+    }
+
+    @Named("stringToList")
+    default List<String> stringToList(String labelItemNames) {
+        return Arrays.asList(labelItemNames.split(","));
+    }
+
+
+}

+ 10 - 0
sino-mark-server/src/main/java/cn/sino/mark/service/convert/SysUserMapStruct.java

@@ -3,9 +3,11 @@ package cn.sino.mark.service.convert;
 import cn.sino.mark.common.config.security.SysUserDetails;
 import cn.sino.mark.common.model.bo.SysUserBO;
 import cn.sino.mark.common.model.dto.LoginUserDTO;
+import cn.sino.mark.common.model.vo.DepartmentTreeVO;
 import cn.sino.mark.common.model.vo.LoginUserInfoVO;
 import cn.sino.mark.common.model.vo.UserDetailsVO;
 import cn.sino.mark.common.model.vo.UserPageVO;
+import cn.sino.mark.dao.model.SysDeptDO;
 import cn.sino.mark.dao.model.SysUserDO;
 import com.github.pagehelper.Page;
 import org.mapstruct.Mapper;
@@ -65,4 +67,12 @@ public interface SysUserMapStruct {
     UserPageVO convertToUserPageVO(SysUserBO sysUserBO);
 
     LoginUserInfoVO convertToLoginUserVO(SysUserDO sysUser);
+
+    /**
+     * SysDept 转 DepartmentTreeVO
+     *
+     * @param sysDept {@link SysDeptDO}
+     * @return {@link DepartmentTreeVO}
+     */
+    DepartmentTreeVO convertToDepartmentTreeVO(SysDeptDO sysDept);
 }

+ 122 - 0
sino-mark-server/src/main/java/cn/sino/mark/service/impl/LabelServiceImpl.java

@@ -0,0 +1,122 @@
+package cn.sino.mark.service.impl;
+
+import cn.sino.common.base.PageResult;
+import cn.sino.common.exception.BizException;
+import cn.sino.mark.common.constants.Constant;
+import cn.sino.mark.common.log.Log;
+import cn.sino.mark.common.log.SysLogEventPublisher;
+import cn.sino.mark.common.model.bo.LabelBO;
+import cn.sino.mark.common.model.dto.AddLabelDTO;
+import cn.sino.mark.common.model.dto.EditLabelDTO;
+import cn.sino.mark.common.model.dto.LabelPageDTO;
+import cn.sino.mark.common.model.vo.LabelAllVO;
+import cn.sino.mark.common.model.vo.LabelInfoVO;
+import cn.sino.mark.common.model.vo.LabelPageVO;
+import cn.sino.mark.dao.model.LabelDO;
+import cn.sino.mark.manager.LabelManager;
+import cn.sino.mark.service.LabelService;
+import cn.sino.mark.service.convert.LabelMapStruct;
+import com.github.pagehelper.Page;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import static com.github.pagehelper.page.PageMethod.startPage;
+
+/**
+ * 标签业务接口实现
+ *
+ * @author zhangamin
+ * @date 2022/8/14
+ */
+@Service
+@RequiredArgsConstructor
+public class LabelServiceImpl implements LabelService {
+
+    private final LabelManager labelManager;
+    private final LabelMapStruct labelMapStruct;
+
+    /**
+     * 日志
+     */
+    private final SysLogEventPublisher logEventPublisher;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void addLabel(AddLabelDTO reqDTO) {
+        if (labelManager.getByName(reqDTO.getName()) != null) {
+            throw new BizException("标签名称已经存在");
+        }
+        checkLabelItem(reqDTO.getLabelItemNames());
+        LabelDO label = labelManager.add(reqDTO.getName(), reqDTO.getLabelItemNames());
+
+        // 系统日志
+        logEventPublisher.publish(Log.builder().append("添加标签,名称:" + reqDTO.getName() + ",ID:" + label).isInsert());
+    }
+
+    @Override
+    public void editLabel(EditLabelDTO reqDTO) {
+        LabelDO label = labelManager.checkById(reqDTO.getId());
+        LabelDO checkLabel = labelManager.getByName(reqDTO.getName());
+        //校验标签可选项是否重复
+        if (checkLabel != null && !checkLabel.getId().equals(label.getId())) {
+            throw new BizException("标签名称已经存在");
+        }
+        checkLabelItem(reqDTO.getLabelItemNames());
+        label.setName(reqDTO.getName());
+        labelManager.edit(label, reqDTO.getLabelItemNames());
+        // 系统日志
+        logEventPublisher.publish(Log.builder().append("编辑标签,名称:" + reqDTO.getName() + ",ID:" + label).isUpdate());
+    }
+
+    @Override
+    public void delete(Long id) {
+        labelManager.deleteById(id);
+        // 系统日志
+        logEventPublisher.publish(Log.builder().append("删除标签,ID:" + id).isDelete());
+    }
+
+    @Override
+    public PageResult<LabelPageVO> getPage(LabelPageDTO reqDTO) {
+        startPage(reqDTO.getPageNum(), Constant.DEFAULT_PAGE_SIZE);
+        Page<LabelBO> labelBOS = labelManager.getPage(reqDTO);
+        Page<LabelPageVO> page = new Page<>();
+        labelBOS.forEach(labelBO -> page.add(labelMapStruct.convertToLabelPageVO(labelBO)));
+        return PageResult.of(labelBOS.getTotal(), page);
+    }
+
+    @Override
+    public LabelInfoVO selectInfo(Long id) {
+        labelManager.checkById(id);
+        LabelBO labelBO = labelManager.getLabelBoById(id);
+        return labelMapStruct.convertToLabelInfoVO(labelBO);
+    }
+
+    @Override
+    public List<LabelAllVO> selectAll() {
+        List<LabelBO> labelBOS = labelManager.getAll();
+        return labelBOS.stream().map(labelMapStruct::convertToLabelAllResDTO).collect(Collectors.toList());
+    }
+
+    /**
+     * 校验标签可选项是否重复
+     *
+     * @param labelItemNames 标签可选项
+     */
+    private void checkLabelItem(List<String> labelItemNames) {
+        //校验标签可选项名称重复
+        Set<String> checkNames = new HashSet<>(labelItemNames);
+        if (labelItemNames.size() != checkNames.size()) {
+            throw new BizException("标签可选项存在重复的名称");
+        }
+    }
+}
+
+
+
+

+ 151 - 85
sino-mark-server/src/main/java/cn/sino/mark/service/impl/ResourceServiceImpl.java

@@ -7,10 +7,14 @@ import cn.sino.common.base.PageResult;
 import cn.sino.common.exception.BizException;
 import cn.sino.common.util.SnowflakeIdFactory;
 import cn.sino.mark.common.constants.Constant;
-import cn.sino.mark.common.enums.*;
+import cn.sino.mark.common.enums.IsOrNotEnum;
+import cn.sino.mark.common.enums.ResourceAssignStatusEnum;
+import cn.sino.mark.common.enums.ResourceTypeEnum;
+import cn.sino.mark.common.enums.SysUserStatusEnum;
 import cn.sino.mark.common.log.Log;
 import cn.sino.mark.common.log.SysLogEventPublisher;
 import cn.sino.mark.common.model.bo.ResourceBO;
+import cn.sino.mark.common.model.bo.ResourceDataBO;
 import cn.sino.mark.common.model.dto.AddResourceDTO;
 import cn.sino.mark.common.model.dto.ImportResourceDTO;
 import cn.sino.mark.common.model.dto.QueryResourceDTO;
@@ -28,13 +32,24 @@ import cn.sino.mark.service.convert.ResourceMapStruct;
 import com.github.pagehelper.Page;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.xssf.usermodel.XSSFCell;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
 import java.time.LocalDateTime;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
@@ -142,12 +157,6 @@ public class ResourceServiceImpl implements ResourceService {
                     log.error("json解析失败: ", jsonException);
                 }
             }
-
-//            BufferedWriter out = new BufferedWriter(new FileWriter("E://Java//movie10w.txt"));
-//            for (int i = 0; i < 100000; i++) {
-//                out.write("{\"data\":{\"movsource\"   :\"http://media.meetsocial.cn/video%2Fvideo_46da6b590867b54be06cc087301ef7dc.mp4\",\"hint\":\"这是一段注释或参考文本内容\"}}}");
-//                out.newLine();
-//            }
         } catch (Exception e) {
             log.error(e.getMessage());
         } finally {
@@ -185,86 +194,23 @@ public class ResourceServiceImpl implements ResourceService {
         }
         resourceManager.deleteDataByResourceId(resourceId);
         Integer type = resourceDO.getType();
-        log.info("开始解析资源...");
-        String suffix = "." + getUploadSuffix(Objects.requireNonNull(uploadFile.getOriginalFilename()));
-        if (!isJson(suffix)) {
-            throw new BizException("只能上传json或txt后缀的文本文件");
-        }
-        List<String> effectiveJsonList = new ArrayList<>();
-        BufferedReader br = null;
-        List<ResourceDataDO> resourceDataDOS = new ArrayList<>();
-        LocalDateTime now = LocalDateTime.now();
-        int totalCount = 0;
-        try {
-            InputStreamReader read = new InputStreamReader(new ByteArrayInputStream(uploadFile.getBytes()));
-            br = new BufferedReader(read);//BufferedReader读取文件
-            String s;
-            while ((s = br.readLine()) != null) {
-                ResourceDataDO dataDO = new ResourceDataDO();
-                dataDO.setResourceId(resourceId);
-                dataDO.setDataId(snowflakeIdFactory.nextId());
-                dataDO.setCreateTime(now);
-                dataDO.setIsDraft(IsOrNotEnum.IS.getValue());
-                totalCount++;
-                try {
-                    Map map = (Map) JSONUtil.parse(s.trim());
-                    Map dataMap = (Map) map.get("data");
-                    if (dataMap != null) {
-                        Object hint = dataMap.get("hint");
-                        if (hint != null) {
-                            dataDO.setHint(hint.toString().trim());
-                        }
-                        if (ResourceTypeEnum.DOC.getValue().equals(type)) {
-                            Object txtSource = dataMap.get("txtsource");
-                            if (txtSource != null) {
-                                effectiveJsonList.add(s.trim());
-                                dataDO.setContent(txtSource.toString().trim());
-                            }
-                        } else if (ResourceTypeEnum.PICTURE.getValue().equals(type)) {
-                            Object picSource = dataMap.get("picsource");
-                            if (picSource != null) {
-                                effectiveJsonList.add(s.trim());
-                                dataDO.setPicUrl(picSource.toString().trim());
-                            }
-                        } else {
-                            Object movSource = dataMap.get("movsource");
-                            if (movSource != null) {
-                                effectiveJsonList.add(s.trim());
-                                dataDO.setMovUrl(movSource.toString().trim());
-                            }
-                        }
-                    }
-                    resourceDataDOS.add(dataDO);
-                } catch (JSONException jsonException) {
-                    //解析失败不用理会
-                    log.error("json解析失败: ", jsonException);
-                }
-            }
 
-//            BufferedWriter out = new BufferedWriter(new FileWriter("E://Java//movie10w.txt"));
-//            for (int i = 0; i < 100000; i++) {
-//                out.write("{\"data\":{\"movsource\"   :\"http://media.meetsocial.cn/video%2Fvideo_46da6b590867b54be06cc087301ef7dc.mp4\",\"hint\":\"这是一段注释或参考文本内容\"}}}");
-//                out.newLine();
-//            }
-        } catch (Exception e) {
-            log.error(e.getMessage());
-        } finally {
-            if (br != null) {
-                try {
-                    br.close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
+        List<ResourceDataBO> resourceDataList;
+        if (type.equals(ResourceTypeEnum.LINK.getValue())) {
+            resourceDataList = parseExcelContent(uploadFile, resourceId, type);
+        } else {
+            resourceDataList = parseJsonContent(uploadFile, resourceId, type);
         }
-        if (isNotEmpty(resourceDataDOS)) {
-            ListsUtil.splitRun(resourceDataDOS, 5000, resourceManager::insertBatch);
-            logEventPublisher.publish(Log.builder().append("上传资源数据,ID:" + resourceId + ",数据量:" + resourceDataDOS.size()).isInsert());
+        List<ResourceDataDO> resourceDataDOList = resourceDataList.stream()
+                .filter(ResourceDataBO::getIsValid).map(ResourceDataBO::getResourceData).collect(Collectors.toList());
+        if (isNotEmpty(resourceDataDOList)) {
+            ListsUtil.splitRun(resourceDataDOList, 5000, resourceManager::insertBatch);
+            logEventPublisher.publish(Log.builder().append("上传资源数据,ID:" + resourceId + ",数据量:" + resourceDataDOList.size()).isInsert());
         }
 
         ImportResourceVO importResourceVO = new ImportResourceVO();
-        importResourceVO.setResourceCount(resourceDataDOS.size());
-        importResourceVO.setFailedCount(totalCount - resourceDataDOS.size());
+        importResourceVO.setResourceCount(resourceDataDOList.size());
+        importResourceVO.setFailedCount(resourceDataList.size() - resourceDataDOList.size());
         log.info("资源解析结束,耗时: {}ms", (System.currentTimeMillis() - start));
         return importResourceVO;
     }
@@ -373,6 +319,7 @@ public class ResourceServiceImpl implements ResourceService {
      */
     @Override
     public PageResult<ResourcePageItemVO> getResourcePage(QueryResourceDTO queryResourceDTO) {
+        // 查询当前用户信息
         startPage(queryResourceDTO.getPageNum(), queryResourceDTO.getPageSize());
         Page<ResourceBO> resourceBOS = resourceManager.queryResourcePage(queryResourceDTO);
         Page<ResourcePageItemVO> page = new Page<>();
@@ -479,10 +426,129 @@ public class ResourceServiceImpl implements ResourceService {
      * @param suffix 后缀
      * @return boolean
      */
-    public static boolean isJson(String suffix) {
+    private boolean isJson(String suffix) {
         Pattern p = Pattern.compile("\\.(json|txt)");
         Matcher m = p.matcher(suffix);
         return m.find();
     }
 
+    /**
+     * 判断是否文本
+     *
+     * @param suffix 后缀
+     * @return boolean
+     */
+    private boolean isExcel(String suffix) {
+        Pattern p = Pattern.compile("\\.(xls|xlsx)");
+        Matcher m = p.matcher(suffix);
+        return m.find();
+    }
+
+    /**
+     * 解析json内容(文本,图片,视频)
+     *
+     * @param uploadFile 上传文件
+     * @param resourceId 资源id
+     * @param type       类型
+     * @return {@link List}<{@link ResourceDataDO}>
+     */
+    private List<ResourceDataBO> parseJsonContent(MultipartFile uploadFile, Long resourceId, Integer type) {
+        String suffix = "." + getUploadSuffix(Objects.requireNonNull(uploadFile.getOriginalFilename()));
+        if (!isJson(suffix)) {
+            throw new BizException("只能上传json或txt后缀的文本文件");
+        }
+        List<ResourceDataBO> resourceDataList = new ArrayList<>();
+        LocalDateTime now = LocalDateTime.now();
+        try (InputStreamReader read = new InputStreamReader(new ByteArrayInputStream(uploadFile.getBytes()));
+             BufferedReader br = new BufferedReader(read)) {
+            String s;
+            while ((s = br.readLine()) != null) {
+                ResourceDataDO dataDO = new ResourceDataDO();
+                dataDO.setResourceId(resourceId);
+                dataDO.setDataId(snowflakeIdFactory.nextId());
+                dataDO.setCreateTime(now);
+                dataDO.setIsDraft(IsOrNotEnum.IS.getValue());
+                ResourceDataBO resourceDataBO = ResourceDataBO.builder().resourceData(dataDO).isValid(false).build();
+                try {
+                    Map map = (Map) JSONUtil.parse(s.trim());
+                    Map dataMap = (Map) map.get("data");
+                    if (dataMap != null) {
+                        Object hint = dataMap.get("hint");
+                        if (hint != null) {
+                            dataDO.setHint(hint.toString().trim());
+                        }
+                        if (ResourceTypeEnum.DOC.getValue().equals(type)) {
+                            Object txtSource = dataMap.get("txtsource");
+                            if (txtSource != null) {
+                                dataDO.setContent(txtSource.toString().trim());
+                            }
+                        } else if (ResourceTypeEnum.PICTURE.getValue().equals(type)) {
+                            Object picSource = dataMap.get("picsource");
+                            if (picSource != null) {
+                                dataDO.setPicUrl(picSource.toString().trim());
+                            }
+                        } else {
+                            Object movSource = dataMap.get("movsource");
+                            if (movSource != null) {
+                                dataDO.setMovUrl(movSource.toString().trim());
+                            }
+                        }
+                    }
+                    resourceDataBO.setIsValid(true);
+                    resourceDataList.add(resourceDataBO);
+                } catch (JSONException jsonException) {
+                    //解析失败不用理会
+                    log.error("资源文件解析失败: ", jsonException);
+                }
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage());
+        }
+        return resourceDataList;
+    }
+
+    /**
+     * 解析excel内容(链接)
+     *
+     * @param uploadFile 上传文件
+     * @param resourceId 资源id
+     * @param type       类型
+     * @return {@link List}<{@link ResourceDataDO}>
+     */
+    private List<ResourceDataBO> parseExcelContent(MultipartFile uploadFile, Long resourceId, Integer type) {
+        String suffix = "." + getUploadSuffix(Objects.requireNonNull(uploadFile.getOriginalFilename()));
+        if (!isExcel(suffix)) {
+            throw new BizException("只能上传excel文件");
+        }
+        List<ResourceDataBO> resourceDataList = new ArrayList<>();
+        LocalDateTime now = LocalDateTime.now();
+
+        try (XSSFWorkbook excel = new XSSFWorkbook(uploadFile.getInputStream())) {
+            // 读取且仅仅读取第一个sheet
+            XSSFSheet sheet = excel.getSheetAt(0);
+            for (int i = 1; i <= sheet.getLastRowNum(); i++) {
+                ResourceDataDO dataDO = new ResourceDataDO();
+                dataDO.setResourceId(resourceId);
+                dataDO.setDataId(snowflakeIdFactory.nextId());
+                dataDO.setCreateTime(now);
+                dataDO.setIsDraft(IsOrNotEnum.IS.getValue());
+                ResourceDataBO resourceDataBO = ResourceDataBO.builder().resourceData(dataDO).isValid(false).build();
+                // 从第二行开始读取,第一行是头部
+                XSSFRow row = sheet.getRow(i);
+                // 读取第1列
+                XSSFCell cell = row.getCell(0);
+                String rawValue = cell.getStringCellValue();
+                if (StringUtils.isNotBlank(rawValue)) {
+                    dataDO.setContent(rawValue);
+                    resourceDataBO.setIsValid(true);
+                }
+                resourceDataList.add(resourceDataBO);
+            }
+        } catch (IOException e) {
+            // 解析失败不用理会
+            log.error("资源文件解析失败: ", e);
+        }
+        return resourceDataList;
+    }
+
 }

+ 18 - 12
sino-mark-server/src/main/java/cn/sino/mark/service/impl/SysUserServiceImpl.java

@@ -22,10 +22,7 @@ import cn.sino.mark.common.utils.HttpUtil;
 import cn.sino.mark.common.utils.LoginUserUtil;
 import cn.sino.mark.dao.mapper.SysRoleMapper;
 import cn.sino.mark.dao.mapper.SysUserRoleMapper;
-import cn.sino.mark.dao.model.SysPermDO;
-import cn.sino.mark.dao.model.SysRoleDO;
-import cn.sino.mark.dao.model.SysUserDO;
-import cn.sino.mark.dao.model.SysUserRoleDO;
+import cn.sino.mark.dao.model.*;
 import cn.sino.mark.manager.ProjectManager;
 import cn.sino.mark.manager.SysUserManager;
 import cn.sino.mark.service.SysUserService;
@@ -36,22 +33,16 @@ import com.github.pagehelper.Page;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.data.redis.core.StringRedisTemplate;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import org.springframework.http.converter.StringHttpMessageConverter;
 import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.security.core.userdetails.UserDetailsService;
 import org.springframework.security.core.userdetails.UsernameNotFoundException;
 import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.client.RestTemplate;
 
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
 import java.time.Instant;
 import java.time.LocalDateTime;
 import java.util.*;
@@ -250,7 +241,7 @@ public class SysUserServiceImpl implements SysUserService, UserDetailsService {
                 item.setCreateTimeStr(DateUtil.format(item.getCreateTime(), Constant.DATETIME_FORMAT));
                 UserPageVO userPageVO = sysUserMapStruct.convertToUserPageVO(item);
                 userPageVO.setIsAdmin(IsOrNotEnum.NOT.getValue());
-                if (userPageVO.getUserRoleNames().contains(SysRoleEnums.ADMIN.getName())){
+                if (userPageVO.getUserRoleNames().contains(SysRoleEnums.ADMIN.getName())) {
                     userPageVO.setIsAdmin(IsOrNotEnum.IS.getValue());
                 }
                 page.add(userPageVO);
@@ -387,6 +378,8 @@ public class SysUserServiceImpl implements SysUserService, UserDetailsService {
      *
      * @param addUserDTO 用户信息
      */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
     public void addInnerUser(AddInnerUserDTO addUserDTO) {
         SysUserDO existUser = sysUserManager.queryByAccount(addUserDTO.getAccount().trim());
         if (existUser != null) {
@@ -399,6 +392,7 @@ public class SysUserServiceImpl implements SysUserService, UserDetailsService {
         sysUserDO.setUserName(addUserDTO.getUserName().trim());
         sysUserDO.setStatus(SysUserStatusEnum.NORMAL.getValue());
         sysUserDO.setUserType(SysUserTypeEnum.INNER_EMPLOYEE.getValue());
+        sysUserDO.setDeptId(addUserDTO.getDeptId());
         sysUserManager.addUser(sysUserDO);
         List<Long> roleIds = addUserDTO.getRoleIds();
         LocalDateTime now = LocalDateTime.now();
@@ -434,6 +428,7 @@ public class SysUserServiceImpl implements SysUserService, UserDetailsService {
         sysUserDO.setAccount(existUser.getAccount());
         sysUserDO.setId(existUser.getId());
         sysUserDO.setStatus(addUserDTO.getStatus());
+        sysUserDO.setDeptId(addUserDTO.getDeptId());
         if (sysUserManager.modifyUserById(sysUserDO) < 1) {
             throw new BizException("修改用户失败");
         }
@@ -462,7 +457,10 @@ public class SysUserServiceImpl implements SysUserService, UserDetailsService {
     public InnerUserVO getInnerUserInfo(String account) {
         String queryUserUrl = innerUserProperties.getQueryUserUrl();
         account = account.trim();
-        return HttpUtil.getInnerUserInfo(queryUserUrl, JSONUtil.toJsonStr(Collections.singletonList(account)));
+        InnerUserVO innerUserVO = new InnerUserVO();
+        innerUserVO.setDisplayName(UUID.randomUUID().toString().substring(0,20));
+        return innerUserVO;
+//        return HttpUtil.getInnerUserInfo(queryUserUrl, JSONUtil.toJsonStr(Collections.singletonList(account)));
     }
 
     /**
@@ -487,6 +485,14 @@ public class SysUserServiceImpl implements SysUserService, UserDetailsService {
         return createUserLoginToken(innerLoginUserInfo.getLoginName());
     }
 
+    @Override
+    public List<DepartmentTreeVO> getAllDeptNotTree() {
+        List<SysDeptDO> allDepts = sysUserManager.getAllDepts();
+        return allDepts.stream()
+                .map(sysUserMapStruct::convertToDepartmentTreeVO)
+                .collect(Collectors.toList());
+    }
+
     /**
      * 生成jwt
      *

+ 27 - 0
sino-mark-server/src/main/resources/application-dev.properties

@@ -0,0 +1,27 @@
+spring.profiles.active = dev
+spring.datasource.type = com.alibaba.druid.pool.DruidDataSource
+spring.datasource.druid.driver-class-name = com.mysql.cj.jdbc.Driver
+spring.datasource.druid.url = jdbc:mysql://192.168.1.241:3306/sino_mark?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&allowMultiQueries=true&tinyInt1isBit=false&rewriteBatchStatements=true
+spring.datasource.druid.username = zsy
+spring.datasource.druid.password = HnTqLszKLNv6RR5b
+spring.datasource.druid.initial-size = 5
+spring.datasource.druid.min-idle = 5
+spring.datasource.druid.max-active = 50
+spring.datasource.druid.max-wait = 60000
+spring.datasource.druid.test-while-idle = true
+spring.datasource.druid.time-between-connect-error-millis = 60000
+spring.datasource.druid.min-evictable-idle-time-millis = 30000
+spring.datasource.druid.validation-query = SELECT 1
+spring.datasource.druid.pool-prepared-statements = true
+spring.datasource.druid.max-pool-prepared-statement-per-connection-size = 20
+spring.cache.type = redis
+spring.redis.host = 192.168.1.240
+spring.redis.port = 6379
+spring.redis.database = 3
+spring.redis.password =
+jwt.issuer = sino
+jwt.admin-secret = 44eaaad173e7c3e3dc522b373c7da326
+inner-user.query-user-url = https://sso.meetsocial.cn/user/getIdInfoByLoginName
+inner-user.check-user-url = https://sso.meetsocial.cn/sso/getUserInfoByToken
+inner-user.token-key = d8be869c3765fa62aee8120a4798385a
+cors.origin = https://localhost:8060

+ 2 - 2
sino-mark-server/src/main/resources/application.yml

@@ -16,9 +16,9 @@ swagger:
 # 可以在以下注解开启的情况下将spring.profiles.active启动参数设置到Apollo,用于日志配置文件的条件解析
 apollo:
   eagerLoad:
-    enabled: true
+    enabled: false
   bootstrap:
-    enabled: true
+    enabled: false
     namespaces: application, application-disclosed, TD.Gateway-Eureka-Server, TD.Background-Eureka-Server, TD.Common
 
 

+ 32 - 0
sino-mark-server/src/main/resources/mapper/mark/LabelItemMapper.xml

@@ -0,0 +1,32 @@
+<?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="cn.sino.mark.dao.mapper.LabelItemMapper">
+
+    <resultMap id="BaseResultMap" type="cn.sino.mark.dao.model.LabelItemDO">
+        <id property="id" column="id" jdbcType="INTEGER"/>
+        <result property="labelId" column="label_id" jdbcType="BIGINT"/>
+        <result property="name" column="name" jdbcType="VARCHAR"/>
+        <result property="sort" column="sort" jdbcType="BIGINT"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id
+        ,label_id,`name`,
+        sort,create_time
+    </sql>
+
+    <select id="insertBatch" parameterType="java.util.List">
+        INSERT INTO t_label_item(label_id, `name`, sort)
+        VALUES
+        <foreach collection="list" item="item" separator=",">
+            (
+            #{item.labelId,jdbcType=BIGINT},
+            #{item.name,jdbcType=VARCHAR},
+            #{item.sort,jdbcType=BIGINT}
+            )
+        </foreach>
+    </select>
+</mapper>

+ 85 - 0
sino-mark-server/src/main/resources/mapper/mark/LabelMapper.xml

@@ -0,0 +1,85 @@
+<?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="cn.sino.mark.dao.mapper.LabelMapper">
+
+    <resultMap id="BaseResultMap" type="cn.sino.mark.dao.model.LabelDO">
+        <id property="id" column="id" jdbcType="BIGINT"/>
+        <result property="name" column="name" jdbcType="VARCHAR"/>
+        <result property="isDelete" column="is_delete" jdbcType="TINYINT"/>
+        <result property="createBy" column="create_by" jdbcType="BIGINT"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="updateBy" column="update_by" jdbcType="BIGINT"/>
+        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id
+        ,`name`,is_delete,
+        create_by,create_time,update_by,
+        update_time
+    </sql>
+
+    <resultMap id="BoMap" type="cn.sino.mark.common.model.bo.LabelBO" extends="BaseResultMap">
+        <result property="labelItemNames" column="label_item_names" jdbcType="VARCHAR"/>
+        <result property="createName" column="create_name" jdbcType="VARCHAR"/>
+        <collection property="labelItems" ofType="cn.sino.mark.dao.model.LabelItemDO">
+            <result property="id" column="item_id"/>
+            <result property="labelId" column="item_label_id"/>
+            <result property="name" column="item_name"/>
+            <result property="sort" column="item_sort"/>
+            <result property="createTime" column="item_create_time"/>
+        </collection>
+    </resultMap>
+    <select id="selectLabelPage" parameterType="cn.sino.mark.common.model.dto.LabelPageDTO" resultMap="BoMap">
+        SELECT
+        l.*,
+        group_concat( li.`name` ORDER BY li.id ASC ) AS label_item_names,
+        su.user_name AS create_name
+        FROM
+        t_label l
+        LEFT JOIN t_sys_user su ON l.create_by = su.user_id
+        LEFT JOIN t_label_item li ON l.id = li.label_id
+        WHERE l.is_delete = 0
+        <if test="name!='' and name!=null ">
+            AND l.name LIKE concat('%',#{name},'%')
+        </if>
+        GROUP BY
+        l.id
+        ORDER BY
+        l.create_time DESC
+    </select>
+
+    <select id="selectInfoById" parameterType="java.lang.Long" resultMap="BoMap">
+        SELECT
+            l.*,
+            li.id AS item_id,
+            li.label_id AS item_label_id,
+            li.`name` AS item_name,
+            li.sort AS item_sort,
+            li.create_time AS item_create_time,
+            su.user_name AS create_name
+        FROM
+            t_label l
+                LEFT JOIN t_sys_user su ON l.create_by = su.user_id
+                LEFT JOIN t_label_item li ON l.id = li.label_id
+        WHERE l.is_delete = 0
+            ANd l.id = #{id}
+    </select>
+
+    <select id="selectAll" parameterType="cn.sino.mark.common.model.dto.LabelPageDTO" resultMap="BoMap">
+        SELECT
+            l.*,
+            group_concat( li.`name` ORDER BY li.id ASC SEPARATOR '/' ) AS label_item_names
+        FROM
+            t_label l
+                LEFT JOIN t_label_item li ON l.id = li.label_id
+        WHERE
+            l.is_delete = 0
+        GROUP BY
+            l.id
+        ORDER BY
+            l.create_time DESC
+    </select>
+</mapper>

+ 26 - 0
sino-mark-server/src/main/resources/mapper/mark/SysDeptMapper.xml

@@ -0,0 +1,26 @@
+<?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="cn.sino.mark.dao.mapper.SysDeptMapper">
+    <resultMap id="BaseResultMap" type="cn.sino.mark.dao.model.SysDeptDO">
+        <id column="id" property="id" jdbcType="BIGINT"/>
+        <result column="name" property="name" jdbcType="VARCHAR"/>
+        <result column="description" property="description" jdbcType="VARCHAR"/>
+        <result column="parent_id" property="parentId" jdbcType="BIGINT"/>
+        <result column="level" property="level" jdbcType="INTEGER"/>
+        <result column="sort" property="sort" jdbcType="BIGINT"/>
+        <result column="is_delete" property="isDelete" jdbcType="INTEGER"/>
+        <result column="create_by" property="createBy" jdbcType="BIGINT"/>
+        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
+        <result column="update_by" property="updateBy" jdbcType="BIGINT"/>
+        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
+    </resultMap>
+
+    <!--查询所有部门,不是树结构(数据权限展示专用)-->
+    <select id="selectAllNotTree" resultMap="BaseResultMap">
+        SELECT *
+        FROM t_sys_dept
+        where is_delete = 0
+        ORDER BY sort asc
+    </select>
+
+</mapper>

+ 44 - 41
sino-mark-server/src/main/resources/mapper/mark/SysUserMapper.xml

@@ -5,33 +5,28 @@
 <mapper namespace="cn.sino.mark.dao.mapper.SysUserMapper">
 
     <resultMap id="BaseResultMap" type="cn.sino.mark.dao.model.SysUserDO">
-            <id property="id" column="id" jdbcType="BIGINT"/>
-            <result property="account" column="account" jdbcType="VARCHAR"/>
-            <result property="password" column="password" jdbcType="VARCHAR"/>
-            <result property="userName" column="user_name" jdbcType="VARCHAR"/>
-            <result property="mobile" column="mobile" jdbcType="VARCHAR"/>
-            <result property="jobNumber" column="job_number" jdbcType="VARCHAR"/>
-            <result property="email" column="email" jdbcType="VARCHAR"/>
-            <result property="avatar" column="avatar" jdbcType="VARCHAR"/>
-            <result property="sex" column="sex" jdbcType="TINYINT"/>
-            <result property="isLeader" column="is_leader" jdbcType="TINYINT"/>
-            <result property="isLeave" column="is_leave" jdbcType="TINYINT"/>
-            <result property="status" column="status" jdbcType="TINYINT"/>
-            <result property="deptId" column="dept_id" jdbcType="BIGINT"/>
-            <result property="isDelete" column="is_delete" jdbcType="TINYINT"/>
-            <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
-            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
-            <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
-            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+        <id property="id" column="id" jdbcType="BIGINT"/>
+        <result property="account" column="account" jdbcType="VARCHAR"/>
+        <result property="password" column="password" jdbcType="VARCHAR"/>
+        <result property="userName" column="user_name" jdbcType="VARCHAR"/>
+        <result property="status" column="status" jdbcType="TINYINT"/>
+        <result property="deptId" column="dept_id" jdbcType="BIGINT"/>
+        <result property="isDelete" column="is_delete" jdbcType="TINYINT"/>
+        <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
+        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
     </resultMap>
 
     <resultMap id="UserBOMap" type="cn.sino.mark.common.model.bo.SysUserBO" extends="BaseResultMap">
         <result column="user_role_names" property="userRoleNames" jdbcType="VARCHAR"/>
         <result column="user_task_num" property="taskNum" jdbcType="INTEGER"/>
+        <result column="dept_name" property="deptName" jdbcType="VARCHAR"/>
     </resultMap>
 
     <sql id="Base_Column_List">
-        id,account,password,
+        id
+        ,account,password,
         user_name,mobile,job_number,
         email,avatar,sex,
         is_leader,is_leave,status,
@@ -41,20 +36,22 @@
 
     <select id="pageUsers" parameterType="cn.sino.mark.common.model.dto.QueryUserPageDTO" resultMap="UserBOMap">
         SELECT
-            tsu.*, ur.`user_role_names`
+        tsu.*, ur.`user_role_names`,sd.name as dept_name
         FROM
-            t_sys_user tsu
-                LEFT JOIN t_sys_user_role tsur ON tsur.user_id = tsu.user_id
-                LEFT JOIN
-                (
-                SELECT user_id,GROUP_CONCAT(tsr.role_name SEPARATOR '/') AS user_role_names FROM t_sys_user_role tsur
-                LEFT JOIN t_sys_role tsr ON tsr.role_id = tsur.role_id
-                GROUP BY tsur.user_id
-                ) ur ON ur.user_id = tsu.user_id
+        t_sys_user tsu
+        LEFT JOIN t_sys_user_role tsur ON tsur.user_id = tsu.user_id
+        LEFT JOIN
+        (
+        SELECT user_id,GROUP_CONCAT(tsr.role_name SEPARATOR '/') AS user_role_names FROM t_sys_user_role tsur
+        LEFT JOIN t_sys_role tsr ON tsr.role_id = tsur.role_id
+        GROUP BY tsur.user_id
+        ) ur ON ur.user_id = tsu.user_id
+        left join t_sys_dept sd on tsu.dept_id = sd.id
         WHERE
-            tsu.is_delete = 0
+        tsu.is_delete = 0
         <if test="nameOrAccount != null and nameOrAccount != ''">
-            AND (tsu.account LIKE concat('%',#{nameOrAccount},'%') OR tsu.user_name LIKE concat('%',#{nameOrAccount},'%'))
+            AND (tsu.account LIKE concat('%',#{nameOrAccount},'%') OR tsu.user_name LIKE
+            concat('%',#{nameOrAccount},'%'))
         </if>
         <if test="userType != null and userType != 100">
             AND tsu.user_type = #{userType,jdbcType=INTEGER}
@@ -72,7 +69,7 @@
             <![CDATA[ AND tsu.create_time <= #{createTimeEnd} ]]>
         </if>
         GROUP BY
-            tsu.user_id
+        tsu.user_id
         ORDER BY tsu.create_time DESC
     </select>
 
@@ -81,20 +78,26 @@
         SELECT * FROM t_sys_user WHERE is_delete = 0
         AND user_id IN
         (
-            <foreach collection="userIds" separator="," item="userId">
-                #{userId,jdbcType=BIGINT}
-            </foreach>
-            )
+        <foreach collection="userIds" separator="," item="userId">
+            #{userId,jdbcType=BIGINT}
+        </foreach>
+        )
     </select>
 
     <!--查询待选标注人员-->
     <select id="selectMarkPersonList" resultMap="UserBOMap">
-        SELECT IFNULL(utn.user_task_num,0) AS user_task_num,tsu.*
+        SELECT IFNULL(utn.user_task_num, 0) AS user_task_num, tsu.*
         FROM t_sys_user tsu
-        LEFT JOIN t_sys_user_role tsur ON tsur.user_id = tsu.user_id
-        LEFT JOIN
-        (SELECT user_id,COUNT(*) user_task_num FROM t_project_task WHERE is_delete = 0 AND is_complete = 0 AND project_id != #{projectId} GROUP BY user_id)
-          utn ON utn.user_id = tsu.user_id
-        WHERE tsu.is_delete = 0 AND tsu.`status` = 0 AND tsur.role_id IN (6,7)
+                 LEFT JOIN t_sys_user_role tsur ON tsur.user_id = tsu.user_id
+                 LEFT JOIN
+             (SELECT user_id, COUNT(*) user_task_num
+              FROM t_project_task
+              WHERE is_delete = 0
+                AND is_complete = 0
+                AND project_id != #{projectId}
+              GROUP BY user_id) utn ON utn.user_id = tsu.user_id
+        WHERE tsu.is_delete = 0
+          AND tsu.`status` = 0
+          AND tsur.role_id IN (6, 7)
     </select>
 </mapper>

+ 57 - 0
sino-mark-server/src/main/resources/sql/sino-mark-db-update-20220913.sql

@@ -0,0 +1,57 @@
+CREATE TABLE `t_label` (
+ `id` bigint(20) NOT NULL COMMENT 'PK',
+ `name` varchar(45) NOT NULL COMMENT '标签名称',
+ `is_delete` tinyint(4) NOT NULL COMMENT '是否删除(0:正常;1:已删除)',
+ `create_by` bigint(20) NOT NULL COMMENT '创建人',
+ `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_by` bigint(20) NOT NULL COMMENT '更新人',
+ `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='标签表';
+
+CREATE TABLE `t_label_item` (
+  `id` int(10) NOT NULL AUTO_INCREMENT COMMENT 'PK',
+  `label_id` bigint(20) NOT NULL COMMENT '标签ID',
+  `name` varchar(10) NOT NULL COMMENT '标签选项名称',
+  `sort` bigint(20) NOT NULL COMMENT '排序(时间戳)',
+  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+  PRIMARY KEY (`id`) USING BTREE,
+  KEY `idx_label_id` (`label_id`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='标签选项表';
+
+ALTER TABLE `t_resource`
+    MODIFY COLUMN `type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '资源类型(0:文本,1:图片,2:视频,3:链接)' AFTER `name`;
+
+
+CREATE TABLE `t_sys_dept` (
+    `id` bigint(20) NOT NULL COMMENT '部门ID,主键',
+    `name` varchar(32) NOT NULL COMMENT '部门名称',
+    `description` varchar(128) DEFAULT NULL COMMENT '部门描述',
+    `parent_id` bigint(11) NOT NULL COMMENT '上级部门id',
+    `sort` bigint(20) NOT NULL COMMENT '排序字段',
+    `level` int(11) DEFAULT '0' COMMENT '部门等级(1:一级部门 2:二级部门 3:三级部门。。)',
+    `is_delete` tinyint(4) NOT NULL COMMENT '是否删除(0:正常;1:删除)',
+    `create_by` bigint(20) NOT NULL COMMENT '创建人',
+    `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '部门创建时间',
+    `update_by` bigint(20) NOT NULL COMMENT '更新人',
+    `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '部门更新时间',
+    PRIMARY KEY (`id`) USING BTREE,
+    KEY `idx_parent_id` (`parent_id`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统部门表';
+
+INSERT INTO `t_sys_dept` (`id`, `name`, `description`, `parent_id`, `sort`, `level`, `is_delete`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (1, '算法部门', NULL, 0, 1662279502530, 1, 0, 1, '2022-09-04 16:18:23', 1, '2022-09-04 16:18:23');
+INSERT INTO `t_sys_dept` (`id`, `name`, `description`, `parent_id`, `sort`, `level`, `is_delete`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (2, '业务部门', NULL, 0, 1662279502531, 1, 0, 1, '2022-09-04 16:18:24', 1, '2022-09-04 16:18:24');
+
+ALTER TABLE `t_sys_user` ADD COLUMN `dept_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '用户部门' AFTER `user_type`;
+
+UPDATE t_sys_user SET dept_id = 1 where user_type = 1;
+
+INSERT INTO `t_sys_role` (`id`, `role_id`, `role_name`, `description`, `role_code`, `is_delete`, `create_by`, `type`, `create_time`, `update_by`, `update_time`) VALUES (8, 8, '标签配置负责人', NULL, 'LabelManagement', 0, 1, 0, '2022-09-14 19:36:26', 1, '2022-09-14 19:36:26');
+INSERT INTO `t_sys_perm` (`perm_id`, `perm_name`, `perm_code`, `is_menu`, `parent_id`, `is_default`, `sort`, `is_delete`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (1559741406246449154, '标签管理', 'label-management', 1, 0, 0, 1606649153931, 0, 1, '2022-09-14 11:18:25', 1, '2022-09-14 14:56:59');
+INSERT INTO `t_sys_perm` (`perm_id`, `perm_name`, `perm_code`, `is_menu`, `parent_id`, `is_default`, `sort`, `is_delete`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (1560465858399625218, '添加标签', 'add-label', 0, 1559741406246449154, 0, 1660879027350, 0, 1, '2022-09-14 11:17:07', 1, '2022-09-14 11:17:07');
+INSERT INTO `t_sys_perm` (`perm_id`, `perm_name`, `perm_code`, `is_menu`, `parent_id`, `is_default`, `sort`, `is_delete`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (1560465901403824130, '编辑标签', 'edit-label', 0, 1559741406246449154, 0, 1660879037606, 0, 1, '2022-09-14 11:17:18', 1, '2022-09-14 11:17:18');
+INSERT INTO `t_sys_perm` (`perm_id`, `perm_name`, `perm_code`, `is_menu`, `parent_id`, `is_default`, `sort`, `is_delete`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (1560465951827746818, '删除标签', 'delete-label', 0, 1559741406246449154, 0, 1660879049632, 0, 1, '2022-09-14 11:17:30', 1, '2022-09-14 11:17:30');
+INSERT INTO `t_sys_role_perm` (`role_id`, `perm_id`, `create_time`) VALUES (8, 1559741406246449154, '2022-09-14 16:53:26');
+INSERT INTO `t_sys_role_perm` (`role_id`, `perm_id`, `create_time`) VALUES (8, 1560465858399625218, '2022-09-14 16:53:27');
+INSERT INTO `t_sys_role_perm` (`role_id`, `perm_id`, `create_time`) VALUES (8, 1560465901403824130, '2022-09-14 16:53:28');
+INSERT INTO `t_sys_role_perm` (`role_id`, `perm_id`, `create_time`) VALUES (8, 1560465951827746818, '2022-09-14 16:53:29');