no commit message
This commit is contained in:
parent
65c0150f5f
commit
aa1ada4bba
53
ruoyi-ui/src/api/base/idiom.js
Normal file
53
ruoyi-ui/src/api/base/idiom.js
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询成语存放列表
|
||||||
|
export function listIdiom(query) {
|
||||||
|
return request({
|
||||||
|
url: '/base/idiom/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询成语存放详细
|
||||||
|
export function getIdiom(id) {
|
||||||
|
return request({
|
||||||
|
url: '/base/idiom/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增成语存放
|
||||||
|
export function addIdiom(data) {
|
||||||
|
return request({
|
||||||
|
url: '/base/idiom',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改成语存放
|
||||||
|
export function updateIdiom(data) {
|
||||||
|
return request({
|
||||||
|
url: '/base/idiom',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除成语存放
|
||||||
|
export function delIdiom(id) {
|
||||||
|
return request({
|
||||||
|
url: '/base/idiom/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出成语存放
|
||||||
|
export function exportIdiom(query) {
|
||||||
|
return request({
|
||||||
|
url: '/base/idiom/export',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
308
ruoyi-ui/src/views/base/idiom/index.vue
Normal file
308
ruoyi-ui/src/views/base/idiom/index.vue
Normal file
@ -0,0 +1,308 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
|
||||||
|
<el-form-item label="成语" prop="idiomName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.idiomName"
|
||||||
|
placeholder="请输入成语"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="难易程度" prop="idiomLevel">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.idiomLevel"
|
||||||
|
placeholder="请输入难易程度"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</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="['base:idiom: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="['base:idiom: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="['base:idiom:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['base:idiom:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" stripe border fit highlight-current-row :data="idiomList" @selection-change="handleSelectionChange" @sort-change='tableSortChange' @row-dblclick="handleUpdate">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="行号" width="80" align="center">
|
||||||
|
<template slot-scope="scope">{{scope.$index + 1}}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="id" align="center" prop="id" v-if="false" />
|
||||||
|
<el-table-column label="成语" align="center" prop="idiomName" min-width="25%" sortable='custom' :sort-orders="['ascending', 'descending']" />
|
||||||
|
<el-table-column label="拼音" align="center" prop="idiomPinyin" min-width="25%" sortable='custom' :sort-orders="['ascending', 'descending']" />
|
||||||
|
<el-table-column label="注释" align="center" prop="idiomDesc" min-width="88%" sortable='custom' :sort-orders="['ascending', 'descending']" />
|
||||||
|
<el-table-column label="难易程度" align="center" prop="idiomLevel" min-width="10%" sortable='custom' :sort-orders="['ascending', 'descending']" />
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" min-width="10%" sortable='custom' :sort-orders="['ascending', 'descending']" />
|
||||||
|
<el-table-column label="操作" align="center" min-width="20%" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
plain
|
||||||
|
size="small"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['base:idiom:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
plain
|
||||||
|
size="small"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['base:idiom: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="成语" prop="idiomName">
|
||||||
|
<el-input v-model="form.idiomName" placeholder="请输入成语" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="拼音" prop="idiomPinyin">
|
||||||
|
<el-input v-model="form.idiomPinyin" placeholder="请输入拼音" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="注释" prop="idiomDesc">
|
||||||
|
<el-input v-model="form.idiomDesc" :rows="8" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="难易程度" prop="idiomLevel">
|
||||||
|
<el-input v-model="form.idiomLevel" 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 { listIdiom, getIdiom, delIdiom, addIdiom, updateIdiom, exportIdiom } from "@/api/base/idiom";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 成语存放表格数据
|
||||||
|
idiomList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
orderByColumn: undefined,
|
||||||
|
isAsc: undefined,
|
||||||
|
idiomName: undefined,
|
||||||
|
idiomDesc: undefined,
|
||||||
|
idiomLevel: undefined,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 通用成语存放排序 */
|
||||||
|
tableSortChange(column) {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
if (column.order === 'descending') {
|
||||||
|
this.queryParams.orderByColumn = column.prop;
|
||||||
|
this.queryParams.isAsc = 'desc';
|
||||||
|
} else {
|
||||||
|
this.queryParams.orderByColumn = column.prop;
|
||||||
|
this.queryParams.isAsc = 'asc';
|
||||||
|
}
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 查询成语存放列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listIdiom(this.queryParams).then(response => {
|
||||||
|
this.idiomList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: undefined,
|
||||||
|
idiomName: undefined,
|
||||||
|
idiomPinyin: undefined,
|
||||||
|
idiomDesc: undefined,
|
||||||
|
idiomLevel: undefined,
|
||||||
|
createBy: undefined,
|
||||||
|
createTime: undefined,
|
||||||
|
updateBy: undefined,
|
||||||
|
updateTime: undefined,
|
||||||
|
remark: 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
|
||||||
|
getIdiom(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) {
|
||||||
|
updateIdiom(this.form).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
} else {
|
||||||
|
this.msgError(response.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addIdiom(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 delIdiom(ids);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.msgSuccess("删除成功");
|
||||||
|
}).catch(function() {});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
const queryParams = this.queryParams;
|
||||||
|
this.$confirm('是否确认导出所有成语存放数据项?', "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(function() {
|
||||||
|
return exportIdiom(queryParams);
|
||||||
|
}).then(response => {
|
||||||
|
this.download(response.msg);
|
||||||
|
}).catch(function() {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -0,0 +1,78 @@
|
|||||||
|
package com.ruoyi.project.mr.api;
|
||||||
|
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.enums.UserStatus;
|
||||||
|
import com.ruoyi.common.utils.MessageUtils;
|
||||||
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.framework.web.controller.BaseController;
|
||||||
|
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||||
|
import com.ruoyi.project.mr.base.domain.DataIdiom;
|
||||||
|
import com.ruoyi.project.mr.base.service.IDataIdiomService;
|
||||||
|
import com.ruoyi.project.system.domain.SysUser;
|
||||||
|
import com.ruoyi.project.system.service.ISysUserService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestHeader;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* swagger 成语接口
|
||||||
|
*
|
||||||
|
* @author zzp
|
||||||
|
*/
|
||||||
|
@Api(tags = "成语接口")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mr/base")
|
||||||
|
public class IdiomController extends BaseController {
|
||||||
|
// 令牌秘钥
|
||||||
|
@Value("${token.apiSecret}")
|
||||||
|
private String apiSecret;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IDataIdiomService dataIdiomService;
|
||||||
|
|
||||||
|
@ApiOperation(value = "成语信息", notes = "根据ID查询成语信息")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "id", value = "成语ID", dataType = "int", paramType = "query", example = "1")})
|
||||||
|
@GetMapping("/IdiomByID")
|
||||||
|
public AjaxResult getIdiomByID(@RequestHeader(value = "signature", required = false) String secret, Long id) {
|
||||||
|
if (StringUtils.isEmpty(secret)) {
|
||||||
|
return AjaxResult.error(400, MessageUtils.message("api.error.msg"));
|
||||||
|
} else if (!apiSecret.equals(secret)) {
|
||||||
|
return AjaxResult.error(400, MessageUtils.message("api.error.msg"));
|
||||||
|
}
|
||||||
|
|
||||||
|
DataIdiom idiom = dataIdiomService.selectDataIdiomById(id);
|
||||||
|
|
||||||
|
if(idiom!= null){
|
||||||
|
return AjaxResult.success(idiom);
|
||||||
|
}else{
|
||||||
|
return AjaxResult.error(400, MessageUtils.message("api.error.null"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "成语信息", notes = "根据词语查询成语信息")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "name", value = "词语", dataType = "String", paramType = "query", example = "双")})
|
||||||
|
@GetMapping("/IdiomByName")
|
||||||
|
public AjaxResult getIdiomByName(@RequestHeader(value = "signature", required = false) String secret, String name) {
|
||||||
|
if (StringUtils.isEmpty(secret)) {
|
||||||
|
return AjaxResult.error(400, MessageUtils.message("api.error.msg"));
|
||||||
|
} else if (!apiSecret.equals(secret)) {
|
||||||
|
return AjaxResult.error(400, MessageUtils.message("api.error.msg"));
|
||||||
|
}
|
||||||
|
DataIdiom idiom = dataIdiomService.selectDataIdiomByName(name);
|
||||||
|
if(idiom!= null){
|
||||||
|
return AjaxResult.success(idiom);
|
||||||
|
}else{
|
||||||
|
return AjaxResult.error(400, MessageUtils.message("api.error.null"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,106 @@
|
|||||||
|
package com.ruoyi.project.mr.base.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
|
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.mr.base.domain.DataIdiom;
|
||||||
|
import com.ruoyi.project.mr.base.service.IDataIdiomService;
|
||||||
|
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 mr
|
||||||
|
* @date 2020-03-03
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/base/idiom")
|
||||||
|
public class DataIdiomController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IDataIdiomService dataIdiomService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询成语存放列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('base:idiom:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(DataIdiom dataIdiom)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<DataIdiom> list = dataIdiomService.selectDataIdiomList(dataIdiom);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出成语存放列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('base:idiom:export')")
|
||||||
|
@Log(title = "成语存放", businessType = BusinessType.EXPORT)
|
||||||
|
@GetMapping("/export")
|
||||||
|
public AjaxResult export(DataIdiom dataIdiom)
|
||||||
|
{
|
||||||
|
List<DataIdiom> list = dataIdiomService.selectDataIdiomList(dataIdiom);
|
||||||
|
ExcelUtil<DataIdiom> util = new ExcelUtil<DataIdiom>(DataIdiom.class);
|
||||||
|
return util.exportExcel(list, "idiom");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取成语存放详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('base:idiom:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(dataIdiomService.selectDataIdiomById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增成语存放
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('base:idiom:add')")
|
||||||
|
@Log(title = "成语存放", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody DataIdiom dataIdiom)
|
||||||
|
{
|
||||||
|
dataIdiom.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
return toAjax(dataIdiomService.insertDataIdiom(dataIdiom));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改成语存放
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('base:idiom:edit')")
|
||||||
|
@Log(title = "成语存放", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody DataIdiom dataIdiom)
|
||||||
|
{
|
||||||
|
return toAjax(dataIdiomService.updateDataIdiom(dataIdiom));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除成语存放
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('base:idiom:remove')")
|
||||||
|
@Log(title = "成语存放", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(dataIdiomService.deleteDataIdiomByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,98 @@
|
|||||||
|
package com.ruoyi.project.mr.base.domain;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
|
||||||
|
import com.ruoyi.framework.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成语存放对象 data_idiom
|
||||||
|
*
|
||||||
|
* @author mr
|
||||||
|
* @date 2020-03-03
|
||||||
|
*/
|
||||||
|
public class DataIdiom extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** id */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 成语 */
|
||||||
|
@Excel(name = "成语")
|
||||||
|
private String idiomName;
|
||||||
|
|
||||||
|
/** 拼音 */
|
||||||
|
@Excel(name = "拼音")
|
||||||
|
private String idiomPinyin;
|
||||||
|
|
||||||
|
/** 注释 */
|
||||||
|
@Excel(name = "注释")
|
||||||
|
private String idiomDesc;
|
||||||
|
|
||||||
|
/** 难易程度 */
|
||||||
|
@Excel(name = "难易程度")
|
||||||
|
private Integer idiomLevel;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setIdiomName(String idiomName)
|
||||||
|
{
|
||||||
|
this.idiomName = idiomName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdiomName()
|
||||||
|
{
|
||||||
|
return idiomName;
|
||||||
|
}
|
||||||
|
public void setIdiomPinyin(String idiomPinyin)
|
||||||
|
{
|
||||||
|
this.idiomPinyin = idiomPinyin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdiomPinyin()
|
||||||
|
{
|
||||||
|
return idiomPinyin;
|
||||||
|
}
|
||||||
|
public void setIdiomDesc(String idiomDesc)
|
||||||
|
{
|
||||||
|
this.idiomDesc = idiomDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdiomDesc()
|
||||||
|
{
|
||||||
|
return idiomDesc;
|
||||||
|
}
|
||||||
|
public void setIdiomLevel(Integer idiomLevel)
|
||||||
|
{
|
||||||
|
this.idiomLevel = idiomLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIdiomLevel()
|
||||||
|
{
|
||||||
|
return idiomLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("idiomName", getIdiomName())
|
||||||
|
.append("idiomPinyin", getIdiomPinyin())
|
||||||
|
.append("idiomDesc", getIdiomDesc())
|
||||||
|
.append("idiomLevel", getIdiomLevel())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.append("remark", getRemark())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package com.ruoyi.project.mr.base.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.project.mr.base.domain.DataIdiom;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成语存放Mapper接口
|
||||||
|
*
|
||||||
|
* @author mr
|
||||||
|
* @date 2020-03-03
|
||||||
|
*/
|
||||||
|
public interface DataIdiomMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询成语存放
|
||||||
|
*
|
||||||
|
* @param id 成语存放ID
|
||||||
|
* @return 成语存放
|
||||||
|
*/
|
||||||
|
public DataIdiom selectDataIdiomById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询成语存放
|
||||||
|
*
|
||||||
|
* @param name 成语存放Name
|
||||||
|
* @return 成语存放
|
||||||
|
*/
|
||||||
|
public DataIdiom selectDataIdiomByName(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询成语存放列表
|
||||||
|
*
|
||||||
|
* @param dataIdiom 成语存放
|
||||||
|
* @return 成语存放集合
|
||||||
|
*/
|
||||||
|
public List<DataIdiom> selectDataIdiomList(DataIdiom dataIdiom);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增成语存放
|
||||||
|
*
|
||||||
|
* @param dataIdiom 成语存放
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertDataIdiom(DataIdiom dataIdiom);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改成语存放
|
||||||
|
*
|
||||||
|
* @param dataIdiom 成语存放
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateDataIdiom(DataIdiom dataIdiom);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除成语存放
|
||||||
|
*
|
||||||
|
* @param id 成语存放ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDataIdiomById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除成语存放
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDataIdiomByIds(Long[] ids);
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package com.ruoyi.project.mr.base.service;
|
||||||
|
|
||||||
|
import com.ruoyi.project.mr.base.domain.DataIdiom;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成语存放Service接口
|
||||||
|
*
|
||||||
|
* @author mr
|
||||||
|
* @date 2020-03-03
|
||||||
|
*/
|
||||||
|
public interface IDataIdiomService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询成语存放
|
||||||
|
*
|
||||||
|
* @param id 成语存放ID
|
||||||
|
* @return 成语存放
|
||||||
|
*/
|
||||||
|
public DataIdiom selectDataIdiomById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询成语存放
|
||||||
|
*
|
||||||
|
* @param name 成语存放Name
|
||||||
|
* @return 成语存放
|
||||||
|
*/
|
||||||
|
public DataIdiom selectDataIdiomByName(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询成语存放列表
|
||||||
|
*
|
||||||
|
* @param dataIdiom 成语存放
|
||||||
|
* @return 成语存放集合
|
||||||
|
*/
|
||||||
|
public List<DataIdiom> selectDataIdiomList(DataIdiom dataIdiom);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增成语存放
|
||||||
|
*
|
||||||
|
* @param dataIdiom 成语存放
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertDataIdiom(DataIdiom dataIdiom);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改成语存放
|
||||||
|
*
|
||||||
|
* @param dataIdiom 成语存放
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateDataIdiom(DataIdiom dataIdiom);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除成语存放
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的成语存放ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDataIdiomByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除成语存放信息
|
||||||
|
*
|
||||||
|
* @param id 成语存放ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDataIdiomById(Long id);
|
||||||
|
}
|
@ -0,0 +1,108 @@
|
|||||||
|
package com.ruoyi.project.mr.base.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.project.mr.base.mapper.DataIdiomMapper;
|
||||||
|
import com.ruoyi.project.mr.base.domain.DataIdiom;
|
||||||
|
import com.ruoyi.project.mr.base.service.IDataIdiomService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成语存放Service业务层处理
|
||||||
|
*
|
||||||
|
* @author mr
|
||||||
|
* @date 2020-03-03
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class DataIdiomServiceImpl implements IDataIdiomService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private DataIdiomMapper dataIdiomMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询成语存放
|
||||||
|
*
|
||||||
|
* @param id 成语存放ID
|
||||||
|
* @return 成语存放
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DataIdiom selectDataIdiomById(Long id)
|
||||||
|
{
|
||||||
|
return dataIdiomMapper.selectDataIdiomById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询成语存放
|
||||||
|
*
|
||||||
|
* @param name 成语存放Name
|
||||||
|
* @return 成语存放
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DataIdiom selectDataIdiomByName(String name)
|
||||||
|
{
|
||||||
|
return dataIdiomMapper.selectDataIdiomByName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询成语存放列表
|
||||||
|
*
|
||||||
|
* @param dataIdiom 成语存放
|
||||||
|
* @return 成语存放
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<DataIdiom> selectDataIdiomList(DataIdiom dataIdiom)
|
||||||
|
{
|
||||||
|
return dataIdiomMapper.selectDataIdiomList(dataIdiom);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增成语存放
|
||||||
|
*
|
||||||
|
* @param dataIdiom 成语存放
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertDataIdiom(DataIdiom dataIdiom)
|
||||||
|
{
|
||||||
|
dataIdiom.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return dataIdiomMapper.insertDataIdiom(dataIdiom);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改成语存放
|
||||||
|
*
|
||||||
|
* @param dataIdiom 成语存放
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateDataIdiom(DataIdiom dataIdiom)
|
||||||
|
{
|
||||||
|
dataIdiom.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return dataIdiomMapper.updateDataIdiom(dataIdiom);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除成语存放
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的成语存放ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteDataIdiomByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return dataIdiomMapper.deleteDataIdiomByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除成语存放信息
|
||||||
|
*
|
||||||
|
* @param id 成语存放ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteDataIdiomById(Long id)
|
||||||
|
{
|
||||||
|
return dataIdiomMapper.deleteDataIdiomById(id);
|
||||||
|
}
|
||||||
|
}
|
@ -38,3 +38,4 @@ no.view.permission=您没有查看数据的权限,请联系管理员添加权
|
|||||||
#API消息
|
#API消息
|
||||||
api.success.msg=请求(或处理)成功
|
api.success.msg=请求(或处理)成功
|
||||||
api.error.msg=请求参数不完整或不正确
|
api.error.msg=请求参数不完整或不正确
|
||||||
|
api.error.null=无请求数据
|
||||||
|
98
ruoyi/src/main/resources/mybatis/base/DataIdiomMapper.xml
Normal file
98
ruoyi/src/main/resources/mybatis/base/DataIdiomMapper.xml
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<?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.mr.base.mapper.DataIdiomMapper">
|
||||||
|
|
||||||
|
<resultMap type="DataIdiom" id="DataIdiomResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="idiomName" column="idiom_name" />
|
||||||
|
<result property="idiomPinyin" column="idiom_pinyin" />
|
||||||
|
<result property="idiomDesc" column="idiom_desc" />
|
||||||
|
<result property="idiomLevel" column="idiom_level" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectDataIdiomVo">
|
||||||
|
select id, idiom_name, idiom_pinyin, idiom_desc, idiom_level, create_by, create_time, update_by, update_time, remark from data_idiom
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectDataIdiomList" parameterType="DataIdiom" resultMap="DataIdiomResult">
|
||||||
|
<include refid="selectDataIdiomVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="idiomName != null and idiomName != ''"> and idiom_name like concat('%', #{idiomName}, '%')</if>
|
||||||
|
<if test="idiomDesc != null and idiomDesc != ''"> and idiom_desc like concat('%', #{idiomDesc}, '%')</if>
|
||||||
|
<if test="idiomLevel != null "> and idiom_level >= #{idiomLevel}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDataIdiomById" parameterType="Long" resultMap="DataIdiomResult">
|
||||||
|
<include refid="selectDataIdiomVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDataIdiomByName" parameterType="String" resultMap="DataIdiomResult">
|
||||||
|
<include refid="selectDataIdiomVo"/>
|
||||||
|
where idiom_name like concat('%', #{name}, '%') LIMIT 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertDataIdiom" parameterType="DataIdiom" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into data_idiom
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null ">id,</if>
|
||||||
|
<if test="idiomName != null and idiomName != ''">idiom_name,</if>
|
||||||
|
<if test="idiomPinyin != null and idiomPinyin != ''">idiom_pinyin,</if>
|
||||||
|
<if test="idiomDesc != null and idiomDesc != ''">idiom_desc,</if>
|
||||||
|
<if test="idiomLevel != null ">idiom_level,</if>
|
||||||
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
|
<if test="createTime != null ">create_time,</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
||||||
|
<if test="updateTime != null ">update_time,</if>
|
||||||
|
<if test="remark != null and remark != ''">remark,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null ">#{id},</if>
|
||||||
|
<if test="idiomName != null and idiomName != ''">#{idiomName},</if>
|
||||||
|
<if test="idiomPinyin != null and idiomPinyin != ''">#{idiomPinyin},</if>
|
||||||
|
<if test="idiomDesc != null and idiomDesc != ''">#{idiomDesc},</if>
|
||||||
|
<if test="idiomLevel != null ">#{idiomLevel},</if>
|
||||||
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
|
<if test="createTime != null ">#{createTime},</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null ">#{updateTime},</if>
|
||||||
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDataIdiom" parameterType="DataIdiom">
|
||||||
|
update data_idiom
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="idiomName != null and idiomName != ''">idiom_name = #{idiomName},</if>
|
||||||
|
<if test="idiomPinyin != null and idiomPinyin != ''">idiom_pinyin = #{idiomPinyin},</if>
|
||||||
|
<if test="idiomDesc != null and idiomDesc != ''">idiom_desc = #{idiomDesc},</if>
|
||||||
|
<if test="idiomLevel != null ">idiom_level = #{idiomLevel},</if>
|
||||||
|
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null ">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null ">update_time = #{updateTime},</if>
|
||||||
|
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteDataIdiomById" parameterType="Long">
|
||||||
|
delete from data_idiom where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteDataIdiomByIds" parameterType="String">
|
||||||
|
delete from data_idiom where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
x
Reference in New Issue
Block a user