疯狂的狮子li
2020-02-14 83c427c1bbf5e8e9a07bdea946479b005da0297e
增加 代码生成与MybatisPlus测试案例 cstest
已添加9个文件
648 ■■■■■ 文件已修改
ruoyi-ui/src/api/cstest/cstest.js 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-ui/src/views/cstest/cstest/index.vue 299 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi/sql/test.sql 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi/src/main/java/com/ruoyi/project/cstest/controller/CsTestController.java 114 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi/src/main/java/com/ruoyi/project/cstest/domain/CsTest.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi/src/main/java/com/ruoyi/project/cstest/mapper/CsTestMapper.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi/src/main/java/com/ruoyi/project/cstest/service/ICsTestService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi/src/main/java/com/ruoyi/project/cstest/service/impl/CsTestServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi/src/main/resources/mybatis/cstest/CsTestMapper.xml 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-ui/src/api/cstest/cstest.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,53 @@
import request from '@/utils/request'
// æŸ¥è¯¢æµ‹è¯•列表
export function listCstest(query) {
  return request({
    url: '/cstest/cstest/list',
    method: 'get',
    params: query
  })
}
// æŸ¥è¯¢æµ‹è¯•详细
export function getCstest(id) {
  return request({
    url: '/cstest/cstest/' + id,
    method: 'get'
  })
}
// æ–°å¢žæµ‹è¯•
export function addCstest(data) {
  return request({
    url: '/cstest/cstest',
    method: 'post',
    data: data
  })
}
// ä¿®æ”¹æµ‹è¯•
export function updateCstest(data) {
  return request({
    url: '/cstest/cstest',
    method: 'put',
    data: data
  })
}
// åˆ é™¤æµ‹è¯•
export function delCstest(id) {
  return request({
    url: '/cstest/cstest/' + id,
    method: 'delete'
  })
}
// å¯¼å‡ºæµ‹è¯•
export function exportCstest(query) {
  return request({
    url: '/cstest/cstest/export',
    method: 'get',
    params: query
  })
}
ruoyi-ui/src/views/cstest/cstest/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,299 @@
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
      <el-form-item label="key键" prop="testKey">
        <el-input
          v-model="queryParams.testKey"
          placeholder="请输入key键"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="值" prop="value">
        <el-input
          v-model="queryParams.value"
          placeholder="请输入值"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建时间" prop="createTime">
        <el-date-picker clearable size="small" style="width: 200px"
          v-model="queryParams.createTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择创建时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['cstest:cstest:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['cstest:cstest:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['cstest:cstest:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['cstest:cstest:export']"
        >导出</el-button>
      </el-col>
    </el-row>
    <el-table v-loading="loading" :data="cstestList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="主键" align="center" prop="id" />
      <el-table-column label="key键" align="center" prop="testKey" />
      <el-table-column label="值" align="center" prop="value" />
      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['cstest:cstest:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['cstest:cstest:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- æ·»åŠ æˆ–ä¿®æ”¹æµ‹è¯•å¯¹è¯æ¡† -->
    <el-dialog :title="title" :visible.sync="open" width="500px">
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="key键" prop="testKey">
          <el-input v-model="form.testKey" placeholder="请输入key键" />
        </el-form-item>
        <el-form-item label="值" prop="value">
          <el-input v-model="form.value" placeholder="请输入值" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">ç¡® å®š</el-button>
        <el-button @click="cancel">取 æ¶ˆ</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { listCstest, getCstest, delCstest, addCstest, updateCstest, exportCstest } from "@/api/cstest/cstest";
export default {
  data() {
    return {
      // é®ç½©å±‚
      loading: true,
      // é€‰ä¸­æ•°ç»„
      ids: [],
      // éžå•个禁用
      single: true,
      // éžå¤šä¸ªç¦ç”¨
      multiple: true,
      // æ€»æ¡æ•°
      total: 0,
      // æµ‹è¯•表格数据
      cstestList: [],
      // å¼¹å‡ºå±‚标题
      title: "",
      // æ˜¯å¦æ˜¾ç¤ºå¼¹å‡ºå±‚
      open: false,
      // æŸ¥è¯¢å‚æ•°
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        testKey: undefined,
        value: undefined,
        createTime: undefined,
      },
      // è¡¨å•参数
      form: {},
      // è¡¨å•校验
      rules: {
        testKey: [
          { required: true, message: "key键不能为空", trigger: "blur" }
        ],        value: [
          { required: true, message: "值不能为空", trigger: "blur" }
        ],        version: [
          { required: true, message: "版本不能为空", trigger: "blur" }
        ],        createTime: [
          { required: true, message: "创建时间不能为空", trigger: "blur" }
        ],        deleted: [
          { required: true, message: "删除状态不能为空", trigger: "blur" }
        ]      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** æŸ¥è¯¢æµ‹è¯•列表 */
    getList() {
      this.loading = true;
      listCstest(this.queryParams).then(response => {
        this.cstestList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // å–消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // è¡¨å•重置
    reset() {
      this.form = {
        id: undefined,
        testKey: undefined,
        value: undefined,
        version: undefined,
        createTime: undefined,
        deleted: undefined
      };
      this.resetForm("form");
    },
    /** æœç´¢æŒ‰é’®æ“ä½œ */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** é‡ç½®æŒ‰é’®æ“ä½œ */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // å¤šé€‰æ¡†é€‰ä¸­æ•°æ®
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!=1
      this.multiple = !selection.length
    },
    /** æ–°å¢žæŒ‰é’®æ“ä½œ */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加测试";
    },
    /** ä¿®æ”¹æŒ‰é’®æ“ä½œ */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getCstest(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改测试";
      });
    },
    /** æäº¤æŒ‰é’® */
    submitForm: function() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != undefined) {
            updateCstest(this.form).then(response => {
              if (response.code === 200) {
                this.msgSuccess("修改成功");
                this.open = false;
                this.getList();
              } else {
                this.msgError(response.msg);
              }
            });
          } else {
            addCstest(this.form).then(response => {
              if (response.code === 200) {
                this.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              } else {
                this.msgError(response.msg);
              }
            });
          }
        }
      });
    },
    /** åˆ é™¤æŒ‰é’®æ“ä½œ */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认删除测试编号为"' + ids + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delCstest(ids);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        }).catch(function() {});
    },
    /** å¯¼å‡ºæŒ‰é’®æ“ä½œ */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有测试数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return exportCstest(queryParams);
        }).then(response => {
          this.download(response.msg);
        }).catch(function() {});
    }
  }
};
</script>
ruoyi/sql/test.sql
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,57 @@
/*
 Navicat Premium Data Transfer
 Source Server         : 192.168.0.222
 Source Server Type    : MySQL
 Source Server Version : 80019
 Source Host           : 192.168.0.222:3306
 Source Schema         : ry-vue
 Target Server Type    : MySQL
 Target Server Version : 80019
 File Encoding         : 65001
 Date: 14/02/2020 13:29:11
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for chkj_test
-- ----------------------------
DROP TABLE IF EXISTS `chkj_test`;
CREATE TABLE `chkj_test`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `test_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT 'key键',
  `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '值',
  `version` int(0) NULL DEFAULT 0 COMMENT '版本',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `deleted` tinyint(0) NULL DEFAULT 0 COMMENT '删除状态',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '测试表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of gen_table
-- ----------------------------
INSERT INTO `gen_table` VALUES (1, 'chkj_test', '测试表', 'CsTest', 'crud', 'com.ruoyi.project.cstest', 'cstest', 'cstest', '测试', 'Lion Li', '{}', 'admin', '2020-02-12 03:39:31', '', '2020-02-14 04:55:27', '测试代码生成器');
-- ----------------------------
-- Records of gen_table_column
-- ----------------------------
INSERT INTO `gen_table_column` VALUES (1, '1', 'id', '主键', 'int', 'Integer', 'id', '1', '1', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 1, 'admin', '2020-02-12 03:39:31', '', '2020-02-14 04:55:27');
INSERT INTO `gen_table_column` VALUES (2, '1', 'test_key', 'key键', 'varchar(255)', 'String', 'testKey', '0', '0', '1', '1', '1', '1', '1', 'LIKE', 'input', '', 2, 'admin', '2020-02-12 03:39:31', '', '2020-02-14 04:55:27');
INSERT INTO `gen_table_column` VALUES (3, '1', 'value', '值', 'varchar(255)', 'String', 'value', '0', '0', '1', '1', '1', '1', '1', 'LIKE', 'input', '', 3, 'admin', '2020-02-12 03:39:31', '', '2020-02-14 04:55:27');
INSERT INTO `gen_table_column` VALUES (4, '1', 'version', '版本', 'int', 'Integer', 'version', '0', '0', '1', NULL, NULL, NULL, NULL, 'EQ', 'input', '', 4, 'admin', '2020-02-12 03:39:31', '', '2020-02-14 04:55:27');
INSERT INTO `gen_table_column` VALUES (5, '1', 'create_time', '创建时间', 'datetime', 'Date', 'createTime', '0', '0', '1', NULL, NULL, '1', '1', 'EQ', 'datetime', '', 5, 'admin', '2020-02-12 03:39:31', '', '2020-02-14 04:55:27');
INSERT INTO `gen_table_column` VALUES (6, '1', 'deleted', '删除状态', 'tinyint', 'Integer', 'deleted', '0', '0', '1', NULL, NULL, NULL, NULL, 'EQ', 'input', '', 6, 'admin', '2020-02-12 03:39:31', '', '2020-02-14 04:55:27');
INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `is_frame`, `menu_type`, `visible`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2000, '测试用例', 0, 5, '', NULL, 1, 'M', '0', NULL, 'bug', 'admin', '2020-02-12 03:57:28', '', NULL, '');
INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `is_frame`, `menu_type`, `visible`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2007, '测试', 2000, 1, 'cstest', 'cstest/cstest/index', 1, 'C', '0', 'cstest:cstest:list', '#', 'admin', '2018-03-01 00:00:00', 'ry', '2018-03-01 00:00:00', '测试菜单');
INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `is_frame`, `menu_type`, `visible`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2008, '测试查询', 2007, 1, '#', '', 1, 'F', '0', 'cstest:cstest:query', '#', 'admin', '2018-03-01 00:00:00', 'ry', '2018-03-01 00:00:00', '');
INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `is_frame`, `menu_type`, `visible`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2009, '测试新增', 2007, 2, '#', '', 1, 'F', '0', 'cstest:cstest:add', '#', 'admin', '2018-03-01 00:00:00', 'ry', '2018-03-01 00:00:00', '');
INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `is_frame`, `menu_type`, `visible`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2010, '测试修改', 2007, 3, '#', '', 1, 'F', '0', 'cstest:cstest:edit', '#', 'admin', '2018-03-01 00:00:00', 'ry', '2018-03-01 00:00:00', '');
INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `is_frame`, `menu_type`, `visible`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2011, '测试删除', 2007, 4, '#', '', 1, 'F', '0', 'cstest:cstest:remove', '#', 'admin', '2018-03-01 00:00:00', 'ry', '2018-03-01 00:00:00', '');
INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `is_frame`, `menu_type`, `visible`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2012, '测试导出', 2007, 5, '#', '', 1, 'F', '0', 'cstest:cstest:export', '#', 'admin', '2018-03-01 00:00:00', 'ry', '2018-03-01 00:00:00', '');
SET FOREIGN_KEY_CHECKS = 1;
ruoyi/src/main/java/com/ruoyi/project/cstest/controller/CsTestController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,114 @@
package com.ruoyi.project.cstest.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import java.util.List;
import java.util.Arrays;
import com.ruoyi.common.utils.StringUtils;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.cstest.domain.CsTest;
import com.ruoyi.project.cstest.service.ICsTestService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;
/**
 * æµ‹è¯•Controller
 *
 * @author Lion Li
 * @date 2020-02-14
 */
