Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
ZhangKuan
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张宽
ZhangKuan
Commits
971f48ac
Commit
971f48ac
authored
Oct 26, 2016
by
胡小根
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coding
parent
71aef10b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
143 deletions
+0
-143
ActivitiController.java
...ringMVCProjectTemplate/controller/ActivitiController.java
+0
-35
CountryController.java
...pringMVCProjectTemplate/controller/CountryController.java
+0
-108
No files found.
web/src/main/java/com/haomostudio/SpringMVCProjectTemplate/controller/ActivitiController.java
deleted
100644 → 0
View file @
71aef10b
package
com
.
haomostudio
.
SpringMVCProjectTemplate
.
controller
;
import
com.haomostudio.SpringMVCProjectTemplate.service.ActivitiService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
javax.servlet.http.HttpServletResponse
;
/**
* Created by hxgqh on 2016/10/6.
*/
public
class
ActivitiController
{
@Autowired
ActivitiService
activitiService
;
@Autowired
HttpServletResponse
response
;
@RequestMapping
(
value
=
"/activities"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
@ResponseBody
public
Object
getActivities
(
@RequestHeader
(
value
=
"X-Auth-Token"
)
String
token
,
@RequestHeader
(
value
=
"page_no"
)
Integer
pageNo
,
@RequestHeader
(
value
=
"page_size"
)
Integer
pageSize
,
@RequestHeader
(
value
=
"sort_item"
)
String
sortItem
,
@RequestHeader
(
value
=
"sort_order"
)
String
sortOrder
,
@RequestHeader
(
value
=
"filters"
)
String
filters
)
{
return
activitiService
.
getListWithPagingAndFilter
(
pageNo
,
pageSize
,
sortItem
,
sortOrder
,
filters
);
}
}
web/src/main/java/com/haomostudio/SpringMVCProjectTemplate/controller/CountryController.java
deleted
100644 → 0
View file @
71aef10b
package
com
.
haomostudio
.
SpringMVCProjectTemplate
.
controller
;
import
com.haomostudio.SpringMVCProjectTemplate.common.Resp
;
import
com.haomostudio.SpringMVCProjectTemplate.domain.Country
;
import
com.haomostudio.SpringMVCProjectTemplate.service.ActivitiService
;
import
com.haomostudio.SpringMVCProjectTemplate.service.CountryService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Date
;
/**
* Created by hxg on 2016/10/06.
*/
@Controller
public
class
CountryController
{
@Autowired
CountryService
countryService
;
@Autowired
HttpServletResponse
response
;
@RequestMapping
(
value
=
"/countries/create"
,
method
=
RequestMethod
.
POST
,
produces
=
"application/json;charset=UTF-8"
)
@ResponseBody
public
Object
createCountry
(
@RequestParam
(
value
=
"country_id"
,
required
=
false
)
Integer
country_id
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
)
{
Country
item
=
new
Country
();
item
.
setCountry_id
(
country_id
);
item
.
setName
(
name
);
countryService
.
create
(
item
);
//若request param为null,但字段定义有默认值,则需从数据库中返回结果
//return countryService.get(id);
return
item
;
}
@RequestMapping
(
value
=
"/countries/{countries_id}/delete"
,
method
=
RequestMethod
.
POST
,
produces
=
"application/json;charset=UTF-8"
)
@ResponseBody
public
Object
deleteCountry
(
@RequestHeader
(
value
=
"X-Auth-Token"
)
String
token
,
@PathVariable
(
value
=
"countries_id"
)
String
id
)
{
Country
item
=
countryService
.
get
(
id
);
if
(
null
==
item
)
{
response
.
setStatus
(
404
);
return
Resp
.
fail
(
"the asset to be deleted doesn't exist"
);
}
countryService
.
delete
(
id
);
return
Resp
.
succ
(
"delete success"
);
}
@RequestMapping
(
value
=
"/countries/{countries_id}/edit"
,
method
=
RequestMethod
.
POST
,
produces
=
"application/json;charset=UTF-8"
)
@ResponseBody
public
Object
editCountry
(
@RequestHeader
(
value
=
"X-Auth-Token"
)
String
token
,
@PathVariable
(
value
=
"countries_id"
)
String
id
,
@RequestParam
(
value
=
"country_id"
,
required
=
false
)
Integer
country_id
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
)
{
Country
item
=
countryService
.
get
(
id
);
if
(
null
==
item
)
{
response
.
setStatus
(
404
);
return
Resp
.
fail
(
"the asset to be edited doesn't exist"
);
}
item
.
setCountry_id
(
country_id
);
item
.
setName
(
name
);
countryService
.
update
(
item
);
return
countryService
.
get
(
id
);
}
@RequestMapping
(
value
=
"/countries/{countries_id}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
@ResponseBody
public
Object
getCountry
(
@RequestHeader
(
value
=
"X-Auth-Token"
)
String
token
,
@PathVariable
(
value
=
"countries_id"
)
String
id
)
{
Country
item
=
countryService
.
get
(
id
);
if
(
null
==
item
)
{
response
.
setStatus
(
404
);
return
Resp
.
fail
(
"the asset to be edited doesn't exist"
);
}
return
item
;
}
@RequestMapping
(
value
=
"/countries"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
@ResponseBody
public
Object
getcountries
(
@RequestHeader
(
value
=
"page_no"
)
Integer
pageNo
,
@RequestHeader
(
value
=
"page_size"
)
Integer
pageSize
,
@RequestHeader
(
value
=
"sort_item"
)
String
sortItem
,
@RequestHeader
(
value
=
"sort_order"
)
String
sortOrder
,
@RequestHeader
(
value
=
"filters"
)
String
filters
)
{
return
countryService
.
getListWithPagingAndFilter
(
pageNo
,
pageSize
,
sortItem
,
sortOrder
,
filters
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment