Skip to content

Commit d979de1

Browse files
committed
region list
1 parent 26d54d4 commit d979de1

File tree

4 files changed

+59
-6
lines changed

4 files changed

+59
-6
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package com.berry.oss.api;
2+
3+
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4+
import com.baomidou.mybatisplus.core.metadata.IPage;
5+
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6+
import com.berry.oss.common.Result;
7+
import com.berry.oss.common.ResultFactory;
8+
import com.berry.oss.dao.entity.RegionInfo;
9+
import com.berry.oss.dao.service.IRegionInfoDaoService;
10+
import io.swagger.annotations.Api;
11+
import io.swagger.annotations.ApiOperation;
12+
import org.springframework.beans.factory.annotation.Autowired;
13+
import org.springframework.web.bind.annotation.GetMapping;
14+
import org.springframework.web.bind.annotation.RequestMapping;
15+
import org.springframework.web.bind.annotation.RequestParam;
16+
import org.springframework.web.bind.annotation.RestController;
17+
18+
import static org.apache.commons.lang3.StringUtils.isNotBlank;
19+
20+
/**
21+
* Created with IntelliJ IDEA.
22+
*
23+
* @author Berry_Cooper.
24+
* @date 2020/6/9 14:28
25+
* fileName:RegionController
26+
* Use:
27+
*/
28+
@RestController
29+
@RequestMapping("ajax/region")
30+
@Api(tags = "Region 管理")
31+
public class RegionController {
32+
33+
@Autowired
34+
private IRegionInfoDaoService regionInfoDaoService;
35+
36+
@ApiOperation("分页查询 区域列表")
37+
@GetMapping("/page_list")
38+
public Result pageListRegion(@RequestParam("pageSize") Integer pageSize,
39+
@RequestParam("pageNum") Integer pageNum,
40+
@RequestParam("keyword") String keyword) {
41+
IPage<RegionInfo> page = new Page<>(pageNum, pageSize);
42+
QueryWrapper<RegionInfo> queryWrapper = new QueryWrapper<>();
43+
if (isNotBlank(keyword)) {
44+
queryWrapper.like("name", keyword)
45+
.or()
46+
.like("code", keyword);
47+
}
48+
regionInfoDaoService.page(page, queryWrapper);
49+
return ResultFactory.wrapper(page);
50+
}
51+
}

src/main/java/com/berry/oss/common/utils/RSAUtil.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ private static void initKey() throws Exception {
8686
private static String getPublicKey() {
8787
try {
8888
ClassPathResource publicFile = new ClassPathResource(PUBLIC_KEY_FILE);
89-
ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(publicFile.getPath()));
90-
PublicKey publicKey = (PublicKey) inputStream.readObject();
91-
return Base64Util.encode(publicKey.getEncoded());
89+
try(ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(publicFile.getPath()));) {
90+
PublicKey publicKey = (PublicKey) inputStream.readObject();
91+
return Base64Util.encode(publicKey.getEncoded());
92+
}
9293
} catch (Exception e) {
9394
e.printStackTrace();
9495
}
@@ -103,9 +104,10 @@ private static String getPublicKey() {
103104
private static String getPrivateKey() {
104105
try {
105106
ClassPathResource privateFile = new ClassPathResource(PRIVATE_KEY_FILE);
106-
ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(privateFile.getPath()));
107-
PrivateKey privateKey = (PrivateKey) inputStream.readObject();
108-
return Base64Util.encode(privateKey.getEncoded());
107+
try(ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(privateFile.getPath()))) {
108+
PrivateKey privateKey = (PrivateKey) inputStream.readObject();
109+
return Base64Util.encode(privateKey.getEncoded());
110+
}
109111
} catch (Exception e) {
110112
e.printStackTrace();
111113
}
-894 Bytes
Binary file not shown.
-419 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)