All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.acyou.leo.framework.mapper.CommonTableMapper Maven / Gradle / Ivy

package cn.acyou.leo.framework.mapper;

import cn.acyou.leo.framework.base.CommonTable;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface CommonTableMapper {

    /**
     * 创建表
     *
     * @param tableName 表
     */
    @Select("        CREATE TABLE `${tableName}`\n" +
            "        (\n" +
            "            `id`            bigint(20) NOT NULL AUTO_INCREMENT COMMENT '参数主键(PK)',\n" +
            "            `abbr`          varchar(200) COLLATE utf8mb4_bin DEFAULT '' COMMENT '简称',\n" +
            "            `name`          varchar(200) COLLATE utf8mb4_bin DEFAULT '' COMMENT '名称',\n" +
            "            `code`          varchar(200) COLLATE utf8mb4_bin DEFAULT '' COMMENT '编码',\n" +
            "            `content`       varchar(200) COLLATE utf8mb4_bin DEFAULT '' COMMENT '内容',\n" +
            "            `amount`        int(11)                        DEFAULT NULL COMMENT '数量',\n" +
            "            `price`         decimal(10, 2)                 DEFAULT NULL COMMENT '金额',\n" +
            "            `type`          int(11) NOT NULL DEFAULT '0' COMMENT '类型',\n" +
            "            `field1`        text COLLATE utf8mb4_bin         DEFAULT NULL COMMENT '',\n" +
            "            `field2`        varchar(100) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '',\n" +
            "            `field3`        varchar(100) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '',\n" +
            "            `field4`        varchar(100) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '',\n" +
            "            `field5`        varchar(100) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '',\n" +
            "            `number_field1` decimal(10, 2)                   DEFAULT NULL COMMENT '',\n" +
            "            `number_field2` decimal(10, 2)                   DEFAULT NULL COMMENT '',\n" +
            "            `number_field3` decimal(10, 2)                   DEFAULT NULL COMMENT '',\n" +
            "            `number_field4` decimal(10, 2)                   DEFAULT NULL COMMENT '',\n" +
            "            `number_field5` decimal(10, 2)                   DEFAULT NULL COMMENT '',\n" +
            "            `field6`        varchar(100) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '',\n" +
            "            `field7`        varchar(100) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '',\n" +
            "            `field8`        varchar(100) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '',\n" +
            "            `field9`        varchar(100) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '',\n" +
            "            `field10`       varchar(100) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '',\n" +
            "            `text`          varchar(500) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '描述',\n" +
            "            `remark`        varchar(500) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '备注',\n" +
            "            `sort`          int(11) DEFAULT NULL COMMENT '排序值',\n" +
            "            `is_delete`     int(11) DEFAULT '0' COMMENT '是否删除  0-正常 1-删除',\n" +
            "            `create_time`   datetime NOT NULL                DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间,默认当前创建时间',\n" +
            "            `create_user`   bigint(20) DEFAULT NULL COMMENT '创建人',\n" +
            "            `update_time`   datetime NOT NULL                DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',\n" +
            "            `update_user`   bigint(20) DEFAULT NULL COMMENT '最后修改人',\n" +
            "            PRIMARY KEY (`id`) USING BTREE,\n" +
            "            UNIQUE KEY `idx_code_type` (`code`, `type`) USING BTREE\n" +
            "        ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='${tableName}_自动公共表'")
    void createTable(@Param("tableName") String tableName);

    @Insert("")
    @Options(useGeneratedKeys = true, keyProperty = "list.id")
    int insertList(@Param("tableName") String tableName, @Param("list") List list);

    @Insert("")
    @Options(useGeneratedKeys = true, keyProperty = "record.id")
    int insertIgnoreSelective(@Param("tableName") String tableName, @Param("record") CommonTable record);

    @Update("")
    int updateListSelective(@Param("tableName") String tableName, @Param("list") List list);

    @Select("")
    List selectByPrimaryKeyList(@Param("tableName") String tableName, @Param("list") List list);

    @Delete("")
    int deleteByPrimaryKeyList(@Param("tableName") String tableName, @Param("list") List list);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy