forked from apolloconfig/apollo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
196 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/SampleController.java
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...com/ctrip/apollo/portal/entities/App.java → ...a/com/ctrip/apollo/portal/domain/App.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
...ollo/portal/repository/AppRepository.java → ...p/apollo/portal/domain/AppRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/AppService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.ctrip.apollo.portal.service; | ||
|
||
import java.util.Date; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.stereotype.Service; | ||
|
||
import com.ctrip.apollo.portal.domain.App; | ||
import com.ctrip.apollo.portal.domain.AppRepository; | ||
|
||
@Service | ||
public class AppService { | ||
|
||
@Autowired | ||
private AppRepository appRepository; | ||
|
||
public App detail(String appId) { | ||
return appRepository.findOne(appId); | ||
} | ||
|
||
public Page<App> list(Pageable pageable) { | ||
return appRepository.findAll(pageable); | ||
} | ||
|
||
public App save(App app) { | ||
app.setCreateTimestamp(new Date()); | ||
return appRepository.save(app); | ||
} | ||
} |
29 changes: 16 additions & 13 deletions
29
...ollo/portal/controller/AppController.java → ...trip/apollo/portal/web/AppController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,36 @@ | ||
package com.ctrip.apollo.portal.controller; | ||
|
||
import java.util.Date; | ||
package com.ctrip.apollo.portal.web; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.web.PageableDefault; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.ctrip.apollo.portal.entities.App; | ||
import com.ctrip.apollo.portal.repository.AppRepository; | ||
import com.ctrip.apollo.portal.domain.App; | ||
import com.ctrip.apollo.portal.service.AppService; | ||
|
||
@RestController | ||
@RequestMapping("/apps") | ||
public class AppController { | ||
|
||
@Autowired | ||
private AppRepository appRepository; | ||
|
||
@RequestMapping("") | ||
public Page<App> list(@PageableDefault(size = 50) Pageable pageable) { | ||
return appRepository.findAll(pageable); | ||
} | ||
private AppService appService; | ||
|
||
@RequestMapping(value = "", method = RequestMethod.POST) | ||
public App create(App app) { | ||
app.setCreateTimestamp(new Date()); | ||
return appRepository.save(app); | ||
return appService.save(app); | ||
} | ||
|
||
@RequestMapping("/{appid}") | ||
public App detail(@PathVariable String appId) { | ||
return appService.detail(appId); | ||
} | ||
|
||
@RequestMapping("") | ||
public Page<App> list(@PageableDefault(size = 50) Pageable pageable) { | ||
return appService.list(pageable); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
spring.datasource.url = jdbc:h2:file:~/fxapolloportaldb | ||
spring.datasource.url = jdbc:h2:file:~/fxapolloportaldb;DB_CLOSE_ON_EXIT=FALSE | ||
spring.datasource.username = sa | ||
spring.datasource.password = sa | ||
spring.datasource.driver-class-name = org.h2.Driver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.