shikeyin
2024-01-17 5be90b09bd999cd380cf13acbbf09ed7246a9cc3
添加mybatis支持 2
5个文件已添加
10个文件已修改
639 ■■■■ 已修改文件
deploy-jar-template/src/main/java/com/iplatform/IplatformApplication.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
deploy-jar-template/src/main/resources/application-dev.yml 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
deploy-jar-template/src/main/resources/application-master.yml 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
deploy-jar-template/src/main/resources/application-prod.yml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
deploy-jar-template/src/main/resources/application-slave.yml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
deploy-jar-template/src/main/resources/application-test.yml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iplatform-base-admin/src/main/java/com/iplatform/base/controller/GenController.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iplatform-support-mybatis/pom.xml 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iplatform-support-mybatis/src/main/java/com/iplatform/mybatis/CreateAndUpdateMetaObjectHandler.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iplatform-support-mybatis/src/main/java/com/iplatform/mybatis/Excel.java 187 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iplatform-support-mybatis/src/main/java/com/iplatform/mybatis/ExcelHandlerAdapter.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iplatform-support-mybatis/src/main/java/com/iplatform/mybatis/config/MybatisPlusConfig.java 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iplatform-support-mybatis/src/main/java/com/iplatform/mybatis/domain/BaseEntity.java 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iplatform-support-mybatis/src/main/java/com/iplatform/mybatis/domain/TableDataInfo.java 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
deploy-jar-template/src/main/java/com/iplatform/IplatformApplication.java
@@ -1,11 +1,13 @@
package com.iplatform;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(scanBasePackages = {"com.walker","com.iplatform"
//        ,"org.jeecg.modules.jmreport"
        , "com.ishop"})
