浏览代码

update mp化

疯狂的狮子li 4 年之前
父节点
当前提交
adeaa77864
共有 21 个文件被更改,包括 469 次插入1064 次删除
  1. 82 46
      ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java
  2. 82 73
      ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java
  3. 3 43
      ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java
  4. 7 31
      ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java
  5. 34 39
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java
  6. 100 163
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java
  7. 6 7
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java
  8. 15 16
      ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java
  9. 0 89
      ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml
  10. 0 65
      ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
  11. 2 55
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java
  12. 2 58
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobMapper.java
  13. 7 8
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobLogService.java
  14. 13 14
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobService.java
  15. 38 32
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java
  16. 63 85
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java
  17. 0 75
      ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml
  18. 0 88
      ruoyi-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml
  19. 0 34
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java
  20. 15 19
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
  21. 0 24
      ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml

+ 82 - 46
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java

@@ -4,13 +4,13 @@ import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.annotation.*;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ruoyi.common.constant.GenConstants;
-import lombok.Data;
-import lombok.NoArgsConstructor;
+import lombok.*;
 import lombok.experimental.Accessors;
 import org.apache.commons.lang3.ArrayUtils;
 
 import javax.validation.Valid;
 import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -18,7 +18,7 @@ import java.util.Map;
 
 /**
  * 业务表 gen_table
- * 
+ *
  * @author ruoyi
  */
 
@@ -26,75 +26,110 @@ import java.util.Map;
 @NoArgsConstructor
 @Accessors(chain = true)
 @TableName("gen_table")
