From d053fbcf6c6d13fb969faaadfd8f6abc0bff4d94 Mon Sep 17 00:00:00 2001 From: qiurunze Date: Thu, 27 Sep 2018 22:10:09 +0800 Subject: [PATCH] =?UTF-8?q?mybatis=20xml=20=E5=86=99=E6=B3=95=E8=A7=A3?= =?UTF-8?q?=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/compiler.xml | 1 + .idea/encodings.xml | 1 + .idea/workspace.xml | 1081 +++++++++-------- README.md | 6 +- gitignore | 0 pom.xml | 194 +-- src/main/java/com/geekq/miaosha/Test.java | 31 +- .../geekq/miaosha/common/ResponseCode.java | 27 + .../geekq/miaosha/common/ServerResponse.java | 78 ++ .../miaosha/controller/LoginController.java | 49 +- .../miaosha/controller/UserController.java | 24 + .../com/geekq/miaosha/dao/MiaoShaUserDao.java | 12 +- .../com/geekq/miaosha/dao/MiaoshaUserDao.java | 13 - .../com/geekq/miaosha/dao/UserMapper.java | 30 + .../com/geekq/miaosha/domain/MiaoshaUser.java | 14 + .../com/geekq/miaosha/result/CodeMsg.java | 5 + .../java/com/geekq/miaosha/result/Result.java | 53 +- .../geekq/miaosha/service/IUserService.java | 7 + .../miaosha/service/MiaoShaUserService.java | 13 + src/main/resources/application.properties | 7 +- src/main/resources/mybatis/config.xml | 11 + .../resources/mybatis/mapper/UserMapper.xml | 62 + src/main/resources/templates/login.html | 4 +- target/classes/application.properties | 7 +- target/classes/com/geekq/miaosha/Test.class | Bin 724 -> 1591 bytes .../geekq/miaosha/common/ResponseCode.class | Bin 0 -> 1519 bytes .../geekq/miaosha/common/ServerResponse.class | Bin 0 -> 3799 bytes .../miaosha/controller/LoginController.class | Bin 2147 -> 3646 bytes .../miaosha/controller/UserController.class | Bin 0 -> 887 bytes .../geekq/miaosha/dao/MiaoShaUserDao.class | Bin 677 -> 1008 bytes .../geekq/miaosha/dao/MiaoshaUserDao.class | Bin 489 -> 0 bytes .../com/geekq/miaosha/dao/UserMapper.class | Bin 0 -> 722 bytes .../geekq/miaosha/domain/MiaoshaUser.class | Bin 2114 -> 2670 bytes .../com/geekq/miaosha/result/CodeMsg.class | Bin 2773 -> 2926 bytes .../com/geekq/miaosha/result/Result.class | Bin 2174 -> 2279 bytes .../geekq/miaosha/service/IUserService.class | Bin 0 -> 206 bytes .../miaosha/service/MiaoShaUserService.class | Bin 4562 -> 5180 bytes target/classes/mybatis/config.xml | 11 + target/classes/mybatis/mapper/UserMapper.xml | 62 + target/classes/templates/login.html | 4 +- 40 files changed, 1136 insertions(+), 671 deletions(-) create mode 100644 gitignore create mode 100644 src/main/java/com/geekq/miaosha/common/ResponseCode.java create mode 100644 src/main/java/com/geekq/miaosha/common/ServerResponse.java create mode 100644 src/main/java/com/geekq/miaosha/controller/UserController.java delete mode 100644 src/main/java/com/geekq/miaosha/dao/MiaoshaUserDao.java create mode 100644 src/main/java/com/geekq/miaosha/dao/UserMapper.java create mode 100644 src/main/java/com/geekq/miaosha/service/IUserService.java create mode 100644 src/main/resources/mybatis/config.xml create mode 100644 src/main/resources/mybatis/mapper/UserMapper.xml create mode 100644 target/classes/com/geekq/miaosha/common/ResponseCode.class create mode 100644 target/classes/com/geekq/miaosha/common/ServerResponse.class create mode 100644 target/classes/com/geekq/miaosha/controller/UserController.class delete mode 100644 target/classes/com/geekq/miaosha/dao/MiaoshaUserDao.class create mode 100644 target/classes/com/geekq/miaosha/dao/UserMapper.class create mode 100644 target/classes/com/geekq/miaosha/service/IUserService.class create mode 100644 target/classes/mybatis/config.xml create mode 100644 target/classes/mybatis/mapper/UserMapper.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 505bdbd..e187800 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -11,6 +11,7 @@ + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml index b26911b..be2f94a 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index dc8eb08..b3fa79e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,20 +2,49 @@ - - - - + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + - + + + + @@ -507,6 +562,7 @@ + @@ -515,9 +571,9 @@ + - @@ -551,11 +607,21 @@ + + + + + + + + + + - @@ -570,7 +636,7 @@ - + @@ -579,16 +645,50 @@ - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -598,43 +698,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + @@ -653,60 +719,66 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + @@ -1053,47 +831,312 @@ - + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index 346f8c0..25f2d45 100644 --- a/README.md +++ b/README.md @@ -121,4 +121,8 @@ redis的数量不是库存,他的作用仅仅只是为了阻挡多余的请求 块时产生的同步访问,那么,让每个线程拥有它自己的对象实例
注意:局部变量是同步或局部线程的一个好的替代,它总是能够保证线程安全。唯一可能限制你这样做的是你的应用设计约束
- 所以设计threadlocal存储user不会对对象产生影响,每次进来一个请求都会产生自身的线程变量来存储 \ No newline at end of file + 所以设计threadlocal存储user不会对对象产生影响,每次进来一个请求都会产生自身的线程变量来存储 + + ### 15.mybatis如何使用注解与xml配置?
+本文使用的是注解方法开发所以不做过多解释
+下面仔细讲解以下如何详细使用xml开发
\ No newline at end of file diff --git a/gitignore b/gitignore new file mode 100644 index 0000000..e69de29 diff --git a/pom.xml b/pom.xml index cae2ac4..f864f10 100644 --- a/pom.xml +++ b/pom.xml @@ -1,111 +1,119 @@ - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - com.geekq - miaosha - 0.0.1-SNAPSHOT - jar - - org.springframework.boot - spring-boot-starter-parent - 1.5.8.RELEASE - + com.geekq + miaosha + 0.0.1-SNAPSHOT + jar + + org.springframework.boot + spring-boot-starter-parent + 1.5.8.RELEASE + - miaosha - http://maven.apache.org - - UTF-8 - + miaosha + http://maven.apache.org + + UTF-8 + - + - - org.springframework.boot - spring-boot-starter-web - - - com.google.guava - guava - 18.0 - - - org.springframework.boot - spring-boot-starter-thymeleaf - + + org.springframework.boot + spring-boot-starter-web + + + com.google.guava + guava + 18.0 + + + org.springframework.boot + spring-boot-starter-thymeleaf + - - org.mybatis.spring.boot - mybatis-spring-boot-starter - 1.3.1 - + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 1.3.1 + - - mysql - mysql-connector-java - + + mysql + mysql-connector-java + - - com.alibaba - druid - 1.0.5 - + + com.alibaba + druid + 1.0.5 + - - redis.clients - jedis - + + redis.clients + jedis + - - com.alibaba - fastjson - 1.2.38 - + + com.alibaba + fastjson + 1.2.38 + - - commons-codec - commons-codec - - - org.apache.commons - commons-lang3 - 3.6 - + + commons-codec + commons-codec + + + org.apache.commons + commons-lang3 + 3.6 + - - commons-codec - commons-codec - - - org.apache.commons - commons-lang3 - 3.6 - + + commons-codec + commons-codec + + + org.apache.commons + commons-lang3 + 3.6 + - - org.springframework.boot - spring-boot-starter-validation - + + org.springframework.boot + spring-boot-starter-validation + - - org.springframework.boot - spring-boot-starter-amqp - + + org.springframework.boot + spring-boot-starter-amqp + - - org.springframework.boot - spring-boot-starter-amqp - + + org.springframework.boot + spring-boot-starter-amqp + + - + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + + + src/main/java + + **/*.xml + + + + - - ${project.artifactId} - - - org.springframework.boot - spring-boot-maven-plugin - - - diff --git a/src/main/java/com/geekq/miaosha/Test.java b/src/main/java/com/geekq/miaosha/Test.java index 8e26828..ef8005a 100644 --- a/src/main/java/com/geekq/miaosha/Test.java +++ b/src/main/java/com/geekq/miaosha/Test.java @@ -1,15 +1,30 @@ package com.geekq.miaosha; +import com.geekq.miaosha.domain.MiaoshaUser; +import org.apache.ibatis.io.Resources; +import org.apache.ibatis.session.SqlSession; +import org.apache.ibatis.session.SqlSessionFactory; +import org.apache.ibatis.session.SqlSessionFactoryBuilder; + +import java.io.IOException; +import java.io.Reader; + +/** + * mybatis xml 写法的配置测试类 + */ public class Test { - public static void main(String[] args) { - DemoTask demoTask = new DemoTask(); - DemoTask demoTask1 = new DemoTask(); - DemoTask demoTask2 = new DemoTask(); - Thread t = new Thread(demoTask); - t.start(); - new Thread(demoTask).start(); - new Thread(demoTask2).start(); + public static void main(String[] args) throws IOException { + + //读取配置文件 + Reader reader = Resources.getResourceAsReader("config.xml"); + SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(reader); + SqlSession session = sessionFactory.openSession(); + + String statement = "com.geekq.miaosha.dao.UserMapper.getMiaoShaUserById" ; + MiaoshaUser user = session.selectOne(statement,"18612766134"); + + System.out.println(user.toString()); } } diff --git a/src/main/java/com/geekq/miaosha/common/ResponseCode.java b/src/main/java/com/geekq/miaosha/common/ResponseCode.java new file mode 100644 index 0000000..0e75e16 --- /dev/null +++ b/src/main/java/com/geekq/miaosha/common/ResponseCode.java @@ -0,0 +1,27 @@ +package com.geekq.miaosha.common; + +/** + * 响应类 + */ +public enum ResponseCode { + SUCCESS(0, "SUCCESS"), + ERROR(1, "ERROR"), + NEED_LOGIN(10, "NEED_LOGIN"), + ILLEGAL_ARGUMENT(2, "ILLEGAL_ARGUMENT"); + + private final int code; + private final String desc; + + private ResponseCode(int code, String desc) { + this.code = code; + this.desc = desc; + } + + public int getCode() { + return code; + } + + public String getDesc() { + return desc; + } +} diff --git a/src/main/java/com/geekq/miaosha/common/ServerResponse.java b/src/main/java/com/geekq/miaosha/common/ServerResponse.java new file mode 100644 index 0000000..69f8b79 --- /dev/null +++ b/src/main/java/com/geekq/miaosha/common/ServerResponse.java @@ -0,0 +1,78 @@ +package com.geekq.miaosha.common; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +import java.io.Serializable; + +@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) +//保证序列化的时候 不会有空 +public class ServerResponse implements Serializable { + + private int status ; + private String msg ; + private T data ; + private ServerResponse( int status ){ + this.status =status; + } + private ServerResponse( int status ,T data){ + this.status =status; + this.data = data; + } + private ServerResponse( int status ,String msg ,T data){ + this.status =status; + this.msg = msg ; + this.data = data; + } + + private ServerResponse( int status ,String msg ){ + this.status =status; + this.msg = msg ; + } + + @JsonIgnore + public boolean isSuccess(){ + return this.status == ResponseCode.SUCCESS.getCode(); + } + + public int getStatus() { + return status; + } + + public String getMsg() { + return msg; + } + + public T getData() { + return data; + } + + public static ServerResponse createBySuccess(){ + return new ServerResponse(ResponseCode.SUCCESS.getCode()); + } + + public static ServerResponse createBySuccessMessage(String msg){ + return new ServerResponse(ResponseCode.SUCCESS.getCode(),msg); + } + + public static ServerResponse createBySuccess(T data){ + return new ServerResponse(ResponseCode.SUCCESS.getCode(),data); + } + + public static ServerResponse createBySuccess(String msg,T data){ + return new ServerResponse(ResponseCode.SUCCESS.getCode(),msg,data); + } + + public static ServerResponse createByError(){ + return new ServerResponse(ResponseCode.ERROR.getCode(),ResponseCode.ERROR.getDesc()); + } + + public static ServerResponse createByErrorMessage(String errorMsg){ + return new ServerResponse(ResponseCode.ERROR.getCode(),errorMsg); + } + public static ServerResponse createByErrorCodeMessage(int errorCode , String errorMsg){ + return new ServerResponse(errorCode,errorMsg); + } + + +} diff --git a/src/main/java/com/geekq/miaosha/controller/LoginController.java b/src/main/java/com/geekq/miaosha/controller/LoginController.java index 9694724..aaddec8 100644 --- a/src/main/java/com/geekq/miaosha/controller/LoginController.java +++ b/src/main/java/com/geekq/miaosha/controller/LoginController.java @@ -1,14 +1,17 @@ package com.geekq.miaosha.controller; -import com.geekq.miaosha.result.CodeMsg; +import com.geekq.miaosha.dao.UserMapper; +import com.geekq.miaosha.domain.MiaoshaUser; import com.geekq.miaosha.result.Result; import com.geekq.miaosha.service.MiaoShaUserService; import com.geekq.miaosha.vo.LoginVo; +import org.apache.ibatis.annotations.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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; @@ -18,24 +21,54 @@ import javax.validation.Valid; @RequestMapping("/login") public class LoginController { - private static Logger log = LoggerFactory.getLogger(LoginController.class) ; + private static Logger log = LoggerFactory.getLogger(LoginController.class); @Autowired - private MiaoShaUserService userService ; + private MiaoShaUserService userService; + @Autowired + private UserMapper userMapper; + @RequestMapping("/to_login") - public String tologin(LoginVo loginVo ){ + public String tologin(LoginVo loginVo) { log.info(loginVo.toString()); - return "login" ; + return "login"; } @RequestMapping("/do_login") @ResponseBody - public Result dologin(HttpServletResponse response , @Valid LoginVo loginVo ){ + public Result dologin(HttpServletResponse response, @Valid LoginVo loginVo) { log.info(loginVo.toString()); - userService.login(response , loginVo); - return Result.success(true); + userService.login(response, loginVo); + return Result.success(true); + } + + + @RequestMapping(value = "/register", method = RequestMethod.POST) + public Result register(MiaoshaUser user) { + return userService.insertMiaoShaUser(user); + } + + @RequestMapping("/mybatis") + public void mybatisXml() { + // + int count = userMapper.getMiaoShaUserNum(); + System.out.println(count); + MiaoshaUser user = userMapper.getMiaoShaUserById(Long.valueOf("18612766134")); + System.out.println(user); +// +// MiaoshaUser miaoshaUser =new MiaoshaUser(); +// miaoshaUser.setId(Long.valueOf("1234569879")); +// miaoshaUser.setNickname("test"); +// Long num = userMapper.insertMiaoShaUser(miaoshaUser); + + MiaoshaUser upmiaoshaUser =new MiaoshaUser(); + upmiaoshaUser.setId(Long.valueOf("1234569879")); + upmiaoshaUser.setNickname("test1"); + userMapper.updateMiaoShaUser(upmiaoshaUser); + + userMapper.deleteMiaoShaUser(Long.valueOf("1234569879")); } } diff --git a/src/main/java/com/geekq/miaosha/controller/UserController.java b/src/main/java/com/geekq/miaosha/controller/UserController.java new file mode 100644 index 0000000..8ed2be0 --- /dev/null +++ b/src/main/java/com/geekq/miaosha/controller/UserController.java @@ -0,0 +1,24 @@ +package com.geekq.miaosha.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import javax.servlet.http.HttpSession; + +@Controller +@RequestMapping("/user/") +public class UserController { + /** + * 用户登录 + * @param username + * @param password + * @param session + * @return + */ + @RequestMapping(value = "/login",method = RequestMethod.POST) + public Object login(String username , String password , HttpSession session){ + + return null; + } +} diff --git a/src/main/java/com/geekq/miaosha/dao/MiaoShaUserDao.java b/src/main/java/com/geekq/miaosha/dao/MiaoShaUserDao.java index e24bf96..9805df8 100644 --- a/src/main/java/com/geekq/miaosha/dao/MiaoShaUserDao.java +++ b/src/main/java/com/geekq/miaosha/dao/MiaoShaUserDao.java @@ -1,10 +1,7 @@ package com.geekq.miaosha.dao; import com.geekq.miaosha.domain.MiaoshaUser; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; -import org.apache.ibatis.annotations.Update; +import org.apache.ibatis.annotations.*; @Mapper public interface MiaoShaUserDao { @@ -15,4 +12,9 @@ public interface MiaoShaUserDao { @Update("update miaosha_user set password = #{password} where id = #{id}") public void update(MiaoshaUser toBeUpdate); -} + + + @Insert("insert into miaosha_user (id , nickname ,password , salt ,head,register_date,last_login_date)value (#{id},#{nickname},#{password},#{salt},#{nickname},#{head},#{register_date},#{last_login_date}) ") + public long insertMiaoShaUser(MiaoshaUser miaoshaUser); + +} \ No newline at end of file diff --git a/src/main/java/com/geekq/miaosha/dao/MiaoshaUserDao.java b/src/main/java/com/geekq/miaosha/dao/MiaoshaUserDao.java deleted file mode 100644 index 8344194..0000000 --- a/src/main/java/com/geekq/miaosha/dao/MiaoshaUserDao.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.geekq.miaosha.dao; - -import com.geekq.miaosha.domain.MiaoshaUser; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; - -@Mapper -public interface MiaoshaUserDao { - - @Select("select * from miaosha_user where id = #{id}") - public MiaoshaUser getById(@Param("id") long id); -} diff --git a/src/main/java/com/geekq/miaosha/dao/UserMapper.java b/src/main/java/com/geekq/miaosha/dao/UserMapper.java new file mode 100644 index 0000000..b9e301e --- /dev/null +++ b/src/main/java/com/geekq/miaosha/dao/UserMapper.java @@ -0,0 +1,30 @@ +package com.geekq.miaosha.dao; + +import com.geekq.miaosha.domain.MiaoshaUser; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * mybatis xml 写法 + */ +@Mapper +public interface UserMapper { + int countbyMenuId(); + MiaoshaUser getMiaoShaUserById(Long phoneId); + //秒杀对象获取 mybatis的#与$的区别 + List queryMiaoShaUserOrderByColumn(String column); + + + //查询总条数 + public int getMiaoShaUserNum(); + + public Long insertMiaoShaUser(MiaoshaUser user); + + //更改表数据 + void updateMiaoShaUser(MiaoshaUser user) ; + + //删除表数据 + + void deleteMiaoShaUser(long id ); +} diff --git a/src/main/java/com/geekq/miaosha/domain/MiaoshaUser.java b/src/main/java/com/geekq/miaosha/domain/MiaoshaUser.java index f3f71ce..121e695 100644 --- a/src/main/java/com/geekq/miaosha/domain/MiaoshaUser.java +++ b/src/main/java/com/geekq/miaosha/domain/MiaoshaUser.java @@ -59,4 +59,18 @@ public class MiaoshaUser { public void setLoginCount(Integer loginCount) { this.loginCount = loginCount; } + + @Override + public String toString() { + return "MiaoshaUser{" + + "id=" + id + + ", nickname='" + nickname + '\'' + + ", password='" + password + '\'' + + ", salt='" + salt + '\'' + + ", head='" + head + '\'' + + ", registerDate=" + registerDate + + ", lastLoginDate=" + lastLoginDate + + ", loginCount=" + loginCount + + '}'; + } } diff --git a/src/main/java/com/geekq/miaosha/result/CodeMsg.java b/src/main/java/com/geekq/miaosha/result/CodeMsg.java index fc5df35..933e2c5 100644 --- a/src/main/java/com/geekq/miaosha/result/CodeMsg.java +++ b/src/main/java/com/geekq/miaosha/result/CodeMsg.java @@ -7,6 +7,11 @@ public class CodeMsg { //通用的错误码 public static CodeMsg SUCCESS = new CodeMsg(0, "success"); + + public static CodeMsg SUCCESS_RESIGETER = new CodeMsg(200,"注册成功!"); + + public static CodeMsg RESIGETER_FAIL = new CodeMsg(300,"注册失败!"); + public static CodeMsg SERVER_ERROR = new CodeMsg(500100, "服务端异常"); public static CodeMsg BIND_ERROR = new CodeMsg(500101, "参数校验异常:%s"); public static CodeMsg REQUEST_ILLEGAL = new CodeMsg(500102, "请求非法"); diff --git a/src/main/java/com/geekq/miaosha/result/Result.java b/src/main/java/com/geekq/miaosha/result/Result.java index 72f8706..dea7c11 100644 --- a/src/main/java/com/geekq/miaosha/result/Result.java +++ b/src/main/java/com/geekq/miaosha/result/Result.java @@ -1,45 +1,66 @@ package com.geekq.miaosha.result; public class Result { - private int code ; - private String msg ; - private T data ; + private int code; + private String msg; + private T data; /** * 成功时候的调用 + * * @param data * @param * @return */ - public static Result success( T data ){ - return new Result(data) ; + public static Result success(T data) { + return new Result(data); + } + + /** + * 注册时候调用 + * + * @param msg + * @param data + * @param + * @return + */ + public static Result success(CodeMsg msg) { + + return new Result(CodeMsg.SUCCESS_RESIGETER); + } /** * 失败的时候调用 + * * @param cm * @param * @return */ - public static Result error(CodeMsg cm){ - return new Result(cm) ; + public static Result error(CodeMsg cm) { + return new Result(cm); } +// public Result(CodeMsg msg, T data) { +// this.code = msg.getCode(); +// this.msg = msg.getMsg(); +// this.data = data; +// } - private Result(CodeMsg cm) { - if(cm ==null){ - return ; + private Result(CodeMsg cm) { + if (cm == null) { + return; } - this.code = cm.getCode() ; - this.msg = cm.getMsg() ; + this.code = cm.getCode(); + this.msg = cm.getMsg(); } - private Result(T data) { - this.code = 0 ; - this.msg = "success" ; - this.data = data ; + private Result(T data) { + this.code = 0; + this.msg = "success"; + this.data = data; } public int getCode() { diff --git a/src/main/java/com/geekq/miaosha/service/IUserService.java b/src/main/java/com/geekq/miaosha/service/IUserService.java new file mode 100644 index 0000000..fceac58 --- /dev/null +++ b/src/main/java/com/geekq/miaosha/service/IUserService.java @@ -0,0 +1,7 @@ +package com.geekq.miaosha.service; + +public interface IUserService { + + Object login(String username , String password) ; + +} diff --git a/src/main/java/com/geekq/miaosha/service/MiaoShaUserService.java b/src/main/java/com/geekq/miaosha/service/MiaoShaUserService.java index 9c3cb80..c29d3fd 100644 --- a/src/main/java/com/geekq/miaosha/service/MiaoShaUserService.java +++ b/src/main/java/com/geekq/miaosha/service/MiaoShaUserService.java @@ -7,8 +7,10 @@ import com.geekq.miaosha.exception.GlobleException; import com.geekq.miaosha.redis.MiaoShaUserKey; import com.geekq.miaosha.redis.RedisService; import com.geekq.miaosha.result.CodeMsg; +import com.geekq.miaosha.result.Result; import com.geekq.miaosha.utils.UUIDUtil; import com.geekq.miaosha.vo.LoginVo; +import com.sun.org.apache.bcel.internal.classfile.Code; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -74,6 +76,17 @@ public class MiaoShaUserService { return true; } + public Result insertMiaoShaUser(MiaoshaUser miaoshaUser){ + + long resultRegister = miaoShaUserDao.insertMiaoShaUser(miaoshaUser); + + if(resultRegister == 0){ + throw new GlobleException(CodeMsg.RESIGETER_FAIL); + } + + return Result.success(CodeMsg.SUCCESS_RESIGETER); + } + public boolean login(HttpServletResponse response , LoginVo loginVo) { if(loginVo ==null){ throw new GlobleException(CodeMsg.SERVER_ERROR); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index f13a5f6..927242c 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -8,10 +8,13 @@ spring.thymeleaf.encoding=UTF-8 spring.thymeleaf.mode=HTML5 #mybatis -mybatis.type-aliases-package=com.imooc.miaosha.domain +mybatis.type-aliases-package=com.geekq.miaosha.domain #开启驼峰转换 mybatis.configuration.map-underscore-to-camel-case=true -mybatis.mapperLocations = classpath:com/imooc/miaosha/dao/*.xml +#mybatis.mapperLocations = classpath:com/geekq/miaosha/dao/*.xml +mybatis.mapperLocations=classpath:mybatis/mapper/*.xml +#add mybatis +mybatis.config-locations=classpath:mybatis/config.xml #datasource spring.datasource.url=jdbc:mysql://localhost:3306/miaosha?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false spring.datasource.username=root diff --git a/src/main/resources/mybatis/config.xml b/src/main/resources/mybatis/config.xml new file mode 100644 index 0000000..fe0f5e4 --- /dev/null +++ b/src/main/resources/mybatis/config.xml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/UserMapper.xml b/src/main/resources/mybatis/mapper/UserMapper.xml new file mode 100644 index 0000000..18da536 --- /dev/null +++ b/src/main/resources/mybatis/mapper/UserMapper.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + insert into miaosha_user (id, nickname, salt, register_date,last_login_date,login_Count ) values + (#{id,jdbcType=BIGINT},#{nickname,jdbcType=VARCHAR}, + #{salt,jdbcType=VARCHAR},#{registerDate,jdbcType=DATE},#{lastLoginDate,jdbcType=DATE}, + #{loginCount,jdbcType=INTEGER} + ) + + + + + + update miaosha_user set nickname = #{nickname}, + login_Count = #{loginCount} + where id=#{id} + + + + + delete from miaosha_user + where id = #{id,jdbcType=BIGINT} + + + + id, nickname, salt, register_date,last_login_date,login_Count + + + + + + + + + + + diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html index f04c028..fb816af 100644 --- a/src/main/resources/templates/login.html +++ b/src/main/resources/templates/login.html @@ -48,10 +48,10 @@
- +
- +
diff --git a/target/classes/application.properties b/target/classes/application.properties index f13a5f6..927242c 100644 --- a/target/classes/application.properties +++ b/target/classes/application.properties @@ -8,10 +8,13 @@ spring.thymeleaf.encoding=UTF-8 spring.thymeleaf.mode=HTML5 #mybatis -mybatis.type-aliases-package=com.imooc.miaosha.domain +mybatis.type-aliases-package=com.geekq.miaosha.domain #开启驼峰转换 mybatis.configuration.map-underscore-to-camel-case=true -mybatis.mapperLocations = classpath:com/imooc/miaosha/dao/*.xml +#mybatis.mapperLocations = classpath:com/geekq/miaosha/dao/*.xml +mybatis.mapperLocations=classpath:mybatis/mapper/*.xml +#add mybatis +mybatis.config-locations=classpath:mybatis/config.xml #datasource spring.datasource.url=jdbc:mysql://localhost:3306/miaosha?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false spring.datasource.username=root diff --git a/target/classes/com/geekq/miaosha/Test.class b/target/classes/com/geekq/miaosha/Test.class index 44178aaeceafec17c1c0564485eee81192fe7313..463f8b9502976cb98995b904f38ee10dae52f892 100644 GIT binary patch literal 1591 zcmb7ETT|0O6#kaBq?agKK&=u(!q7QhR zaeVeiIewdF1gAKInaL)5&e?PM&bR01udm+$Okq8ZLl{kBERAtY7$~L@$EaSc3@%|Z ziK!%}Gq{W^24+&YirF+WxR%Bo<_%moa6_Q?y6xD(O@Uaxuptn?7`zlWN+c}mulCvd29*mkY;P(sHCedYVM>nzD?;CfpE z6D8NHTe2mqo652)GO&Fsva!l<8s)#t>A;AT0weo6$s;L0kb!C{C(w9w)x&DrzD{>! z4?JqFM#5U@!1IiDbeO*PuBuuA%kT}b2kElg_Nr>h)`+Jxghd_2#9?Hqt-8)jyIy?P zY#3NDaSOKvrv9Vq#kSobo+cJ?$G}|^_pl@|&E^%u<`tvn6>HKh>J(RGtED_D1D$ty zQ)=Pj)^bfCGdVjmIdyerW^($nf%_&NU|C?en+V;78+d5q5lSXjuxen<#A7@mN4n2y z1lau@q}M91RF$IsP((f~ul<2gV5l35kTQOVs-_t$Sy!FyZNI}MCY|r@WucpKiHe3# zU?DQ!VPj!m1d5o-wvTn^`A?=2X}6`Eh`s{({Qjab%f~TF7GH)63p|B5w{5LxWID(_x zrEm;6I?;#UBSuSLHrw+VvC=ohpMOGPY#Y5R<6mG1tY(vQ@rhhKoBD!u3_p;WOMHZx zOKju7HV*E@8-hVU{q#1#)Q&Pj4ySOOGyEh+^rIpP#<~bg}89ik64_J}l!O_;B#hm~{^u9@+wxH#*k& zo`BtXawy=uONL5dA=I(jpGJL^_GEv;%2JpN-?$;UbqSPchB6pWNQ{Sri4 zCfQg9J(cCV+!sk53p6{&;feezgNcks!9kwtc(hya$#ldG%h$98szVheJ(-;fw639e zUv^1Tn@_&D6n6zgZj@gz_r|G`LjwGRWSS1t2W`$)Gh%nlR2?<=0(Y;TXHF*2_Z@Pf5nNOWl{Wbv@ds7=Og%I%WzEj1WLFV9)Agk@$`yuxkVp{53Q&}3v0 VxrG%*Ht{WHYy4077M!+l?=M!Lma_l= diff --git a/target/classes/com/geekq/miaosha/common/ResponseCode.class b/target/classes/com/geekq/miaosha/common/ResponseCode.class new file mode 100644 index 0000000000000000000000000000000000000000..303ef69fa591a98a781753ce2d636f8814c55e90 GIT binary patch literal 1519 zcma)6>rN9<5dKcP?QWM9$^unX6cMB?N=3yRh}5!>CMzUeAR(HNrL1MK-D)qqgYV)G zt=DKY{`R4aGp99H#iZM0W@pY^zHiQKzyJ936~HyD#-QMaj(OZvF{a{{4imRo+~JeE zEEY5j>7*CgxTj%+^^%4J>-!o`vR+n^6;Pe6T+VVFfoZ!~tz=4`_w;$D;=9%Qftw*u zr5a=kUj11$sC&8UzPBI{u?mHaf`GnmSu4Bt##(+|AfC5vYb|TNPLN|QFp4%TG3ned7gvaD>KWNZs07h>zIKD$O%mKv}^_@uwvj6 zECZ)7YTz`^usLmD2*UD^557y^ok9FJl}m0xw2cY zFLVu{v!LCR;v>S=##dgD5fFp6VmRF#C5Y@ItHX89*vlB zX%DJjs6x1fK4(X1;e@jjX<@+GiMBB4yn*1+wJ$9phpW=yG$J3v9CTy}MyNBIIr@X= H5ncZY0q!w< literal 0 HcmV?d00001 diff --git a/target/classes/com/geekq/miaosha/common/ServerResponse.class b/target/classes/com/geekq/miaosha/common/ServerResponse.class new file mode 100644 index 0000000000000000000000000000000000000000..2aad957a7cceeb46ffac2169d327c5bcfd710372 GIT binary patch literal 3799 zcmbtWZBrXn6h505wuymIh`hD5)V>e`CEBV;p(!*#O&dTHK%i<}!ZzJD+2C%{vHk*o zhTr_+2klrpqci>hf0W~M?%gcAAsGW^Cim`rd(Ly7bMD#w`=3AlBBEPVj#3}3M@Xd& zZZ^63EJB}CA&RD`(pD5R+uZDM^947%ykUPx>&aiv%H{C=uoR`{XBa7&^Z4)h$Udma9JcUN(znHt zsQsbQc3T}7zaE^VqH6O6dElw%(_w4cMRKrZp)@w zLl_N+q0mj?@l(yN>(+PGO8PlY+R#jMH>Dq9oGY6(i=~T{^*Z2162KbLpa(PSoC%5K zl*cVM7gVgTh;;C8a1$b&oDyjeFIl=)*YCe_-I)er_fcJ2+`8i-;NWMv$8dw%LS!A< zYGvf#-J}P<8G=(V-0i^df1oxw`=~YZ@D$W?9jI~kbqmwvve`x^kBetu_qYQ)52_Q6 zv+(V0#(UMWY8DdNH+G|cPUmHj>Lb1#T&~<*nRa)$YYF*=2{W<;?sf3nTXasFhs`Ku z+GBepbpj=4j2hQbL#r6ybMXbyXtCC?O8T0?rFqa_WM}!MpwPTXos-ptUk?X{dDvQJ znid#dHOx|_aj2{GHAKnrz(&ndD3&u#-O5%p+tyLRvS+n%&BcVZa~qo*Pd2vm`52AR zlNj~W`4}bW-53qfpi1AwNTY)om1stx$u4UWLydBCotrD%T#eBo}s(HhdWmQ?-33fioHA?UM&1Cw$eZ^ zuv{ytnKu+XHZ=ev1i~Rujv%Z0K$*==I24-Z;*L3{#cl4rK4FDtCU63uXEfUeF7!(a+;o?4X?ovL#LF(&3YYE* zPDc0x1nL&uc3^La_~LT?N$Q>y`YoMfe8r>jZ6`ZE#MzJNW9RHV;=qE%kIy2DBYZgE zIXvef7k8?Fq%tR{eB!`8Y6}-_^>x7q$G46=*PZX-FlMBId12s=V_=6f0BijozSD2% zomLC?gavtv`yIkKCGL>7wD8O@6p*$SU~AFUbq3DxFClHkkif4AZLcGcSKX{f-MgLC zWrTL>KJdwr5jFN$-Fvj;IG+I_QCXSL7~DP)r-vT5qqq%RwYh#WX4A?0K#}NKTES|7 dR>ghl#f~-nAL#Um^7K#~ROnOsigHV%{{mc#GmZcN literal 0 HcmV?d00001 diff --git a/target/classes/com/geekq/miaosha/controller/LoginController.class b/target/classes/com/geekq/miaosha/controller/LoginController.class index f700d72e613c2408fa85a1c74c029c89041a66fc..868a238c44b6231ac05af090b29e98c680df7906 100644 GIT binary patch literal 3646 zcmb_eX;%|h7=CUDgoJU6d$ovbS=1@0hy|^J8y1xk#jVy3$t8?VX5!2QrHkG7ec#t# z(Apl9_MCp~hyJLZK6fUNghXpkn{zUA=e_Uxyvx0R{`Kqc0J`u)0?inSV=Yn%oWkiQ zjN(iq&ML~e1kU3^0*~Qh0*~X8`g}rd7)=;MI*trv0^`UwVj=+(mlgSnqF6EH5?G3n zM%e1@G$OCwR~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SXS#c?Qxn`9`V_0_FMmo$Dx~ZDnEOq(L==9;{P!~j R3BFJ-;$?Zkfa?1t#aqy|GK&BJ diff --git a/target/classes/com/geekq/miaosha/controller/UserController.class b/target/classes/com/geekq/miaosha/controller/UserController.class new file mode 100644 index 0000000000000000000000000000000000000000..8b0c05513776066badd96df838d264d504b6aeca GIT binary patch literal 887 zcmb7C+invv5Ix>*HYF{zBv2^V^45!rC0;-ZLPC`gLV=>DL`Z#dHYRbqYj16D3V#Jp zNIdWXd=z5V8?{tir0&DmGjqFdH)TGQc3%uLinMzs71=;oRr#}E>?g`GZ1+-=^Rbji$2?cUxQXDY(cYRY zla{}8((atPU4}+x#!551U+*1?so2dcTk&m22rkV77;(ftilIct5l+oRd z-zdAoLz#LiF<%m1i#&AxM-j>w!nqS;M+{9@3o)z(rT>&-SluhNSGgQ0r)Un(wKiUO zYJ2TQd{|A?Q+As;F|;^Gv`_vCRYoqsKgqIxq;WGb?fdQJFjG)XS~ z#87vSFDx2}q#3{6?e8cFynOVKo_st-scAURr7Vr$X{`+e>&gTfT@G z4dPy4^$g2rtEg9n2Z-o*tiA};Ga6(Q@;IH0&c^0furDFqB%6fb0_N$ySOahgE%F!^ zC=vzoEArxs!#-CQXUvtr+^n-RW`($nD?u&765XP}TE)HTKRgNGIjo literal 0 HcmV?d00001 diff --git a/target/classes/com/geekq/miaosha/dao/MiaoShaUserDao.class b/target/classes/com/geekq/miaosha/dao/MiaoShaUserDao.class index cee563549f4da404973ca972bd14a784a256ee62..54b9bc3172b5b5f686475a2827abb055ef025c8d 100644 GIT binary patch delta 322 zcmZ3=`hi{G)W2Q(7#J9g7$n&l#Mv1nHVQ0d6cWtLD^4vc@y$%k56(yo1+pj0FlsY; zP4-|^s`muTSu-*mhNx1=%qz)P$OWn`&Pa?e1u9n1$V^etQOL_o&dy8BO;yk-NGvWc z&o2TA7ANMEDClIQCZ^~VrKV>Vm!uZOrzDo7>f|IAm&E7fr)TDY`I=>kIi;xz8p_p~ zDYZJv)iA?q{eT>pc_0apfhY=qVj$x|VkkC%1kfz0)l`_gnQCU)H=kec9{_LwD;_L+&=%l@l%2es2Ld`f7oDzeVigiSKB-uvaYIyr ziBTu2_cPu&vWEiJuJa_*G2LpX2N4}7iODe2CUF9`yT*nJQ}lT)pRI_d&A u4W9-;R0YgIm8Tj{EynBoygLvM=3#-cWuinC!r#!AXHKd27BKmOS+ouw#ly0zvjUo;Exg~ zQD`h4a@k?$&3ilZc0Rw}KLFqY4lUTX;DA6oP)2HhG2+q;Ljr5IGbGTDxE=|nyeWIm zczV0Yp-bC+VQ-AaOh(jIG8#B;pb{E!{yL`#mSrF(xTel!W@gv9pC zMieGgn%PuiO7T>^BXCZW?Cqj5jb;I8c{Z5!IV?sV>+X3SwMe;(4mum=4Og6A0yCR z?#I}F;el=tAW*}N1F-72Tu=wVxDJgXTCjn56VV#9Fu(bWZ$Z1jx1m$SF7%3;esS)= LF2)8j_W-^D5EawP literal 0 HcmV?d00001 diff --git a/target/classes/com/geekq/miaosha/domain/MiaoshaUser.class b/target/classes/com/geekq/miaosha/domain/MiaoshaUser.class index 2b7c5fea61386d134b95250e6428f81ad391bbe9..fd4b78ac20d89323984332dd27fc5f1fe8fd8c6e 100644 GIT binary patch literal 2670 zcma)+TXWM^5Xb*=d{G>^b{!JJrC{2C9mgQMVs zU$AJgc)((d#X}a4a`-ZjJT_E3X1&egiHfJJcT{|(;+cx)Dqg7gTE#c){x*m2a(JmA zWpxykTCa@n4ZUaBUA^Vl-4z9@ZM9$9M&DFWj{M#BT}%8wFg))E$EE1BXY_nh`=&u( znrn6~&o|wBhEKs^>Va?dboNl{LeKF0meaLtu_WJPd)*n>lw~%u*{1EAUDKtI?5bs3 z{+fcR+R_efweEB%cd=#J=GLIUXSz>}y6-o~ouph_iok?*$#~-DY)$^hU^5iDH7eYZSb|aM zW+=sY(Ofi9xMrB@(Wu58GyclaHrqkbbL0;#@@)hiV4tvx6vzHE59 z@hV0tQMy*VcO?pyTm@bg>F8Xn3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classes/com/geekq/miaosha/result/CodeMsg.class b/target/classes/com/geekq/miaosha/result/CodeMsg.class index 9330f7fac3ad845219e85c169e8e8bcfb92c74e1..0f76fc6db7c3a949fb0388354e82f0e0c6fb8724 100644 GIT binary patch literal 2926 zcma);+jmn{5XQfgl;#i)EgWd6f?5zXy+8#;ykNBzf53#7?9fNIMBK4m3OAK$D7HY@g%dc@;0Hc#)?ssd$+;y`th( zw!2mAVcTMdbRkSj^!O*6njp0p(Usdd9IKc3mih~U848N;* zi=l(z4;61Syu*Ku1G~9($r89%%tK?4NDa`g6k?PJ;9)YS-xnpv7#Xs zdv<3J|ZEpSRi@qP*_PHJ()pCI(5B*IzTV zF|XDg3~ulTC{uN9sE$sl_OJB%JfqM&bdt4N;}3;B8@<60=^V~r#^h5rk~tz|Vzt-p z4+qz{!+!bz1*Ept;|_Vk>?b#$YR;@r&0Q96if2|(iCrb@specM+UAQl#cG-x>tm@< zq&`6&-It6;66+(WIJ4!<$!v?K6%@L>qi=?@IT~UaGa+TCYjmWCILGDXfLscod!ZV- zN=B!kb=n~71+LM{oIu?gPbA!_22!!ewP{3*zkYixnps-%e|jP(A_=C9v7aC{B+ag)>9T0Ts+%*IY)(aERdKG8W;NP8Zd48Hu|dOQaBEnJN(WAAIEB*+ivO!m zdFN9KrrqA|E1TnqEwL1Jf^|;urYPOlat&QL!^2rBS$Q!%mgV$rHfz|9dainNG)f<# zVHG@dx7o{|7_A4hZEqXd^dRbf^qiz zVAnhSU$@8^Pw>jDAgPNdo38h^8=oIBj(w7CJ2bFopV9M0|FsShll#9Gh!ri>*RYO#lZLO~?B-isL#>#*HJNIRWE3nOa4yzC8=X3_W;}NgU6g9MrneGZE)D=q&D z_Tf}IB>~E4ET;H1jJTqAOb{84As)o04)ZNeUvUw{ndXV!wEskVRt(iDJtr zA!WDJ$P}`Kge?6RA>2a>S`folE7vxvC|9bvEHQgiRkPc1?Nwo&GB)VbWZHi~p2PN&+*OFydCsR3HydvINYqpk<4KK=@v ztl$b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$m0l+%F@vte4b9ij zKDlZRe5fYRshA-yZJ<7x;isrZ+NGbxWK=hmi2Go908>>jWOd4Ym^p*{n5ruJw~>UJ zPRo5{jAo&?$~LA#mSl7pfsuKX=8L?5U-%wIHIpuK2h$kT>8dJdhM+7pThL5Fv(y|x z&j@-}oh@jNpy$-*1AuR@gp diff --git a/target/classes/com/geekq/miaosha/result/Result.class b/target/classes/com/geekq/miaosha/result/Result.class index a9219051b8eedc9c8d08de50de3dc19227dc486d..c00750226b4c23dd4dd2c1872d46a4c1f02557f4 100644 GIT binary patch literal 2279 zcma)-TXWk~6ouE3FN$rIG{Fv#(kpF|9jJj2N?X@$aNRURdYQ@%6Q=1`IGj*hlM))_o@71X9erZ?;=EN(ruf3WL&cE4M<0^jR* zZ*bRRJFq8X4|kusPQX~f^16LH82OaRbUJ*a4@ZvU4u=YBW=bvoqPpb_diAdBKKs7j z^X$R!iCy>I;b^;ZF!CMjo9G`Oirl(spYS19ifyR*fpb78iO!go`EXMcO_^Wj-%|rc12~EelI!wM0tSX;^HR32@6~U@y1ZS~G znA*xdNwNpIR!BL9gc{g~Vdnx>Uf}amv zoGzxsB6Z%RSUn9}IPBcdj|uxB|651yIDlo{LnlOsk6<4X_R$nrxoStluF^eGlhd%J z!?4z|V55euG1VuDcfLs~JZY8)`b$E8H3d5QU6B4o1{qgauKuJ!wAdu@ggFip zA7S5RFF>M9+9cj0@u3FK@pW9MG)iB@_s==^Ilp_(x%v42zwZGo;l7321t=`bXQhB~ ztQPPy8hI}7$m|!Ht&L$u#=92Q6|!#UiKn186*8@EQ(p^geLD>Nc5{VZ zPn^&hv_0H==D8tl`E9@1cEVmjnas`(cdTyDb-iv^;f9@3i%(Rx+)k_B^t|VP)?2>Q z={|Mpf!FQrhxOm1LE^1PR1;f%+xxZG+Vg@PXK$YYrnWk+v%l*EzO3WT*}=_MFZzbH z)t%)p0U9&S7X+O^VZ$EIEwm51&C#ONGu)QK#nD;{e+;1?efGqcGgtk# zA2t*&pX7GCEKK;+XI$m9kid+p$BEVS zLfs}AyTbOhy8U(5-mHix9at5G8M~6|f~2WU9*FD%p<=TLNQ8S);}0q%t)H_ial`i= z?c-~f3ZEP)rRIug7)T7Uk_J%#C;M`VsQM3#*IZ=q6~AU=n8aDmi`q#rx%zrwXPPT5UZ(Upd=pDwKO&tGX(J_F z9+3VP=M$kh`Y~k;DvW<|WpFH$FI)S7?3-%s9dZXSWwZ`3_J-DMq+BL8sFcMV#;B3U zMItW{`BD^ZRx5FLfqvA4#8s&)m1(;~%Vqv1pgvK;uyDn~Rc;8D&97kfI0{xtu&Nos znaUHUT01~Nh;$lfk>mU-iEK($s99zHYblyiLQ{$otZ6i<*o1~*XqzUfPIZMd_EDUn zHI7onT=gx?zd1=)a50tUTpa4Kg0dq46u!gvvD|O*&CKdK-s@s0jhQP}EI39M17t}>g!xoOh zHckYq3-%*J-AH=pagyP|X3@}h3B5i9T0dr~pKg$ThUL8uHi!|o%1zv&w}GEN1I)dE AwEzGB diff --git a/target/classes/com/geekq/miaosha/service/IUserService.class b/target/classes/com/geekq/miaosha/service/IUserService.class new file mode 100644 index 0000000000000000000000000000000000000000..b39e95518cffa993b93ca9d5303330653a52206e GIT binary patch literal 206 zcmZXOO$x#=6olv1{-`Uxgy_bAE1`Qq5L^@w5W^#;wh5-ShjZZpJe1hr!h)M&7(RyY z^?p17Y%s}?Wf&8Z%4uT>+vTB@ofMU{S`@7}R_FiAYA_woC95_kObd7Sig%`B!hC;f z*ca?Oqj()I2@Bk literal 0 HcmV?d00001 diff --git a/target/classes/com/geekq/miaosha/service/MiaoShaUserService.class b/target/classes/com/geekq/miaosha/service/MiaoShaUserService.class index 0dc2cec011505f51857ff844f30432ac0c7f0d7a..2a213f66fe689690716b1ecb731d147eb747b6ba 100644 GIT binary patch delta 1999 zcmZuy`Fj&p6g@MUbdu?#(1k)+N;TLeX(=F<+F+s77K>0JVX?B5SV{<_MVgews=<9n zWk3-(#0?b`3Z#W%!4<^?#a&!*!5{n^Dxc>~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5Mqq`AFfdsWXhtQ!&xcqMp@>G8T@1qYLVgk~g{2D8?9ykU5gw+t<8G+f6)hwQG_ZLL-D z)~y{?jlDgwtsTqyV)4!GJq{S&<{fL^HN3|mLk*XEyl(@qH+;Z{NynSl`H|sc1`Kt4 z;_<2BFh>l73>k(wK#tg?eZW!l;;d6_3k^zrXhA-^mFsBV)@|DMa!`FOc z_|_huF?`1%hiLLIcUp2!MtbtBH$S(IvxakgZ}@>99h@q|PmFo|Y^D7&JTtV?9WJ2LkUgn=EsZuQa285YSmE*VGh~c2t!ao$N11V|e1yCPnb~!2X~h`%BNQatv#Jww z4qR}XYu!rAqG_Xe?tmbIQiVDoL$*PgtR|DSy6Q&V!p$n_I?7qELN-ayty0h|uNH1$ zBW>KF=ilmUZJA6br8SvXBp6|`Prg92WwyRov11ZZy{O(2yzua@i;+HKOz z6H%@xs|op~m_;!2JVhSO{&&@R$}Y^C1+ND`SsXoQSAbAEMqxwgQG!DW+zM4?>V|QO znzBkNMk%dxqwWyy2xTLbN8PN75h}}~?lGzYdfWC1{o7sb0^Gt>{a0N=rrO>63fZi2r7h^p&4 diff --git a/target/classes/mybatis/config.xml b/target/classes/mybatis/config.xml new file mode 100644 index 0000000..fe0f5e4 --- /dev/null +++ b/target/classes/mybatis/config.xml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/target/classes/mybatis/mapper/UserMapper.xml b/target/classes/mybatis/mapper/UserMapper.xml new file mode 100644 index 0000000..18da536 --- /dev/null +++ b/target/classes/mybatis/mapper/UserMapper.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + insert into miaosha_user (id, nickname, salt, register_date,last_login_date,login_Count ) values + (#{id,jdbcType=BIGINT},#{nickname,jdbcType=VARCHAR}, + #{salt,jdbcType=VARCHAR},#{registerDate,jdbcType=DATE},#{lastLoginDate,jdbcType=DATE}, + #{loginCount,jdbcType=INTEGER} + ) + + + + + + update miaosha_user set nickname = #{nickname}, + login_Count = #{loginCount} + where id=#{id} + + + + + delete from miaosha_user + where id = #{id,jdbcType=BIGINT} + + + + id, nickname, salt, register_date,last_login_date,login_Count + + + + + + + + + + + diff --git a/target/classes/templates/login.html b/target/classes/templates/login.html index f04c028..fb816af 100644 --- a/target/classes/templates/login.html +++ b/target/classes/templates/login.html @@ -48,10 +48,10 @@
- +
- +