@MapperScan("com.iplatform.**.mapper")
public class IplatformApplication {
    public static void main(String[] args) throws Exception{
deploy-jar-template/src/main/resources/application-dev.yml
@@ -11,12 +11,8 @@
    # interactive_timeout: 客户端工具交互超过这个时间(秒)会端口,表现为navicat
    username: root
    password: Yanglin@123456
    url: jdbc:mysql://101.43.168.96:3306/iplatform_base?useUnicode=true&characterEncoding=UTF-8&useSSL=false
#    username: root
#    password: Bjjmy_2020
#    url: jdbc:mysql://116.198.40.76:3306/iplatform?useUnicode=true&characterEncoding=UTF-8&useSSL=false
    password: Bjjmy_2020
    url: jdbc:mysql://116.198.40.76:3306/iplatform_base?useUnicode=true&characterEncoding=UTF-8&useSSL=false
    # 达梦数据库
#    driver-class-name: dm.jdbc.driver.DmDriver
@@ -88,8 +84,10 @@
              multi-statement-allow: false
  redis:
    host: localhost
    host: 116.198.40.76
    port: 6379
    password: Jmy2019.
    database: 2
  mvc:
    pathmatch:
@@ -210,6 +208,7 @@
      - /front/login/**
      - /front/wechat/get/**
      - /front/article/**
      - /tool/generate/** # 新mybatis生成器测试,2024-01-17。
    # 允许所有认证用户都可访问地址,请慎重否则权限都过大,一般API都应该设置在这里
    permit-list:
deploy-jar-template/src/main/resources/application-master.yml
@@ -17,12 +17,9 @@
#    password: Yanglin@123456
#    url: jdbc:mysql://101.43.168.96:3306/iplatform?useUnicode=true&characterEncoding=UTF-8&useSSL=false
#    username: root
#    password: Bjjmy_2020
#    url: jdbc:mysql://116.198.40.76:3306/iplatform?useUnicode=true&characterEncoding=UTF-8&useSSL=false
    username: root
    password: Yanglin@123456
    url: jdbc:mysql://101.43.168.96:3306/iplatform_base?useUnicode=true&characterEncoding=UTF-8&useSSL=false
    password: Bjjmy_2020
    url: jdbc:mysql://116.198.40.76:3306/iplatform_base?useUnicode=true&characterEncoding=UTF-8&useSSL=false
#    type: com.walker.jdbc.ds.DefaultDataSource
#    hikari:
@@ -95,8 +92,10 @@
#  cache:
#    type: redis
  redis:
    host: localhost
    host: 116.198.40.76
    port: 6379
    password: Jmy2019.
    database: 2
  # 配置注册服务地址,把服务注册到Nacos中。2022-12-28
  cloud:
deploy-jar-template/src/main/resources/application-prod.yml
@@ -10,13 +10,13 @@
    # wait_timeout: 超过改时间(秒)服务端主动断开
    # interactive_timeout: 客户端工具交互超过这个时间(秒)会端口,表现为navicat
    username: root
    password: Yanglin@123456
    url: jdbc:mysql://127.0.0.1:3306/iplatform_base?useUnicode=true&characterEncoding=UTF-8&useSSL=false
    #    username: root
    #    password: Bjjmy_2020
    #    url: jdbc:mysql://116.198.40.76:3306/iplatform?useUnicode=true&characterEncoding=UTF-8&useSSL=false
#    password: Yanglin@123456
#    url: jdbc:mysql://127.0.0.1:3306/iplatform_base?useUnicode=true&characterEncoding=UTF-8&useSSL=false
    username: root
    password: Bjjmy_2020
    url: jdbc:mysql://116.198.40.76:3306/iplatform_base?useUnicode=true&characterEncoding=UTF-8&useSSL=false
    # 达梦数据库
    #    driver-class-name: dm.jdbc.driver.DmDriver
@@ -68,8 +68,10 @@
      use-global-data-source-stat: true
  redis:
    host: localhost
    host: 116.198.40.76
    port: 6379
    password: Jmy2019.
    database: 2
  mvc:
    pathmatch:
deploy-jar-template/src/main/resources/application-slave.yml
@@ -11,13 +11,8 @@
    # interactive_timeout: 客户端工具交互超过这个时间(秒)会端口,表现为navicat
    username: root
    password: Yanglin@123456
    #    url: jdbc:mysql://127.0.0.1:3306/iplatform_base?useUnicode=true&characterEncoding=UTF-8&useSSL=false
    url: jdbc:mysql://101.43.168.96:3306/iplatform_base?useUnicode=true&characterEncoding=UTF-8&useSSL=false
    #    username: root
    #    password: Bjjmy_2020
    #    url: jdbc:mysql://116.198.40.76:3306/iplatform?useUnicode=true&characterEncoding=UTF-8&useSSL=false
    password: Bjjmy_2020
    url: jdbc:mysql://116.198.40.76:3306/iplatform_base?useUnicode=true&characterEncoding=UTF-8&useSSL=false
    # 达梦数据库
    #    driver-class-name: dm.jdbc.driver.DmDriver
@@ -69,8 +64,10 @@
      use-global-data-source-stat: true
  redis:
    host: localhost
    host: 116.198.40.76
    port: 6379
    password: Jmy2019.
    database: 2
  mvc:
    pathmatch:
deploy-jar-template/src/main/resources/application-test.yml
@@ -11,13 +11,8 @@
    # interactive_timeout: 客户端工具交互超过这个时间(秒)会端口,表现为navicat
    username: root
    password: Yanglin@123456
#    url: jdbc:mysql://127.0.0.1:3306/iplatform_base?useUnicode=true&characterEncoding=UTF-8&useSSL=false
    url: jdbc:mysql://101.43.168.96:3306/iplatform_test?useUnicode=true&characterEncoding=UTF-8&useSSL=false
    #    username: root
    #    password: Bjjmy_2020
    #    url: jdbc:mysql://116.198.40.76:3306/iplatform?useUnicode=true&characterEncoding=UTF-8&useSSL=false
    password: Bjjmy_2020
    url: jdbc:mysql://116.198.40.76:3306/iplatform_base?useUnicode=true&characterEncoding=UTF-8&useSSL=false
    # 达梦数据库
    #    driver-class-name: dm.jdbc.driver.DmDriver
@@ -69,8 +64,10 @@
      use-global-data-source-stat: true
  redis:
    host: localhost
    host: 116.198.40.76
    port: 6379
    password: Jmy2019.
    database: 2
  mvc:
    pathmatch:
iplatform-base-admin/src/main/java/com/iplatform/base/controller/GenController.java
@@ -1,17 +1,16 @@
package com.iplatform.base.controller;
import com.insurance.common.annotation.Log;
import com.insurance.common.core.domain.AjaxResult;
import com.insurance.common.core.page.TableDataInfo;
import com.insurance.common.enums.BusinessType;
import com.iplatform.base.SystemController;
import com.iplatform.core.util.Convert;
import com.iplatform.mybatis.domain.GenTable;
import com.iplatform.mybatis.domain.GenTableColumn;
import com.iplatform.mybatis.domain.TableDataInfo;
import com.iplatform.mybatis.service.IGenTableColumnService;
import com.iplatform.mybatis.service.IGenTableService;
import com.walker.web.ResponseValue;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
@@ -41,7 +40,7 @@
 */
//@Api(value = "代码生成管理", tags = {"代码生成管理"})
@RestController
@RequestMapping("/tool/gen")
@RequestMapping("/tool/generate")
public class GenController extends SystemController
{
    @Autowired
@@ -67,7 +66,7 @@
     */
//    @PreAuthorize("@ss.hasPermi('tool:gen:query')")
    @GetMapping(value = "/{tableId}")
    public AjaxResult getInfo(@PathVariable Long tableId)
    public ResponseValue getInfo(@PathVariable Long tableId)
    {
        GenTable table = genTableService.selectGenTableById(tableId);
        List<GenTable> tables = genTableService.selectGenTableAll();
@@ -76,7 +75,8 @@
        map.put("info", table);
        map.put("rows", list);
        map.put("tables", tables);
        return success(map);
//        return success(map);
        return ResponseValue.success(map);
    }
    /**
@@ -111,13 +111,13 @@
//    @PreAuthorize("@ss.hasPermi('tool:gen:import')")
//    @Log(title = "代码生成", businessType = BusinessType.IMPORT)
    @PostMapping("/importTable")
    public AjaxResult importTableSave(String tables)
    public ResponseValue importTableSave(String tables)
    {
        String[] tableNames = Convert.toStrArray(tables);
        // 查询表信息
        List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames);
        genTableService.importGenTable(tableList);
        return success();
        return ResponseValue.success();
    }
    /**
@@ -126,11 +126,11 @@
//    @PreAuthorize("@ss.hasPermi('tool:gen:edit')")
//    @Log(title = "代码生成", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult editSave(@Validated @RequestBody GenTable genTable)
    public ResponseValue editSave(@Validated @RequestBody GenTable genTable)
    {
        genTableService.validateEdit(genTable);
        genTableService.updateGenTable(genTable);
        return success();
        return ResponseValue.success();
    }
    /**
@@ -139,10 +139,10 @@
//    @PreAuthorize("@ss.hasPermi('tool:gen:remove')")
//    @Log(title = "代码生成", businessType = BusinessType.DELETE)
    @DeleteMapping("/{tableIds}")
    public AjaxResult remove(@PathVariable Long[] tableIds)
    public ResponseValue remove(@PathVariable Long[] tableIds)
    {
        genTableService.deleteGenTableByIds(tableIds);
        return success();
        return ResponseValue.success();
    }
    /**
@@ -150,17 +150,17 @@
     */
//    @PreAuthorize("@ss.hasPermi('tool:gen:preview')")
    @GetMapping("/preview/{tableId}")
    public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException
    public ResponseValue preview(@PathVariable("tableId") Long tableId) throws IOException
    {
        Map<String, String> dataMap = genTableService.previewCode(tableId);
        return success(dataMap);
        return ResponseValue.success(dataMap);
    }
    /**
     * 生成代码(下载方式)
     */
//    @PreAuthorize("@ss.hasPermi('tool:gen:code')")
    @Log(title = "代码生成", businessType = BusinessType.GENCODE)
//    @Log(title = "代码生成", businessType = BusinessType.GENCODE)
    @GetMapping("/download/{tableName}")
    public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException
    {
@@ -174,10 +174,10 @@
//    @PreAuthorize("@ss.hasPermi('tool:gen:code')")
//    @Log(title = "代码生成", businessType = BusinessType.GENCODE)
    @GetMapping("/genCode/{tableName}")
    public AjaxResult genCode(@PathVariable("tableName") String tableName)
    public ResponseValue genCode(@PathVariable("tableName") String tableName)
    {
        genTableService.generatorCode(tableName);
        return success();
        return ResponseValue.success();
    }
    /**
@@ -186,10 +186,10 @@
//    @PreAuthorize("@ss.hasPermi('tool:gen:edit')")
//    @Log(title = "代码生成", businessType = BusinessType.UPDATE)
    @GetMapping("/synchDb/{tableName}")
    public AjaxResult synchDb(@PathVariable("tableName") String tableName)
    public ResponseValue synchDb(@PathVariable("tableName") String tableName)
    {
        genTableService.synchDb(tableName);
        return success();
        return ResponseValue.success();
    }
    /**
@@ -218,4 +218,19 @@
        response.setContentType("application/octet-stream; charset=UTF-8");
        IOUtils.write(data, response.getOutputStream());
    }
    /**
     * 响应请求分页数据
     */
    @SuppressWarnings({ "rawtypes"})
    protected  TableDataInfo getDataTable(List<?> list)
    {
        TableDataInfo rspData = new TableDataInfo();
        rspData.setCode(HttpStatus.OK.value());
        rspData.setMsg("查询成功");
        rspData.setRows(list);
//        rspData.setTotal(page.getTotal());
        rspData.setTotal(0);
        return rspData;
    }
}
iplatform-support-mybatis/pom.xml
@@ -70,6 +70,21 @@
            <artifactId>walker-jdbc-generator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>
        <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-core</artifactId>
        </dependency>
        <!-- 生成domain中,excel导出使用,2024-01-17 -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
        </dependency>
    </dependencies>
</project>
iplatform-support-mybatis/src/main/java/com/iplatform/mybatis/CreateAndUpdateMetaObjectHandler.java
New file
@@ -0,0 +1,62 @@
package com.iplatform.mybatis;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.iplatform.core.util.StringUtils;
import org.apache.ibatis.reflection.MetaObject;
import java.util.Date;
/**
 * @author woo
 * @date 2021/3/11
 */
public class CreateAndUpdateMetaObjectHandler implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
        //region 处理创建人信息
        String createBy = (String) this.getFieldValByName("createBy", metaObject);
        Object createTime = this.getFieldValByName("createTime", metaObject);
        if (StringUtils.isEmpty(createBy)) {
//            createBy = SecurityUtils.getLoginUser().getUser().getNickName();
            createBy = "none";
            this.setFieldValByName("createBy", createBy, metaObject);
        }
        if (createTime == null) {
            createTime = new Date();
            this.setFieldValByName("createTime", createTime, metaObject);
        }
        //endregion
        //region 处理修改人信息
        Object updateBy = this.getFieldValByName("updateBy", metaObject);
        Object updateTime = this.getFieldValByName("updateTime", metaObject);
        if (updateBy == null) {
            updateBy = createBy;
            this.setFieldValByName("updateBy", updateBy, metaObject);
        }
        if (updateTime == null) {
            updateTime = createTime;
            this.setFieldValByName("updateTime", updateTime, metaObject);
        }
        //endregion
    }
    @Override
    public void updateFill(MetaObject metaObject) {
        //region 处理修改人信息
//        String updateBy = SecurityUtils.getLoginUser().getUser().getNickName();
//        this.setFieldValByName("updateBy", updateBy, metaObject);
        Date updateTime = new Date();
        this.setFieldValByName("updateTime", updateTime, metaObject);
        //endregion
    }
    @Override
    public boolean openInsertFill() {
        return true;
    }
    @Override
    public boolean openUpdateFill() {
        return true;
    }
}
iplatform-support-mybatis/src/main/java/com/iplatform/mybatis/Excel.java
New file
@@ -0,0 +1,187 @@
package com.iplatform.mybatis;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.math.BigDecimal;
/**
 * 自定义导出Excel数据注解
 *
 * @author insurance
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Excel
{
    /**
     * 导出时在excel中排序
     */
    public int sort() default Integer.MAX_VALUE;
    /**
     * 导出到Excel中的名字.
     */
    public String name() default "";
    /**
     * 日期格式, 如: yyyy-MM-dd
     */
    public String dateFormat() default "";
    /**
     * 如果是字典类型,请设置字典的type值 (如: sys_user_sex)
     */
    public String dictType() default "";
    /**
     * 读取内容转表达式 (如: 0=男,1=女,2=未知)
     */
    public String readConverterExp() default "";
    /**
     * 分隔符,读取字符串组内容
     */
    public String separator() default ",";
    /**
     * BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
     */
    public int scale() default -1;
    /**
     * BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
     */
    public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
    /**
     * 导出时在excel中每个列的高度 单位为字符
     */
    public double height() default 14;
    /**
     * 导出时在excel中每个列的宽 单位为字符
     */
    public double width() default 16;
    /**
     * 文字后缀,如% 90 变成90%
     */
    public String suffix() default "";
    /**
     * 当值为空时,字段的默认值
     */
    public String defaultValue() default "";
    /**
     * 提示信息
     */
    public String prompt() default "";
    /**
     * 设置只能选择不能输入的列内容.
     */
    public String[] combo() default {};
    /**
     * 是否需要纵向合并单元格,应对需求:含有list集合单元格)
     */
    public boolean needMerge() default false;
    /**
     * 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
     */
    public boolean isExport() default true;
    /**
     * 另一个类中的属性名称,支持多级获取,以小数点隔开
     */
    public String targetAttr() default "";
    /**
     * 是否自动统计数据,在最后追加一行统计数据总和
     */
    public boolean isStatistics() default false;
    /**
     * 导出类型(0数字 1字符串 2图片)
     */
    public ColumnType cellType() default ColumnType.STRING;
    /**
     * 导出列头背景色
     */
    public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
    /**
     * 导出列头字体颜色
     */
    public IndexedColors headerColor() default IndexedColors.WHITE;
    /**
     * 导出单元格背景色
     */
    public IndexedColors backgroundColor() default IndexedColors.WHITE;
    /**
     * 导出单元格字体颜色
     */
    public IndexedColors color() default IndexedColors.BLACK;
    /**
     * 导出字段对齐方式
     */
    public HorizontalAlignment align() default HorizontalAlignment.CENTER;
    /**
     * 自定义数据处理器
     */
    public Class<?> handler() default ExcelHandlerAdapter.class;
    /**
     * 自定义数据处理器参数
     */
    public String[] args() default {};
    /**
     * 字段类型(0:导出导入;1:仅导出;2:仅导入)
     */
    Type type() default Type.ALL;
    public enum Type
    {
        ALL(0), EXPORT(1), IMPORT(2);
        private final int value;
        Type(int value)
        {
            this.value = value;
        }
        public int value()
        {
            return this.value;
        }
    }
    public enum ColumnType
    {
        NUMERIC(0), STRING(1), IMAGE(2);
        private final int value;
        ColumnType(int value)
        {
            this.value = value;
        }
        public int value()
        {
            return this.value;
        }
    }
}
iplatform-support-mybatis/src/main/java/com/iplatform/mybatis/ExcelHandlerAdapter.java
New file
@@ -0,0 +1,19 @@
package com.iplatform.mybatis;
/**
 * Excel数据格式处理适配器
 *
 * @author insurance
 */
