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
liqiangqiang
committed
May 5, 2018
1 parent
e79d458
commit 435b375
Showing
13 changed files
with
272 additions
and
324 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
4 changes: 2 additions & 2 deletions
4
...a/demo/springboot/dao/BookRepository.java → ...a/demo/springboot/dao/CityRepository.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,10 +1,10 @@ | ||
package demo.springboot.dao; | ||
|
||
import demo.springboot.domain.Book; | ||
import demo.springboot.domain.City; | ||
import org.springframework.data.mongodb.repository.ReactiveMongoRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface BookRepository extends ReactiveMongoRepository<Book, Long> { | ||
public interface CityRepository extends ReactiveMongoRepository<City, Long> { | ||
|
||
} |
68 changes: 0 additions & 68 deletions
68
springboot-webflux-10-book-manage-sys/src/main/java/demo/springboot/domain/Book.java
This file was deleted.
Oops, something went wrong.
60 changes: 60 additions & 0 deletions
60
springboot-webflux-10-book-manage-sys/src/main/java/demo/springboot/domain/City.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,60 @@ | ||
package demo.springboot.domain; | ||
|
||
/** | ||
* 城市实体类 | ||
* | ||
*/ | ||
public class City { | ||
|
||
/** | ||
* 城市编号 | ||
*/ | ||
private Long id; | ||
|
||
/** | ||
* 省份编号 | ||
*/ | ||
private Long provinceId; | ||
|
||
/** | ||
* 城市名称 | ||
*/ | ||
private String cityName; | ||
|
||
/** | ||
* 描述 | ||
*/ | ||
private String description; | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
public Long getProvinceId() { | ||
return provinceId; | ||
} | ||
|
||
public void setProvinceId(Long provinceId) { | ||
this.provinceId = provinceId; | ||
} | ||
|
||
public String getCityName() { | ||
return cityName; | ||
} | ||
|
||
public void setCityName(String cityName) { | ||
this.cityName = cityName; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public void setDescription(String description) { | ||
this.description = description; | ||
} | ||
} |
45 changes: 0 additions & 45 deletions
45
springboot-webflux-10-book-manage-sys/src/main/java/demo/springboot/service/BookService.java
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
springboot-webflux-10-book-manage-sys/src/main/java/demo/springboot/service/CityService.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,18 @@ | ||
package demo.springboot.service; | ||
|
||
import demo.springboot.domain.City; | ||
import reactor.core.publisher.Flux; | ||
import reactor.core.publisher.Mono; | ||
|
||
public interface CityService { | ||
|
||
Flux<City> findAll(); | ||
|
||
Mono<City> insertByCity(City city); | ||
|
||
Mono<City> update(City city); | ||
|
||
Mono<Void> delete(Long id); | ||
|
||
Mono<City> findById(Long id); | ||
} |
50 changes: 0 additions & 50 deletions
50
...ebflux-10-book-manage-sys/src/main/java/demo/springboot/service/impl/BookServiceImpl.java
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
...ebflux-10-book-manage-sys/src/main/java/demo/springboot/service/impl/CityServiceImpl.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,45 @@ | ||
package demo.springboot.service.impl; | ||
|
||
import demo.springboot.dao.CityRepository; | ||
import demo.springboot.domain.City; | ||
import demo.springboot.service.CityService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
import reactor.core.publisher.Flux; | ||
import reactor.core.publisher.Mono; | ||
|
||
@Component | ||
public class CityServiceImpl implements CityService { | ||
|
||
private final CityRepository cityRepository; | ||
|
||
@Autowired | ||
public CityServiceImpl(CityRepository cityRepository) { | ||
this.cityRepository = cityRepository; | ||
} | ||
|
||
@Override | ||
public Flux<City> findAll() { | ||
return cityRepository.findAll(); | ||
} | ||
|
||
@Override | ||
public Mono<City> insertByCity(City city) { | ||
return cityRepository.save(city); | ||
} | ||
|
||
@Override | ||
public Mono<City> update(City city) { | ||
return cityRepository.save(city); | ||
} | ||
|
||
@Override | ||
public Mono<Void> delete(Long id) { | ||
return cityRepository.deleteById(id); | ||
} | ||
|
||
@Override | ||
public Mono<City> findById(Long id) { | ||
return cityRepository.findById(id); | ||
} | ||
} |
Oops, something went wrong.