From 83c427c1bbf5e8e9a07bdea946479b005da0297e Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期五, 14 二月 2020 13:36:52 +0800
Subject: [PATCH] 增加 代码生成与MybatisPlus测试案例 cstest
---
ruoyi/sql/test.sql | 57 +++++
ruoyi/src/main/java/com/ruoyi/project/cstest/mapper/CsTestMapper.java | 14 +
ruoyi/src/main/resources/mybatis/cstest/CsTestMapper.xml | 17 +
ruoyi/src/main/java/com/ruoyi/project/cstest/domain/CsTest.java | 62 +++++
ruoyi-ui/src/views/cstest/cstest/index.vue | 299 +++++++++++++++++++++++++++
ruoyi/src/main/java/com/ruoyi/project/cstest/controller/CsTestController.java | 114 ++++++++++
ruoyi/src/main/java/com/ruoyi/project/cstest/service/ICsTestService.java | 14 +
ruoyi/src/main/java/com/ruoyi/project/cstest/service/impl/CsTestServiceImpl.java | 18 +
ruoyi-ui/src/api/cstest/cstest.js | 53 ++++
9 files changed, 648 insertions(+), 0 deletions(-)
diff --git a/ruoyi-ui/src/api/cstest/cstest.js b/ruoyi-ui/src/api/cstest/cstest.js
new file mode 100644
index 0000000..221fe36
--- /dev/null
+++ b/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
+ })
+}
\ No newline at end of file
diff --git a/ruoyi-ui/src/views/cstest/cstest/index.vue b/ruoyi-ui/src/views/cstest/cstest/index.vue
new file mode 100644
index 0000000..60a0b8c
--- /dev/null
+++ b/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="璇疯緭鍏ey閿�"
+ 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="璇疯緭鍏ey閿�" />
+ </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>
\ No newline at end of file
diff --git a/ruoyi/sql/test.sql b/ruoyi/sql/test.sql
new file mode 100644
index 0000000..487800c
--- /dev/null
+++ b/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', '娴嬭瘯浠g爜鐢熸垚鍣�');
+
+-- ----------------------------
+-- 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;
\ No newline at end of file
diff --git a/ruoyi/src/main/java/com/ruoyi/project/cstest/controller/CsTestController.java b/ruoyi/src/main/java/com/ruoyi/project/cstest/controller/CsTestController.java
new file mode 100644
index 0000000..2c4edc2
--- /dev/null
+++ b/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);
+ }
+}
diff --git a/ruoyi/src/main/java/com/ruoyi/project/cstest/domain/CsTest.java b/ruoyi/src/main/java/com/ruoyi/project/cstest/domain/CsTest.java
new file mode 100644
index 0000000..583c688
--- /dev/null
+++ b/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;
+
+}
diff --git a/ruoyi/src/main/java/com/ruoyi/project/cstest/mapper/CsTestMapper.java b/ruoyi/src/main/java/com/ruoyi/project/cstest/mapper/CsTestMapper.java
new file mode 100644
index 0000000..6034f3b
--- /dev/null
+++ b/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> {
+
+}
diff --git a/ruoyi/src/main/java/com/ruoyi/project/cstest/service/ICsTestService.java b/ruoyi/src/main/java/com/ruoyi/project/cstest/service/ICsTestService.java
new file mode 100644
index 0000000..d579d58
--- /dev/null
+++ b/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> {
+
+}
diff --git a/ruoyi/src/main/java/com/ruoyi/project/cstest/service/impl/CsTestServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/cstest/service/impl/CsTestServiceImpl.java
new file mode 100644
index 0000000..9b00e9b
--- /dev/null
+++ b/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 {
+
+}
diff --git a/ruoyi/src/main/resources/mybatis/cstest/CsTestMapper.xml b/ruoyi/src/main/resources/mybatis/cstest/CsTestMapper.xml
new file mode 100644
index 0000000..a3cb78b
--- /dev/null
+++ b/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>
\ No newline at end of file
--
Gitblit v1.9.3