feat: lucene字典配置分页
- lucene字典配置分页 - 字典建表sql - 删除无用依赖
This commit is contained in:
parent
40a6e06cb4
commit
7820644413
5
pom.xml
5
pom.xml
@ -74,11 +74,6 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-log4j2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 通用Mapper插件 -->
|
||||
<dependency>
|
||||
<groupId>tk.mybatis</groupId>
|
||||
|
@ -20,7 +20,6 @@ import java.util.List;
|
||||
* @author suwen
|
||||
* @date 2021/2/3 10:41
|
||||
*/
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/lucene")
|
||||
public class LuceneSearchController {
|
||||
|
@ -1,14 +1,19 @@
|
||||
package com.rymcu.forest.lucene.api;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.rymcu.forest.core.result.GlobalResult;
|
||||
import com.rymcu.forest.core.result.GlobalResultGenerator;
|
||||
import com.rymcu.forest.lucene.model.UserDic;
|
||||
import com.rymcu.forest.lucene.service.UserDicService;
|
||||
import com.rymcu.forest.util.Utils;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* UserDicController
|
||||
@ -16,7 +21,6 @@ import java.io.FileNotFoundException;
|
||||
* @author suwen
|
||||
* @date 2021/2/4 09:29
|
||||
*/
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/lucene/dic")
|
||||
public class UserDicController {
|
||||
@ -24,21 +28,17 @@ public class UserDicController {
|
||||
@Resource private UserDicService dicService;
|
||||
|
||||
@GetMapping("/getAll")
|
||||
public GlobalResult getAll() {
|
||||
|
||||
return GlobalResultGenerator.genSuccessResult(dicService.getAll());
|
||||
}
|
||||
|
||||
@GetMapping("/getAllDic")
|
||||
public GlobalResult getAllDic() {
|
||||
|
||||
return GlobalResultGenerator.genSuccessResult(dicService.getAllDic());
|
||||
}
|
||||
|
||||
@GetMapping("/loadUserDic")
|
||||
public GlobalResult loadUserDic() throws FileNotFoundException {
|
||||
dicService.writeUserDic();
|
||||
return GlobalResultGenerator.genSuccessResult("加载用户自定义字典成功");
|
||||
public GlobalResult getAll(
|
||||
@RequestParam(defaultValue = "0") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<UserDic> list = dicService.getAll();
|
||||
PageInfo<UserDic> pageInfo = new PageInfo<>(list);
|
||||
Map<String, Object> map = new HashMap<>(2);
|
||||
map.put("userDic", pageInfo.getList());
|
||||
Map pagination = Utils.getPagination(pageInfo);
|
||||
map.put("pagination", pagination);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@PostMapping("/addDic/{dic}")
|
||||
|
@ -47,10 +47,4 @@ public interface UserDicService {
|
||||
* @param userDic
|
||||
*/
|
||||
void updateDic(UserDic userDic);
|
||||
|
||||
/**
|
||||
* 写入字典至内存
|
||||
*
|
||||
*/
|
||||
void writeUserDic() throws FileNotFoundException;
|
||||
}
|
||||
|
@ -54,8 +54,7 @@ public class UserDicServiceImpl implements UserDicService {
|
||||
writeUserDic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeUserDic() {
|
||||
private void writeUserDic() {
|
||||
try {
|
||||
File file = new File(dicPath);
|
||||
FileOutputStream stream = new FileOutputStream(file, false);
|
||||
|
@ -340,6 +340,18 @@ create table forest_visit
|
||||
)
|
||||
comment '浏览表' collate = utf8mb4_unicode_ci;
|
||||
|
||||
create table lucene_user_dic
|
||||
(
|
||||
id int auto_increment comment '字典编号',
|
||||
dic char(32) null comment '字典',
|
||||
constraint lucene_user_dic_id_uindex
|
||||
unique (id)
|
||||
)
|
||||
comment '用户扩展字典';
|
||||
|
||||
alter table lucene_user_dic
|
||||
add primary key (id);
|
||||
|
||||
insert into forest.forest_role (id, name, input_code, status, created_time, updated_time, weights) values (1, '管理员', 'admin', '0', '2019-11-16 04:22:45', '2019-11-16 04:22:45', 1);
|
||||
insert into forest.forest_role (id, name, input_code, status, created_time, updated_time, weights) values (2, '社区管理员', 'blog_admin', '0', '2019-12-05 03:10:05', '2019-12-05 17:11:35', 2);
|
||||
insert into forest.forest_role (id, name, input_code, status, created_time, updated_time, weights) values (3, '作者', 'zz', '0', '2020-03-12 15:07:27', '2020-03-12 15:07:27', 3);
|
||||
@ -347,4 +359,4 @@ insert into forest.forest_role (id, name, input_code, status, created_time, upda
|
||||
|
||||
insert into forest.forest_user (id, account, password, nickname, real_name, sex, avatar_type, avatar_url, email, phone, status, created_time, updated_time, last_login_time, signature) values (1, 'admin', '8ce2dd866238958ac4f07870766813cdaa39a9b83a8c75e26aa50f23', 'admin', 'admin', '0', '0', null, null, null, '0', '2021-01-25 18:21:51', '2021-01-25 18:21:54', null, null);
|
||||
|
||||
insert into forest.forest_user_role (id_user, id_role, created_time) values (1, 1, '2021-01-25 18:22:12');
|
||||
insert into forest.forest_user_role (id_user, id_role, created_time) values (1, 1, '2021-01-25 18:22:12');
|
||||
|
Loading…
Reference in New Issue
Block a user