liurunyu
2023-11-04 df37487916ebc1ff8d8e0f8b088c5b6af1e582ff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package com.dy.pipIrrDemo.user;
 
import com.dy.common.mybatis.envm.Deleted;
import com.dy.common.mybatis.envm.Disabled;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.pipIrrGlobal.pojoDemo.DemoUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
@Slf4j
@RestController
@RequestMapping(path="user")
@SuppressWarnings("unchecked")
public class UserCtrl {
 
    UserSv userSv;
 
    @Autowired
    public void setUserSv(UserSv userSv){
        this.userSv = userSv;
    }
 
    @GetMapping("selectById1")
    public BaseResponse<DemoUser> selectById1(){
        try {
            DemoUser po = userSv.selectById1(1L) ;
            return BaseResponseUtils.buildSuccess(po);
        } catch (Exception e) {
            log.error("selectById1", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
 
 
    @GetMapping("selectById2")
    public BaseResponse<DemoUser> selectById2(){
        try {
            DemoUser po = userSv.selectById2(1L) ;
            return BaseResponseUtils.buildSuccess(po);
        } catch (Exception e) {
            log.error("selectById2", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
 
 
    @GetMapping("selectById3")
    public BaseResponse<DemoUser> selectById3(){
        try {
            DemoUser po = userSv.selectById3(1L) ;
            return BaseResponseUtils.buildSuccess(po);
        } catch (Exception e) {
            log.error("selectById3", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
 
 
    @GetMapping("selectById4")
    public BaseResponse<DemoUser> selectById4(){
        try {
            DemoUser po = userSv.selectById4(1L) ;
            return BaseResponseUtils.buildSuccess(po);
        } catch (Exception e) {
            log.error("selectById4", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
 
 
    @GetMapping("selectById5")
    public BaseResponse<DemoUser> selectById5(){
        try {
            DemoUser po = userSv.selectById5(1L) ;
            return BaseResponseUtils.buildSuccess(po);
        } catch (Exception e) {
            log.error("selectById5", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
 
 
 
    @GetMapping("insert")
    public BaseResponse<DemoUser> insert(){
        try {
            DemoUser po = new DemoUser();
            po.name = "王五" ;
            po.password = "123456" ;
            po.disabled = Disabled.NO ;
            po.deleted = Deleted.NO ;
            po.roleId = 1L ;
            this.userSv.insert(po) ;
            return BaseResponseUtils.buildSuccess(po);
        } catch (Exception e) {
            log.error("insert", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
 
}