public interface ExcelHandlerAdapter
{
    /**
     * 格式化
     *
     * @param value 单元格数据值
     * @param args excel注解args参数组
     *
     * @return 处理后的值
     */
    Object format(Object value, String[] args);
}
iplatform-support-mybatis/src/main/java/com/iplatform/mybatis/config/MybatisPlusConfig.java
New file
@@ -0,0 +1,102 @@
package com.iplatform.mybatis.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.iplatform.core.PlatformConfiguration;
import com.iplatform.mybatis.CreateAndUpdateMetaObjectHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableTransactionManagement(proxyTargetClass = true)
@Configuration
public class MybatisPlusConfig extends PlatformConfiguration {
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        // 分页插件
        interceptor.addInnerInterceptor(paginationInnerInterceptor());
        // 乐观锁插件
        interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor());
        // 阻断插件
//        interceptor.addInnerInterceptor(blockAttackInnerInterceptor());
        return interceptor;
    }
    /**
     * 分页插件,自动识别数据库类型
     * https://baomidou.com/guide/interceptor-pagination.html
     */
    public PaginationInnerInterceptor paginationInnerInterceptor() {
        PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
        // 设置数据库类型为mysql
        paginationInnerInterceptor.setDbType(DbType.MYSQL);
        // 设置最大单页限制数量,默认 500 条,-1 不受限制
        paginationInnerInterceptor.setMaxLimit(-1L);
        return paginationInnerInterceptor;
    }
    /**
     * 乐观锁插件
     * https://baomidou.com/guide/interceptor-optimistic-locker.html
     */
    public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor() {
        return new OptimisticLockerInnerInterceptor();
    }
    /**
     * 如果是对全表的删除或更新操作,就会终止该操作
     * https://baomidou.com/guide/interceptor-block-attack.html
     */