@AllArgsConstructor
@RestController
@RequestMapping("/cstest/cstest" )
public class CsTestController extends BaseController {
    private final ICsTestService iCsTestService;
    /**
     * æŸ¥è¯¢æµ‹è¯•列表
     */
    @PreAuthorize("@ss.hasPermi('cstest:cstest:list')" )
    @GetMapping("/list" )
    public TableDataInfo list(CsTest csTest) {
        startPage();
        LambdaQueryWrapper<CsTest> lqw = new LambdaQueryWrapper<CsTest>();
        if (StringUtils.isNotBlank(csTest.getTestKey())){
            lqw.like(CsTest::getTestKey ,csTest.getTestKey());
        }
        if (StringUtils.isNotBlank(csTest.getValue())){
            lqw.like(CsTest::getValue ,csTest.getValue());
        }
        if (csTest.getCreateTime() != null){
            lqw.eq(CsTest::getCreateTime ,csTest.getCreateTime());
        }
        List<CsTest> list = iCsTestService.list(lqw);
        return getDataTable(list);
    }
    /**
     * å¯¼å‡ºæµ‹è¯•列表
     */
    @PreAuthorize("@ss.hasPermi('cstest:cstest:export')" )
    @Log(title = "测试" , businessType = BusinessType.EXPORT)
    @GetMapping("/export" )
    public AjaxResult export(CsTest csTest) {
        LambdaQueryWrapper<CsTest> lqw = new LambdaQueryWrapper<CsTest>(csTest);
        List<CsTest> list = iCsTestService.list(lqw);
        ExcelUtil<CsTest> util = new ExcelUtil<CsTest>(CsTest. class);
        return util.exportExcel(list, "cstest" );
    }
    /**
     * èŽ·å–æµ‹è¯•è¯¦ç»†ä¿¡æ¯
     */
    @PreAuthorize("@ss.hasPermi('cstest:cstest:query')" )
    @GetMapping(value = "/{id}" )
    public AjaxResult getInfo(@PathVariable("id" ) Integer id) {
        return AjaxResult.success(iCsTestService.getById(id));
    }
    /**
     * æ–°å¢žæµ‹è¯•
     */
    @PreAuthorize("@ss.hasPermi('cstest:cstest:add')" )
    @Log(title = "测试" , businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CsTest csTest) {
        return toAjax(iCsTestService.save(csTest) ? 1 : 0);
    }
    /**
     * ä¿®æ”¹æµ‹è¯•
     */
    @PreAuthorize("@ss.hasPermi('cstest:cstest:edit')" )
    @Log(title = "测试" , businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CsTest csTest) {
        return toAjax(iCsTestService.updateById(csTest) ? 1 : 0);
    }
    /**
     * åˆ é™¤æµ‹è¯•
     */
    @PreAuthorize("@ss.hasPermi('cstest:cstest:remove')" )
    @Log(title = "测试" , businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}" )
    public AjaxResult remove(@PathVariable Integer[] ids) {
        return toAjax(iCsTestService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
    }
}
ruoyi/src/main/java/com/ruoyi/project/cstest/domain/CsTest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,62 @@
package com.ruoyi.project.cstest.domain;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import java.io.Serializable;
import java.util.Date;
/**
 * æµ‹è¯•对象 chkj_test
 *
 * @author Lion Li
 * @date 2020-02-14
 */
@Data
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@Accessors(chain = true)
@TableName("chkj_test")
public class CsTest implements Serializable {
private static final long serialVersionUID=1L;
    /** ä¸»é”® */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    /** key键 */
    @Excel(name = "key键")
    private String testKey;
    /** å€¼ */
    @Excel(name = "值")
    private String value;
    /** ç‰ˆæœ¬ */
    @Version
    private Integer version;
    /** åˆ›å»ºæ—¶é—´ */
    @Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    /** åˆ é™¤çŠ¶æ€ */
    @TableLogic
    private Integer deleted;
}
ruoyi/src/main/java/com/ruoyi/project/cstest/mapper/CsTestMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
package com.ruoyi.project.cstest.mapper;
import com.ruoyi.project.cstest.domain.CsTest;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
 * æµ‹è¯•Mapper接口
 *
 * @author Lion Li
 * @date 2020-02-14
 */
public interface CsTestMapper extends BaseMapper<CsTest> {
}
ruoyi/src/main/java/com/ruoyi/project/cstest/service/ICsTestService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
package com.ruoyi.project.cstest.service;
import com.ruoyi.project.cstest.domain.CsTest;
import com.baomidou.mybatisplus.extension.service.IService;
/**
 * æµ‹è¯•Service接口
 *
 * @author Lion Li
 * @date 2020-02-14
 */
public interface ICsTestService extends IService<CsTest> {
}
ruoyi/src/main/java/com/ruoyi/project/cstest/service/impl/CsTestServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
package com.ruoyi.project.cstest.service.impl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.project.cstest.mapper.CsTestMapper;
import com.ruoyi.project.cstest.domain.CsTest;
import com.ruoyi.project.cstest.service.ICsTestService;
/**
 * æµ‹è¯•Service业务层处理
 *
 * @author Lion Li
 * @date 2020-02-14
 */
@Service
public class CsTestServiceImpl extends ServiceImpl<CsTestMapper, CsTest> implements ICsTestService {
}
ruoyi/src/main/resources/mybatis/cstest/CsTestMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.cstest.mapper.CsTestMapper">
    <resultMap type="CsTest" id="CsTestResult">
        <result property="id"    column="id"    />
        <result property="testKey"    column="test_key"    />
        <result property="value"    column="value"    />
        <result property="version"    column="version"    />
        <result property="createTime"    column="create_time"    />
        <result property="deleted"    column="deleted"    />
    </resultMap>
</mapper>