1、微信搜狗列表排序前端可手动调节根据创建时间
2、英语单词页面查询条件优化,一个框可以查询两个条件 3、英语单词页面排序优化,也可手动调节 4、MyBaseController类优化mybatisplus分页相关参数设置
This commit is contained in:
parent
f757d2c967
commit
d388634a23
|
|
@ -1,26 +1,17 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
<el-form-item label="英语单词" prop="englishWord">
|
<el-form-item label="中英文" prop="condition">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.englishWord"
|
v-model="queryParams.condition"
|
||||||
placeholder="英语单词"
|
placeholder="请输入中英文"
|
||||||
clearable
|
|
||||||
maxlength="20"
|
|
||||||
size="small"
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="中文" prop="chineseWord">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.chineseWord"
|
|
||||||
placeholder="请输入中文"
|
|
||||||
clearable
|
clearable
|
||||||
maxlength="10"
|
maxlength="10"
|
||||||
size="small"
|
size="small"
|
||||||
@keyup.enter.native="handleQuery"
|
@keyup.enter.native="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="创建时间">
|
<el-form-item label="创建时间">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="daterangeCreateTime"
|
v-model="daterangeCreateTime"
|
||||||
|
|
@ -106,7 +97,13 @@
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="wordList" @selection-change="handleSelectionChange">
|
<el-table
|
||||||
|
ref="tables"
|
||||||
|
v-loading="loading"
|
||||||
|
:data="wordList"
|
||||||
|
:default-sort="defaultSort"
|
||||||
|
@sort-change="handleSortChange"
|
||||||
|
@selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center"/>
|
<el-table-column type="selection" width="55" align="center"/>
|
||||||
<el-table-column label="英语单词" align="center" prop="englishWord" :show-overflow-tooltip="true"/>
|
<el-table-column label="英语单词" align="center" prop="englishWord" :show-overflow-tooltip="true"/>
|
||||||
<el-table-column label="中文" align="center" prop="chineseWord" :show-overflow-tooltip="true"/>
|
<el-table-column label="中文" align="center" prop="chineseWord" :show-overflow-tooltip="true"/>
|
||||||
|
|
@ -122,7 +119,12 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="查看次数" align="center" prop="lookCount" :show-overflow-tooltip="true"/>
|
<el-table-column label="查看次数" align="center" prop="lookCount" :show-overflow-tooltip="true"/>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" :show-overflow-tooltip="true"/>
|
<el-table-column label="创建时间"
|
||||||
|
align="center"
|
||||||
|
prop="createTime"
|
||||||
|
sortable="custom"
|
||||||
|
:sort-orders="['descending', 'ascending']"
|
||||||
|
:show-overflow-tooltip="true"/>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tooltip class="item" effect="dark" content="点击查看详情" placement="top-start">
|
<el-tooltip class="item" effect="dark" content="点击查看详情" placement="top-start">
|
||||||
|
|
@ -307,9 +309,12 @@ export default {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
condition: null,
|
||||||
englishWord: null,
|
englishWord: null,
|
||||||
chineseWord: null,
|
chineseWord: null,
|
||||||
createTime: null
|
createTime: null,
|
||||||
|
isAsc: null,
|
||||||
|
orderByColumn: null
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {
|
form: {
|
||||||
|
|
@ -318,6 +323,10 @@ export default {
|
||||||
},
|
},
|
||||||
//英语一言数据
|
//英语一言数据
|
||||||
oneEnglishData: {},
|
oneEnglishData: {},
|
||||||
|
|
||||||
|
// 默认排序
|
||||||
|
defaultSort: {prop: 'createTime', order: 'descending'},
|
||||||
|
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rulesEdit: {
|
rulesEdit: {
|
||||||
englishWord: [
|
englishWord: [
|
||||||
|
|
@ -352,6 +361,7 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.resetSort()
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -373,6 +383,12 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
//重置排序
|
||||||
|
resetSort() {
|
||||||
|
this.queryParams.isAsc = this.defaultSort.order
|
||||||
|
this.queryParams.orderByColumn = this.defaultSort.prop
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
//关闭抽屉
|
//关闭抽屉
|
||||||
handleClose(done) {
|
handleClose(done) {
|
||||||
|
|
@ -396,10 +412,14 @@ export default {
|
||||||
this.queryParams.createTime = this.daterangeCreateTime[0];
|
this.queryParams.createTime = this.daterangeCreateTime[0];
|
||||||
this.queryParams.endCreateTime = this.daterangeCreateTime[1];
|
this.queryParams.endCreateTime = this.daterangeCreateTime[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this.queryParams.orderByColumn=this.defaultSort.prop
|
||||||
|
// this.queryParams.isAsc=this.defaultSort.order
|
||||||
|
|
||||||
listWord(this.queryParams).then(response => {
|
listWord(this.queryParams).then(response => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.wordList = response.rows;
|
this.wordList = response.data.records;
|
||||||
this.total = response.total;
|
this.total = response.data.total;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
|
|
@ -429,6 +449,7 @@ export default {
|
||||||
},
|
},
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
|
this.resetSort()
|
||||||
this.daterangeCreateTime = [];
|
this.daterangeCreateTime = [];
|
||||||
this.queryParams.createTime = null
|
this.queryParams.createTime = null
|
||||||
this.queryParams.endCreateTime = null
|
this.queryParams.endCreateTime = null
|
||||||
|
|
@ -447,10 +468,17 @@ export default {
|
||||||
this.openAdd = true;
|
this.openAdd = true;
|
||||||
this.title = "添加英语单词";
|
this.title = "添加英语单词";
|
||||||
//下拉框默认选中
|
//下拉框默认选中
|
||||||
this.form.isCollect= parseInt(this.dict.type.english_collect[0].value)
|
this.form.isCollect = parseInt(this.dict.type.english_collect[0].value)
|
||||||
this.form.top = parseInt(this.dict.type.english_top[1].value)
|
this.form.top = parseInt(this.dict.type.english_top[1].value)
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** 排序触发事件 */
|
||||||
|
handleSortChange(column, prop, order) {
|
||||||
|
this.queryParams.isAsc = column.order;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
|
|
|
||||||
|
|
@ -85,12 +85,40 @@
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="weixinsougouList" @selection-change="handleSelectionChange">
|
<el-table
|
||||||
|
ref="tables"
|
||||||
|
v-loading="loading"
|
||||||
|
:data="weixinsougouList"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
:default-sort="defaultSort"
|
||||||
|
@sort-change="handleSortChange">
|
||||||
|
|
||||||
|
<el-table-column type="expand">
|
||||||
|
<template slot-scope="props">
|
||||||
|
|
||||||
|
<el-form label-position="left" class="demo-table-expand">
|
||||||
|
<el-form-item label="文章标题">
|
||||||
|
<a :href=props.row.url target="_blank">{{ props.row.title }}</a>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="文章内容">
|
||||||
|
<span>{{ props.row.content }}</span>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column type="selection" width="55" align="center"/>
|
<el-table-column type="selection" width="55" align="center"/>
|
||||||
<el-table-column label="文章标题" align="center" prop="title" :show-overflow-tooltip="true"/>
|
<el-table-column label="文章标题" align="center" prop="title" :show-overflow-tooltip="true"/>
|
||||||
<el-table-column label="简略的内容" align="center" prop="content" :show-overflow-tooltip="true"/>
|
<el-table-column label="简略的内容" align="center" prop="content" :show-overflow-tooltip="true"/>
|
||||||
<el-table-column label="文章来源" align="center" prop="source" :show-overflow-tooltip="true"/>
|
<el-table-column label="文章来源" align="center" prop="source" :show-overflow-tooltip="true"/>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" :show-overflow-tooltip="true"/>
|
<el-table-column label="创建时间"
|
||||||
|
align="center"
|
||||||
|
prop="createTime"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
sortable="custom"
|
||||||
|
:sort-orders="['descending', 'ascending']"
|
||||||
|
/>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
|
|
@ -143,18 +171,24 @@ export default {
|
||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
|
|
||||||
|
// 默认排序
|
||||||
|
defaultSort: {prop: 'createTime', order: 'descending'},
|
||||||
|
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
isAsc: 'desc',
|
|
||||||
title: null,
|
title: null,
|
||||||
content: null,
|
content: null,
|
||||||
source: null,
|
source: null,
|
||||||
createTime: null,
|
createTime: null,
|
||||||
condition: null //综合条件
|
condition: null, //综合条件
|
||||||
|
isAsc: null,
|
||||||
|
orderByColumn: null
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
//检查查询范围
|
//检查查询范围
|
||||||
daterangeCreateTime: [],
|
daterangeCreateTime: [],
|
||||||
|
|
||||||
|
|
@ -165,6 +199,7 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.resetSort()
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -175,6 +210,8 @@ export default {
|
||||||
this.queryParams.createTime = this.daterangeCreateTime[0];
|
this.queryParams.createTime = this.daterangeCreateTime[0];
|
||||||
this.queryParams.endCreateTime = this.daterangeCreateTime[1];
|
this.queryParams.endCreateTime = this.daterangeCreateTime[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
listWeixinsougou(this.queryParams).then(response => {
|
listWeixinsougou(this.queryParams).then(response => {
|
||||||
this.weixinsougouList = response.data.dataList;
|
this.weixinsougouList = response.data.dataList;
|
||||||
this.total = response.data.totalCount;
|
this.total = response.data.totalCount;
|
||||||
|
|
@ -182,6 +219,18 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** 排序触发事件 */
|
||||||
|
handleSortChange(column, prop, order) {
|
||||||
|
this.queryParams.isAsc = column.order;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
|
||||||
|
//重置排序
|
||||||
|
resetSort() {
|
||||||
|
this.queryParams.isAsc = this.defaultSort.order
|
||||||
|
this.queryParams.orderByColumn = this.defaultSort.prop
|
||||||
|
},
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.queryParams.pageNum = 1;
|
this.queryParams.pageNum = 1;
|
||||||
|
|
@ -189,6 +238,7 @@ export default {
|
||||||
},
|
},
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
|
this.resetSort()
|
||||||
this.daterangeCreateTime = [];
|
this.daterangeCreateTime = [];
|
||||||
this.queryParams.createTime = null
|
this.queryParams.createTime = null
|
||||||
this.queryParams.endCreateTime = null
|
this.queryParams.endCreateTime = null
|
||||||
|
|
@ -222,3 +272,7 @@ export default {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,45 @@
|
||||||
package com.xjs.web;
|
package com.xjs.web;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.core.utils.sql.SqlUtil;
|
||||||
import com.ruoyi.common.core.web.controller.BaseController;
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
import com.ruoyi.common.core.web.page.PageDomain;
|
import com.ruoyi.common.core.web.page.PageDomain;
|
||||||
import com.ruoyi.common.core.web.page.TableSupport;
|
import com.ruoyi.common.core.web.page.TableSupport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义通用controller
|
* 自定义通用controller
|
||||||
|
*
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @since 2021-12-31
|
* @since 2021-12-31
|
||||||
*/
|
*/
|
||||||
public class MyBaseController extends BaseController {
|
public class MyBaseController<T> extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mp分页封装
|
* mp分页封装
|
||||||
|
*
|
||||||
* @return Page
|
* @return Page
|
||||||
*/
|
*/
|
||||||
protected Page startPageMP( ){
|
protected Page<T> startPageMP() {
|
||||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
Integer pageNum = pageDomain.getPageNum();
|
Integer pageNum = pageDomain.getPageNum();
|
||||||
Integer pageSize = pageDomain.getPageSize();
|
Integer pageSize = pageDomain.getPageSize();
|
||||||
Page page = new Page<>();
|
Page<T> page = new Page<>();
|
||||||
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
|
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
|
||||||
{
|
|
||||||
page.setSize(pageSize);
|
page.setSize(pageSize);
|
||||||
page.setCurrent(pageNum);
|
page.setCurrent(pageNum);
|
||||||
}
|
}
|
||||||
|
String orderByColumn = pageDomain.getOrderByColumn();
|
||||||
|
if (StringUtils.isNotNull(orderByColumn)) {
|
||||||
|
String orderBy = SqlUtil.escapeOrderBySql(StringUtils.toUnderScoreCase(orderByColumn));
|
||||||
|
|
||||||
|
if (pageDomain.getIsAsc().equals("asc")) {
|
||||||
|
page.addOrder(OrderItem.asc(orderBy));
|
||||||
|
} else {
|
||||||
|
page.addOrder(OrderItem.desc(orderBy));
|
||||||
|
}
|
||||||
|
}
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package com.xjs.word.controller;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
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.annotation.Log;
|
||||||
import com.ruoyi.common.log.enums.BusinessType;
|
import com.ruoyi.common.log.enums.BusinessType;
|
||||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||||
|
|
@ -31,13 +30,14 @@ import java.util.List;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/word")
|
@RequestMapping("/word")
|
||||||
@Api(tags = "业务模块-英语管理")
|
@Api(tags = "业务模块-英语管理")
|
||||||
public class EnglishWordController extends MyBaseController {
|
public class EnglishWordController extends MyBaseController<EnglishWord> {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IEnglishWordService englishWordService;
|
private IEnglishWordService englishWordService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 英语单词收藏夹
|
* 英语单词收藏夹
|
||||||
|
*
|
||||||
* @return TableDataInfo
|
* @return TableDataInfo
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("english:word:collect")
|
@RequiresPermissions("english:word:collect")
|
||||||
|
|
@ -45,7 +45,7 @@ public class EnglishWordController extends MyBaseController {
|
||||||
@Log(title = "查看单词夹")
|
@Log(title = "查看单词夹")
|
||||||
@ApiOperation("英语单词收藏夹")
|
@ApiOperation("英语单词收藏夹")
|
||||||
public AjaxResult collect() {
|
public AjaxResult collect() {
|
||||||
IPage<EnglishWord> englishWordList=englishWordService.getEnglishWordByCollect(startPageMP());
|
IPage<EnglishWord> englishWordList = englishWordService.getEnglishWordByCollect(startPageMP());
|
||||||
return AjaxResult.success(englishWordList);
|
return AjaxResult.success(englishWordList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,21 +69,20 @@ public class EnglishWordController extends MyBaseController {
|
||||||
return AjaxResult.success(englishWordService.selectById(id));
|
return AjaxResult.success(englishWordService.selectById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------代码自动生成-----------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询英语单词列表
|
* 查询英语单词列表
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("english:word:list")
|
@RequiresPermissions("english:word:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperation("查询英语单词列表")
|
@ApiOperation("查询英语单词列表")
|
||||||
public TableDataInfo list(@Validated({SelectGroup.class}) EnglishWord englishWord) {
|
public AjaxResult list(@Validated({SelectGroup.class}) EnglishWord englishWord) {
|
||||||
startPage();
|
return AjaxResult.success(englishWordService.selectEnglishWordList(startPageMP(), englishWord));
|
||||||
List<EnglishWord> list = englishWordService.selectEnglishWordList(englishWord);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------代码自动生成-----------------------------------
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出英语单词列表
|
* 导出英语单词列表
|
||||||
*/
|
*/
|
||||||
|
|
@ -98,7 +97,6 @@ public class EnglishWordController extends MyBaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增英语单词
|
* 新增英语单词
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,18 @@ package com.xjs.word.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
import com.xjs.entity.BaseEntity;
|
||||||
import com.xjs.validation.group.AddGroup;
|
import com.xjs.validation.group.AddGroup;
|
||||||
import com.xjs.validation.group.SelectGroup;
|
import com.xjs.validation.group.SelectGroup;
|
||||||
import com.xjs.validation.group.UpdateGroup;
|
import com.xjs.validation.group.UpdateGroup;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -20,7 +24,9 @@ import java.util.Date;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("english_word")
|
@TableName("english_word")
|
||||||
public class EnglishWord {
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class EnglishWord extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主键id
|
* 主键id
|
||||||
|
|
@ -84,7 +90,5 @@ public class EnglishWord {
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private Date endCreateTime;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.xjs.word.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.xjs.word.domain.EnglishWord;
|
import com.xjs.word.domain.EnglishWord;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -12,7 +13,7 @@ import java.util.List;
|
||||||
* @author xjs
|
* @author xjs
|
||||||
* @date 2021-12-29
|
* @date 2021-12-29
|
||||||
*/
|
*/
|
||||||
public interface IEnglishWordService {
|
public interface IEnglishWordService extends IService<EnglishWord> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询收藏的单词列表
|
* 查询收藏的单词列表
|
||||||
|
|
@ -30,16 +31,22 @@ public interface IEnglishWordService {
|
||||||
|
|
||||||
EnglishWord selectById(Long id);
|
EnglishWord selectById(Long id);
|
||||||
|
|
||||||
|
|
||||||
//------------------------代码自动生成-----------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询英语单词列表
|
* 查询英语单词列表(mybatis分页)
|
||||||
*
|
*
|
||||||
* @param englishWord 英语单词
|
* @param englishWord 英语单词
|
||||||
* @return 英语单词集合
|
* @return 英语单词集合
|
||||||
*/
|
*/
|
||||||
public List<EnglishWord> selectEnglishWordList(EnglishWord englishWord);
|
List<EnglishWord> selectEnglishWordList(EnglishWord englishWord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询英语单词列表(mybatis-plus分页)
|
||||||
|
*
|
||||||
|
* @param page 分页条件
|
||||||
|
* @param englishWord 查询条件
|
||||||
|
* @return 英语单词集合
|
||||||
|
*/
|
||||||
|
IPage<EnglishWord> selectEnglishWordList(Page<EnglishWord> page,EnglishWord englishWord);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增英语单词
|
* 新增英语单词
|
||||||
|
|
@ -65,6 +72,11 @@ public interface IEnglishWordService {
|
||||||
*/
|
*/
|
||||||
public int deleteEnglishWordByIds(Long[] ids);
|
public int deleteEnglishWordByIds(Long[] ids);
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------代码自动生成-----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除英语单词信息
|
* 删除英语单词信息
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.ruoyi.common.core.constant.Constants;
|
import com.ruoyi.common.core.constant.Constants;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
import com.ruoyi.common.redis.service.RedisService;
|
import com.ruoyi.common.redis.service.RedisService;
|
||||||
|
|
@ -16,6 +17,7 @@ import com.xjs.word.domain.EnglishWord;
|
||||||
import com.xjs.word.mapper.EnglishWordMapper;
|
import com.xjs.word.mapper.EnglishWordMapper;
|
||||||
import com.xjs.word.service.IEnglishWordService;
|
import com.xjs.word.service.IEnglishWordService;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
@ -35,7 +37,7 @@ import static com.xjs.consts.RedisConst.TRAN_DICT_EXPIRE;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Log4j2
|
@Log4j2
|
||||||
public class EnglishWordServiceImpl implements IEnglishWordService {
|
public class EnglishWordServiceImpl extends ServiceImpl<EnglishWordMapper, EnglishWord> implements IEnglishWordService {
|
||||||
@Resource
|
@Resource
|
||||||
private EnglishWordMapper englishWordMapper;
|
private EnglishWordMapper englishWordMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -52,7 +54,8 @@ public class EnglishWordServiceImpl implements IEnglishWordService {
|
||||||
.eq("is_collect", COLLECT)
|
.eq("is_collect", COLLECT)
|
||||||
.orderByDesc("top")
|
.orderByDesc("top")
|
||||||
.orderByDesc("create_time");
|
.orderByDesc("create_time");
|
||||||
return englishWordMapper.selectPage(page,wr);
|
|
||||||
|
return englishWordMapper.selectPage(page, wr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -73,7 +76,7 @@ public class EnglishWordServiceImpl implements IEnglishWordService {
|
||||||
String hkey = englishWord.getEnglishWord() + ":" + id;
|
String hkey = englishWord.getEnglishWord() + ":" + id;
|
||||||
Object value = redisService.getCacheMapValue(TRAN_DICT, hkey);
|
Object value = redisService.getCacheMapValue(TRAN_DICT, hkey);
|
||||||
if (Objects.nonNull(value)) {
|
if (Objects.nonNull(value)) {
|
||||||
return (EnglishWord)value;
|
return (EnglishWord) value;
|
||||||
}
|
}
|
||||||
R<TranslationVo> r = remoteTranDIctFeign.tranDict(englishWord.getEnglishWord());
|
R<TranslationVo> r = remoteTranDIctFeign.tranDict(englishWord.getEnglishWord());
|
||||||
if (r.getCode() != R.FAIL) {
|
if (r.getCode() != R.FAIL) {
|
||||||
|
|
@ -110,7 +113,7 @@ public class EnglishWordServiceImpl implements IEnglishWordService {
|
||||||
.eq("english_word", englishWord.getContent()));
|
.eq("english_word", englishWord.getContent()));
|
||||||
List<EnglishWord> chineseWordList = englishWordMapper.selectList(new QueryWrapper<EnglishWord>()
|
List<EnglishWord> chineseWordList = englishWordMapper.selectList(new QueryWrapper<EnglishWord>()
|
||||||
.eq("chinese_word", englishWord.getContent()));
|
.eq("chinese_word", englishWord.getContent()));
|
||||||
if (CollUtil.isNotEmpty(englishWordList)|| CollUtil.isNotEmpty(chineseWordList)) {
|
if (CollUtil.isNotEmpty(englishWordList) || CollUtil.isNotEmpty(chineseWordList)) {
|
||||||
throw new BusinessException("该词汇已存在!!!!");
|
throw new BusinessException("该词汇已存在!!!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -172,8 +175,6 @@ public class EnglishWordServiceImpl implements IEnglishWordService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------代码自动生成-----------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询英语单词列表
|
* 查询英语单词列表
|
||||||
*
|
*
|
||||||
|
|
@ -185,6 +186,22 @@ public class EnglishWordServiceImpl implements IEnglishWordService {
|
||||||
return englishWordMapper.selectEnglishWordList(englishWord);
|
return englishWordMapper.selectEnglishWordList(englishWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<EnglishWord> selectEnglishWordList(Page<EnglishWord> page, EnglishWord englishWord) {
|
||||||
|
String condition = englishWord.getCondition();
|
||||||
|
|
||||||
|
QueryWrapper<EnglishWord> wr = new QueryWrapper<>();
|
||||||
|
wr.and(StringUtils.isNotEmpty(condition), obj -> {
|
||||||
|
obj.like("english_word", condition).or().like("chinese_word", condition);
|
||||||
|
});
|
||||||
|
|
||||||
|
//wr.like("english_word", condition).or().like("chinese_word", condition);
|
||||||
|
|
||||||
|
return this.page(page, wr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------代码自动生成-----------------------------------
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@ public class WeiXinSouGouServiceImpl extends ServiceImpl<WeiXinSouGouMapper, Wei
|
||||||
.op("ct")
|
.op("ct")
|
||||||
.field(WeiXinSouGou::getSource,weiXinSouGou.getSource())
|
.field(WeiXinSouGou::getSource,weiXinSouGou.getSource())
|
||||||
.op("ct")
|
.op("ct")
|
||||||
.field(WeiXinSouGou::getCreateTime,weiXinSouGou.getCreateTime(),weiXinSouGou.getEndCreateTime())
|
.field(pageDomain.getOrderByColumn(),weiXinSouGou.getCreateTime(),weiXinSouGou.getEndCreateTime())
|
||||||
.op("bt")
|
.op("bt")//构建bt区间查询
|
||||||
.orderBy(WeiXinSouGou::getCreateTime,pageDomain.getIsAsc())
|
.orderBy(WeiXinSouGou::getCreateTime,pageDomain.getIsAsc())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue