1
1
package com .singer .application .controller .sb ;
2
2
3
3
import com .singer .application .controller .BaseController ;
4
+ import com .singer .application .dto .sb .SB01ListResponse ;
5
+ import com .singer .application .dto .sb .SB01Request ;
6
+ import com .singer .application .dto .sb .SB01Response ;
4
7
import com .singer .application .service .sb .SB01Service ;
5
8
import java .io .InputStream ;
6
- import java .util .List ;
7
9
8
10
import org .springframework .beans .factory .annotation .Autowired ;
9
11
import javax .servlet .http .HttpServletRequest ;
17
19
import org .springframework .http .ResponseEntity ;
18
20
import org .springframework .stereotype .Controller ;
19
21
import org .springframework .web .bind .annotation .ModelAttribute ;
22
+ import org .springframework .web .bind .annotation .PathVariable ;
20
23
import org .springframework .web .bind .annotation .RequestMapping ;
21
24
import org .springframework .web .bind .annotation .RequestMethod ;
22
25
import org .springframework .web .bind .annotation .ResponseBody ;
23
26
import org .springframework .web .multipart .MultipartHttpServletRequest ;
24
27
import org .springframework .web .servlet .ModelAndView ;
25
28
26
- import com .singer .common .util .Constants .RESULT_CODE ;
27
- import com .singer .domain .entity .sb .SB01Vo ;
28
-
29
29
import lombok .Cleanup ;
30
30
31
31
@ Controller
32
32
public class SB01Controller extends BaseController {
33
33
34
- private final Log log = LogFactory .getLog (SB01Controller .class );
35
-
36
- @ Autowired
37
- private SB01Service sb01Service ;
34
+ private final Log log = LogFactory .getLog (SB01Controller .class );
35
+
36
+ @ Autowired
37
+ private SB01Service sb01Service ;
38
+
39
+ @ RequestMapping (value = "/sb01/page" , method = RequestMethod .GET )
40
+ public ModelAndView showSB01 () throws Exception {
41
+ ModelAndView model = new ModelAndView ("/sb01view" );
42
+ return model ;
43
+ }
44
+
45
+ @ RequestMapping (value = "/sb01/insertPage" , method = RequestMethod .GET )
46
+ public ModelAndView insertPageSB01 () throws Exception {
47
+ ModelAndView model = new ModelAndView ("/sb01insert" );
48
+ return model ;
49
+ }
50
+
51
+ @ ResponseBody
52
+ @ RequestMapping (value = "/sb01/show_detail/{seq}" , method = RequestMethod .GET )
53
+ public ModelAndView selectOneSB01View (@ PathVariable int seq , HttpServletRequest request ) throws Exception {
54
+ log .debug ("enter sb01show_detail get" );
55
+
56
+ ModelAndView model = new ModelAndView ("/sb01view_detail" );
57
+
58
+ String userid = getSessionId (request );
59
+ SB01Response response = sb01Service .selectOneSB01Vo (seq , userid );
60
+ model .addObject ("sb01Vo" , response );
61
+
62
+ log .debug ("exit sb01show_detail get" );
63
+ return model ;
64
+ }
65
+
66
+ @ ResponseBody
67
+ @ RequestMapping (value = "/sb01" , method = RequestMethod .POST )
68
+ public ResponseEntity <SB01Response > insertSB01Vo (@ ModelAttribute @ Valid SB01Request sb01Request ,
69
+ MultipartHttpServletRequest request ) throws Exception {
70
+ log .debug ("enter sb01 post" );
71
+
72
+ String userid = getSessionId (request );
73
+
74
+ SB01Response response = sb01Service .insertSB01Vo (sb01Request , request , userid );
75
+
76
+ log .debug ("exit sb01 post" );
77
+ return new ResponseEntity <SB01Response >(response , HttpStatus .OK );
78
+ }
79
+
80
+ @ ResponseBody
81
+ @ RequestMapping (value = "/sb01/{nowPage}" , method = RequestMethod .GET )
82
+ public ResponseEntity <SB01ListResponse > selectSB01Vo (@ PathVariable int nowPage ) throws Exception {
83
+ log .debug ("enter sb01 get" );
84
+
85
+ SB01ListResponse listResponse = sb01Service .selectSB01Vo (nowPage );
86
+
87
+ log .debug ("exit sb01 get" );
88
+ return new ResponseEntity <SB01ListResponse >(listResponse , HttpStatus .OK );
89
+ }
90
+
91
+ @ ResponseBody
92
+ @ RequestMapping (value = "/sb01/seq/{seq}" , method = RequestMethod .GET )
93
+ public ResponseEntity <SB01Response > selectOneSB01Vo (@ PathVariable int seq , HttpServletRequest request )
94
+ throws Exception {
95
+ log .debug ("enter sb01/seq get" );
96
+
97
+ String userid = getSessionId (request );
98
+ SB01Response response = sb01Service .selectOneSB01Vo (seq , userid );
99
+
100
+ log .debug ("exit sb01/seq get" );
101
+ return new ResponseEntity <>(response , HttpStatus .OK );
102
+ }
103
+
104
+ @ ResponseBody
105
+ @ RequestMapping (value = "/sb01/video/{seq}" , method = RequestMethod .GET )
106
+ public void selectVideoSB01Vo (@ PathVariable int seq , HttpServletRequest request ,
107
+ HttpServletResponse response ) throws Exception {
108
+ log .debug ("enter sb01Video get" );
109
+
110
+ @ Cleanup
111
+ InputStream is = sb01Service .selectVideo (seq , request );
112
+
113
+ IOUtils .copy (is , response .getOutputStream ());
114
+
115
+ log .debug ("exit sb01Video get" );
116
+ }
117
+
118
+ @ ResponseBody
119
+ @ RequestMapping (value = "/sb01/{seq}" , method = RequestMethod .DELETE )
120
+ public ResponseEntity <SB01Response > deleteSB01Vo (@ PathVariable int seq , HttpServletRequest request )
121
+ throws Exception {
122
+ log .debug ("enter sb01 delete" );
123
+
124
+ sb01Service .deleteSB01Vo (seq );
125
+
126
+ log .debug ("exit sb01 delete" );
127
+ return new ResponseEntity <SB01Response >(HttpStatus .NO_CONTENT );
128
+ }
129
+
130
+ @ ResponseBody
131
+ @ RequestMapping (value = "/sb01/like/{seq}" , method = RequestMethod .PATCH )
132
+ public ResponseEntity <SB01Response > likeSB01Vo (@ PathVariable int seq , HttpServletRequest request )
133
+ throws Exception {
134
+ log .debug ("enter sb01like put" );
135
+
136
+ String sessionid = getSessionId (request );
137
+
138
+ SB01Response sb01Response = sb01Service .likeSB01Vo (seq , sessionid );
139
+
140
+ log .debug ("exit sb01like put" );
141
+ return new ResponseEntity <SB01Response >(sb01Response , HttpStatus .OK );
142
+ }
38
143
39
- @ RequestMapping ( value = "/sb01/page" , method = RequestMethod . GET )
40
- public ModelAndView showSB01 () throws Exception {
41
- ModelAndView model = new ModelAndView ( "/sb01view" );
42
- return model ;
43
- }
144
+ @ ResponseBody
145
+ @ RequestMapping ( value = "/sb01/hate/{seq}" , method = RequestMethod . PATCH )
146
+ public ResponseEntity < SB01Response > hateSB01Vo ( @ PathVariable int seq , HttpServletRequest request )
147
+ throws Exception {
148
+ log . debug ( "enter sb01hate put" );
44
149
45
- @ RequestMapping (value = "/sb01/insertPage" , method = RequestMethod .GET )
46
- public ModelAndView insertPageSB01 () throws Exception {
47
- ModelAndView model = new ModelAndView ("/sb01insert" );
48
- return model ;
49
- }
150
+ String sessionid = getSessionId (request );
151
+ SB01Response sb01Response = sb01Service .hateSB01Vo (seq , sessionid );
50
152
51
- @ ResponseBody
52
- @ RequestMapping (value = "/sb01" , method = RequestMethod .POST )
53
- public ResponseEntity <SB01Vo > insertSB01Vo (@ ModelAttribute @ Valid SB01Vo sb01Vo ,
54
- MultipartHttpServletRequest request ) throws Exception {
55
- log .debug ("enter sb01 post" );
56
-
57
- String userid = getSessionId (request );
58
-
59
- int success = sb01Service .insertSB01Vo (sb01Vo , request , userid );
60
- sb01Vo .setResult (success );
61
-
62
- log .debug ("exit sb01 post" );
63
- return new ResponseEntity <SB01Vo >(sb01Vo , HttpStatus .OK );
64
- }
65
-
66
- @ ResponseBody
67
- @ RequestMapping (value = "/sb01/{nowPage}" , method = RequestMethod .GET )
68
- public ResponseEntity <SB01Vo > selectSB01Vo (@ ModelAttribute SB01Vo sb01Vo ) throws Exception {
69
- log .debug ("enter sb01 get" );
70
-
71
- List <SB01Vo > list = sb01Service .selectSB01Vo (sb01Vo );
72
- sb01Vo .setList (list );
73
- sb01Vo .setTotCnt (sb01Service .selectSB01Count ());
74
- log .debug ("exit sb01 get" );
75
- return new ResponseEntity <SB01Vo >(sb01Vo , HttpStatus .OK );
76
- }
77
-
78
- @ ResponseBody
79
- @ RequestMapping (value = "/sb01/find/{selection}/{findText}" , method = RequestMethod .GET )
80
- public ResponseEntity <SB01Vo > selectFindSB01Vo (@ ModelAttribute SB01Vo sb01Vo ) throws Exception {
81
- log .debug ("enter sb01find get" );
82
-
83
- List <SB01Vo > list = sb01Service .selectFindSB01Vo (sb01Vo );
84
- sb01Vo .setList (list );
85
-
86
- log .debug ("exit sb01find get" );
87
- return new ResponseEntity <SB01Vo >(sb01Vo , HttpStatus .OK );
88
- }
89
-
90
- @ ResponseBody
91
- @ RequestMapping (value = "/sb01/show_detail/{seq}" , method = RequestMethod .GET )
92
- public ModelAndView selectOneSB01Vo (@ ModelAttribute SB01Vo sb01Vo , HttpServletRequest request ) throws Exception {
93
- log .debug ("enter sb01show_detail get" );
94
-
95
- ModelAndView model = new ModelAndView ("/sb01view_detail" );
96
-
97
- String userid = getSessionId (request );
98
- sb01Vo = sb01Service .selectOneSB01Vo (sb01Vo , userid );
99
- model .addObject ("sb01Vo" , sb01Vo );
100
-
101
- log .debug ("exit sb01show_detail get" );
102
- return model ;
103
- }
104
-
105
- @ ResponseBody
106
- @ RequestMapping (value = "/sb01/video/{seq}/{title}" , method = RequestMethod .GET )
107
- public void selectVideoSB01Vo (@ ModelAttribute SB01Vo sb01Vo , HttpServletRequest request ,
108
- HttpServletResponse response ) throws Exception {
109
- log .debug ("enter sb01Video get" );
110
- @ Cleanup
111
- InputStream is = sb01Service .selectVideo (sb01Vo , request );
112
-
113
- IOUtils .copy (is , response .getOutputStream ());
114
-
115
- log .debug ("exit sb01Video get" );
116
- }
117
-
118
- @ ResponseBody
119
- @ RequestMapping (value = "/sb01/{seq}" , method = RequestMethod .DELETE )
120
- public ResponseEntity <SB01Vo > deleteSB01Vo (@ ModelAttribute SB01Vo sb01Vo , HttpServletRequest request )
121
- throws Exception {
122
- log .debug ("enter sb01 delete" );
123
-
124
- sb01Service .deleteSB01Vo (sb01Vo );
125
- sb01Vo .setResult (RESULT_CODE .SUCCESS .getValue ());
126
-
127
- log .debug ("exit sb01 delete" );
128
- return new ResponseEntity <SB01Vo >(HttpStatus .NO_CONTENT );
129
- }
130
-
131
- @ ResponseBody
132
- @ RequestMapping (value = "/sb01/like/{seq}" , method = RequestMethod .PATCH )
133
- public ResponseEntity <SB01Vo > likeSB01Vo (@ ModelAttribute SB01Vo sb01Vo , HttpServletRequest request )
134
- throws Exception {
135
- log .debug ("enter sb01like put" );
136
-
137
- String sessionid = getSessionId (request );
138
-
139
- sb01Vo = sb01Service .likeSB01Vo (sb01Vo , sessionid );
140
-
141
- log .debug ("exit sb01like put" );
142
- return new ResponseEntity <SB01Vo >(sb01Vo , HttpStatus .OK );
143
- }
144
-
145
- @ ResponseBody
146
- @ RequestMapping (value = "/sb01/hate/{seq}" , method = RequestMethod .PATCH )
147
- public ResponseEntity <SB01Vo > hateSB01Vo (@ ModelAttribute SB01Vo sb01Vo , HttpServletRequest request )
148
- throws Exception {
149
- log .debug ("enter sb01hate put" );
153
+ log .debug ("exit sb01hate put" );
154
+ return new ResponseEntity <SB01Response >(sb01Response , HttpStatus .OK );
155
+ }
150
156
151
- String sessionid = getSessionId (request );
152
- sb01Vo = sb01Service .hateSB01Vo (sb01Vo , sessionid );
153
-
154
- log .debug ("exit sb01hate put" );
155
- return new ResponseEntity <SB01Vo >(sb01Vo , HttpStatus .OK );
156
- }
157
157
}
0 commit comments