From 44c0de47edbf25e308499abdfa52a33d1361349d Mon Sep 17 00:00:00 2001 From: DESKTOP-HG94VRH\taohandong <2821744554@qq.com> Date: Fri, 1 Mar 2019 13:25:35 +0800 Subject: [PATCH] no message --- springboot/pom.xml | 8 ++++++-- springboot/src/main/java/com/sincre/springboot/SpringbootApplication.java | 8 ++++---- springboot/src/main/java/com/sincre/springboot/Swagger2.java | 4 ++-- springboot/src/main/java/com/sincre/springboot/controller/UserController.java | 4 ++-- springboot/src/main/java/com/sincre/springboot/mapper/UserMapper.java | 6 +++--- springboot/src/main/java/com/sincre/springboot/server/UserServer.java | 4 ++-- springboot/src/main/java/com/sincre/springboot/server/UserServerImp.java | 4 ++-- springboot/src/main/java/com/sincre/springboot/utils/FileUtils.java | 2 +- springboot/src/main/resources/application.properties | 2 -- springboot/src/main/resources/mapper/usermapper.xml | 4 ++-- 10 files changed, 24 insertions(+), 22 deletions(-) diff --git a/springboot/pom.xml b/springboot/pom.xml index 79b6019..9927bce 100644 --- a/springboot/pom.xml +++ b/springboot/pom.xml @@ -26,6 +26,11 @@ org.springframework.boot + spring-boot-starter-jdbc + + + + org.springframework.boot spring-boot-starter-test test @@ -46,8 +51,7 @@ com.microsoft.sqlserver mssql-jdbc - 7.2.1.jre8 - test + runtime diff --git a/springboot/src/main/java/com/sincre/springboot/SpringbootApplication.java b/springboot/src/main/java/com/sincre/springboot/SpringbootApplication.java index 2b5d8c1..1617a6d 100644 --- a/springboot/src/main/java/com/sincre/springboot/SpringbootApplication.java +++ b/springboot/src/main/java/com/sincre/springboot/SpringbootApplication.java @@ -10,24 +10,24 @@ import java.awt.*; @MapperScan("com.sincre.springboot.mapper") @SpringBootApplication -public class SpringbootApplication{ +public class SpringbootApplication { public static void main(String[] args) { SpringApplication.run(SpringbootApplication.class, args); - System.out.println("classpath:"+new SpringbootApplication().getClass().getResource("")); + System.out.println("classpath:" + new SpringbootApplication().getClass().getResource("")); // new SpringbootApplication().initFrame(); } - private void initFrame(){ + private void initFrame() { JFrame jFrame = new JFrame(); //设置窗口是否可视 jFrame.setVisible(true); //设置窗口的大小是否可以调节 jFrame.setResizable(false); //设置窗口大小和x,y位置 - jFrame.setBounds(100,100, 600, 800); + jFrame.setBounds(100, 100, 600, 800); //设置窗口退出则程序退出 jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } diff --git a/springboot/src/main/java/com/sincre/springboot/Swagger2.java b/springboot/src/main/java/com/sincre/springboot/Swagger2.java index cdaf1e1..18a69df 100644 --- a/springboot/src/main/java/com/sincre/springboot/Swagger2.java +++ b/springboot/src/main/java/com/sincre/springboot/Swagger2.java @@ -15,7 +15,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; public class Swagger2 { @Bean - public Docket createRestApi(){ + public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() @@ -24,7 +24,7 @@ public class Swagger2 { .build(); } - private ApiInfo apiInfo(){ + private ApiInfo apiInfo() { return new ApiInfoBuilder() .title("Spring Boot中使用Swagger2") .contact("Mr.Tao") diff --git a/springboot/src/main/java/com/sincre/springboot/controller/UserController.java b/springboot/src/main/java/com/sincre/springboot/controller/UserController.java index 7742584..e3a628d 100644 --- a/springboot/src/main/java/com/sincre/springboot/controller/UserController.java +++ b/springboot/src/main/java/com/sincre/springboot/controller/UserController.java @@ -50,8 +50,8 @@ public class UserController { return "登录成功"; } - @RequestMapping(method = RequestMethod.GET,value = "getImg") - public String getImg(){ + @RequestMapping(method = RequestMethod.GET, value = "getImg") + public String getImg() { return FileUtils.getImageStr("C:\\Users\\taohandong\\Desktop\\微耕.png"); } diff --git a/springboot/src/main/java/com/sincre/springboot/mapper/UserMapper.java b/springboot/src/main/java/com/sincre/springboot/mapper/UserMapper.java index 26b8849..6c6385c 100644 --- a/springboot/src/main/java/com/sincre/springboot/mapper/UserMapper.java +++ b/springboot/src/main/java/com/sincre/springboot/mapper/UserMapper.java @@ -9,9 +9,9 @@ import org.springframework.stereotype.Repository; @Repository public interface UserMapper { - public User login(@Param("userName") String userName,@Param("password") String password); + public User login(@Param("userName") String userName, @Param("password") String password); - public boolean register(@Param("username") String username,@Param("password") String password); + public boolean register(@Param("username") String username, @Param("password") String password); - public User isExit(@Param("username")String username); + public User isExit(@Param("username") String username); } diff --git a/springboot/src/main/java/com/sincre/springboot/server/UserServer.java b/springboot/src/main/java/com/sincre/springboot/server/UserServer.java index 5280a8d..517e544 100644 --- a/springboot/src/main/java/com/sincre/springboot/server/UserServer.java +++ b/springboot/src/main/java/com/sincre/springboot/server/UserServer.java @@ -7,9 +7,9 @@ public interface UserServer { public boolean insertUser(User user); - public User login(String loginname,String password); + public User login(String loginname, String password); - public boolean registr(String username,String password); + public boolean registr(String username, String password); public User isExit(String username); } diff --git a/springboot/src/main/java/com/sincre/springboot/server/UserServerImp.java b/springboot/src/main/java/com/sincre/springboot/server/UserServerImp.java index a36c9b3..35ccfef 100644 --- a/springboot/src/main/java/com/sincre/springboot/server/UserServerImp.java +++ b/springboot/src/main/java/com/sincre/springboot/server/UserServerImp.java @@ -19,12 +19,12 @@ public class UserServerImp implements UserServer { @Override public User login(String loginname, String password) { - return userMapper.login(loginname,password); + return userMapper.login(loginname, password); } @Override public boolean registr(String username, String password) { - return userMapper.register(username,password); + return userMapper.register(username, password); } @Override diff --git a/springboot/src/main/java/com/sincre/springboot/utils/FileUtils.java b/springboot/src/main/java/com/sincre/springboot/utils/FileUtils.java index 9408ed3..3e6d748 100644 --- a/springboot/src/main/java/com/sincre/springboot/utils/FileUtils.java +++ b/springboot/src/main/java/com/sincre/springboot/utils/FileUtils.java @@ -41,10 +41,10 @@ public class FileUtils { } /** + * @return * @Description: 根据图片地址转换为base64编码字符串 * @Author: * @CreateTime: - * @return */ public static String getImageStr(String imgFile) { InputStream inputStream = null; diff --git a/springboot/src/main/resources/application.properties b/springboot/src/main/resources/application.properties index f03cc3d..3c8b046 100644 --- a/springboot/src/main/resources/application.properties +++ b/springboot/src/main/resources/application.properties @@ -1,11 +1,9 @@ server.port=1111 - # ݿ spring.datasource.username=thd spring.datasource.password=pmd19930415A spring.datasource.url=jdbc:sqlserver://60.190.202.57:14333;database=test spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver - mybatis.config-location=classpath:mybatis-config.xml mybatis.mapper-locations=classpath:/mapper/*.xml mybatis.type-aliases-package=com.sincre.springboot.model \ No newline at end of file diff --git a/springboot/src/main/resources/mapper/usermapper.xml b/springboot/src/main/resources/mapper/usermapper.xml index 04ba427..a3f7822 100644 --- a/springboot/src/main/resources/mapper/usermapper.xml +++ b/springboot/src/main/resources/mapper/usermapper.xml @@ -8,13 +8,13 @@ select * from "User" where username = #{userName} - and password = #{password} + and password = #{password} --- SELECT LAST_INSERT_ID() AS ID + -- SELECT LAST_INSERT_ID() AS ID insert into "User"(username, password) VALUES (#{username},#{password}) -- libgit2 0.21.0