parent
a5940e24fb
commit
3ae4960e84
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询英语单词列表
|
||||
export function listWord(query) {
|
||||
return request({
|
||||
url: '/english/word/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询英语单词详细
|
||||
export function getWord(id) {
|
||||
return request({
|
||||
url: '/english/word/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增英语单词
|
||||
export function addWord(data) {
|
||||
return request({
|
||||
url: '/english/word',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改英语单词
|
||||
export function updateWord(data) {
|
||||
return request({
|
||||
url: '/english/word',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除英语单词
|
||||
export function delWord(id) {
|
||||
return request({
|
||||
url: '/english/word/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
@ -0,0 +1,342 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="英语单词" prop="englishWord">
|
||||
<el-input
|
||||
v-model="queryParams.englishWord"
|
||||
placeholder="英语单词"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="中文" prop="chineseWord">
|
||||
<el-input
|
||||
v-model="queryParams.chineseWord"
|
||||
placeholder="请输入中文"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间">
|
||||
<el-date-picker
|
||||
v-model="daterangeCreateTime"
|
||||
size="small"
|
||||
style="width: 240px"
|
||||
value-format="yyyy-MM-dd"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-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"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['english:word:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['english:word:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['english:word:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['english:word:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="wordList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="英语单词" align="center" prop="englishWord" />
|
||||
<el-table-column label="中文" align="center" prop="chineseWord" />
|
||||
<el-table-column label="排序" align="center" prop="sort" />
|
||||
<el-table-column label="收藏" align="center" prop="isCollect">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.english_collect" :value="scope.row.isCollect"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="置顶" align="center" prop="top">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.english_top" :value="scope.row.top"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="查看次数" align="center" prop="lookCount" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</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="['english:word:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['english:word: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" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="英语单词" prop="englishWord">
|
||||
<el-input v-model="form.englishWord" placeholder="请输入英语单词" />
|
||||
</el-form-item>
|
||||
<el-form-item label="中文" prop="chineseWord">
|
||||
<el-input v-model="form.chineseWord" placeholder="请输入对应的中文" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input v-model="form.sort" placeholder="请输入排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="收藏" prop="isCollect">
|
||||
<el-select v-model="form.isCollect" placeholder="请选择是否收藏">
|
||||
<el-option
|
||||
v-for="dict in dict.type.english_collect"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="parseInt(dict.value)"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="置顶" prop="top">
|
||||
<el-select v-model="form.top" placeholder="请选择置顶">
|
||||
<el-option
|
||||
v-for="dict in dict.type.english_top"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="parseInt(dict.value)"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="查看次数" prop="lookCount">
|
||||
<el-input v-model="form.lookCount" 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 { listWord, getWord, delWord, addWord, updateWord } from "@/api/business/english/word";
|
||||
|
||||
export default {
|
||||
name: "Word",
|
||||
dicts: ['english_collect', 'english_top'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 英语单词表格数据
|
||||
wordList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查看次数时间范围
|
||||
daterangeCreateTime: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
englishWord: null,
|
||||
chineseWord: null,
|
||||
createTime: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
englishWord: [
|
||||
{ required: true, message: "英语单词不能为空", trigger: "blur" }
|
||||
],
|
||||
isCollect: [
|
||||
{ required: true, message: "是否收藏 1收藏 2不收藏不能为空", trigger: "change" }
|
||||
],
|
||||
top: [
|
||||
{ required: true, message: "置顶 1置顶 2不置顶不能为空", trigger: "change" }
|
||||
],
|
||||
createTime: [
|
||||
{ required: true, message: "创建时间不能为空", trigger: "blur" }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询英语单词列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
this.queryParams.params = {};
|
||||
if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
|
||||
this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
|
||||
this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
|
||||
}
|
||||
listWord(this.queryParams).then(response => {
|
||||
this.wordList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
englishWord: null,
|
||||
chineseWord: null,
|
||||
sort: null,
|
||||
isCollect: null,
|
||||
top: null,
|
||||
lookCount: null,
|
||||
createTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.daterangeCreateTime = [];
|
||||
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
|
||||
getWord(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改英语单词";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateWord(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addWord(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除英语单词编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delWord(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('english/word/export', {
|
||||
...this.queryParams
|
||||
}, `word_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -0,0 +1,94 @@
|
||||
package com.xjs.word.controller;
|
||||
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.xjs.word.domain.EnglishWord;
|
||||
import com.xjs.word.service.IEnglishWordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 英语单词Controller
|
||||
*
|
||||
* @author xjs
|
||||
* @date 2021-12-29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/word")
|
||||
public class EnglishWordController extends BaseController {
|
||||
@Autowired
|
||||
private IEnglishWordService englishWordService;
|
||||
|
||||
|
||||
//------------------------代码自动生成-----------------------------------
|
||||
|
||||
/**
|
||||
* 查询英语单词列表
|
||||
*/
|
||||
@RequiresPermissions("english:word:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(EnglishWord englishWord) {
|
||||
startPage();
|
||||
List<EnglishWord> list = englishWordService.selectEnglishWordList(englishWord);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出英语单词列表
|
||||
*/
|
||||
@RequiresPermissions("english:word:export")
|
||||
@Log(title = "英语单词", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, EnglishWord englishWord) {
|
||||
List<EnglishWord> list = englishWordService.selectEnglishWordList(englishWord);
|
||||
ExcelUtil<EnglishWord> util = new ExcelUtil<EnglishWord>(EnglishWord.class);
|
||||
util.exportExcel(response, list, "英语单词数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取英语单词详细信息
|
||||
*/
|
||||
@RequiresPermissions("english:word:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(englishWordService.selectEnglishWordById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增英语单词
|
||||
*/
|
||||
@RequiresPermissions("english:word:add")
|
||||
@Log(title = "英语单词", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EnglishWord englishWord) {
|
||||
return toAjax(englishWordService.insertEnglishWord(englishWord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改英语单词
|
||||
*/
|
||||
@RequiresPermissions("english:word:edit")
|
||||
@Log(title = "英语单词", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EnglishWord englishWord) {
|
||||
return toAjax(englishWordService.updateEnglishWord(englishWord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除英语单词
|
||||
*/
|
||||
@RequiresPermissions("english:word:remove")
|
||||
@Log(title = "英语单词", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(englishWordService.deleteEnglishWordByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
package com.xjs.word.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 英语单词对象 english_word
|
||||
*
|
||||
* @author xjs
|
||||
* @date 2021-12-29
|
||||
*/
|
||||
public class EnglishWord extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 英语单词
|
||||
*/
|
||||
@Excel(name = "英语单词")
|
||||
private String englishWord;
|
||||
|
||||
/**
|
||||
* 对应的中文
|
||||
*/
|
||||
@Excel(name = "对应的中文")
|
||||
private String chineseWord;
|
||||
|
||||
/**
|
||||
* 排序1,2,3,4
|
||||
*/
|
||||
@Excel(name = "排序1,2,3,4")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 是否收藏 1收藏 2不收藏
|
||||
*/
|
||||
@Excel(name = "是否收藏 1收藏 2不收藏")
|
||||
private Integer isCollect;
|
||||
|
||||
/**
|
||||
* 置顶 1置顶 2不置顶
|
||||
*/
|
||||
@Excel(name = "置顶 1置顶 2不置顶")
|
||||
private Integer top;
|
||||
|
||||
/**
|
||||
* 查看次数
|
||||
*/
|
||||
@Excel(name = "查看次数")
|
||||
private Long lookCount;
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setEnglishWord(String englishWord) {
|
||||
this.englishWord = englishWord;
|
||||
}
|
||||
|
||||
public String getEnglishWord() {
|
||||
return englishWord;
|
||||
}
|
||||
|
||||
public void setChineseWord(String chineseWord) {
|
||||
this.chineseWord = chineseWord;
|
||||
}
|
||||
|
||||
public String getChineseWord() {
|
||||
return chineseWord;
|
||||
}
|
||||
|
||||
public void setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setIsCollect(Integer isCollect) {
|
||||
this.isCollect = isCollect;
|
||||
}
|
||||
|
||||
public Integer getIsCollect() {
|
||||
return isCollect;
|
||||
}
|
||||
|
||||
public void setTop(Integer top) {
|
||||
this.top = top;
|
||||
}
|
||||
|
||||
public Integer getTop() {
|
||||
return top;
|
||||
}
|
||||
|
||||
public void setLookCount(Long lookCount) {
|
||||
this.lookCount = lookCount;
|
||||
}
|
||||
|
||||
public Long getLookCount() {
|
||||
return lookCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("englishWord", getEnglishWord())
|
||||
.append("chineseWord", getChineseWord())
|
||||
.append("sort", getSort())
|
||||
.append("isCollect", getIsCollect())
|
||||
.append("top", getTop())
|
||||
.append("lookCount", getLookCount())
|
||||
.append("createTime", getCreateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.xjs.word.mapper;
|
||||
|
||||
import com.xjs.word.domain.EnglishWord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 英语单词Mapper接口
|
||||
*
|
||||
* @author xjs
|
||||
* @date 2021-12-29
|
||||
*/
|
||||
public interface EnglishWordMapper {
|
||||
|
||||
//------------------------代码自动生成-----------------------------------
|
||||
|
||||
/**
|
||||
* 查询英语单词
|
||||
*
|
||||
* @param id 英语单词主键
|
||||
* @return 英语单词
|
||||
*/
|
||||
EnglishWord selectEnglishWordById(Long id);
|
||||
|
||||
/**
|
||||
* 查询英语单词列表
|
||||
*
|
||||
* @param englishWord 英语单词
|
||||
* @return 英语单词集合
|
||||
*/
|
||||
List<EnglishWord> selectEnglishWordList(EnglishWord englishWord);
|
||||
|
||||
/**
|
||||
* 新增英语单词
|
||||
*
|
||||
* @param englishWord 英语单词
|
||||
* @return 结果
|
||||
*/
|
||||
int insertEnglishWord(EnglishWord englishWord);
|
||||
|
||||
/**
|
||||
* 修改英语单词
|
||||
*
|
||||
* @param englishWord 英语单词
|
||||
* @return 结果
|
||||
*/
|
||||
int updateEnglishWord(EnglishWord englishWord);
|
||||
|
||||
/**
|
||||
* 删除英语单词
|
||||
*
|
||||
* @param id 英语单词主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteEnglishWordById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除英语单词
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteEnglishWordByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.xjs.word.service;
|
||||
|
||||
import com.xjs.word.domain.EnglishWord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 英语单词Service接口
|
||||
*
|
||||
* @author xjs
|
||||
* @date 2021-12-29
|
||||
*/
|
||||
public interface IEnglishWordService {
|
||||
|
||||
|
||||
//------------------------代码自动生成-----------------------------------
|
||||
/**
|
||||
* 查询英语单词
|
||||
*
|
||||
* @param id 英语单词主键
|
||||
* @return 英语单词
|
||||
*/
|
||||
public EnglishWord selectEnglishWordById(Long id);
|
||||
|
||||
/**
|
||||
* 查询英语单词列表
|
||||
*
|
||||
* @param englishWord 英语单词
|
||||
* @return 英语单词集合
|
||||
*/
|
||||
public List<EnglishWord> selectEnglishWordList(EnglishWord englishWord);
|
||||
|
||||
/**
|
||||
* 新增英语单词
|
||||
*
|
||||
* @param englishWord 英语单词
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEnglishWord(EnglishWord englishWord);
|
||||
|
||||
/**
|
||||
* 修改英语单词
|
||||
*
|
||||
* @param englishWord 英语单词
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEnglishWord(EnglishWord englishWord);
|
||||
|
||||
/**
|
||||
* 批量删除英语单词
|
||||
*
|
||||
* @param ids 需要删除的英语单词主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEnglishWordByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除英语单词信息
|
||||
*
|
||||
* @param id 英语单词主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEnglishWordById(Long id);
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package com.xjs.word.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.xjs.word.domain.EnglishWord;
|
||||
import com.xjs.word.mapper.EnglishWordMapper;
|
||||
import com.xjs.word.service.IEnglishWordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 英语单词Service业务层处理
|
||||
*
|
||||
* @author xjs
|
||||
* @date 2021-12-29
|
||||
*/
|
||||
@Service
|
||||
public class EnglishWordServiceImpl implements IEnglishWordService {
|
||||
@Resource
|
||||
private EnglishWordMapper englishWordMapper;
|
||||
|
||||
|
||||
//------------------------代码自动生成-----------------------------------
|
||||
|
||||
/**
|
||||
* 查询英语单词
|
||||
*
|
||||
* @param id 英语单词主键
|
||||
* @return 英语单词
|
||||
*/
|
||||
@Override
|
||||
public EnglishWord selectEnglishWordById(Long id) {
|
||||
return englishWordMapper.selectEnglishWordById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询英语单词列表
|
||||
*
|
||||
* @param englishWord 英语单词
|
||||
* @return 英语单词
|
||||
*/
|
||||
@Override
|
||||
public List<EnglishWord> selectEnglishWordList(EnglishWord englishWord) {
|
||||
return englishWordMapper.selectEnglishWordList(englishWord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增英语单词
|
||||
*
|
||||
* @param englishWord 英语单词
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEnglishWord(EnglishWord englishWord) {
|
||||
englishWord.setCreateTime(DateUtils.getNowDate());
|
||||
return englishWordMapper.insertEnglishWord(englishWord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改英语单词
|
||||
*
|
||||
* @param englishWord 英语单词
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateEnglishWord(EnglishWord englishWord) {
|
||||
return englishWordMapper.updateEnglishWord(englishWord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除英语单词
|
||||
*
|
||||
* @param ids 需要删除的英语单词主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEnglishWordByIds(Long[] ids) {
|
||||
return englishWordMapper.deleteEnglishWordByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除英语单词信息
|
||||
*
|
||||
* @param id 英语单词主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEnglishWordById(Long id) {
|
||||
return englishWordMapper.deleteEnglishWordById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
<?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.xjs.word.mapper.EnglishWordMapper">
|
||||
|
||||
<resultMap type="com.xjs.word.domain.EnglishWord" id="EnglishWordResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="englishWord" column="english_word"/>
|
||||
<result property="chineseWord" column="chinese_word"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="isCollect" column="is_collect"/>
|
||||
<result property="top" column="top"/>
|
||||
<result property="lookCount" column="look_count"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEnglishWordVo">
|
||||
select id,
|
||||
english_word,
|
||||
chinese_word,
|
||||
sort,
|
||||
is_collect,
|
||||
top,
|
||||
look_count,
|
||||
create_time
|
||||
from english_word
|
||||
</sql>
|
||||
|
||||
<select id="selectEnglishWordList" parameterType="com.xjs.word.domain.EnglishWord" resultMap="EnglishWordResult">
|
||||
<include refid="selectEnglishWordVo"/>
|
||||
<where>
|
||||
<if test="englishWord != null and englishWord != ''">and english_word like concat('%', #{englishWord},
|
||||
'%')
|
||||
</if>
|
||||
<if test="chineseWord != null and chineseWord != ''">and chinese_word like concat('%', #{chineseWord},
|
||||
'%')
|
||||
</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectEnglishWordById" parameterType="Long" resultMap="EnglishWordResult">
|
||||
<include refid="selectEnglishWordVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertEnglishWord" parameterType="com.xjs.word.domain.EnglishWord">
|
||||
insert into english_word
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="englishWord != null and englishWord != ''">english_word,</if>
|
||||
<if test="chineseWord != null">chinese_word,</if>
|
||||
<if test="sort != null">sort,</if>
|
||||
<if test="isCollect != null">is_collect,</if>
|
||||
<if test="top != null">top,</if>
|
||||
<if test="lookCount != null">look_count,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="englishWord != null and englishWord != ''">#{englishWord},</if>
|
||||
<if test="chineseWord != null">#{chineseWord},</if>
|
||||
<if test="sort != null">#{sort},</if>
|
||||
<if test="isCollect != null">#{isCollect},</if>
|
||||
<if test="top != null">#{top},</if>
|
||||
<if test="lookCount != null">#{lookCount},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEnglishWord" parameterType="com.xjs.word.domain.EnglishWord">
|
||||
update english_word
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="englishWord != null and englishWord != ''">english_word = #{englishWord},</if>
|
||||
<if test="chineseWord != null">chinese_word = #{chineseWord},</if>
|
||||
<if test="sort != null">sort = #{sort},</if>
|
||||
<if test="isCollect != null">is_collect = #{isCollect},</if>
|
||||
<if test="top != null">top = #{top},</if>
|
||||
<if test="lookCount != null">look_count = #{lookCount},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEnglishWordById" parameterType="Long">
|
||||
delete
|
||||
from english_word
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEnglishWordByIds" parameterType="String">
|
||||
delete from english_word where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
|
||||
Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information.
|
||||
-->
|
||||
<application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd">
|
||||
|
||||
<id>xjs-business-english</id>
|
||||
|
||||
<classpath>
|
||||
<dir name="D:/Dev/IdeaPerject/GitHub/RuoYi-Cloud/xjs-business/xjs-business-english/target/classes">
|
||||
</dir>
|
||||
</classpath>
|
||||
|
||||
</application>
|
Loading…
Reference in new issue