//    public BlockAttackInnerInterceptor blockAttackInnerInterceptor() {
//        return new BlockAttackInnerInterceptor();
//    }
    /**
     * sql性能规范插件(垃圾SQL拦截)
     * 如有需要可以启用
     */
//    public IllegalSQLInnerInterceptor illegalSQLInnerInterceptor() {
//        return new IllegalSQLInnerInterceptor();
//    }
    /**
     * 自定义主键策略
     * https://baomidou.com/guide/id-generator.html
     */
//    @Bean
//    public IdentifierGenerator idGenerator() {
//        return new CustomIdGenerator();
//    }
    /**
     * 元对象字段填充控制器
     * https://baomidou.com/guide/auto-fill-metainfo.html
     */
    @Bean
    public MetaObjectHandler metaObjectHandler() {
        return new CreateAndUpdateMetaObjectHandler();
    }
    /**
     * sql注入器配置
     * https://baomidou.com/guide/sql-injector.html
     */
//    @Bean
//    public ISqlInjector sqlInjector() {
//        return new DefaultSqlInjector();
//    }
    /**
     * TenantLineInnerInterceptor 多租户插件
     * https://baomidou.com/guide/interceptor-tenant-line.html
     * DynamicTableNameInnerInterceptor 动态表名插件
     * https://baomidou.com/guide/interceptor-dynamic-table-name.html
     */
}
iplatform-support-mybatis/src/main/java/com/iplatform/mybatis/domain/BaseEntity.java
@@ -1,12 +1,11 @@
package com.iplatform.mybatis.domain;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
 * Entity基类
