Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Develop #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
houko merged 3 commits into master from develop
Apr 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions core/src/main/java/info/xiaomo/core/base/BaseDao.java
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@
@Repository
public interface BaseDao<T> extends JpaRepository<T, Long> {

/**
* 根据id查
*
* @param id
* @return
*/
T findById(Long id);

/**
* 根据名字查
*
Expand Down
2 changes: 1 addition & 1 deletion freemarker/src/main/resources/config/banner-girl.txt
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
...::: ::::::::::::' ``::.
```` ':. ':::::::::' ::::..
'.:::::' ':'````..
:: Spring Boot :: (v1.5.8.RELEASE)
:: Spring Boot :: (v2.0.0.RELEASE)
6 changes: 3 additions & 3 deletions javase/src/main/java/info/xiaomo/javase/QuestionMain.java
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import springfox.documentation.annotations.ApiIgnore;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
Expand Down Expand Up @@ -43,9 +43,9 @@
@EnableJpaRepositories("info.xiaomo.*.dao")
@EnableSwagger2
@RestController
public class QuestionMain extends WebMvcConfigurerAdapter {
public class QuestionMain implements WebMvcConfigurer {

public static void main(String[] args) throws Exception {
public static void main(String[] args) {
SpringApplication.run(QuestionMain.class, args);
}

Expand Down
8 changes: 0 additions & 8 deletions javase/src/main/java/info/xiaomo/javase/dao/QuestionDao.java
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,4 @@
*/
@Repository
public interface QuestionDao extends JpaRepository<QuestionModel, Long> {

/**
* 根据Id查找
*
* @param id
* @return
*/
QuestionModel findById(Long id);
}
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

/**
* 把今天最好的表现当作明天最新的起点..〜
* いま 最高の表現 として 明日最新の始発..〜
Expand All @@ -32,12 +34,13 @@ public QuestionServiceImpl(QuestionDao questionDao) {

@Override
public QuestionModel findById(Long id) {
return questionDao.findById(id);
Optional<QuestionModel> optionalModel = questionDao.findById(id);
return optionalModel.orElse(null);
}

@Override
public boolean add(QuestionModel questionModel) {
QuestionModel save = questionDao.save(questionModel);
return save != null;
questionDao.save(questionModel);
return true;
}
}
2 changes: 1 addition & 1 deletion javase/src/main/resources/config/banner-girl.txt
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
...::: ::::::::::::' ``::.
```` ':. ':::::::::' ::::..
'.:::::' ':'````..
:: Spring Boot :: (v1.5.8.RELEASE)
:: Spring Boot :: (v2.0.0.RELEASE)
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
* 把今天最好的表现当作明天最新的起点..〜
Expand Down Expand Up @@ -38,7 +39,8 @@ public List<MongoUser> findAll() {

@Override
public MongoUser findById(Long id) {
return dao.findOne(id);
Optional<MongoUser> optionalUser = dao.findById(id);
return optionalUser.orElse(null);
}

@Override
Expand All @@ -53,7 +55,11 @@ public MongoUser add(MongoUser mongoUser) {

@Override
public void delete(Long id) {
dao.delete(id);
Optional<MongoUser> optional = dao.findById(id);
if (!optional.isPresent()) {
return;
}
dao.delete(optional.get());
}

@Override
Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.jdbc.core.JdbcTemplate;
Expand Down
2 changes: 1 addition & 1 deletion multipleSource/src/main/resources/config/banner-girl.txt
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
...::: ::::::::::::' ``::.
```` ':. ':::::::::' ::::..
'.:::::' ':'````..
:: Spring Boot :: (v1.5.8.RELEASE)
:: Spring Boot :: (v2.0.0.RELEASE)
2 changes: 1 addition & 1 deletion mybatis/src/main/resources/config/banner-girl.txt
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
...::: ::::::::::::' ``::.
```` ':. ':::::::::' ::::..
'.:::::' ':'````..
:: Spring Boot :: (v1.5.8.RELEASE)
:: Spring Boot :: (v2.0.0.RELEASE)
42 changes: 1 addition & 41 deletions pom.xml
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<!-- html -->
<jsoup.version>1.10.1</jsoup.version>
<!-- spring-boot version -->
<spring-boot.version>1.5.8.RELEASE</spring-boot.version>
<spring-boot.version>2.0.0.RELEASE</spring-boot.version>
<!-- compiler-plugin version -->
<maven-compiler-plugin.version>3.5.1</maven-compiler-plugin.version>
<!-- surefile-plugin test util -->
Expand All @@ -103,7 +103,6 @@
<jxl.version>2.6.12</jxl.version>
<!-- microsoft office -->
<poi.version>3.10-beta2</poi.version>
<kotlin.version>1.1.51</kotlin.version>
</properties>


Expand Down Expand Up @@ -215,20 +214,6 @@
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jre8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>

Expand Down Expand Up @@ -270,31 +255,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<jvmTarget>1.8</jvmTarget>
</configuration>
</plugin>

</plugins>
</build>
</project>
1 change: 0 additions & 1 deletion redis/pom.xml
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<version>1.5.8.RELEASE</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion thymeleaf/src/main/resources/config/banner-girl.txt
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
...::: ::::::::::::' ``::.
```` ':. ':::::::::' ::::..
'.:::::' ':'````..
:: Spring Boot :: (v1.5.8.RELEASE)
:: Spring Boot :: (v2.0.0.RELEASE)
6 changes: 3 additions & 3 deletions website/src/main/java/info/xiaomo/website/XiaomoMain.java
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import springfox.documentation.annotations.ApiIgnore;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
Expand Down Expand Up @@ -48,9 +48,9 @@
@EnableCaching
@EnableSwagger2
@Controller
public class XiaomoMain extends WebMvcConfigurerAdapter {
public class XiaomoMain implements WebMvcConfigurer {

public static void main(String[] args) throws Exception {
public static void main(String[] args) {
SpringApplication.run(XiaomoMain.class, args);
}

Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

Expand Down Expand Up @@ -78,7 +82,7 @@ public Result findByName(@PathVariable("name") String name) {
if (model == null) {
return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage());
}
return new Result(model);
return new Result<>(model);
}

/**
Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.List;
import java.util.Optional;

/**
* 把今天最好的表现当作明天最新的起点..〜
Expand Down Expand Up @@ -61,12 +65,10 @@ public UserController(UserService service) {
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "唯一id", required = true, dataType = "Long", paramType = "path"),
})
@SuppressWarnings("unchecked")
public Result findUserById(@PathVariable("id") Long id) {
UserModel userModel = service.findUserById(id);
if (userModel == null) {
return new Result(CodeConst.USER_NOT_FOUND.getResultCode(), CodeConst.USER_NOT_FOUND.getMessage());
}
return new Result<>(userModel);
Optional<UserModel> optional = service.findUserById(id);
return optional.map(Result::new).orElseGet(() -> new Result(CodeConst.USER_NOT_FOUND.getResultCode(), CodeConst.USER_NOT_FOUND.getMessage()));
}

/**
Expand Down Expand Up @@ -98,7 +100,7 @@ public Result addUser(@RequestBody UserModel user) {
@ApiImplicitParam(name = "密码", required = true, dataType = "String", paramType = "path")
})
@RequestMapping(value = "register/{email}/{password}", method = RequestMethod.POST)
public Result register(@PathVariable("email") String email, @PathVariable("password") String password) throws Exception {
public Result register(@PathVariable("email") String email, @PathVariable("password") String password) {
UserModel userModel = service.findUserByEmail(email);
//邮箱被占用
if (userModel != null) {
Expand Down Expand Up @@ -221,7 +223,7 @@ public Result deleteUserById(@PathVariable("id") Long id) throws UserNotFoundExc
@ApiOperation(value = "处理激活", notes = "处理激活", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@RequestMapping(value = "validateEmail", method = RequestMethod.POST)
public Result validateEmail(@RequestBody UserModel user
) throws ServiceException, ParseException, UserNotFoundException {
) throws ServiceException {
//数据访问层,通过email获取用户信息
UserModel userModel = service.findUserByEmail(user.getEmail());
if (userModel != null) {
Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.springframework.data.domain.Page;

import java.util.List;
import java.util.Optional;

/**
* 把今天最好的表现当作明天最新的起点..〜
Expand All @@ -27,7 +28,7 @@ public interface UserService {
* @param id id
* @return UserModel
*/
UserModel findUserById(Long id);
Optional<UserModel> findUserById(Long id);

/**
* 根据邮件查用户
Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /