diff --git a/src/main/java/com/sixteam/irs/controller/RoleController.java b/src/main/java/com/sixteam/irs/controller/RoleController.java new file mode 100644 index 0000000000000000000000000000000000000000..02224dd1b92012d4bba34d18bd76344032fe6cdd --- /dev/null +++ b/src/main/java/com/sixteam/irs/controller/RoleController.java @@ -0,0 +1,26 @@ +package com.sixteam.irs.controller; + +import com.sixteam.irs.entity.Role; +import com.sixteam.irs.service.RoleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpRequest; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +@RequestMapping("/") +@Controller +public class RoleController { + @Autowired + private RoleService roleService; + + @RequestMapping("/findAllRole") + public String findAllRole(HttpServletRequest request){ + List roleList = roleService.findAll(); + System.out.println(roleList); + request.setAttribute("roleList",roleList); + return "roleList.html"; + } +} diff --git a/src/main/java/com/sixteam/irs/entity/User.java b/src/main/java/com/sixteam/irs/entity/User.java index e0ae7c82bc08f3cce867b83916c9652707fde720..dae98ce29eec7ffd0d4c22d01b01e00e62664cbf 100644 --- a/src/main/java/com/sixteam/irs/entity/User.java +++ b/src/main/java/com/sixteam/irs/entity/User.java @@ -9,7 +9,7 @@ public class User { private String uPhone;//电话 private String uPassword;//密码 private String uSex;//性别 - private Integer uBirthDate;//生日 + private String uBirthDate;//生日 private List roleList;//(平时为空,在管理用户角色时嵌套查询role->Jurisdiction) private List jurisdictionRoleList;//(查询用户时应嵌套查询此列,用于拦截) @@ -22,7 +22,7 @@ public class User { ", uPhone='" + uPhone + '\'' + ", uPassword='" + uPassword + '\'' + ", uSex='" + uSex + '\'' + - ", uBirthDate=" + uBirthDate + + ", uBirthDate='" + uBirthDate + '\'' + ", roleList=" + roleList + ", jurisdictionRoleList=" + jurisdictionRoleList + '}'; @@ -32,7 +32,7 @@ public class User { super(); } - public User(String uId, String uName, String uEmail, String uPhone, String uPassword, String uSex, Integer uBirthDate, List roleList, List jurisdictionRoleList) { + public User(String uId, String uName, String uEmail, String uPhone, String uPassword, String uSex, String uBirthDate, List roleList, List jurisdictionRoleList) { this.uId = uId; this.uName = uName; this.uEmail = uEmail; @@ -92,11 +92,11 @@ public class User { this.uSex = uSex; } - public Integer getuBirthDate() { + public String getuBirthDate() { return uBirthDate; } - public void setuBirthDate(Integer uBirthDate) { + public void setuBirthDate(String uBirthDate) { this.uBirthDate = uBirthDate; } diff --git a/src/main/java/com/sixteam/irs/mapper/RoleMapper.java b/src/main/java/com/sixteam/irs/mapper/RoleMapper.java index 23942a7a981443af6b777dec2350ef2f804c318a..7cf17668489975ca7f543bebbacf0da9626f0a39 100644 --- a/src/main/java/com/sixteam/irs/mapper/RoleMapper.java +++ b/src/main/java/com/sixteam/irs/mapper/RoleMapper.java @@ -1,9 +1,13 @@ package com.sixteam.irs.mapper; +import com.sixteam.irs.entity.Role; import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Repository; +import java.util.List; + @Mapper @Repository public interface RoleMapper { + List findAll(); } diff --git a/src/main/java/com/sixteam/irs/service/Impl/RoleServiceImpl.java b/src/main/java/com/sixteam/irs/service/Impl/RoleServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..b8e9ddeb1a2c74d1df1adde808733f98935e1256 --- /dev/null +++ b/src/main/java/com/sixteam/irs/service/Impl/RoleServiceImpl.java @@ -0,0 +1,19 @@ +package com.sixteam.irs.service.Impl; + +import com.sixteam.irs.entity.Role; +import com.sixteam.irs.mapper.RoleMapper; +import com.sixteam.irs.service.RoleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class RoleServiceImpl implements RoleService { + @Autowired + private RoleMapper roleMapper; + + public List findAll() { + return roleMapper.findAll(); + } +} diff --git a/src/main/java/com/sixteam/irs/service/RoleService.java b/src/main/java/com/sixteam/irs/service/RoleService.java new file mode 100644 index 0000000000000000000000000000000000000000..252855e99652a866a781dbd37fa67f504777287c --- /dev/null +++ b/src/main/java/com/sixteam/irs/service/RoleService.java @@ -0,0 +1,9 @@ +package com.sixteam.irs.service; + +import com.sixteam.irs.entity.Role; + +import java.util.List; + +public interface RoleService { + List findAll(); +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index bfbf38d44c7b969156bbff5ac020d8630645cc8c..d33b9b96022e2ca7efa12c350aa9fef5baff00ca 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -4,7 +4,7 @@ spring: datasource: driver-class-name: com.mysql.jdbc.Driver url: jdbc:mysql://49.232.158.16:3306/irs?serverTimezone=UTC - username: irsFWQ + username: irsYH password: 666 thymeleaf: @@ -16,6 +16,8 @@ spring: mybatis: configuration: map-underscore-to-camel-case: true - + #�����շ�ʽ mapper-locations: classpath:mapper/*.xml type-aliases-package: com.sixteam.irs.entity + + diff --git a/src/main/resources/com/sixteam/irs/mapper/RoleMapper.xml b/src/main/resources/com/sixteam/irs/mapper/RoleMapper.xml index c98d1d0b3bda7aae7c09be861af012367f16aa34..c408bb3ee1d14f0c777cd802874d94bf3099c109 100644 --- a/src/main/resources/com/sixteam/irs/mapper/RoleMapper.xml +++ b/src/main/resources/com/sixteam/irs/mapper/RoleMapper.xml @@ -1,10 +1,22 @@ - + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/com/sixteam/irs/mapper/UserMapper.xml b/src/main/resources/com/sixteam/irs/mapper/UserMapper.xml index 7d10075a711ab6661ababd8318b1d4ad2a0c0bda..7de84e5a494be8f2c92f915b9952015d54e6d091 100644 --- a/src/main/resources/com/sixteam/irs/mapper/UserMapper.xml +++ b/src/main/resources/com/sixteam/irs/mapper/UserMapper.xml @@ -4,14 +4,24 @@ - + + + + + + + +