diff --git a/src/main/java/com/yingjun/ssm/dao/TUserDao.java b/src/main/java/com/yingjun/ssm/dao/TUserDao.java new file mode 100644 index 0000000000000000000000000000000000000000..9b30b1d37302566c7b6a8601697b20be060c2d3f --- /dev/null +++ b/src/main/java/com/yingjun/ssm/dao/TUserDao.java @@ -0,0 +1,63 @@ +package com.yingjun.ssm.dao; +import com.yingjun.ssm.entity.TUser; +import java.util.List; +public interface TUserDao{ + /** + * 获得TUser数据的总行数 + * @return + */ + long getTUserRowCount(); + /** + * 获得TUser数据集合 + * @return + */ + List selectTUser(); + /** + * 获得一个TUser对象,以参数TUser对象中不为空的属性作为条件进行查询 + * @param obj + * @return + */ + TUser selectTUserByObj(TUser obj); + /** + * 通过TUser的id获得TUser对象 + * @param id + * @return + */ + TUser selectTUserById(Long id); + /** + * 插入TUser到数据库,包括null值 + * @param value + * @return + */ + int insertTUser(TUser value); + /** + * 插入TUser中属性值不为null的数据到数据库 + * @param value + * @return + */ + int insertNonEmptyTUser(TUser value); + /** + * 批量插入TUser到数据库,包括null值 + * @param value + * @return + */ + int insertTUserByBatch(List value); + /** + * 通过TUser的id删除TUser + * @param id + * @return + */ + int deleteTUserById(Long id); + /** + * 通过TUser的id更新TUser中的数据,包括null值 + * @param enti + * @return + */ + int updateTUserById(TUser enti); + /** + * 通过TUser的id更新TUser中属性不为null的数据 + * @param enti + * @return + */ + int updateNonEmptyTUserById(TUser enti); +} \ No newline at end of file diff --git a/src/main/java/com/yingjun/ssm/entity/TUser.java b/src/main/java/com/yingjun/ssm/entity/TUser.java new file mode 100644 index 0000000000000000000000000000000000000000..a96f10325d362442dbe5e2757dd61ac9f740cc7c --- /dev/null +++ b/src/main/java/com/yingjun/ssm/entity/TUser.java @@ -0,0 +1,49 @@ +package com.yingjun.ssm.entity; +public class TUser { + private Long id;//主键id + private String password;//密码 + private String name;//姓名 + private String email;//手机号码 + public TUser() { + super(); + } + public TUser(Long id,String password,String name,String email) { + super(); + this.id = id; + this.password = password; + this.name = name; + this.email = email; + } + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPassword() { + return this.password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getEmail() { + return this.email; + } + + public void setEmail(String email) { + this.email = email; + } + +} diff --git a/src/main/java/com/yingjun/ssm/service/TUserService.java b/src/main/java/com/yingjun/ssm/service/TUserService.java new file mode 100644 index 0000000000000000000000000000000000000000..00203144aa7b916b8aeb7640ba99e0db9edc7e20 --- /dev/null +++ b/src/main/java/com/yingjun/ssm/service/TUserService.java @@ -0,0 +1,63 @@ +package com.yingjun.ssm.service; +import java.util.List; +import com.yingjun.ssm.entity.TUser; +public interface TUserService{ + /** + * 获得TUser数据的总行数 + * @return + */ + long getTUserRowCount(); + /** + * 获得TUser数据集合 + * @return + */ + List selectTUser(); + /** + * 获得一个TUser对象,以参数TUser对象中不为空的属性作为条件进行查询 + * @param obj + * @return + */ + TUser selectTUserByObj(TUser obj); + /** + * 通过TUser的id获得TUser对象 + * @param id + * @return + */ + TUser selectTUserById(Long id); + /** + * 插入TUser到数据库,包括null值 + * @param value + * @return + */ + int insertTUser(TUser value); + /** + * 插入TUser中属性值不为null的数据到数据库 + * @param value + * @return + */ + int insertNonEmptyTUser(TUser value); + /** + * 批量插入TUser到数据库 + * @param value + * @return + */ + int insertTUserByBatch(List value); + /** + * 通过TUser的id删除TUser + * @param id + * @return + */ + int deleteTUserById(Long id); + /** + * 通过TUser的id更新TUser中的数据,包括null值 + * @param enti + * @return + */ + int updateTUserById(TUser enti); + /** + * 通过TUser的id更新TUser中属性不为null的数据 + * @param enti + * @return + */ + int updateNonEmptyTUserById(TUser enti); +} \ No newline at end of file diff --git a/src/main/java/com/yingjun/ssm/service/impl/TUserServiceImpl.java b/src/main/java/com/yingjun/ssm/service/impl/TUserServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..6466998f5e7f829f148569d1090f1cee7ec04b80 --- /dev/null +++ b/src/main/java/com/yingjun/ssm/service/impl/TUserServiceImpl.java @@ -0,0 +1,61 @@ +package com.yingjun.ssm.service.impl; +import java.util.List; +import com.yingjun.ssm.dao.TUserDao; +import com.yingjun.ssm.entity.TUser; +import com.yingjun.ssm.service.TUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +@Service +public class TUserServiceImpl implements TUserService{ + @Autowired + private TUserDao tUserDao; + @Override + public long getTUserRowCount(){ + return tUserDao.getTUserRowCount(); + } + @Override + public List selectTUser(){ + return tUserDao.selectTUser(); + } + @Override + public TUser selectTUserByObj(TUser obj){ + return tUserDao.selectTUserByObj(obj); + } + @Override + public TUser selectTUserById(Long id){ + return tUserDao.selectTUserById(id); + } + @Override + public int insertTUser(TUser value){ + return tUserDao.insertTUser(value); + } + @Override + public int insertNonEmptyTUser(TUser value){ + return tUserDao.insertNonEmptyTUser(value); + } + @Override + public int insertTUserByBatch(List value){ + return tUserDao.insertTUserByBatch(value); + } + @Override + public int deleteTUserById(Long id){ + return tUserDao.deleteTUserById(id); + } + @Override + public int updateTUserById(TUser enti){ + return tUserDao.updateTUserById(enti); + } + @Override + public int updateNonEmptyTUserById(TUser enti){ + return tUserDao.updateNonEmptyTUserById(enti); + } + + public TUserDao getTUserDao() { + return this.tUserDao; + } + + public void setTUserDao(TUserDao tUserDao) { + this.tUserDao = tUserDao; + } + +} \ No newline at end of file diff --git a/src/main/java/com/yingjun/ssm/web/UserController.java b/src/main/java/com/yingjun/ssm/web/UserController.java index c838cfb95a97d39ccdcac64307cdae95c1c03f29..958c4f21255f010b76a3144590b23b569e6ed788 100644 --- a/src/main/java/com/yingjun/ssm/web/UserController.java +++ b/src/main/java/com/yingjun/ssm/web/UserController.java @@ -23,7 +23,7 @@ public class UserController { * 用户登录 * @return */ - @RequestMapping(value = "/userLogin", method = RequestMethod.GET) + @RequestMapping(value = "/userLogin") public String userLogin() { LOG.info("用户登录"); return "/user/userLogin"; diff --git a/src/main/resources/mapper/TUserMapper.xml b/src/main/resources/mapper/TUserMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..446dac1d1021ec52664f452d6394b1e16eb95004 --- /dev/null +++ b/src/main/resources/mapper/TUserMapper.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + t_user.id as id + ,t_user.password as password + ,t_user.name as name + ,t_user.email as email + + + + + + + + + + + + + + + + + insert into t_user(id,password,name,email) + values(#{id},#{password},#{name},#{email}) + + + + + insert into t_user + + id, + password, + name, + email, + + + #{id}, + #{password}, + #{name}, + #{email}, + + + + + + insert into t_user(id,password,name,email) values + + (#{item.id},#{item.password},#{item.name},#{item.email}) + + + + + + delete from t_user + where id = #{id} + + + + + update t_user set + password=#{password} + ,name=#{name} + ,email=#{email} + where id=#{id} + + + + + update t_user + + + password=#{password}, + + + name=#{name}, + + + email=#{email}, + + + where id=#{id} + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/user/userLogin.jsp b/src/main/webapp/WEB-INF/jsp/user/userLogin.jsp index 6ad428d6eaebdfd385da403251d113c37880ee33..b1ee7d625cba847b64dba141d23c0fbaed05b9cd 100644 --- a/src/main/webapp/WEB-INF/jsp/user/userLogin.jsp +++ b/src/main/webapp/WEB-INF/jsp/user/userLogin.jsp @@ -40,23 +40,25 @@

用户登录

-
-
    -
  • - -
  • -
  • - -
  • -
-
- 新用户注册 - 忘记密码 +
+
+
    +
  • + +
  • +
  • + +
  • +
+ +
- -
+
@@ -80,4 +82,10 @@ +