-public class GenTable
-{
+public class GenTable implements Serializable {
     private static final long serialVersionUID = 1L;
 
-    /** 编号 */
+    /**
+     * 编号
+     */
     @TableId(value = "table_id", type = IdType.AUTO)
     private Long tableId;
 
-    /** 表名称 */
+    /**
+     * 表名称
+     */
     @NotBlank(message = "表名称不能为空")
     private String tableName;
 
-    /** 表描述 */
+    /**
+     * 表描述
+     */
     @NotBlank(message = "表描述不能为空")
     private String tableComment;
 
-    /** 关联父表的表名 */
+    /**
+     * 关联父表的表名
+     */
     private String subTableName;
 
-    /** 本表关联父表的外键名 */
+    /**
+     * 本表关联父表的外键名
+     */
     private String subTableFkName;
 
-    /** 实体类名称(首字母大写) */
+    /**
+     * 实体类名称(首字母大写)
+     */
     @NotBlank(message = "实体类名称不能为空")
     private String className;
 
-    /** 使用的模板(crud单表操作 tree树表操作 sub主子表操作) */
+    /**
+     * 使用的模板(crud单表操作 tree树表操作 sub主子表操作)
+     */
     private String tplCategory;
 
-    /** 生成包路径 */
+    /**
+     * 生成包路径
+     */
     @NotBlank(message = "生成包路径不能为空")
     private String packageName;
 
-    /** 生成模块名 */
+    /**
+     * 生成模块名
+     */
     @NotBlank(message = "生成模块名不能为空")
     private String moduleName;
 
-    /** 生成业务名 */
+    /**
+     * 生成业务名
+     */
     @NotBlank(message = "生成业务名不能为空")
     private String businessName;
 
-    /** 生成功能名 */
+    /**
+     * 生成功能名
+     */
     @NotBlank(message = "生成功能名不能为空")
     private String functionName;
 
-    /** 生成作者 */
+    /**
+     * 生成作者
+     */
     @NotBlank(message = "作者不能为空")
     private String functionAuthor;
 
-    /** 生成代码方式(0zip压缩包 1自定义路径) */
+    /**
+     * 生成代码方式(0zip压缩包 1自定义路径)
+     */
     private String genType;
 
-    /** 生成路径(不填默认项目路径) */
+    /**
+     * 生成路径(不填默认项目路径)
+     */
     private String genPath;
 
-    /** 主键信息 */
+    /**
+     * 主键信息
+     */
     @TableField(exist = false)
     private GenTableColumn pkColumn;
 
-    /** 子表信息 */
+    /**
+     * 子表信息
+     */
     @TableField(exist = false)
     private GenTable subTable;
 
-    /** 表列信息 */
+    /**
+     * 表列信息
+     */
     @Valid
     @TableField(exist = false)
     private List<GenTableColumn> columns;
 
-    /** 其它生成选项 */
+    /**
+     * 其它生成选项
+     */
     private String options;
 
     /**
@@ -132,65 +167,66 @@ public class GenTable
     @TableField(exist = false)
     private Map<String, Object> params = new HashMap<>();
 
-    /** 树编码字段 */
+    /**
+     * 树编码字段
+     */
     @TableField(exist = false)
     private String treeCode;
 
-    /** 树父编码字段 */
+    /**
+     * 树父编码字段
+     */
     @TableField(exist = false)
     private String treeParentCode;
 
-    /** 树名称字段 */
+    /**
+     * 树名称字段
+     */
     @TableField(exist = false)
     private String treeName;
 
-    /** 上级菜单ID字段 */
+    /**
+     * 上级菜单ID字段
+     */
     @TableField(exist = false)
     private String parentMenuId;
 
-    /** 上级菜单名称字段 */
+    /**
+     * 上级菜单名称字段
+     */
     @TableField(exist = false)
     private String parentMenuName;
 
-    public boolean isSub()
-    {
+    public boolean isSub() {
         return isSub(this.tplCategory);
     }
 
-    public static boolean isSub(String tplCategory)
-    {
+    public static boolean isSub(String tplCategory) {
         return tplCategory != null && StrUtil.equals(GenConstants.TPL_SUB, tplCategory);
     }
 
-    public boolean isTree()
-    {
+    public boolean isTree() {
         return isTree(this.tplCategory);
     }
 
-    public static boolean isTree(String tplCategory)
-    {
+    public static boolean isTree(String tplCategory) {
         return tplCategory != null && StrUtil.equals(GenConstants.TPL_TREE, tplCategory);
     }
 
-    public boolean isCrud()
-    {
+    public boolean isCrud() {
         return isCrud(this.tplCategory);
     }
 
-    public static boolean isCrud(String tplCategory)
-    {
+    public static boolean isCrud(String tplCategory) {
         return tplCategory != null && StrUtil.equals(GenConstants.TPL_CRUD, tplCategory);
     }
 
-    public boolean isSuperColumn(String javaField)
-    {
+    public boolean isSuperColumn(String javaField) {
         return isSuperColumn(this.tplCategory, javaField);
     }
 
-    public static boolean isSuperColumn(String tplCategory, String javaField)
-    {
-        if (isTree(tplCategory))
-        {
+    public static boolean isSuperColumn(String tplCategory, String javaField) {
+        if (isTree(tplCategory)) {
             return StrUtil.equalsAnyIgnoreCase(javaField,
                     ArrayUtils.addAll(GenConstants.TREE_ENTITY, GenConstants.BASE_ENTITY));
         }

+ 82 - 73
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java

@@ -3,19 +3,18 @@ package com.ruoyi.generator.domain;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.annotation.*;
 import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.common.core.domain.BaseEntity;
-import lombok.Data;
-import lombok.NoArgsConstructor;
+import lombok.*;
 import lombok.experimental.Accessors;
 
 import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
 /**
  * 代码生成业务字段表 gen_table_column
- * 
+ *
  * @author ruoyi
  */
 
@@ -23,64 +22,99 @@ import java.util.Map;
 @NoArgsConstructor
 @Accessors(chain = true)
 @TableName("gen_table_column")
-public class GenTableColumn extends BaseEntity
-{
+public class GenTableColumn implements Serializable {
     private static final long serialVersionUID = 1L;
 
-    /** 编号 */
+    /**
+     * 编号
+     */
     @TableId(value = "column_id", type = IdType.AUTO)
     private Long columnId;
 
-    /** 归属表编号 */
+    /**
+     * 归属表编号
+     */
     private Long tableId;
 
-    /** 列名称 */
+    /**
+     * 列名称
+     */
     private String columnName;
 
-    /** 列描述 */
+    /**
+     * 列描述
+     */
     private String columnComment;
 
-    /** 列类型 */
+    /**
+     * 列类型
+     */
     private String columnType;
 
-    /** JAVA类型 */
+    /**
+     * JAVA类型
+     */
     private String javaType;
 
-    /** JAVA字段名 */
+    /**
+     * JAVA字段名
+     */
     @NotBlank(message = "Java属性不能为空")
     private String javaField;
 
-    /** 是否主键(1是) */
+    /**
+     * 是否主键(1是)
+     */
     private String isPk;
 
-    /** 是否自增(1是) */
+    /**
+     * 是否自增(1是)
+     */
     private String isIncrement;
 
-    /** 是否必填(1是) */
+    /**
+     * 是否必填(1是)
+     */
     private String isRequired;
 
-    /** 是否为插入字段(1是) */
+    /**
+     * 是否为插入字段(1是)
+     */
     private String isInsert;
 
-    /** 是否编辑字段(1是) */
+    /**
+     * 是否编辑字段(1是)
+     */
     private String isEdit;
 
-    /** 是否列表字段(1是) */
+    /**
+     * 是否列表字段(1是)
+     */
     private String isList;
 
-    /** 是否查询字段(1是) */
+    /**
+     * 是否查询字段(1是)
+     */
     private String isQuery;
 
-    /** 查询方式(EQ等于、NE不等于、GT大于、LT小于、LIKE模糊、BETWEEN范围) */
+    /**
+     * 查询方式(EQ等于、NE不等于、GT大于、LT小于、LIKE模糊、BETWEEN范围)
+     */
     private String queryType;
 
-    /** 显示类型(input文本框、textarea文本域、select下拉框、checkbox复选框、radio单选框、datetime日期控件、image图片上传控件、upload文件上传控件、editor富文本控件) */
+    /**
+     * 显示类型(input文本框、textarea文本域、select下拉框、checkbox复选框、radio单选框、datetime日期控件、image图片上传控件、upload文件上传控件、editor富文本控件)
+     */
     private String htmlType;
 
-    /** 字典类型 */
+    /**
+     * 字典类型
+     */
     private String dictType;
 
-    /** 排序 */
+    /**
+     * 排序
+     */
     private Integer sort;
 
     /**
@@ -113,88 +147,71 @@ public class GenTableColumn extends BaseEntity
     @TableField(exist = false)
     private Map<String, Object> params = new HashMap<>();
 
-    public String getCapJavaField()
-    {
+    public String getCapJavaField() {
         return StrUtil.upperFirst(javaField);
     }
 
-    public boolean isPk()
-    {
+    public boolean isPk() {
         return isPk(this.isPk);
     }
 
-    public boolean isPk(String isPk)
-    {
+    public boolean isPk(String isPk) {
         return isPk != null && StrUtil.equals("1", isPk);
     }
 
-    public boolean isIncrement()
-    {
+    public boolean isIncrement() {
         return isIncrement(this.isIncrement);
     }
 
-    public boolean isIncrement(String isIncrement)
-    {
+    public boolean isIncrement(String isIncrement) {
         return isIncrement != null && StrUtil.equals("1", isIncrement);
     }
 
-    public boolean isRequired()
-    {
+    public boolean isRequired() {
         return isRequired(this.isRequired);
     }
 
-    public boolean isRequired(String isRequired)
-    {
+    public boolean isRequired(String isRequired) {
         return isRequired != null && StrUtil.equals("1", isRequired);
     }
 
-    public boolean isInsert()
-    {
+    public boolean isInsert() {
         return isInsert(this.isInsert);
     }
 
-    public boolean isInsert(String isInsert)
-    {
+    public boolean isInsert(String isInsert) {
         return isInsert != null && StrUtil.equals("1", isInsert);
     }
 
-    public boolean isEdit()
-    {
+    public boolean isEdit() {
         return isInsert(this.isEdit);
     }
 
-    public boolean isEdit(String isEdit)
-    {
+    public boolean isEdit(String isEdit) {
         return isEdit != null && StrUtil.equals("1", isEdit);
     }
 
-    public boolean isList()
-    {
+    public boolean isList() {
         return isList(this.isList);
     }
 
-    public boolean isList(String isList)
-    {
+    public boolean isList(String isList) {
         return isList != null && StrUtil.equals("1", isList);
     }
 
-    public boolean isQuery()
-    {
+    public boolean isQuery() {
         return isQuery(this.isQuery);
     }
 
-    public boolean isQuery(String isQuery)
-    {
+    public boolean isQuery(String isQuery) {
         return isQuery != null && StrUtil.equals("1", isQuery);
     }
 
-    public boolean isSuperColumn()
-    {
+    public boolean isSuperColumn() {
         return isSuperColumn(this.javaField);
     }
 
-    public static boolean isSuperColumn(String javaField)
-    {
+    public static boolean isSuperColumn(String javaField) {
         return StrUtil.equalsAnyIgnoreCase(javaField,
                 // BaseEntity
                 "createBy", "createTime", "updateBy", "updateTime", "remark",
@@ -202,36 +219,28 @@ public class GenTableColumn extends BaseEntity
                 "parentName", "parentId", "orderNum", "ancestors");
     }
 
-    public boolean isUsableColumn()
-    {
+    public boolean isUsableColumn() {
         return isUsableColumn(javaField);
     }
 
-    public static boolean isUsableColumn(String javaField)
-    {
+    public static boolean isUsableColumn(String javaField) {
         // isSuperColumn()中的名单用于避免生成多余Domain属性,若某些属性在生成页面时需要用到不能忽略,则放在此处白名单
         return StrUtil.equalsAnyIgnoreCase(javaField, "parentId", "orderNum", "remark");
     }
 
-    public String readConverterExp()
-    {
+    public String readConverterExp() {
         String remarks = StrUtil.subBetween(this.columnComment, "(", ")");
         StringBuffer sb = new StringBuffer();
-        if (StrUtil.isNotEmpty(remarks))
-        {
-            for (String value : remarks.split(" "))
-            {
-                if (StrUtil.isNotEmpty(value))
-                {
+        if (StrUtil.isNotEmpty(remarks)) {
+            for (String value : remarks.split(" ")) {
+                if (StrUtil.isNotEmpty(value)) {
                     Object startStr = value.subSequence(0, 1);
                     String endStr = value.substring(1);
                     sb.append("").append(startStr).append("=").append(endStr).append(",");
                 }
             }
             return sb.deleteCharAt(sb.length() - 1).toString();
-        }
-        else
-        {
+        } else {
             return this.columnComment;
         }
     }

+ 3 - 43
ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java

@@ -7,56 +7,16 @@ import java.util.List;
 
 /**
  * 业务字段 数据层
- * 
+ *
  * @author ruoyi
  */
-public interface GenTableColumnMapper extends BaseMapper<GenTableColumn>
-{
+public interface GenTableColumnMapper extends BaseMapper<GenTableColumn> {
     /**
      * 根据表名称查询列信息
-     * 
+     *
      * @param tableName 表名称
      * @return 列信息
      */
     public List<GenTableColumn> selectDbTableColumnsByName(String tableName);
 
-    /**
-     * 查询业务字段列表
-     * 
-     * @param tableId 业务字段编号
-     * @return 业务字段集合
-     */
-    public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId);
-
-    /**
-     * 新增业务字段
-     * 
-     * @param genTableColumn 业务字段信息
-     * @return 结果
-     */
-    public int insertGenTableColumn(GenTableColumn genTableColumn);
-
-    /**
-     * 修改业务字段
-     * 
-     * @param genTableColumn 业务字段信息
-     * @return 结果
-     */
-    public int updateGenTableColumn(GenTableColumn genTableColumn);
-
-    /**
-     * 删除业务字段
-     * 
-     * @param genTableColumns 列数据
-     * @return 结果
-     */
-    public int deleteGenTableColumns(List<GenTableColumn> genTableColumns);
-
-    /**
-     * 批量删除业务字段
-     * 
-     * @param ids 需要删除的数据ID
-     * @return 结果
-     */
-    public int deleteGenTableColumnByIds(Long[] ids);
 }

+ 7 - 31
ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java

@@ -7,14 +7,13 @@ import java.util.List;
 
 /**
  * 业务 数据层
- * 
+ *
  * @author ruoyi
  */
-public interface GenTableMapper extends BaseMapper<GenTable>
-{
+public interface GenTableMapper extends BaseMapper<GenTable> {
     /**
      * 查询业务列表
-     * 
+     *
      * @param genTable 业务信息
      * @return 业务集合
      */
@@ -22,7 +21,7 @@ public interface GenTableMapper extends BaseMapper<GenTable>
 
     /**
      * 查询据库列表
-     * 
+     *
      * @param genTable 业务信息
      * @return 数据库表集合
      */
@@ -30,7 +29,7 @@ public interface GenTableMapper extends BaseMapper<GenTable>
 
     /**
      * 查询据库列表
-     * 
+     *
      * @param tableNames 表名称组
      * @return 数据库表集合
      */
@@ -45,7 +44,7 @@ public interface GenTableMapper extends BaseMapper<GenTable>
 
     /**
      * 查询表ID业务信息
-     * 
+     *
      * @param id 业务ID
      * @return 业务信息
      */
@@ -53,33 +52,10 @@ public interface GenTableMapper extends BaseMapper<GenTable>
 
     /**
      * 查询表名称业务信息
-     * 
+     *
      * @param tableName 表名称
      * @return 业务信息
      */
     public GenTable selectGenTableByName(String tableName);
 
-    /**
-     * 新增业务
-     * 
-     * @param genTable 业务信息
-     * @return 结果
-     */
-    public int insertGenTable(GenTable genTable);
-
-    /**
-     * 修改业务
-     * 
-     * @param genTable 业务信息
-     * @return 结果
-     */
-    public int updateGenTable(GenTable genTable);
-
-    /**
-     * 批量删除业务
-     * 
-     * @param ids 需要删除的数据ID
-     * @return 结果
-     */
-    public int deleteGenTableByIds(Long[] ids);
 }

+ 34 - 39
ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java

@@ -1,70 +1,65 @@
 package com.ruoyi.generator.service;
 
-import java.util.List;
-
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import cn.hutool.core.convert.Convert;
 import com.ruoyi.generator.domain.GenTableColumn;
 import com.ruoyi.generator.mapper.GenTableColumnMapper;
+import org.springframework.stereotype.Service;
+
+import java.util.Arrays;
+import java.util.List;
 
 /**
  * 业务字段 服务层实现
- * 
+ *
  * @author ruoyi
  */
 @Service
-public class GenTableColumnServiceImpl extends ServiceImpl<GenTableColumnMapper, GenTableColumn> implements IGenTableColumnService
-{
-	@Autowired
-	private GenTableColumnMapper genTableColumnMapper;
+public class GenTableColumnServiceImpl extends ServiceImpl<GenTableColumnMapper, GenTableColumn> implements IGenTableColumnService {
 
-	/**
+    /**
      * 查询业务字段列表
-     * 
+     *
      * @param tableId 业务字段编号
      * @return 业务字段集合
      */
-	@Override
-	public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId)
-	{
-	    return genTableColumnMapper.selectGenTableColumnListByTableId(tableId);
-	}
-	
+    @Override
+    public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId) {
+        return list(new LambdaQueryWrapper<GenTableColumn>()
+                .eq(GenTableColumn::getTableId,tableId)
+                .orderByAsc(GenTableColumn::getSort));
+    }
+
     /**
      * 新增业务字段
-     * 
+     *
      * @param genTableColumn 业务字段信息
      * @return 结果
      */
-	@Override
-	public int insertGenTableColumn(GenTableColumn genTableColumn)
-	{
-	    return genTableColumnMapper.insertGenTableColumn(genTableColumn);
-	}
-	
-	/**
+    @Override
+    public int insertGenTableColumn(GenTableColumn genTableColumn) {
+        return baseMapper.insert(genTableColumn);
+    }
+
+    /**
      * 修改业务字段
-     * 
+     *
      * @param genTableColumn 业务字段信息
      * @return 结果
      */
-	@Override
-	public int updateGenTableColumn(GenTableColumn genTableColumn)
-	{
-	    return genTableColumnMapper.updateGenTableColumn(genTableColumn);
-	}
+    @Override
+    public int updateGenTableColumn(GenTableColumn genTableColumn) {
+        return baseMapper.updateById(genTableColumn);
+    }
 
-	/**
+    /**
      * 删除业务字段对象
-     * 
+     *
      * @param ids 需要删除的数据ID
      * @return 结果
      */
-	@Override
-	public int deleteGenTableColumnByIds(String ids)
-	{
-		return genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids));
-	}
+    @Override
+    public int deleteGenTableColumnByIds(String ids) {
+        return baseMapper.deleteBatchIds(Arrays.asList(ids.split(",")));
+    }
 }

+ 100 - 163
ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.constant.Constants;
 import com.ruoyi.common.constant.GenConstants;
@@ -18,12 +19,11 @@ import com.ruoyi.generator.mapper.GenTableMapper;
 import com.ruoyi.generator.util.GenUtils;
 import com.ruoyi.generator.util.VelocityInitializer;
 import com.ruoyi.generator.util.VelocityUtils;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.io.IOUtils;
 import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.Velocity;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -32,6 +32,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.StringWriter;
+import java.util.Arrays;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -41,68 +42,60 @@ import java.util.zip.ZipOutputStream;
 
 /**
  * 业务 服务层实现
- * 
+ *
  * @author ruoyi
  */
+@Slf4j
 @Service
-public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> implements IGenTableService
-{
-    private static final Logger log = LoggerFactory.getLogger(GenTableServiceImpl.class);
-
-    @Autowired
-    private GenTableMapper genTableMapper;
+public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> implements IGenTableService {
 
     @Autowired
     private GenTableColumnMapper genTableColumnMapper;
 
     /**
      * 查询业务信息
-     * 
+     *
      * @param id 业务ID
      * @return 业务信息
      */
     @Override
-    public GenTable selectGenTableById(Long id)
-    {
-        GenTable genTable = genTableMapper.selectGenTableById(id);
+    public GenTable selectGenTableById(Long id) {
+        GenTable genTable = baseMapper.selectGenTableById(id);
         setTableFromOptions(genTable);
         return genTable;
     }
 
     /**
      * 查询业务列表
-     * 
+     *
      * @param genTable 业务信息
      * @return 业务集合
      */
     @Override
-    public List<GenTable> selectGenTableList(GenTable genTable)
-    {
-        return genTableMapper.selectGenTableList(genTable);
+    public List<GenTable> selectGenTableList(GenTable genTable) {
+        return baseMapper.selectGenTableList(genTable);
     }
 
     /**
      * 查询据库列表
-     * 
+     *
      * @param genTable 业务信息
      * @return 数据库表集合
      */
     @Override
-    public List<GenTable> selectDbTableList(GenTable genTable)
-    {
-        return genTableMapper.selectDbTableList(genTable);
+    public List<GenTable> selectDbTableList(GenTable genTable) {
+        return baseMapper.selectDbTableList(genTable);
     }
 
     /**
      * 查询据库列表
-     * 
+     *
      * @param tableNames 表名称组
      * @return 数据库表集合
      */
     @Override
-    public List<GenTable> selectDbTableListByNames(String[] tableNames)
-    {
-        return genTableMapper.selectDbTableListByNames(tableNames);
+    public List<GenTable> selectDbTableListByNames(String[] tableNames) {
+        return baseMapper.selectDbTableListByNames(tableNames);
     }
 
     /**
@@ -111,94 +104,82 @@ public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> i
      * @return 表信息集合
      */
     @Override
-    public List<GenTable> selectGenTableAll()
-    {
-        return genTableMapper.selectGenTableAll();
+    public List<GenTable> selectGenTableAll() {
+        return baseMapper.selectGenTableAll();
     }
 
     /**
      * 修改业务
-     * 
+     *
      * @param genTable 业务信息
      * @return 结果
      */
     @Override
     @Transactional
-    public void updateGenTable(GenTable genTable)
-    {
+    public void updateGenTable(GenTable genTable) {
         String options = JSON.toJSONString(genTable.getParams());
         genTable.setOptions(options);
-        int row = genTableMapper.updateGenTable(genTable);
-        if (row > 0)
-        {
-            for (GenTableColumn cenTableColumn : genTable.getColumns())
-            {
-                genTableColumnMapper.updateGenTableColumn(cenTableColumn);
+        int row = baseMapper.updateById(genTable);
+        if (row > 0) {
+            for (GenTableColumn cenTableColumn : genTable.getColumns()) {
+                genTableColumnMapper.updateById(cenTableColumn);
             }
         }
     }
 
     /**
      * 删除业务对象
-     * 
+     *
      * @param tableIds 需要删除的数据ID
      * @return 结果
      */
     @Override
     @Transactional
-    public void deleteGenTableByIds(Long[] tableIds)
-    {
-        genTableMapper.deleteGenTableByIds(tableIds);
-        genTableColumnMapper.deleteGenTableColumnByIds(tableIds);
+    public void deleteGenTableByIds(Long[] tableIds) {
+        List<Long> ids = Arrays.asList(tableIds);
+        removeByIds(ids);
+        genTableColumnMapper.delete(new LambdaQueryWrapper<GenTableColumn>().in(GenTableColumn::getTableId, ids));
     }
 
     /**
      * 导入表结构
-     * 
+     *
      * @param tableList 导入表列表
      */
     @Override
     @Transactional
-    public void importGenTable(List<GenTable> tableList)
-    {
+    public void importGenTable(List<GenTable> tableList) {
         String operName = SecurityUtils.getUsername();
-        try
-        {
-            for (GenTable table : tableList)
-            {
+        try {
+            for (GenTable table : tableList) {
                 String tableName = table.getTableName();
                 GenUtils.initTable(table, operName);
-                int row = genTableMapper.insertGenTable(table);
-                if (row > 0)
-                {
+                int row = baseMapper.insert(table);
+                if (row > 0) {
                     // 保存列信息
                     List<GenTableColumn> genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
-                    for (GenTableColumn column : genTableColumns)
-                    {
+                    for (GenTableColumn column : genTableColumns) {
                         GenUtils.initColumnField(column, table);
-                        genTableColumnMapper.insertGenTableColumn(column);
+                        genTableColumnMapper.insert(column);
                     }
                 }
             }
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             throw new CustomException("导入失败:" + e.getMessage());
         }
     }
 
     /**
      * 预览代码
-     * 
+     *
      * @param tableId 表编号
      * @return 预览数据列表
      */
     @Override
-    public Map<String, String> previewCode(Long tableId)
-    {
+    public Map<String, String> previewCode(Long tableId) {
         Map<String, String> dataMap = new LinkedHashMap<>();
         // 查询表信息
-        GenTable table = genTableMapper.selectGenTableById(tableId);
+        GenTable table = baseMapper.selectGenTableById(tableId);
         // 设置主子表信息
         setSubTable(table);
         // 设置主键列信息
@@ -209,8 +190,7 @@ public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> i
 
         // 获取模板列表
         List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
-        for (String template : templates)
-        {
+        for (String template : templates) {
             // 渲染模板
             StringWriter sw = new StringWriter();
             Template tpl = Velocity.getTemplate(template, Constants.UTF8);
@@ -222,13 +202,12 @@ public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> i
 
     /**
      * 生成代码(下载方式)
-     * 
+     *
      * @param tableName 表名称
      * @return 数据
      */
     @Override
-    public byte[] downloadCode(String tableName)
-    {
+    public byte[] downloadCode(String tableName) {
         ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
         ZipOutputStream zip = new ZipOutputStream(outputStream);
         generatorCode(tableName, zip);
@@ -238,14 +217,13 @@ public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> i
 
     /**
      * 生成代码(自定义路径)
-     * 
+     *
      * @param tableName 表名称
      */
     @Override
-    public void generatorCode(String tableName)
-    {
+    public void generatorCode(String tableName) {
         // 查询表信息
-        GenTable table = genTableMapper.selectGenTableByName(tableName);
+        GenTable table = baseMapper.selectGenTableByName(tableName);
         // 设置主子表信息
         setSubTable(table);
         // 设置主键列信息
@@ -257,21 +235,16 @@ public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> i
 
         // 获取模板列表
         List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
-        for (String template : templates)
-        {
-            if (!StrUtil.containsAny(template, "sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm"))
-            {
+        for (String template : templates) {
+            if (!StrUtil.containsAny(template, "sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm")) {
                 // 渲染模板
                 StringWriter sw = new StringWriter();
                 Template tpl = Velocity.getTemplate(template, Constants.UTF8);
                 tpl.merge(context, sw);
-                try
-                {
+                try {
                     String path = getGenPath(table, template);
                     FileUtils.writeStringToFile(new File(path), sw.toString(), Constants.UTF8);
-                }
-                catch (IOException e)
-                {
+                } catch (IOException e) {
                     throw new CustomException("渲染模板失败,表名:" + table.getTableName());
                 }
             }
@@ -280,52 +253,47 @@ public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> i
 
     /**
      * 同步数据库
-     * 
+     *
      * @param tableName 表名称
      */
     @Override
     @Transactional
-    public void synchDb(String tableName)
-    {
-        GenTable table = genTableMapper.selectGenTableByName(tableName);
+    public void synchDb(String tableName) {
+        GenTable table = baseMapper.selectGenTableByName(tableName);
         List<GenTableColumn> tableColumns = table.getColumns();
         List<String> tableColumnNames = tableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
 
         List<GenTableColumn> dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
-        if (Validator.isEmpty(dbTableColumns))
-        {
+        if (Validator.isEmpty(dbTableColumns)) {
             throw new CustomException("同步数据失败,原表结构不存在");
         }
         List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
 
         dbTableColumns.forEach(column -> {
-            if (!tableColumnNames.contains(column.getColumnName()))
-            {
+            if (!tableColumnNames.contains(column.getColumnName())) {
                 GenUtils.initColumnField(column, table);
-                genTableColumnMapper.insertGenTableColumn(column);
+                genTableColumnMapper.insert(column);
             }
         });
 
         List<GenTableColumn> delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList());
-        if (CollUtil.isNotEmpty(delColumns))
-        {
-            genTableColumnMapper.deleteGenTableColumns(delColumns);
+        if (CollUtil.isNotEmpty(delColumns)) {
+            List<Long> ids = delColumns.stream().map(GenTableColumn::getColumnId).collect(Collectors.toList());
+            genTableColumnMapper.deleteBatchIds(ids);
         }
     }
 
     /**
      * 批量生成代码(下载方式)
-     * 
+     *
      * @param tableNames 表数组
      * @return 数据
      */
     @Override
-    public byte[] downloadCode(String[] tableNames)
-    {
+    public byte[] downloadCode(String[] tableNames) {
         ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
         ZipOutputStream zip = new ZipOutputStream(outputStream);
-        for (String tableName : tableNames)
-        {
+        for (String tableName : tableNames) {
             generatorCode(tableName, zip);
         }
         IOUtils.closeQuietly(zip);
@@ -335,10 +303,9 @@ public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> i
     /**
      * 查询表信息并生成代码
      */
-    private void generatorCode(String tableName, ZipOutputStream zip)
-    {
+    private void generatorCode(String tableName, ZipOutputStream zip) {
         // 查询表信息
-        GenTable table = genTableMapper.selectGenTableByName(tableName);
+        GenTable table = baseMapper.selectGenTableByName(tableName);
         // 设置主子表信息
         setSubTable(table);
         // 设置主键列信息
@@ -350,23 +317,19 @@ public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> i
 
         // 获取模板列表
         List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
-        for (String template : templates)
-        {
+        for (String template : templates) {
             // 渲染模板
             StringWriter sw = new StringWriter();
             Template tpl = Velocity.getTemplate(template, Constants.UTF8);
             tpl.merge(context, sw);
-            try
-            {
+            try {
                 // 添加到zip
                 zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table)));
                 IOUtils.write(sw.toString(), zip, Constants.UTF8);
                 IOUtils.closeQuietly(sw);
-				zip.flush();
+                zip.flush();
                 zip.closeEntry();
-            }
-            catch (IOException e)
-            {
+            } catch (IOException e) {
                 log.error("渲染模板失败,表名:" + table.getTableName(), e);
             }
         }
@@ -374,36 +337,24 @@ public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> i
 
     /**
      * 修改保存参数校验
-     * 
+     *
      * @param genTable 业务信息
      */
     @Override
-    public void validateEdit(GenTable genTable)
-    {
-        if (GenConstants.TPL_TREE.equals(genTable.getTplCategory()))
-        {
+    public void validateEdit(GenTable genTable) {
+        if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) {
             String options = JSON.toJSONString(genTable.getParams());
             JSONObject paramsObj = JSONObject.parseObject(options);
-            if (Validator.isEmpty(paramsObj.getString(GenConstants.TREE_CODE)))
-            {
+            if (Validator.isEmpty(paramsObj.getString(GenConstants.TREE_CODE))) {
                 throw new CustomException("树编码字段不能为空");
-            }
-            else if (Validator.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE)))
-            {
+            } else if (Validator.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE))) {
                 throw new CustomException("树父编码字段不能为空");
-            }
-            else if (Validator.isEmpty(paramsObj.getString(GenConstants.TREE_NAME)))
-            {
+            } else if (Validator.isEmpty(paramsObj.getString(GenConstants.TREE_NAME))) {
                 throw new CustomException("树名称字段不能为空");
-            }
-            else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory()))
-            {
-                if (Validator.isEmpty(genTable.getSubTableName()))
-                {
+            } else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) {
+                if (Validator.isEmpty(genTable.getSubTableName())) {
                     throw new CustomException("关联子表的表名不能为空");
-                }
-                else if (Validator.isEmpty(genTable.getSubTableFkName()))
-                {
+                } else if (Validator.isEmpty(genTable.getSubTableFkName())) {
                     throw new CustomException("子表关联的外键名不能为空");
                 }
             }
@@ -412,35 +363,27 @@ public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> i
 
     /**
      * 设置主键列信息
-     * 
+     *
      * @param table 业务表信息
      */
-    public void setPkColumn(GenTable table)
-    {
-        for (GenTableColumn column : table.getColumns())
-        {
-            if (column.isPk())
-            {
+    public void setPkColumn(GenTable table) {
+        for (GenTableColumn column : table.getColumns()) {
+            if (column.isPk()) {
                 table.setPkColumn(column);
                 break;
             }
         }
-        if (Validator.isNull(table.getPkColumn()))
-        {
+        if (Validator.isNull(table.getPkColumn())) {
             table.setPkColumn(table.getColumns().get(0));
         }
-        if (GenConstants.TPL_SUB.equals(table.getTplCategory()))
-        {
-            for (GenTableColumn column : table.getSubTable().getColumns())
-            {
-                if (column.isPk())
-                {
+        if (GenConstants.TPL_SUB.equals(table.getTplCategory())) {
+            for (GenTableColumn column : table.getSubTable().getColumns()) {
+                if (column.isPk()) {
                     table.getSubTable().setPkColumn(column);
                     break;
                 }
             }
-            if (Validator.isNull(table.getSubTable().getPkColumn()))
-            {
+            if (Validator.isNull(table.getSubTable().getPkColumn())) {
                 table.getSubTable().setPkColumn(table.getSubTable().getColumns().get(0));
             }
         }
@@ -451,31 +394,27 @@ public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> i
      *
      * @param table 业务表信息
      */
-    public void setSubTable(GenTable table)
-    {
+    public void setSubTable(GenTable table) {
         String subTableName = table.getSubTableName();
-        if (Validator.isNotEmpty(subTableName))
-        {
-            table.setSubTable(genTableMapper.selectGenTableByName(subTableName));
+        if (Validator.isNotEmpty(subTableName)) {
+            table.setSubTable(baseMapper.selectGenTableByName(subTableName));
         }
     }
 
     /**
      * 设置代码生成其他选项值
-     * 
+     *
      * @param genTable 设置后的生成对象
      */
-    public void setTableFromOptions(GenTable genTable)
-    {
+    public void setTableFromOptions(GenTable genTable) {
         JSONObject paramsObj = JSONObject.parseObject(genTable.getOptions());
-        if (Validator.isNotNull(paramsObj))
-        {
+        if (Validator.isNotNull(paramsObj)) {
             String treeCode = paramsObj.getString(GenConstants.TREE_CODE);
             String treeParentCode = paramsObj.getString(GenConstants.TREE_PARENT_CODE);
             String treeName = paramsObj.getString(GenConstants.TREE_NAME);
             String parentMenuId = paramsObj.getString(GenConstants.PARENT_MENU_ID);
             String parentMenuName = paramsObj.getString(GenConstants.PARENT_MENU_NAME);
-            
+
             genTable.setTreeCode(treeCode);
             genTable.setTreeParentCode(treeParentCode);
             genTable.setTreeName(treeName);
@@ -486,16 +425,14 @@ public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> i
 
     /**
      * 获取代码生成地址
-     * 
-     * @param table 业务表信息
+     *
+     * @param table    业务表信息
      * @param template 模板文件路径
      * @return 生成地址
      */
-    public static String getGenPath(GenTable table, String template)
-    {
+    public static String getGenPath(GenTable table, String template) {
         String genPath = table.getGenPath();
-        if (StrUtil.equals(genPath, "/"))
-        {
+        if (StrUtil.equals(genPath, "/")) {
             return System.getProperty("user.dir") + File.separator + "src" + File.separator + VelocityUtils.getFileName(template, table);
         }
         return genPath + File.separator + VelocityUtils.getFileName(template, table);

+ 6 - 7
ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java

@@ -7,14 +7,13 @@ import java.util.List;
 
 /**
  * 业务字段 服务层
- * 
+ *
  * @author ruoyi
  */
-public interface IGenTableColumnService extends IService<GenTableColumn>
-{
+public interface IGenTableColumnService extends IService<GenTableColumn> {
     /**
      * 查询业务字段列表
-     * 
+     *
      * @param tableId 业务字段编号
      * @return 业务字段集合
      */
@@ -22,7 +21,7 @@ public interface IGenTableColumnService extends IService<GenTableColumn>
 
     /**
      * 新增业务字段
-     * 
+     *
      * @param genTableColumn 业务字段信息
      * @return 结果
      */
@@ -30,7 +29,7 @@ public interface IGenTableColumnService extends IService<GenTableColumn>
 
     /**
      * 修改业务字段
-     * 
+     *
      * @param genTableColumn 业务字段信息
      * @return 结果
      */
@@ -38,7 +37,7 @@ public interface IGenTableColumnService extends IService<GenTableColumn>
 
     /**
      * 删除业务字段信息
-     * 
+     *
      * @param ids 需要删除的数据ID
      * @return 结果
      */

+ 15 - 16
ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java

@@ -8,14 +8,13 @@ import java.util.Map;
 
 /**
  * 业务 服务层
- * 
+ *
  * @author ruoyi
  */
-public interface IGenTableService extends IService<GenTable>
-{
+public interface IGenTableService extends IService<GenTable> {
     /**
      * 查询业务列表
-     * 
+     *
      * @param genTable 业务信息
      * @return 业务集合
      */
@@ -23,7 +22,7 @@ public interface IGenTableService extends IService<GenTable>
 
     /**
      * 查询据库列表
-     * 
+     *
      * @param genTable 业务信息
      * @return 数据库表集合
      */
@@ -31,7 +30,7 @@ public interface IGenTableService extends IService<GenTable>
 
     /**
      * 查询据库列表
-     * 
+     *
      * @param tableNames 表名称组
      * @return 数据库表集合
      */
@@ -46,7 +45,7 @@ public interface IGenTableService extends IService<GenTable>
 
     /**
      * 查询业务信息
-     * 
+     *
      * @param id 业务ID
      * @return 业务信息
      */
@@ -54,7 +53,7 @@ public interface IGenTableService extends IService<GenTable>
 
     /**
      * 修改业务
-     * 
+     *
      * @param genTable 业务信息
      * @return 结果
      */
@@ -62,7 +61,7 @@ public interface IGenTableService extends IService<GenTable>
 
     /**
      * 删除业务信息
-     * 
+     *
      * @param tableIds 需要删除的表数据ID
      * @return 结果
      */
@@ -70,14 +69,14 @@ public interface IGenTableService extends IService<GenTable>
 
     /**
      * 导入表结构
-     * 
+     *
      * @param tableList 导入表列表
      */
     public void importGenTable(List<GenTable> tableList);
 
     /**
      * 预览代码
-     * 
+     *
      * @param tableId 表编号
      * @return 预览数据列表
      */
@@ -85,7 +84,7 @@ public interface IGenTableService extends IService<GenTable>
 
     /**
      * 生成代码(下载方式)
-     * 
+     *
      * @param tableName 表名称
      * @return 数据
      */
@@ -93,7 +92,7 @@ public interface IGenTableService extends IService<GenTable>
 
     /**
      * 生成代码(自定义路径)
-     * 
+     *
      * @param tableName 表名称
      * @return 数据
      */
@@ -101,14 +100,14 @@ public interface IGenTableService extends IService<GenTable>
 
     /**
      * 同步数据库
-     * 
+     *
      * @param tableName 表名称
      */
     public void synchDb(String tableName);
 
     /**
      * 批量生成代码(下载方式)
-     * 
+     *
      * @param tableNames 表数组
      * @return 数据
      */
@@ -116,7 +115,7 @@ public interface IGenTableService extends IService<GenTable>
 
     /**
      * 修改保存参数校验
-     * 
+     *
      * @param genTable 业务信息
      */
     public void validateEdit(GenTable genTable);

+ 0 - 89
ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml

@@ -28,100 +28,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateBy"       column="update_by"      />
         <result property="updateTime"     column="update_time"    />
     </resultMap>
-	
-	<sql id="selectGenTableColumnVo">
-        select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column
-    </sql>
-	
-    <select id="selectGenTableColumnListByTableId" parameterType="Long" resultMap="GenTableColumnResult">
-        <include refid="selectGenTableColumnVo"/>
-        where table_id = #{tableId}
-        order by sort
-    </select>
     
     <select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult">
 		select column_name, (case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else null end) as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort, column_comment, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type
 		from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName})
 		order by ordinal_position
 	</select>
-    
-    <insert id="insertGenTableColumn" parameterType="GenTableColumn" useGeneratedKeys="true" keyProperty="columnId">
-        insert into gen_table_column (
-			<if test="tableId != null and tableId != ''">table_id,</if>
-			<if test="columnName != null and columnName != ''">column_name,</if>
-			<if test="columnComment != null and columnComment != ''">column_comment,</if>
-			<if test="columnType != null and columnType != ''">column_type,</if>
-			<if test="javaType != null and javaType != ''">java_type,</if>
-			<if test="javaField != null  and javaField != ''">java_field,</if>
-			<if test="isPk != null and isPk != ''">is_pk,</if>
-			<if test="isIncrement != null and isIncrement != ''">is_increment,</if>
-			<if test="isRequired != null and isRequired != ''">is_required,</if>
-			<if test="isInsert != null and isInsert != ''">is_insert,</if>
-			<if test="isEdit != null and isEdit != ''">is_edit,</if>
-			<if test="isList != null and isList != ''">is_list,</if>
-			<if test="isQuery != null and isQuery != ''">is_query,</if>
-			<if test="queryType != null and queryType != ''">query_type,</if>
-			<if test="htmlType != null and htmlType != ''">html_type,</if>
-			<if test="dictType != null and dictType != ''">dict_type,</if>
-			<if test="sort != null">sort,</if>
-			<if test="createBy != null and createBy != ''">create_by,</if>
-			create_time
-         )values(
-			<if test="tableId != null and tableId != ''">#{tableId},</if>
-			<if test="columnName != null and columnName != ''">#{columnName},</if>
-			<if test="columnComment != null and columnComment != ''">#{columnComment},</if>
-			<if test="columnType != null and columnType != ''">#{columnType},</if>
-			<if test="javaType != null and javaType != ''">#{javaType},</if>
-			<if test="javaField != null and javaField != ''">#{javaField},</if>
-			<if test="isPk != null and isPk != ''">#{isPk},</if>
-			<if test="isIncrement != null and isIncrement != ''">#{isIncrement},</if>
-			<if test="isRequired != null and isRequired != ''">#{isRequired},</if>
-			<if test="isInsert != null and isInsert != ''">#{isInsert},</if>
-			<if test="isEdit != null and isEdit != ''">#{isEdit},</if>
-			<if test="isList != null and isList != ''">#{isList},</if>
-			<if test="isQuery != null and isQuery != ''">#{isQuery},</if>
-			<if test="queryType != null and queryType != ''">#{queryType},</if>
-			<if test="htmlType != null and htmlType != ''">#{htmlType},</if>
-			<if test="dictType != null and dictType != ''">#{dictType},</if>
-			<if test="sort != null">#{sort},</if>
-			<if test="createBy != null and createBy != ''">#{createBy},</if>
-			sysdate()
-         )
-    </insert>
-	 
-    <update id="updateGenTableColumn" parameterType="GenTableColumn">
-        update gen_table_column
-        <set>
-            column_comment = #{columnComment},
-            java_type = #{javaType},
-            java_field = #{javaField},
-            is_insert = #{isInsert},
-            is_edit = #{isEdit},
-            is_list = #{isList},
-            is_query = #{isQuery},
-            is_required = #{isRequired},
-            query_type = #{queryType},
-            html_type = #{htmlType},
-            dict_type = #{dictType},
-            sort = #{sort},
-            update_by = #{updateBy},
-            update_time = sysdate()
-        </set>
-        where column_id = #{columnId}
-    </update>
-
-    <delete id="deleteGenTableColumnByIds" parameterType="Long">
-        delete from gen_table_column where table_id in 
-        <foreach collection="array" item="tableId" open="(" separator="," close=")">
-            #{tableId}
-        </foreach>
-    </delete>
-    
-    <delete id="deleteGenTableColumns">
-        delete from gen_table_column where column_id in 
-        <foreach collection="list" item="item" open="(" separator="," close=")">
-            #{item.columnId}
-        </foreach>
-    </delete>
 
 </mapper>

+ 0 - 65
ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml

@@ -133,69 +133,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		order by c.sort
 	</select>
 
-	<insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId">
-        insert into gen_table (
-			<if test="tableName != null">table_name,</if>
-			<if test="tableComment != null and tableComment != ''">table_comment,</if>
-			<if test="className != null and className != ''">class_name,</if>
-			<if test="tplCategory != null and tplCategory != ''">tpl_category,</if>
-			<if test="packageName != null and packageName != ''">package_name,</if>
-			<if test="moduleName != null and moduleName != ''">module_name,</if>
-			<if test="businessName != null and businessName != ''">business_name,</if>
-			<if test="functionName != null and functionName != ''">function_name,</if>
-			<if test="functionAuthor != null and functionAuthor != ''">function_author,</if>
-			<if test="genType != null and genType != ''">gen_type,</if>
-			<if test="genPath != null and genPath != ''">gen_path,</if>
-			<if test="remark != null and remark != ''">remark,</if>
- 			<if test="createBy != null and createBy != ''">create_by,</if>
-			create_time
-         )values(
-			<if test="tableName != null">#{tableName},</if>
-			<if test="tableComment != null and tableComment != ''">#{tableComment},</if>
-			<if test="className != null and className != ''">#{className},</if>
-			<if test="tplCategory != null and tplCategory != ''">#{tplCategory},</if>
-			<if test="packageName != null and packageName != ''">#{packageName},</if>
-			<if test="moduleName != null and moduleName != ''">#{moduleName},</if>
-			<if test="businessName != null and businessName != ''">#{businessName},</if>
-			<if test="functionName != null and functionName != ''">#{functionName},</if>
-			<if test="functionAuthor != null and functionAuthor != ''">#{functionAuthor},</if>
-			<if test="genType != null and genType != ''">#{genType},</if>
-			<if test="genPath != null and genPath != ''">#{genPath},</if>
-			<if test="remark != null and remark != ''">#{remark},</if>
- 			<if test="createBy != null and createBy != ''">#{createBy},</if>
-			sysdate()
-         )
-    </insert>
-    
-    <update id="updateGenTable" parameterType="GenTable">
-        update gen_table
-        <set>
-            <if test="tableName != null">table_name = #{tableName},</if>
-            <if test="tableComment != null and tableComment != ''">table_comment = #{tableComment},</if>
-            <if test="subTableName != null">sub_table_name = #{subTableName},</if>
-            <if test="subTableFkName != null">sub_table_fk_name = #{subTableFkName},</if>
-            <if test="className != null and className != ''">class_name = #{className},</if>
-            <if test="functionAuthor != null and functionAuthor != ''">function_author = #{functionAuthor},</if>
-            <if test="genType != null and genType != ''">gen_type = #{genType},</if>
-            <if test="genPath != null and genPath != ''">gen_path = #{genPath},</if>
-            <if test="tplCategory != null and tplCategory != ''">tpl_category = #{tplCategory},</if>
-            <if test="packageName != null and packageName != ''">package_name = #{packageName},</if>
-            <if test="moduleName != null and moduleName != ''">module_name = #{moduleName},</if>
-            <if test="businessName != null and businessName != ''">business_name = #{businessName},</if>
-            <if test="functionName != null and functionName != ''">function_name = #{functionName},</if>
-            <if test="options != null and options != ''">options = #{options},</if>
-            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
-            <if test="remark != null">remark = #{remark},</if>
-            update_time = sysdate()
-        </set>
-        where table_id = #{tableId}
-    </update>
-    
-    <delete id="deleteGenTableByIds" parameterType="Long">
-        delete from gen_table where table_id in 
-        <foreach collection="array" item="tableId" open="(" separator="," close=")">
-            #{tableId}
-        </foreach>
-    </delete>
-
 </mapper>

+ 2 - 55
ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java

@@ -3,64 +3,11 @@ package com.ruoyi.quartz.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ruoyi.quartz.domain.SysJobLog;
 
-import java.util.List;
-
 /**
  * 调度任务日志信息 数据层
- * 
+ *
  * @author ruoyi
  */
-public interface SysJobLogMapper extends BaseMapper<SysJobLog>
-{
-    /**
-     * 获取quartz调度器日志的计划任务
-     * 
-     * @param jobLog 调度日志信息
-     * @return 调度任务日志集合
-     */
-    public List<SysJobLog> selectJobLogList(SysJobLog jobLog);
-
-    /**
-     * 查询所有调度任务日志
-     *
-     * @return 调度任务日志列表
-     */
-    public List<SysJobLog> selectJobLogAll();
-
-    /**
-     * 通过调度任务日志ID查询调度信息
-     * 
-     * @param jobLogId 调度任务日志ID
-     * @return 调度任务日志对象信息
-     */
-    public SysJobLog selectJobLogById(Long jobLogId);
-
-    /**
-     * 新增任务日志
-     * 
-     * @param jobLog 调度日志信息
-     * @return 结果
-     */
-    public int insertJobLog(SysJobLog jobLog);
-
-    /**
-     * 批量删除调度日志信息
-     * 
-     * @param logIds 需要删除的数据ID
-     * @return 结果
-     */
-    public int deleteJobLogByIds(Long[] logIds);
-
-    /**
-     * 删除任务日志
-     * 
-     * @param jobId 调度日志ID
-     * @return 结果
-     */
-    public int deleteJobLogById(Long jobId);
+public interface SysJobLogMapper extends BaseMapper<SysJobLog> {
 
-    /**
-     * 清空任务日志
-     */
-    public void cleanJobLog();
 }

+ 2 - 58
ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobMapper.java

@@ -3,67 +3,11 @@ package com.ruoyi.quartz.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ruoyi.quartz.domain.SysJob;
 
-import java.util.List;
-
 /**
  * 调度任务信息 数据层
- * 
+ *
  * @author ruoyi
  */
-public interface SysJobMapper extends BaseMapper<SysJob>
-{
-    /**
-     * 查询调度任务日志集合
-     * 
-     * @param job 调度信息
-     * @return 操作日志集合
-     */
-    public List<SysJob> selectJobList(SysJob job);
-
-    /**
-     * 查询所有调度任务
-     * 
-     * @return 调度任务列表
-     */
-    public List<SysJob> selectJobAll();
-
-    /**
-     * 通过调度ID查询调度任务信息
-     * 
-     * @param jobId 调度ID
-     * @return 角色对象信息
-     */
-    public SysJob selectJobById(Long jobId);
-
-    /**
-     * 通过调度ID删除调度任务信息
-     * 
-     * @param jobId 调度ID
-     * @return 结果
-     */
-    public int deleteJobById(Long jobId);
-
-    /**
-     * 批量删除调度任务信息
-     * 
-     * @param ids 需要删除的数据ID
-     * @return 结果
-     */
-    public int deleteJobByIds(Long[] ids);
-
-    /**
-     * 修改调度任务信息
-     * 
-     * @param job 调度任务信息
-     * @return 结果
-     */
-    public int updateJob(SysJob job);
+public interface SysJobMapper extends BaseMapper<SysJob> {
 
-    /**
-     * 新增调度任务信息
-     * 
-     * @param job 调度任务信息
-     * @return 结果
-     */
-    public int insertJob(SysJob job);
 }

+ 7 - 8
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobLogService.java

@@ -7,14 +7,13 @@ import java.util.List;
 
 /**
  * 定时任务调度日志信息信息 服务层
- * 
+ *
  * @author ruoyi
  */
-public interface ISysJobLogService extends IService<SysJobLog>
-{
+public interface ISysJobLogService extends IService<SysJobLog> {
     /**
      * 获取quartz调度器日志的计划任务
-     * 
+     *
      * @param jobLog 调度日志信息
      * @return 调度任务日志集合
      */
@@ -22,7 +21,7 @@ public interface ISysJobLogService extends IService<SysJobLog>
 
     /**
      * 通过调度任务日志ID查询调度信息
-     * 
+     *
      * @param jobLogId 调度任务日志ID
      * @return 调度任务日志对象信息
      */
@@ -30,14 +29,14 @@ public interface ISysJobLogService extends IService<SysJobLog>
 
     /**
      * 新增任务日志
-     * 
+     *
      * @param jobLog 调度日志信息
      */
     public void addJobLog(SysJobLog jobLog);
 
     /**
      * 批量删除调度日志信息
-     * 
+     *
      * @param logIds 需要删除的日志ID
      * @return 结果
      */
@@ -45,7 +44,7 @@ public interface ISysJobLogService extends IService<SysJobLog>
 
     /**
      * 删除任务日志
-     * 
+     *
      * @param jobId 调度日志ID
      * @return 结果
      */

+ 13 - 14
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobService.java

@@ -9,14 +9,13 @@ import java.util.List;
 
 /**
  * 定时任务调度信息信息 服务层
- * 
+ *
  * @author ruoyi
  */
-public interface ISysJobService extends IService<SysJob>
-{
+public interface ISysJobService extends IService<SysJob> {
     /**
      * 获取quartz调度器的计划任务
-     * 
+     *
      * @param job 调度信息
      * @return 调度任务集合
      */
@@ -24,7 +23,7 @@ public interface ISysJobService extends IService<SysJob>
 
     /**
      * 通过调度任务ID查询调度信息
-     * 
+     *
      * @param jobId 调度任务ID
      * @return 调度任务对象信息
      */
@@ -32,7 +31,7 @@ public interface ISysJobService extends IService<SysJob>
 
     /**
      * 暂停任务
-     * 
+     *
      * @param job 调度信息
      * @return 结果
      */
@@ -40,7 +39,7 @@ public interface ISysJobService extends IService<SysJob>
 
     /**
      * 恢复任务
-     * 
+     *
      * @param job 调度信息
      * @return 结果
      */
@@ -48,7 +47,7 @@ public interface ISysJobService extends IService<SysJob>
 
     /**
      * 删除任务后,所对应的trigger也将被删除
-     * 
+     *
      * @param job 调度信息
      * @return 结果
      */
@@ -56,7 +55,7 @@ public interface ISysJobService extends IService<SysJob>
 
     /**
      * 批量删除调度信息
-     * 
+     *
      * @param jobIds 需要删除的任务ID
      * @return 结果
      */
@@ -64,7 +63,7 @@ public interface ISysJobService extends IService<SysJob>
 
     /**
      * 任务调度状态修改
-     * 
+     *
      * @param job 调度信息
      * @return 结果
      */
@@ -72,7 +71,7 @@ public interface ISysJobService extends IService<SysJob>
 
     /**
      * 立即运行任务
-     * 
+     *
      * @param job 调度信息
      * @return 结果
      */
@@ -80,7 +79,7 @@ public interface ISysJobService extends IService<SysJob>
 
     /**
      * 新增任务
-     * 
+     *
      * @param job 调度信息
      * @return 结果
      */
@@ -88,7 +87,7 @@ public interface ISysJobService extends IService<SysJob>
 
     /**
      * 更新任务
-     * 
+     *
      * @param job 调度信息
      * @return 结果
      */
@@ -96,7 +95,7 @@ public interface ISysJobService extends IService<SysJob>
 
     /**
      * 校验cron表达式是否有效
-     * 
+     *
      * @param cronExpression 表达式
      * @return 结果
      */

+ 38 - 32
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java

@@ -1,89 +1,95 @@
 package com.ruoyi.quartz.service.impl;
 
-import java.util.List;
-
+import cn.hutool.core.lang.Validator;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
 import com.ruoyi.quartz.domain.SysJobLog;
 import com.ruoyi.quartz.mapper.SysJobLogMapper;
 import com.ruoyi.quartz.service.ISysJobLogService;
+import org.springframework.stereotype.Service;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 定时任务调度日志信息 服务层
- * 
+ *
  * @author ruoyi
  */
 @Service
-public class SysJobLogServiceImpl extends ServiceImpl<SysJobLogMapper, SysJobLog> implements ISysJobLogService
-{
-    @Autowired
-    private SysJobLogMapper jobLogMapper;
+public class SysJobLogServiceImpl extends ServiceImpl<SysJobLogMapper, SysJobLog> implements ISysJobLogService {
 
     /**
      * 获取quartz调度器日志的计划任务
-     * 
+     *
      * @param jobLog 调度日志信息
      * @return 调度任务日志集合
      */
     @Override
-    public List<SysJobLog> selectJobLogList(SysJobLog jobLog)
-    {
-        return jobLogMapper.selectJobLogList(jobLog);
+    public List<SysJobLog> selectJobLogList(SysJobLog jobLog) {
+        Map<String, Object> params = jobLog.getParams();
+        return list(new LambdaQueryWrapper<SysJobLog>()
+                .like(StrUtil.isNotBlank(jobLog.getJobName()), SysJobLog::getJobName, jobLog.getJobName())
+                .eq(StrUtil.isNotBlank(jobLog.getJobGroup()), SysJobLog::getJobGroup, jobLog.getJobGroup())
+                .eq(StrUtil.isNotBlank(jobLog.getStatus()), SysJobLog::getStatus, jobLog.getStatus())
+                .like(StrUtil.isNotBlank(jobLog.getInvokeTarget()), SysJobLog::getInvokeTarget, jobLog.getInvokeTarget())
+                .apply(Validator.isNotEmpty(params.get("beginTime")),
+                        "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')",
+                        params.get("beginTime"))
+                .apply(Validator.isNotEmpty(params.get("endTime")),
+                        "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')",
+                        params.get("endTime")));
     }
 
     /**
      * 通过调度任务日志ID查询调度信息
-     * 
+     *
      * @param jobLogId 调度任务日志ID
      * @return 调度任务日志对象信息
      */
     @Override
-    public SysJobLog selectJobLogById(Long jobLogId)
-    {
-        return jobLogMapper.selectJobLogById(jobLogId);
+    public SysJobLog selectJobLogById(Long jobLogId) {
+        return getById(jobLogId);
     }
 
     /**
      * 新增任务日志
-     * 
+     *
      * @param jobLog 调度日志信息
      */
     @Override
-    public void addJobLog(SysJobLog jobLog)
-    {
-        jobLogMapper.insertJobLog(jobLog);
+    public void addJobLog(SysJobLog jobLog) {
+        baseMapper.insert(jobLog);
     }
 
     /**
      * 批量删除调度日志信息
-     * 
+     *
      * @param logIds 需要删除的数据ID
      * @return 结果
      */
     @Override
-    public int deleteJobLogByIds(Long[] logIds)
-    {
-        return jobLogMapper.deleteJobLogByIds(logIds);
+    public int deleteJobLogByIds(Long[] logIds) {
+        return baseMapper.deleteBatchIds(Arrays.asList(logIds));
     }
 
     /**
      * 删除任务日志
-     * 
+     *
      * @param jobId 调度日志ID
      */
     @Override
-    public int deleteJobLogById(Long jobId)
-    {
-        return jobLogMapper.deleteJobLogById(jobId);
+    public int deleteJobLogById(Long jobId) {
+        return baseMapper.deleteById(jobId);
     }
 
     /**
      * 清空任务日志
      */
     @Override
-    public void cleanJobLog()
-    {
-        jobLogMapper.cleanJobLog();
+    public void cleanJobLog() {
+        remove(new LambdaQueryWrapper<>());
     }
 }

+ 63 - 85
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java

@@ -1,16 +1,8 @@
 package com.ruoyi.quartz.service.impl;
 
-import java.util.List;
-import javax.annotation.PostConstruct;
-
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.quartz.JobDataMap;
-import org.quartz.JobKey;
-import org.quartz.Scheduler;
-import org.quartz.SchedulerException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 import com.ruoyi.common.constant.ScheduleConstants;
 import com.ruoyi.common.exception.job.TaskException;
 import com.ruoyi.quartz.domain.SysJob;
@@ -18,74 +10,78 @@ import com.ruoyi.quartz.mapper.SysJobMapper;
 import com.ruoyi.quartz.service.ISysJobService;
 import com.ruoyi.quartz.util.CronUtils;
 import com.ruoyi.quartz.util.ScheduleUtils;
+import org.quartz.JobDataMap;
+import org.quartz.JobKey;
+import org.quartz.Scheduler;
+import org.quartz.SchedulerException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.PostConstruct;
+import java.util.List;
 
 /**
  * 定时任务调度信息 服务层
- * 
+ *
  * @author ruoyi
  */
 @Service
-public class SysJobServiceImpl extends ServiceImpl<SysJobMapper, SysJob> implements ISysJobService
-{
+public class SysJobServiceImpl extends ServiceImpl<SysJobMapper, SysJob> implements ISysJobService {
     @Autowired
     private Scheduler scheduler;
 
-    @Autowired
-    private SysJobMapper jobMapper;
-
     /**
      * 项目启动时,初始化定时器 主要是防止手动修改数据库导致未同步到定时任务处理(注:不能手动修改数据库ID和任务组名,否则会导致脏数据)
      */
     @PostConstruct
-    public void init() throws SchedulerException, TaskException
-    {
+    public void init() throws SchedulerException, TaskException {
         scheduler.clear();
-        List<SysJob> jobList = jobMapper.selectJobAll();
-        for (SysJob job : jobList)
-        {
+        List<SysJob> jobList = list();
+        for (SysJob job : jobList) {
             ScheduleUtils.createScheduleJob(scheduler, job);
         }
     }
 
     /**
      * 获取quartz调度器的计划任务列表
-     * 
+     *
      * @param job 调度信息
      * @return
      */
     @Override
-    public List<SysJob> selectJobList(SysJob job)
-    {
-        return jobMapper.selectJobList(job);
+    public List<SysJob> selectJobList(SysJob job) {
+        return list(new LambdaQueryWrapper<SysJob>()
+                .like(StrUtil.isNotBlank(job.getJobName()), SysJob::getJobName, job.getJobName())
+                .eq(StrUtil.isNotBlank(job.getJobGroup()), SysJob::getJobGroup, job.getJobGroup())
+                .eq(StrUtil.isNotBlank(job.getStatus()), SysJob::getStatus, job.getStatus())
+                .like(StrUtil.isNotBlank(job.getInvokeTarget()), SysJob::getInvokeTarget, job.getInvokeTarget()));
     }
 
     /**
      * 通过调度任务ID查询调度信息
-     * 
+     *
      * @param jobId 调度任务ID
      * @return 调度任务对象信息
      */
     @Override
-    public SysJob selectJobById(Long jobId)
-    {
-        return jobMapper.selectJobById(jobId);
+    public SysJob selectJobById(Long jobId) {
+        return getById(jobId);
     }
 
     /**
      * 暂停任务
-     * 
+     *
      * @param job 调度信息
      */
     @Override
     @Transactional
-    public int pauseJob(SysJob job) throws SchedulerException
-    {
+    public int pauseJob(SysJob job) throws SchedulerException {
         Long jobId = job.getJobId();
         String jobGroup = job.getJobGroup();
         job.setStatus(ScheduleConstants.Status.PAUSE.getValue());
-        int rows = jobMapper.updateJob(job);
-        if (rows > 0)
-        {
+        int rows = baseMapper.updateById(job);
+        if (rows > 0) {
             scheduler.pauseJob(ScheduleUtils.getJobKey(jobId, jobGroup));
         }
         return rows;
@@ -93,19 +89,17 @@ public class SysJobServiceImpl extends ServiceImpl<SysJobMapper, SysJob> impleme
 
     /**
      * 恢复任务
-     * 
+     *
      * @param job 调度信息
      */
     @Override
     @Transactional
-    public int resumeJob(SysJob job) throws SchedulerException
-    {
+    public int resumeJob(SysJob job) throws SchedulerException {
         Long jobId = job.getJobId();
         String jobGroup = job.getJobGroup();
         job.setStatus(ScheduleConstants.Status.NORMAL.getValue());
-        int rows = jobMapper.updateJob(job);
-        if (rows > 0)
-        {
+        int rows = baseMapper.updateById(job);
+        if (rows > 0) {
             scheduler.resumeJob(ScheduleUtils.getJobKey(jobId, jobGroup));
         }
         return rows;
@@ -113,18 +107,16 @@ public class SysJobServiceImpl extends ServiceImpl<SysJobMapper, SysJob> impleme
 
     /**
      * 删除任务后,所对应的trigger也将被删除
-     * 
+     *
      * @param job 调度信息
      */
     @Override
     @Transactional
-    public int deleteJob(SysJob job) throws SchedulerException
-    {
+    public int deleteJob(SysJob job) throws SchedulerException {
         Long jobId = job.getJobId();
         String jobGroup = job.getJobGroup();
-        int rows = jobMapper.deleteJobById(jobId);
-        if (rows > 0)
-        {
+        int rows = baseMapper.deleteById(jobId);
+        if (rows > 0) {
             scheduler.deleteJob(ScheduleUtils.getJobKey(jobId, jobGroup));
         }
         return rows;
@@ -132,38 +124,32 @@ public class SysJobServiceImpl extends ServiceImpl<SysJobMapper, SysJob> impleme
 
     /**
      * 批量删除调度信息
-     * 
+     *
      * @param jobIds 需要删除的任务ID
      * @return 结果
      */
     @Override
     @Transactional
-    public void deleteJobByIds(Long[] jobIds) throws SchedulerException
-    {
-        for (Long jobId : jobIds)
-        {
-            SysJob job = jobMapper.selectJobById(jobId);
+    public void deleteJobByIds(Long[] jobIds) throws SchedulerException {
+        for (Long jobId : jobIds) {
+            SysJob job = getById(jobId);
             deleteJob(job);
         }
     }
 
     /**
      * 任务调度状态修改
-     * 
+     *
      * @param job 调度信息
      */
     @Override
     @Transactional
-    public int changeStatus(SysJob job) throws SchedulerException
-    {
+    public int changeStatus(SysJob job) throws SchedulerException {
         int rows = 0;
         String status = job.getStatus();
-        if (ScheduleConstants.Status.NORMAL.getValue().equals(status))
-        {
+        if (ScheduleConstants.Status.NORMAL.getValue().equals(status)) {
             rows = resumeJob(job);
-        }
-        else if (ScheduleConstants.Status.PAUSE.getValue().equals(status))
-        {
+        } else if (ScheduleConstants.Status.PAUSE.getValue().equals(status)) {
             rows = pauseJob(job);
         }
         return rows;
@@ -171,13 +157,12 @@ public class SysJobServiceImpl extends ServiceImpl<SysJobMapper, SysJob> impleme
 
     /**
      * 立即运行任务
-     * 
+     *
      * @param job 调度信息
      */
     @Override
     @Transactional
-    public void run(SysJob job) throws SchedulerException
-    {
+    public void run(SysJob job) throws SchedulerException {
         Long jobId = job.getJobId();
         String jobGroup = job.getJobGroup();
         SysJob properties = selectJobById(job.getJobId());
@@ -189,17 +174,15 @@ public class SysJobServiceImpl extends ServiceImpl<SysJobMapper, SysJob> impleme
 
     /**
      * 新增任务
-     * 
+     *
      * @param job 调度信息 调度信息
      */
     @Override
     @Transactional
-    public int insertJob(SysJob job) throws SchedulerException, TaskException
-    {
+    public int insertJob(SysJob job) throws SchedulerException, TaskException {
         job.setStatus(ScheduleConstants.Status.PAUSE.getValue());
-        int rows = jobMapper.insertJob(job);
-        if (rows > 0)
-        {
+        int rows = baseMapper.insert(job);
+        if (rows > 0) {
             ScheduleUtils.createScheduleJob(scheduler, job);
         }
         return rows;
@@ -207,17 +190,15 @@ public class SysJobServiceImpl extends ServiceImpl<SysJobMapper, SysJob> impleme
 
     /**
      * 更新任务的时间表达式
-     * 
+     *
      * @param job 调度信息
      */
     @Override
     @Transactional
-    public int updateJob(SysJob job) throws SchedulerException, TaskException
-    {
+    public int updateJob(SysJob job) throws SchedulerException, TaskException {
         SysJob properties = selectJobById(job.getJobId());
-        int rows = jobMapper.updateJob(job);
-        if (rows > 0)
-        {
+        int rows = baseMapper.updateById(job);
+        if (rows > 0) {
             updateSchedulerJob(job, properties.getJobGroup());
         }
         return rows;
@@ -225,17 +206,15 @@ public class SysJobServiceImpl extends ServiceImpl<SysJobMapper, SysJob> impleme
 
     /**
      * 更新任务
-     * 
-     * @param job 任务对象
+     *
+     * @param job      任务对象
      * @param jobGroup 任务组名
      */
-    public void updateSchedulerJob(SysJob job, String jobGroup) throws SchedulerException, TaskException
-    {
+    public void updateSchedulerJob(SysJob job, String jobGroup) throws SchedulerException, TaskException {
         Long jobId = job.getJobId();
         // 判断是否存在
         JobKey jobKey = ScheduleUtils.getJobKey(jobId, jobGroup);
-        if (scheduler.checkExists(jobKey))
-        {
+        if (scheduler.checkExists(jobKey)) {
             // 防止创建时存在数据问题 先移除,然后在执行创建操作
             scheduler.deleteJob(jobKey);
         }
@@ -244,13 +223,12 @@ public class SysJobServiceImpl extends ServiceImpl<SysJobMapper, SysJob> impleme
 
     /**
      * 校验cron表达式是否有效
-     * 
+     *
      * @param cronExpression 表达式
      * @return 结果
      */
     @Override
-    public boolean checkCronExpressionIsValid(String cronExpression)
-    {
+    public boolean checkCronExpressionIsValid(String cronExpression) {
         return CronUtils.isValid(cronExpression);
     }
 }

+ 0 - 75
ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml

@@ -14,80 +14,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="exceptionInfo"  column="exception_info"  />
 		<result property="createTime"     column="create_time"     />
 	</resultMap>
-	
-	<sql id="selectJobLogVo">
-        select job_log_id, job_name, job_group, invoke_target, job_message, status, exception_info, create_time 
-		from sys_job_log
-    </sql>
-	
-	<select id="selectJobLogList" parameterType="SysJobLog" resultMap="SysJobLogResult">
-		<include refid="selectJobLogVo"/>
-		<where>
-			<if test="jobName != null and jobName != ''">
-				AND job_name like concat('%', #{jobName}, '%')
-			</if>
-			<if test="jobGroup != null and jobGroup != ''">
-				AND job_group = #{jobGroup}
-			</if>
-			<if test="status != null and status != ''">
-				AND status = #{status}
-			</if>
-			<if test="invokeTarget != null and invokeTarget != ''">
-				AND invoke_target like concat('%', #{invokeTarget}, '%')
-			</if>
-			<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-				and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
-			</if>
-			<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-				and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
-			</if>
-		</where>
-	</select>
-	
-	<select id="selectJobLogAll" resultMap="SysJobLogResult">
-		<include refid="selectJobLogVo"/>
-	</select>
-	
-	<select id="selectJobLogById" parameterType="Long" resultMap="SysJobLogResult">
-		<include refid="selectJobLogVo"/>
-		where job_log_id = #{jobLogId}
-	</select>
-	
-	<delete id="deleteJobLogById" parameterType="Long">
- 		delete from sys_job_log where job_log_id = #{jobLogId}
- 	</delete>
- 	
- 	<delete id="deleteJobLogByIds" parameterType="Long">
- 		delete from sys_job_log where job_log_id in
- 		<foreach collection="array" item="jobLogId" open="(" separator="," close=")">
- 			#{jobLogId}
-        </foreach> 
- 	</delete>
- 	
- 	<update id="cleanJobLog">
-        truncate table sys_job_log
-    </update>
- 	
- 	<insert id="insertJobLog" parameterType="SysJobLog">
- 		insert into sys_job_log(
- 			<if test="jobLogId != null and jobLogId != 0">job_log_id,</if>
- 			<if test="jobName != null and jobName != ''">job_name,</if>
- 			<if test="jobGroup != null and jobGroup != ''">job_group,</if>
- 			<if test="invokeTarget != null and invokeTarget != ''">invoke_target,</if>
- 			<if test="jobMessage != null and jobMessage != ''">job_message,</if>
- 			<if test="status != null and status != ''">status,</if>
- 			<if test="exceptionInfo != null and exceptionInfo != ''">exception_info,</if>
- 			create_time
- 		)values(
- 			<if test="jobLogId != null and jobLogId != 0">#{jobLogId},</if>
- 			<if test="jobName != null and jobName != ''">#{jobName},</if>
- 			<if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if>
- 			<if test="invokeTarget != null and invokeTarget != ''">#{invokeTarget},</if>
- 			<if test="jobMessage != null and jobMessage != ''">#{jobMessage},</if>
- 			<if test="status != null and status != ''">#{status},</if>
- 			<if test="exceptionInfo != null and exceptionInfo != ''">#{exceptionInfo},</if>
- 			sysdate()
- 		)
-	</insert>
 
 </mapper> 

+ 0 - 88
ruoyi-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml

@@ -19,93 +19,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="updateTime"     column="update_time"     />
 		<result property="remark"         column="remark"          />
 	</resultMap>
-	
-	<sql id="selectJobVo">
-        select job_id, job_name, job_group, invoke_target, cron_expression, misfire_policy, concurrent, status, create_by, create_time, remark 
-		from sys_job
-    </sql>
-	
-	<select id="selectJobList" parameterType="SysJob" resultMap="SysJobResult">
-		<include refid="selectJobVo"/>
-		<where>
-			<if test="jobName != null and jobName != ''">
-				AND job_name like concat('%', #{jobName}, '%')
-			</if>
-			<if test="jobGroup != null and jobGroup != ''">
-				AND job_group = #{jobGroup}
-			</if>
-			<if test="status != null and status != ''">
-				AND status = #{status}
-			</if>
-			<if test="invokeTarget != null and invokeTarget != ''">
-				AND invoke_target like concat('%', #{invokeTarget}, '%')
-			</if>
-		</where>
-	</select>
-	
-	<select id="selectJobAll" resultMap="SysJobResult">
-		<include refid="selectJobVo"/>
-	</select>
-	
-	<select id="selectJobById" parameterType="Long" resultMap="SysJobResult">
-		<include refid="selectJobVo"/>
-		where job_id = #{jobId}
-	</select>
-	
-	<delete id="deleteJobById" parameterType="Long">
- 		delete from sys_job where job_id = #{jobId}
- 	</delete>
- 	
- 	<delete id="deleteJobByIds" parameterType="Long">
- 		delete from sys_job where job_id in
- 		<foreach collection="array" item="jobId" open="(" separator="," close=")">
- 			#{jobId}
-        </foreach> 
- 	</delete>
- 	
- 	<update id="updateJob" parameterType="SysJob">
- 		update sys_job
- 		<set>
- 			<if test="jobName != null and jobName != ''">job_name = #{jobName},</if>
- 			<if test="jobGroup != null and jobGroup != ''">job_group = #{jobGroup},</if>
- 			<if test="invokeTarget != null and invokeTarget != ''">invoke_target = #{invokeTarget},</if>
- 			<if test="cronExpression != null and cronExpression != ''">cron_expression = #{cronExpression},</if>
- 			<if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy = #{misfirePolicy},</if>
- 			<if test="concurrent != null and concurrent != ''">concurrent = #{concurrent},</if>
- 			<if test="status !=null">status = #{status},</if>
- 			<if test="remark != null and remark != ''">remark = #{remark},</if>
- 			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
- 			update_time = sysdate()
- 		</set>
- 		where job_id = #{jobId}
-	</update>
- 	
- 	<insert id="insertJob" parameterType="SysJob" useGeneratedKeys="true" keyProperty="jobId">
- 		insert into sys_job(
- 			<if test="jobId != null and jobId != 0">job_id,</if>
- 			<if test="jobName != null and jobName != ''">job_name,</if>
- 			<if test="jobGroup != null and jobGroup != ''">job_group,</if>
- 			<if test="invokeTarget != null and invokeTarget != ''">invoke_target,</if>
- 			<if test="cronExpression != null and cronExpression != ''">cron_expression,</if>
- 			<if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy,</if>
- 			<if test="concurrent != null and concurrent != ''">concurrent,</if>
- 			<if test="status != null and status != ''">status,</if>
- 			<if test="remark != null and remark != ''">remark,</if>
- 			<if test="createBy != null and createBy != ''">create_by,</if>
- 			create_time
- 		)values(
- 			<if test="jobId != null and jobId != 0">#{jobId},</if>
- 			<if test="jobName != null and jobName != ''">#{jobName},</if>
- 			<if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if>
- 			<if test="invokeTarget != null and invokeTarget != ''">#{invokeTarget},</if>
- 			<if test="cronExpression != null and cronExpression != ''">#{cronExpression},</if>
- 			<if test="misfirePolicy != null and misfirePolicy != ''">#{misfirePolicy},</if>
- 			<if test="concurrent != null and concurrent != ''">#{concurrent},</if>
- 			<if test="status != null and status != ''">#{status},</if>
- 			<if test="remark != null and remark != ''">#{remark},</if>
- 			<if test="createBy != null and createBy != ''">#{createBy},</if>
- 			sysdate()
- 		)
-	</insert>
 
 </mapper> 

+ 0 - 34
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java

@@ -2,46 +2,12 @@ package com.ruoyi.system.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ruoyi.common.core.domain.entity.SysDictType;
-import org.apache.ibatis.annotations.Mapper;
-
-import java.util.List;
 
 /**
  * 字典表 数据层
  *
  * @author ruoyi
  */
-@Mapper
 public interface SysDictTypeMapper extends BaseMapper<SysDictType> {
 
-    /**
-     * 根据所有字典类型
-     *
-     * @return 字典类型集合信息
-     */
-    public List<SysDictType> selectDictTypeAll();
-
-    /**
-     * 根据字典类型ID查询信息
-     *
-     * @param dictId 字典类型ID
-     * @return 字典类型
-     */
-    public SysDictType selectDictTypeById(Long dictId);
-
-    /**
-     * 根据字典类型查询信息
-     *
-     * @param dictType 字典类型
-     * @return 字典类型
-     */
-    public SysDictType selectDictTypeByType(String dictType);
-
-    /**
-     * 校验字典类型称是否唯一
-     *
-     * @param dictType 字典类型
-     * @return 结果
-     */
-    public SysDictType checkDictTypeUnique(String dictType);
 }

+ 15 - 19
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@@ -16,8 +16,7 @@ import com.ruoyi.system.domain.SysUserRole;
 import com.ruoyi.system.mapper.*;
 import com.ruoyi.system.service.ISysConfigService;
 import com.ruoyi.system.service.ISysUserService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -31,12 +30,9 @@ import java.util.List;
  *
  * @author ruoyi
  */
+@Slf4j
 @Service
 public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {
-    private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
-
-    @Autowired
-    private SysUserMapper userMapper;
 
     @Autowired
     private SysRoleMapper roleMapper;
@@ -62,7 +58,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     @Override
     @DataScope(deptAlias = "d", userAlias = "u")
     public List<SysUser> selectUserList(SysUser user) {
-        return userMapper.selectUserList(user);
+        return baseMapper.selectUserList(user);
     }
 
     /**
@@ -73,7 +69,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
      */
     @Override
     public SysUser selectUserByUserName(String userName) {
-        return userMapper.selectUserByUserName(userName);
+        return baseMapper.selectUserByUserName(userName);
     }
 
     /**
@@ -84,7 +80,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
      */
     @Override
     public SysUser selectUserById(Long userId) {
-        return userMapper.selectUserById(userId);
+        return baseMapper.selectUserById(userId);
     }
 
     /**
@@ -198,7 +194,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     @Transactional
     public int insertUser(SysUser user) {
         // 新增用户信息
-        int rows = userMapper.insert(user);
+        int rows = baseMapper.insert(user);
         // 新增用户岗位关联
         insertUserPost(user);
         // 新增用户与角色管理
@@ -224,7 +220,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getUserId,userId));
         // 新增用户与岗位管理
         insertUserPost(user);
-        return userMapper.updateById(user);
+        return baseMapper.updateById(user);
     }
 
     /**
@@ -235,7 +231,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
      */
     @Override
     public int updateUserStatus(SysUser user) {
-        return userMapper.updateById(user);
+        return baseMapper.updateById(user);
     }
 
     /**
@@ -246,7 +242,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
      */
     @Override
     public int updateUserProfile(SysUser user) {
-        return userMapper.updateById(user);
+        return baseMapper.updateById(user);
     }
 
     /**
@@ -258,7 +254,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
      */
     @Override
     public boolean updateUserAvatar(String userName, String avatar) {
-        return userMapper.update(null,
+        return baseMapper.update(null,
                 new LambdaUpdateWrapper<SysUser>()
                         .set(SysUser::getAvatar,avatar)
                         .eq(SysUser::getUserName,userName)) > 0;
@@ -272,7 +268,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
      */
     @Override
     public int resetPwd(SysUser user) {
-        return userMapper.updateById(user);
+        return baseMapper.updateById(user);
     }
 
     /**
@@ -284,7 +280,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
      */
     @Override
     public int resetUserPwd(String userName, String password) {
-        return userMapper.update(null,
+        return baseMapper.update(null,
                 new LambdaUpdateWrapper<SysUser>()
                         .set(SysUser::getPassword,password)
                         .eq(SysUser::getUserName,userName));
@@ -351,7 +347,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId,userId));
         // 删除用户与岗位表
         userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getUserId,userId));
-        return userMapper.deleteById(userId);
+        return baseMapper.deleteById(userId);
     }
 
     /**
@@ -371,7 +367,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().in(SysUserRole::getUserId,ids));
         // 删除用户与岗位表
         userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().in(SysUserPost::getUserId,ids));
-        return userMapper.deleteBatchIds(ids);
+        return baseMapper.deleteBatchIds(ids);
     }
 
     /**
@@ -395,7 +391,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         for (SysUser user : userList) {
             try {
                 // 验证是否存在这个用户
-                SysUser u = userMapper.selectUserByUserName(user.getUserName());
+                SysUser u = baseMapper.selectUserByUserName(user.getUserName());
                 if (Validator.isNull(u)) {
                     user.setPassword(SecurityUtils.encryptPassword(password));
                     user.setCreateBy(operName);

+ 0 - 24
ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml

@@ -15,28 +15,4 @@
         <result property="updateTime" column="update_time"/>
     </resultMap>
 
-    <sql id="selectDictTypeVo">
-        select dict_id, dict_name, dict_type, status, create_by, create_time, remark
-        from sys_dict_type
-    </sql>
-
-    <select id="selectDictTypeAll" resultMap="SysDictTypeResult">
-        <include refid="selectDictTypeVo"/>
-    </select>
-
-    <select id="selectDictTypeById" parameterType="Long" resultMap="SysDictTypeResult">
-        <include refid="selectDictTypeVo"/>
-        where dict_id = #{dictId}
-    </select>
-
-    <select id="selectDictTypeByType" parameterType="String" resultMap="SysDictTypeResult">
-        <include refid="selectDictTypeVo"/>
-        where dict_type = #{dictType}
-    </select>
-
-    <select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
-        <include refid="selectDictTypeVo"/>
-        where dict_type = #{dictType} limit 1
-    </select>
-
 </mapper>