删除无用包
This commit is contained in:
parent
93bb94b023
commit
2df098dd53
@ -1,8 +0,0 @@
|
|||||||
/**
|
|
||||||
* @author: chenwenjian
|
|
||||||
* @date: 2023/9/6 15:37
|
|
||||||
* @description:
|
|
||||||
* @modifiedBy:
|
|
||||||
* @version: 1.0
|
|
||||||
*/
|
|
||||||
package cn.axzo.tyr.client.model.enums;
|
|
||||||
@ -1 +0,0 @@
|
|||||||
package cn.axzo.tyr.server.consumer;
|
|
||||||
@ -1 +0,0 @@
|
|||||||
package cn.axzo.tyr.server.controller.app;
|
|
||||||
@ -1,76 +0,0 @@
|
|||||||
package cn.axzo.tyr.server.controller.web;
|
|
||||||
|
|
||||||
import cn.axzo.tyr.server.service.user.UserService;
|
|
||||||
import cn.axzo.tyr.server.service.dto.request.user.NewUserDTO;
|
|
||||||
import cn.axzo.tyr.server.service.dto.request.user.UpdateUserDTO;
|
|
||||||
import cn.axzo.tyr.server.service.dto.request.user.UserQO;
|
|
||||||
import cn.axzo.tyr.server.service.dto.response.user.UserVO;
|
|
||||||
import cn.azxo.framework.common.model.CommonPageResponse;
|
|
||||||
import cn.azxo.framework.common.model.CommonResponse;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: liyong.tian
|
|
||||||
* @Date: 2022/9/2
|
|
||||||
* @Description:
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Api(tags = "web-用户信息接口")
|
|
||||||
@ApiSupport(author = "田立勇")
|
|
||||||
@RequestMapping("/api/v1")
|
|
||||||
@RestController
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class UserController {
|
|
||||||
|
|
||||||
private final UserService userService;
|
|
||||||
|
|
||||||
@ApiOperation(value = "创建用户")
|
|
||||||
@PostMapping("/users")
|
|
||||||
public CommonResponse<UserVO> createUser(@Valid @RequestBody NewUserDTO dto) {
|
|
||||||
log.info("REST request to save user : {}", dto);
|
|
||||||
// 校验入参
|
|
||||||
dto.valid();
|
|
||||||
UserVO result = userService.create(dto);
|
|
||||||
return CommonResponse.success(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "修改用户")
|
|
||||||
@PutMapping("/users/{id}")
|
|
||||||
public CommonResponse<UserVO> updateUser(@ApiParam("用户ID") @PathVariable Long id,
|
|
||||||
@Valid @RequestBody UpdateUserDTO dto) {
|
|
||||||
log.info("REST request to update user : {}", dto);
|
|
||||||
// 校验入参
|
|
||||||
dto.valid();
|
|
||||||
UserVO result = userService.update(id, dto);
|
|
||||||
return CommonResponse.success(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("获取用户列表")
|
|
||||||
@GetMapping("/users")
|
|
||||||
public CommonResponse<CommonPageResponse<UserVO>> getUsers(@Valid UserQO userQO) {
|
|
||||||
CommonPageResponse<UserVO> results = userService.queryByPage(userQO);
|
|
||||||
return CommonResponse.success(results);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("获取用户详情")
|
|
||||||
@GetMapping("/users/{id}")
|
|
||||||
public CommonResponse getUser(@ApiParam("用户ID") @PathVariable Long id) {
|
|
||||||
UserVO result = userService.getOne(id);
|
|
||||||
return CommonResponse.success(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("删除用户")
|
|
||||||
@DeleteMapping("/users/{id}")
|
|
||||||
public CommonResponse deleteUser(@ApiParam("用户ID") @PathVariable Long id) {
|
|
||||||
userService.delete(id);
|
|
||||||
return CommonResponse.success();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,78 +0,0 @@
|
|||||||
package cn.axzo.tyr.server.controller.web;
|
|
||||||
|
|
||||||
import cn.axzo.framework.domain.page.PageQO;
|
|
||||||
import cn.axzo.framework.domain.page.PageResp;
|
|
||||||
import cn.axzo.framework.web.http.ApiResponse;
|
|
||||||
import cn.axzo.framework.web.http.ApiPageResponse;
|
|
||||||
import cn.axzo.tyr.server.service.dto.request.user.NewUserDTO;
|
|
||||||
import cn.axzo.tyr.server.service.dto.request.user.UpdateUserDTO;
|
|
||||||
import cn.axzo.tyr.server.service.dto.request.user.UserQO1;
|
|
||||||
import cn.axzo.tyr.server.service.dto.response.user.UserVO;
|
|
||||||
import cn.axzo.tyr.server.service.user.UserService;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: liyong.tian
|
|
||||||
* @Date: 2022/10/28
|
|
||||||
* @Description: 新项目搭建推荐方式
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Api(tags = "web-用户信息接口")
|
|
||||||
@ApiSupport(author = "田立勇")
|
|
||||||
@RequestMapping("/api/v2")
|
|
||||||
@RestController
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class UserResource {
|
|
||||||
|
|
||||||
private final UserService userService;
|
|
||||||
|
|
||||||
@ApiOperation(value = "创建用户")
|
|
||||||
@PostMapping("/users")
|
|
||||||
public ApiResponse<UserVO> createUser(@Valid @RequestBody NewUserDTO dto) {
|
|
||||||
log.info("REST request to save user : {}", dto);
|
|
||||||
// 校验入参
|
|
||||||
dto.valid();
|
|
||||||
UserVO result = userService.create(dto);
|
|
||||||
return ApiResponse.ok(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "修改用户")
|
|
||||||
@PutMapping("/users/{id}")
|
|
||||||
public ApiResponse<UserVO> updateUser(@ApiParam("用户ID") @PathVariable Long id,
|
|
||||||
@Valid @RequestBody UpdateUserDTO dto) {
|
|
||||||
log.info("REST request to update user : {}", dto);
|
|
||||||
// 校验入参
|
|
||||||
dto.valid();
|
|
||||||
UserVO result = userService.update(id, dto);
|
|
||||||
return ApiResponse.ok(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("获取用户列表")
|
|
||||||
@GetMapping("/users")
|
|
||||||
public ApiPageResponse<UserVO> getUsers(@ModelAttribute UserQO1 userQo, PageQO page) {
|
|
||||||
PageResp<UserVO> results = userService.find(userQo, page);
|
|
||||||
return ApiPageResponse.ok(results);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("获取用户详情")
|
|
||||||
@GetMapping("/users/{id}")
|
|
||||||
public ApiResponse<UserVO> getUser(@ApiParam("用户ID") @PathVariable Long id) {
|
|
||||||
UserVO result = userService.getOne(id);
|
|
||||||
return ApiResponse.ok(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("删除用户")
|
|
||||||
@DeleteMapping("/users/{id}")
|
|
||||||
public ApiResponse deleteUser(@ApiParam("用户ID") @PathVariable Long id) {
|
|
||||||
userService.delete(id);
|
|
||||||
return ApiResponse.ok();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
package cn.axzo.tyr.server.job;
|
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package cn.axzo.tyr.server.repository;
|
||||||
|
|
||||||
|
import cn.axzo.tyr.server.repository.entity.SaasBasicDict;
|
||||||
|
import cn.axzo.tyr.server.repository.mapper.SaasBasicDictMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: chenwenjian
|
||||||
|
* @date: 2023/9/7 17:43
|
||||||
|
* @description:
|
||||||
|
* @modifiedBy:
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SaasBasicDictDao extends ServiceImpl<SaasBasicDictMapper,SaasBasicDict> {
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package cn.axzo.tyr.server.repository.entity;
|
||||||
|
|
||||||
|
import cn.axzo.framework.data.mybatisplus.model.BaseEntity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: chenwenjian
|
||||||
|
* @date: 2023/9/7 17:39
|
||||||
|
* @description:
|
||||||
|
* @modifiedBy:
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
public class SaasBasicDict extends BaseEntity<SaasBasicDict> implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 100L;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -1 +0,0 @@
|
|||||||
package cn.axzo.tyr.server.repository.entity;
|
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package cn.axzo.tyr.server.repository.mapper;
|
||||||
|
|
||||||
|
import cn.axzo.tyr.server.repository.entity.SaasBasicDict;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: chenwenjian
|
||||||
|
* @date: 2023/9/7 17:41
|
||||||
|
* @description:
|
||||||
|
* @modifiedBy:
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SaasBasicDictMapper extends BaseMapper<SaasBasicDict> {
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
package cn.axzo.tyr.server.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: chenwenjian
|
||||||
|
* @date: 2023/9/7 17:54
|
||||||
|
* @description:
|
||||||
|
* @modifiedBy:
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
public interface SaasBasicDictService {
|
||||||
|
}
|
||||||
@ -1,15 +0,0 @@
|
|||||||
package cn.axzo.tyr.server.service.converter;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: liyong.tian
|
|
||||||
* @Date: 2022/9/5
|
|
||||||
* @Description:
|
|
||||||
*/
|
|
||||||
public interface EntityConverter<V, E>{
|
|
||||||
|
|
||||||
V toVo(E var);
|
|
||||||
|
|
||||||
List<V> toVo(List<E> var);
|
|
||||||
}
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
package cn.axzo.tyr.server.service.converter;
|
|
||||||
|
|
||||||
import cn.axzo.tyr.server.service.dto.request.user.NewUserDTO;
|
|
||||||
import cn.axzo.tyr.server.service.dto.request.user.UpdateUserDTO;
|
|
||||||
import cn.axzo.tyr.server.service.dto.response.user.UserVO;
|
|
||||||
import cn.axzo.tyr.server.repository.entity.user.User;
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.MappingTarget;
|
|
||||||
|
|
||||||
import static org.mapstruct.NullValueCheckStrategy.ALWAYS;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: liyong.tian
|
|
||||||
* @Date: 2022/9/2
|
|
||||||
* @Description:
|
|
||||||
*/
|
|
||||||
@Mapper(
|
|
||||||
componentModel = "spring",
|
|
||||||
nullValueCheckStrategy = ALWAYS
|
|
||||||
)
|
|
||||||
public interface UserConverter extends EntityConverter<UserVO, User> {
|
|
||||||
|
|
||||||
User toEntity(NewUserDTO dto);
|
|
||||||
|
|
||||||
void updateEntity(UpdateUserDTO dto, @MappingTarget User user);
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
package cn.axzo.tyr.server.service.dto.request;
|
|
||||||
@ -1 +0,0 @@
|
|||||||
package cn.axzo.tyr.server.service.dto.response;
|
|
||||||
@ -1 +0,0 @@
|
|||||||
package cn.axzo.tyr.server.service.event;
|
|
||||||
@ -1 +0,0 @@
|
|||||||
package cn.axzo.tyr.server.service.manager;
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
package cn.axzo.tyr.server.service.user;
|
|
||||||
|
|
||||||
import cn.axzo.framework.domain.page.PageQO;
|
|
||||||
import cn.axzo.framework.domain.page.PageResp;
|
|
||||||
import cn.axzo.tyr.server.service.dto.request.user.NewUserDTO;
|
|
||||||
import cn.axzo.tyr.server.service.dto.request.user.UpdateUserDTO;
|
|
||||||
import cn.axzo.tyr.server.service.dto.request.user.UserQO;
|
|
||||||
import cn.axzo.tyr.server.service.dto.request.user.UserQO1;
|
|
||||||
import cn.axzo.tyr.server.service.dto.response.user.UserVO;
|
|
||||||
import cn.azxo.framework.common.model.CommonPageResponse;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: liyong.tian
|
|
||||||
* @Date: 2022/9/2
|
|
||||||
* @Description:
|
|
||||||
*/
|
|
||||||
public interface UserService {
|
|
||||||
UserVO create(NewUserDTO dto);
|
|
||||||
|
|
||||||
UserVO update(Long id, UpdateUserDTO dto);
|
|
||||||
|
|
||||||
UserVO getOne(Long id);
|
|
||||||
|
|
||||||
void delete(Long id);
|
|
||||||
|
|
||||||
CommonPageResponse<UserVO> queryByPage(UserQO userQO);
|
|
||||||
|
|
||||||
PageResp<UserVO> find(UserQO1 userQo, PageQO page);
|
|
||||||
}
|
|
||||||
@ -1,82 +0,0 @@
|
|||||||
package cn.axzo.tyr.server.service.user.impl;
|
|
||||||
|
|
||||||
import cn.axzo.framework.domain.page.PageQO;
|
|
||||||
import cn.axzo.framework.domain.page.PageResp;
|
|
||||||
import cn.axzo.framework.domain.web.ApiException;
|
|
||||||
import cn.axzo.tyr.server.common.enums.ErrorCode;
|
|
||||||
import cn.axzo.tyr.server.service.dto.request.user.NewUserDTO;
|
|
||||||
import cn.axzo.tyr.server.service.dto.request.user.UpdateUserDTO;
|
|
||||||
import cn.axzo.tyr.server.service.dto.request.user.UserQO;
|
|
||||||
import cn.axzo.tyr.server.service.dto.request.user.UserQO1;
|
|
||||||
import cn.axzo.tyr.server.service.dto.response.user.UserVO;
|
|
||||||
import cn.axzo.tyr.server.repository.entity.user.User;
|
|
||||||
import cn.axzo.tyr.server.repository.UserDao;
|
|
||||||
import cn.axzo.tyr.server.service.user.UserService;
|
|
||||||
import cn.axzo.tyr.server.service.converter.UserConverter;
|
|
||||||
import cn.azxo.framework.common.model.CommonPageResponse;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: liyong.tian
|
|
||||||
* @Date: 2022/9/2
|
|
||||||
* @Description:
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class UserServiceImpl implements UserService {
|
|
||||||
|
|
||||||
private final UserConverter userConverter;
|
|
||||||
|
|
||||||
private final UserDao userDao;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserVO create(NewUserDTO dto) {
|
|
||||||
User user = userConverter.toEntity(dto);
|
|
||||||
userDao.save(user);
|
|
||||||
return userConverter.toVo(user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserVO update(Long id, UpdateUserDTO dto) {
|
|
||||||
User user = userDao.findById(id);
|
|
||||||
if (user == null) {
|
|
||||||
throw new ApiException(ErrorCode.USER_NOT_EXISTS, id);
|
|
||||||
}
|
|
||||||
userConverter.updateEntity(dto, user);
|
|
||||||
return userConverter.toVo(user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserVO getOne(Long id) {
|
|
||||||
User user = userDao.findById(id);
|
|
||||||
return userConverter.toVo(user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void delete(Long id) {
|
|
||||||
userDao.delete(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommonPageResponse<UserVO> queryByPage(UserQO userQo) {
|
|
||||||
IPage<User> page = userDao.queryByPage(userQo);
|
|
||||||
List<User> userList = page.getRecords();
|
|
||||||
if (CollectionUtils.isEmpty(userList)) {
|
|
||||||
return CommonPageResponse.zero(userQo.getPage(), userQo.getPageSize());
|
|
||||||
}
|
|
||||||
return new CommonPageResponse<>(page.getCurrent(), page.getSize(), page.getTotal(), userConverter.toVo(page.getRecords()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PageResp<UserVO> find(UserQO1 userQo, PageQO page) {
|
|
||||||
IPage<User> userPage = userDao.find(userQo, page);
|
|
||||||
return PageResp.list(userPage, userConverter.toVo(userPage.getRecords()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
package cn.axzo.tyr.server.service.validator;
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
package cn.axzo.tyr.server;
|
|
||||||
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unit test for simple App.
|
|
||||||
*/
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest
|
|
||||||
public class AppTest {
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user