@@ -25,15 +24,17 @@
    private String createBy;
    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
//    @JsonFormat(pattern = "yyyyMMddHHmmss")
//    private Date createTime;
    private Long createTime;
    /** 更新者 */
    private String updateBy;
    /** 更新时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
//    private Date updateTime;
    private Long updateTime;
    /** 备注 */
    private String remark;
@@ -62,12 +63,12 @@
        this.createBy = createBy;
    }
    public Date getCreateTime()
    public Long getCreateTime()
    {
        return createTime;
    }
    public void setCreateTime(Date createTime)
    public void setCreateTime(Long createTime)
    {
        this.createTime = createTime;
    }
@@ -82,12 +83,12 @@
        this.updateBy = updateBy;
    }
    public Date getUpdateTime()
    public Long getUpdateTime()
    {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime)
    public void setUpdateTime(Long updateTime)
    {
        this.updateTime = updateTime;
    }
iplatform-support-mybatis/src/main/java/com/iplatform/mybatis/domain/TableDataInfo.java
New file
@@ -0,0 +1,85 @@
package com.iplatform.mybatis.domain;
import java.io.Serializable;
import java.util.List;
/**
 * 表格分页数据对象
 *
 * @author insurance
 */
public class TableDataInfo implements Serializable
{
    private static final long serialVersionUID = 1L;
    /** 总记录数 */
    private long total;
    /** 列表数据 */
    private List<?> rows;
    /** 消息状态码 */
    private int code;
    /** 消息内容 */
    private String msg;
    /**
     * 表格数据对象
     */
    public TableDataInfo()
    {
    }
    /**
     * 分页
     *
     * @param list 列表数据
     * @param total 总记录数
     */
    public TableDataInfo(List<?> list, int total)
    {
        this.rows = list;
        this.total = total;
    }
    public long getTotal()
    {
        return total;
    }
    public void setTotal(long total)
    {
        this.total = total;
    }
    public List<?> getRows()
    {
        return rows;
    }
    public void setRows(List<?> rows)
    {
        this.rows = rows;
    }
    public int getCode()
    {
        return code;
    }
    public void setCode(int code)
    {
        this.code = code;
    }
    public String getMsg()
    {
        return msg;
    }
    public void setMsg(String msg)
    {
        this.msg = msg;
    }
}
pom.xml
@@ -77,6 +77,8 @@
    <mybatis-plus-boot-starter.version>3.5.3.1</mybatis-plus-boot-starter.version>
    <mybatis-plus-annotation.version>3.5.5</mybatis-plus-annotation.version>
    <fastjson.version>2.0.23</fastjson.version>
    <lombok.version>1.18.24</lombok.version>
    <hutool.version>5.8.9</hutool.version>
  </properties>
  <dependencyManagement>
@@ -332,13 +334,28 @@
        <type>jar.sha256</type>
      </dependency>
      <!-- 阿里JSON解析器 -->
      <!-- 阿里JSON解析器,2024-01-15 -->
      <dependency>
        <groupId>com.alibaba.fastjson2</groupId>
        <artifactId>fastjson2</artifactId>
        <version>${fastjson.version}</version>
      </dependency>
      <!-- lombok,2024-01-17 -->
      <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>${lombok.version}</version>
      </dependency>
      <!-- hutool,暂时只引入核心包,2024-01-17 -->
      <dependency>
        <groupId>cn.hutool</groupId>
        <artifactId>hutool-core</artifactId>
        <version>${hutool.version}</version>
<!--        <type>pom</type>-->
      </dependency>
    </dependencies>
  </dependencyManagement>