xiaoyong931011
2020-05-25 6f44fa20505ec0b1c95b460043f25b9050511aa0
src/main/java/com/xcong/excoin/modules/test/controller/TestUserController.java
@@ -2,7 +2,9 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xcong.excoin.common.annotations.UserAuth;
import com.xcong.excoin.common.response.Result;
import com.xcong.excoin.modules.member.entity.MemberEntity;
import com.xcong.excoin.modules.test.dto.TestUserDto;
import com.xcong.excoin.modules.test.entity.TestUserEntity;
import com.xcong.excoin.modules.test.mapper.TestUserEntityMapper;
@@ -15,6 +17,7 @@
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -38,12 +41,14 @@
    @PostMapping(value = "/findUserInPage")
    public Result findUserInPage(@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
                                 @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                 @RequestBody @Valid TestUserDto testUserDto) {
                                 @RequestBody @Validated TestUserDto testUserDto, @UserAuth MemberEntity memberEntity) {
        log.info("--->{}",SecurityContextHolder.getContext().getAuthentication());
        log.info("----->{}", memberEntity);
        Page<TestUserEntity> page = new Page<>(pageNum, pageSize);
        log.info(testUserDto.getName());
        IPage<TestUserEntity> list = testUserService.page(page);
        return Result.ok(MessageSourceUtils.getString("111"), list);
        IPage<TestUserVo> aa = TestUserEntityMapper.INSTANCE.pageEntityToPageVO(list);
        return Result.ok(MessageSourceUtils.getString("111"), aa);
    }
@@ -58,6 +63,19 @@
        return Result.fail("fail");
    }
    @ApiOperation(value = "修改测试用户", notes = "该接口用户修改测试用户")
    @PostMapping(value = "/modify")
    public Result modify(@RequestBody @Validated TestUserDto testUserDto) {
        TestUserEntity testUserEntity = TestUserEntityMapper.INSTANCE.dtoToEntity(testUserDto);
        log.info("#-------->{}#", testUserEntity);
        boolean flag = testUserService.updateById(testUserEntity);
        if (flag) {
            return Result.ok("success");
        }
        return Result.fail("fail");
    }
    @ApiOperation(value = "根据ID删除用户", notes = "根据ID删除用户")
    @GetMapping(value = "/del/{id}")
    public Result del(@PathVariable(value = "id") Long id) {