岗位管理的crud+分页查询
This commit is contained in:
@@ -40,7 +40,7 @@ public class SaTokenMvcConfiguration implements WebMvcConfigurer {
|
||||
public SaServletFilter getGlobleSaServletFilter() {
|
||||
return new SaServletFilter()
|
||||
.addInclude("/**").addExclude("/favicon.ico")
|
||||
.addExclude("/auth/getConfig", "/captcha/code", "/auth/register")
|
||||
.addExclude("/auth/getConfig", "/captcha/code", "/auth/register","/system/post")
|
||||
.setAuth(obj -> {
|
||||
SaRouter.match("/**", "/auth/login", StpUtil::checkLogin);
|
||||
})
|
||||
|
||||
@@ -82,8 +82,9 @@ public class SysPostController {
|
||||
* 删除岗位
|
||||
*/
|
||||
@DeleteMapping
|
||||
public R<Void> remove(@RequestParam @NotNull @NotEmpty List<Long> ids) {
|
||||
public R<Void> remove(@RequestBody @NotNull @NotEmpty List<Long> ids) {
|
||||
sysPostService.deletePost(ids);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.agileboot.system.post.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.agileboot.common.core.exception.BizException;
|
||||
import com.agileboot.common.core.exception.error.ErrorCode;
|
||||
import com.agileboot.common.mybatis.core.page.PageR;
|
||||
@@ -21,7 +22,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@@ -32,14 +35,33 @@ public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPost> impl
|
||||
|
||||
@Override
|
||||
public PostVO getPostInfo(Long postId) {
|
||||
// sysUserMapper.getPostInfo();
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
*
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PageR<PostVO> getPostList(PostQuery query) {
|
||||
Page<SysPost> page = super.page(query.toPage(), query.toQueryWrapper());
|
||||
IPage<PostVO> convert = page.convert(PostVO::new);
|
||||
return new PageR<>(convert);
|
||||
String postCode = query.getPostCode();
|
||||
String postName = query.getPostName();
|
||||
LocalDate beginTime = query.getBeginTime();
|
||||
LocalDate endTime = query.getEndTime();
|
||||
LambdaQueryWrapper<SysPost> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.like(StrUtil.isNotBlank(postCode), SysPost::getPostCode, postCode);
|
||||
lqw.like(StrUtil.isNotBlank(postName), SysPost::getPostName, postName);
|
||||
lqw.eq(Objects.nonNull(query.getStatus()), SysPost::getStatus, query.getStatus());
|
||||
lqw.between(Objects.nonNull(beginTime) && Objects.nonNull(endTime), SysPost::getCreateTime, beginTime, endTime);
|
||||
Page<SysPost> page = new Page<>(query.getPageNum(), query.getPageSize());
|
||||
page(page, lqw);
|
||||
List<SysPost> records = page.getRecords();
|
||||
List<PostVO> convert = records.stream().map(PostVO::new).collect(Collectors.toList());
|
||||
|
||||
return new PageR<>(page,convert);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.agileboot.system.post.entity.SysPost;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* @author valarchie
|
||||
*/
|
||||
@@ -14,6 +16,8 @@ public class PostQuery extends PageQuery<SysPost> {
|
||||
private String postCode;
|
||||
private String postName;
|
||||
private Integer status;
|
||||
private LocalDate beginTime;
|
||||
private LocalDate endTime;
|
||||
|
||||
@Override
|
||||
public LambdaQueryWrapper<SysPost> toQueryWrapper() {
|
||||
|
||||
Reference in New Issue
Block a user