增加 代码生成与MybatisPlus测试案例 cstest
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | 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; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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> { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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> { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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> |