Commit 02d3c3e0 authored by Administrator's avatar Administrator

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	src/main/java/com/yxproject/start/api/ShiroApi.java
#	src/main/java/com/yxproject/start/mapper/SysPermissionMapper.java
parents 09ca7507 6c73aeb9
......@@ -4,6 +4,7 @@ import com.yxproject.start.entity.ProductionTaskListEntity;
import com.yxproject.start.entity.SysPermission;
import com.yxproject.start.entity.SysRole;
import com.yxproject.start.entity.UserInfo;
import com.yxproject.start.service.SysPermissionService;
import com.yxproject.start.service.ProductionTaskListService;
import com.yxproject.start.service.UtilService;
import com.yxproject.start.utils.YXJSONResponse;
......@@ -11,6 +12,7 @@ import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JSONString;
import com.yxproject.start.service.SysRoleService;
import com.yxproject.start.service.UserInfoService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.IncorrectCredentialsException;
......@@ -20,6 +22,8 @@ import org.apache.shiro.subject.Subject;
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.RequestParam;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
......@@ -43,9 +47,15 @@ public class ShiroApi {
@Autowired
private UtilService utilService;
@Autowired
private UserInfoService userInfoService;
@Autowired
private SysRoleService sysRoleService;
@Autowired
private SysPermissionService sysPermissionService;
@RequestMapping(value={"/","/index"})
public String index(Map<String,Object> map){
System.out.println("HomeController.index()");
......@@ -111,9 +121,8 @@ public class ShiroApi {
@RequestMapping("/permissionAdd")
@RequiresPermissions("permission.add")//权限管理;
public String permissionAdd(Map<String,Object> map){
Subject subject = SecurityUtils.getSubject();
UserInfo ui = (UserInfo) subject.getPrincipal();
map.put("roleInfo",ui.getRoleList().get(0));
List<SysPermission> permissionList = sysPermissionService.getAllActivePermission();
map.put("permissionList",permissionList);
return "permissionAdd";
}
......@@ -136,20 +145,58 @@ public class ShiroApi {
@RequestMapping("/userList")
@RequiresPermissions("userInfo.view")//权限管理;
public String userInfo(Map<String,Object> map){
Subject subject = SecurityUtils.getSubject();
UserInfo ui = (UserInfo) subject.getPrincipal();
map.put("userInfo",ui);
List<UserInfo> list = userInfoService.getAllUserInfo();
map.put("userInfoList",list);
return "userInfo";
}
/**
* 用户删除;
* 角色查询.
* @return
*/
@RequestMapping("/userDel")
@RequiresPermissions("userInfo.del")//权限管理;
public String userDel(){
return "userInfoDel";
@RequestMapping("/roleList")
@RequiresPermissions("userInfo.view")//权限管理;
public String roleList(Map<String,Object> map){
List<SysRole> list = sysRoleService.getAllRoleInfo();
map.put("roleInfoList",list);
return "roleInfo";
}
/**
* 权限查询.
* @return
*/
@RequestMapping("/permissionList")
@RequiresPermissions("userInfo.view")//权限管理;
public String permissionList(Map<String,Object> map){
List<SysPermission> list = sysPermissionService.getAllPermission();
map.put("permissionList",list);
return "permissionInfo";
}
/**
* 修改用户.
* @return
*/
@RequestMapping("/updateUserInfo")
public String updateUserInfo(@RequestParam("userId") String userId, Map<String,Object> map){
UserInfo userInfo = userInfoService.getUserInfoByUserId(Integer.parseInt(userId));
List<SysRole> roleList = sysRoleService.getAllRoleInfo();
map.put("userInfo",userInfo);
map.put("roleList",roleList);
return "updateUserInfo";
}
/**
* 修改角色
* @return
*/
@RequestMapping("/updateRoleInfo")
public String updateRoleInfo(@RequestParam("roleId") String roleId, Map<String,Object> map){
SysRole sysRole = sysRoleService.getRoleByRoleId(Integer.parseInt(roleId));
List<SysPermission> permissionList = sysPermissionService.getAllActivePermission();
map.put("sysRole",sysRole);
map.put("permissionList",permissionList);
return "updateRoleInfo";
}
/**
......@@ -208,4 +255,21 @@ public class ShiroApi {
yxjsonResponse.outPutSuccess(i+"更新成功");
return yxjsonResponse.toJSONString();
}
/**
* 修改权限
* @return
*/
@RequestMapping("/updatePermission")
public String updatePermission(@RequestParam("permissionId") String permissionId, Map<String,Object> map){
SysPermission sysPermission = sysPermissionService.getPermissionByPId(Integer.parseInt(permissionId));
String parentName = sysPermissionService.getParentNameByParentId(sysPermission.getParent_id());
List<SysPermission> permissionList = sysPermissionService.getAllActivePermission();
map.put("sysPermission",sysPermission);
map.put("parentName",parentName);
map.put("permissionList",permissionList);
return "updatePermission";
}
}
......@@ -19,10 +19,7 @@ import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -91,14 +88,14 @@ public class UserInfoApi {
String str = "0";
SysPermission sysPermission = new SysPermission();
sysPermission.setName(name);
sysPermission.setResourceType(resourceType);
sysPermission.setResource_type(resourceType);
sysPermission.setUrl(url);
sysPermission.setPermission(permission);
sysPermission.setParentId(Long.parseLong(parentId));
sysPermission.setParent_id(Long.parseLong(parentId));
if(parentId.equals(str)){
sysPermission.setParentIds(parentId+"/");
sysPermission.setParent_ids(parentId+"/");
}else{
sysPermission.setParentIds(str+"/"+parentId);
sysPermission.setParent_ids(str+"/"+parentId);
}
System.out.println(sysPermission);
flag = sysPermissionService.addPermission(sysPermission);
......@@ -149,11 +146,39 @@ public class UserInfoApi {
@RequiresPermissions("userInfo.del")
public String userInfoDel(@QueryParam("userId") String userId,@Context HttpServletResponse response){
response.setCharacterEncoding("UTF-8");
Map map = new HashMap();
Map<String,Object> map = new HashMap<>();
boolean flag = false;
flag = userInfoService.deleteUserInfo(Integer.parseInt(userId));
if(flag){
map.put("returnMsg","删除成功");
}else{
map.put("returnMsg","删除失败");
}
return map.toString();
}
/**
* 用户启用;
* @return
*/
@GET
@Path("userBack")
@RequiresPermissions("userInfo.back")
public String userInfoBack(@QueryParam("userId") String userId,@Context HttpServletResponse response){
response.setCharacterEncoding("UTF-8");
Map<String,Object> map = new HashMap<>();
boolean flag = false;
flag = userInfoService.BackUserInfo(Integer.parseInt(userId));
if(flag){
map.put("returnMsg","启用成功");
}else{
map.put("returnMsg","启用失败");
}
return map.toString();
return map.toString();
}
/**
......@@ -168,7 +193,32 @@ public class UserInfoApi {
Map map = new HashMap();
boolean flag = false;
flag = sysRoleService.deleteRole(Integer.parseInt(roleId));
if(flag){
map.put("returnMsg","删除成功");
}else{
map.put("returnMsg","删除失败");
}
return map.toString();
}
/**
* 角色启用
* @param roleId
* @param response
* @return
*/
@GET
@Path("roleBack")
public String roleBack(@QueryParam("roleId") String roleId,@Context HttpServletResponse response){
response.setCharacterEncoding("UTF-8");
Map map = new HashMap();
boolean flag = false;
flag = sysRoleService.backRole(Integer.parseInt(roleId));
if(flag){
map.put("returnMsg","启用成功");
}else{
map.put("returnMsg","启用失败");
}
return map.toString();
}
......@@ -178,30 +228,37 @@ public class UserInfoApi {
*/
@GET
@Path("permissionDel")
@RequiresPermissions("permission.del")
public String permissionDel(@QueryParam("permissionId") String permissionId,@Context HttpServletResponse response){
response.setCharacterEncoding("UTF-8");
Map map = new HashMap();
boolean flag = false;
flag = sysPermissionService.deletePermission(Integer.parseInt(permissionId));
if(flag){
map.put("returnMsg","删除成功");
}else{
map.put("returnMsg","删除失败");
}
return map.toString();
}
/**
* 权限启用;
* @return
*/
@GET
@Path("permissionBack")
public String permissionBack(@QueryParam("permissionId") String permissionId,@Context HttpServletResponse response){
response.setCharacterEncoding("UTF-8");
Map map = new HashMap();
boolean flag = false;
flag = sysPermissionService.backPermission(Integer.parseInt(permissionId));
if(flag){
map.put("returnMsg","启用成功");
}else{
map.put("returnMsg","启用失败");
}
return map.toString();
}
//
// /**
// * 用户更新;
// * @return
// */
// @RequestMapping(value = "/userUpdate",method = RequestMethod.POST)
// @RequiresPermissions("userInfo.update")//权限管理;
// public String userInfoUpdate(@QueryParam("username") String username, @QueryParam("password") String password){
// System.out.println("username------"+username+" -----password-----"+password);
// UserInfoService systemUserService = new UserInfoServiceImpl();
// int i = systemUserService.updateUsername(new UserInfo());
//// int i = 0;
// System.out.println(i+"------返回值");
// return i+"userInfoAdd";
// }
@POST
@Path("roleInfoAdd")
......@@ -226,6 +283,86 @@ public class UserInfoApi {
}
@POST
@Path("userInfoUpdate")
public String userInfoUpdate(@FormParam("userId") String userId,@FormParam("oldRoleId") String oldRoleId,@FormParam("username") String username,@FormParam("name") String name,
@FormParam("roleId")String roleId,@Context HttpServletResponse resp) {
resp.setCharacterEncoding("UTF-8");
UserInfo userInfo = new UserInfo();
userInfo.setId(Integer.parseInt(userId));
userInfo.setUsername(username);
userInfo.setName(name);
Map<String,String> map = new HashMap<>();
boolean flag = false;
flag = userInfoService.updateUser(userInfo,Integer.parseInt(roleId),Integer.parseInt(oldRoleId));
if (flag){
map.put("resultMsg","修改成功");
}else {
map.put("resultMsg","修改失败");
}
return map.toString();
}
@POST
@Path("roleInfoUpdate")
public String roleInfoUpdate(@FormParam("roleId") String roleId,@FormParam("role") String role,@FormParam("description") String description,
@Context HttpServletRequest request,@Context HttpServletResponse resp) {
resp.setCharacterEncoding("UTF-8");
Map<String,String> map = new HashMap<>();
boolean flag = false;
SysRole sysRole = new SysRole();
sysRole.setId(Integer.parseInt(roleId));
sysRole.setRole(role);
sysRole.setDescription(description);
String[] oldPermissionIds = request.getParameterValues("permissionIds");
String[] permissionIds = request.getParameterValues("permissions");
flag = sysRoleService.updateRole(sysRole,permissionIds,oldPermissionIds);
if (flag){
map.put("resultMsg","修改成功");
}else {
map.put("resultMsg","修改失败");
}
return map.toString();
}
@POST
@Path("permissionUpdate")
@RequiresPermissions("permission.update")
public String permissionUpdate(@FormParam("id") String id,@FormParam("name") String name,@FormParam("resourceType") String resourceType,@FormParam("url") String url,
@FormParam("permission")String permission,@FormParam("parentId")String parentId,@Context HttpServletResponse resp){
resp.setCharacterEncoding("UTF-8");
Map<String,String> map = new HashMap<>();
boolean flag = false;
String str = "0";
SysPermission sysPermission = new SysPermission();
sysPermission.setId(Integer.parseInt(id));
sysPermission.setName(name);
sysPermission.setResource_type(resourceType);
sysPermission.setUrl(url);
sysPermission.setPermission(permission);
sysPermission.setParent_id(Long.parseLong(parentId));
if(parentId.equals(str)){
sysPermission.setParent_ids(parentId+"/");
}else{
sysPermission.setParent_ids(str+"/"+parentId);
}
System.out.println(sysPermission);
flag = sysPermissionService.updatePermission(sysPermission);
if (flag){
map.put("resultMsg","修改成功");
}else {
map.put("resultMsg","修改失败");
}
return map.toString();
}
@GET
@RequestMapping("selectAllUser")
@Produces(MediaType.APPLICATION_JSON)
......
......@@ -23,7 +23,7 @@ public class SysPermission implements Serializable {
/**
* 资源类型
*/
private String resourceType;
private String resource_type;
/**
* 资源路径.
*/
......@@ -32,15 +32,21 @@ public class SysPermission implements Serializable {
* 权限字符串,menu例子:role:*,button例子:role:create,role:update,role:delete,role:view
*/
private String permission;
/**
* 父编号
*/
private Long parentId;
private Long parent_id;
/**
* 父编号列表
*/
private String parentIds;
private Boolean available = Boolean.FALSE;
private String parent_ids;
private byte available = 0;
@ManyToMany
@JoinTable(name="SysRolePermission",joinColumns={@JoinColumn(name="permissionId")},inverseJoinColumns={@JoinColumn(name="roleId")})
private List<SysRole> roles;
......@@ -61,12 +67,20 @@ public class SysPermission implements Serializable {
this.name = name;
}
public String getResourceType() {
return resourceType;
public String getResource_type() {
return resource_type;
}
public void setResourceType(String resourceType) {
this.resourceType = resourceType;
public void setResource_type(String resource_type) {
this.resource_type = resource_type;
}
public String getParent_ids() {
return parent_ids;
}
public void setParent_ids(String parent_ids) {
this.parent_ids = parent_ids;
}
public String getUrl() {
......@@ -85,27 +99,21 @@ public class SysPermission implements Serializable {
this.permission = permission;
}
public Long getParentId() {
return parentId;
public Long getParent_id() {
return parent_id;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
public void setParent_id(Long parent_id) {
this.parent_id = parent_id;
}
public String getParentIds() {
return parentIds;
}
public void setParentIds(String parentIds) {
this.parentIds = parentIds;
}
public Boolean getAvailable() {
public byte getAvailable() {
return available;
}
public void setAvailable(Boolean available) {
public void setAvailable(byte available) {
this.available = available;
}
......
......@@ -26,7 +26,7 @@ public class SysRole {
/**
* 是否可用,如果不可用将不会添加给用户
*/
private Boolean available = Boolean.FALSE;
private byte available = 0;
/**
* 角色 -- 权限关系:多对多关系;
......@@ -71,11 +71,11 @@ public class SysRole {
this.description = description;
}
public Boolean getAvailable(boolean b) {
public byte getAvailable() {
return available;
}
public void setAvailable(Boolean available) {
public void setAvailable(byte available) {
this.available = available;
}
......
......@@ -27,7 +27,7 @@ public class UserInfo implements Serializable {
return id;
}
public void setUid(Integer id) {
public void setId(Integer id) {
this.id = id;
}
......
......@@ -16,21 +16,67 @@ public interface SysPermissionMapper{
* 新增权限
* @param sysPermission
*/
// @Insert("INSERT INTO sys_permission (id,available,name,parent_id,parent_ids,permission,resource_type,url)\n" +
// "VALUES (PERMISSION_seq.nextval,0,#{name},#{parentId},#{parentIds},#{permission},#{resourceType},#{url})")
@Insert("INSERT INTO sys_permission (id,available,name,parent_id,parent_ids,permission,resource_type,url)\n" +
"VALUES (PERMISSION_seq.nextval,0,#{name},#{parent_id},#{parent_ids},#{permission},#{resource_type},#{url})")
public void addPermissionByMap(SysPermission sysPermission);
/**
* 查询所有用户
* 查询所有可用权限
* @return
*/
@Select("select * from SYS_PERMISSION where available=0")
public List<SysPermission> selectAllActivePermission();
/**
* 查询所有权限
* @return
*/
@Select("select * from SYS_PERMISSION")
public List<SysPermission> selectAllPermission();
/**
* 删除角色
* 删除权限
* @param permissionId
*/
@Update("UPDATE FROM SYS_PERMISSION SET AVAILABLE = 1 WHERE ID=#{permissionId}")
@Update("UPDATE SYS_PERMISSION SET AVAILABLE = 1 WHERE ID=#{permissionId}")
public void delPermission(@Param("permissionId") Integer permissionId);
/**
* 启用权限
* @param permissionId
*/
@Update("UPDATE SYS_PERMISSION SET AVAILABLE = 0 WHERE ID=#{permissionId}")
public void backPermission(@Param("permissionId") Integer permissionId);
/**
* 通过角色id查询权限
* @param roleId
* @return
*/
@Select("select sp.id,sp.name from SYS_ROLE_PERMISSION srp ,SYS_PERMISSION sp where srp.PERMISSION_ID=sp.ID and srp.ROLE_ID=#{roleId}")
public List<SysPermission> selectPermissionByRoleId(@Param("roleId") Integer roleId);
/**
*通过id查询权限信息
* @param permissionId
* @return
*/
@Select("select * from SYS_PERMISSION WHERE ID=#{permissionId}")
public SysPermission selectPermissionByPid(@Param("permissionId") Integer permissionId);
/**
* 通过父id查询父名称
* @param parentId
* @return
*/
@Select("select name from SYS_PERMISSION WHERE ID=#{parentId}")
public String selectParentNameById(@Param("parentId")Long parentId);
/**
* 修改权限信息
* @param sysPermission
*/
@Update("update SYS_PERMISSION SET NAME=#{name},resource_type=#{resource_type},url=#{url}," +
"permission=#{permission},parent_id=#{parent_id},parent_ids=#{parent_ids} where id=#{id}")
public void updatePermission(SysPermission sysPermission);
}
......@@ -29,23 +29,82 @@ public interface SysRoleMapper {
public void addRolePermission(@Param("roleId")Integer roleId,@Param("permissionId") Integer permissionId);
/**
* 查询所有用户
* 查询所有角色
* @return
*/
@Select("select * from SYS_ROLE")
@Results({@Result(property = "id",column = "id"),
@Result(property = "role",column = "role"),
@Result(property = "description",column = "description"),
@Result(property = "available",column = "available"),
@Result(property = "permissions",javaType = List.class,column ="id",
many = @Many(select = "com.yxproject.start.mapper.SysPermissionMapper.selectPermissionByRoleId"))})
public List<SysRole> selectAllRole();
/**
* 查询所有用户
* 查询所有可用角色
* @return
*/
@Select("select * from SYS_ROLE WHERE AVAILABLE=0")
public List<SysRole> selectAllActiveRole();
/**
* 通过用户id查询角色
* @param userId
* @return
*/
@Select("select sr.id,sr.role from SYS_USER_ROLE sur ,SYS_ROLE sr where sur.ROLE_ID=sr.ID and sur.USER_ID=#{userId}")
List<SysRole> selectRoleByUserId(@Param("userId") Integer userId);
/**
* 更新用户的角色
* @param userId
* @param roleId
*/
@Update("update SYS_USER_ROLE SET ROLE_ID=#{roleId} where USER_ID=#{userId}")
public void updateUserRole(@Param("userId") Integer userId,@Param("roleId")Integer roleId);
/**
* 删除角色
* @param roleId
*/
@Update("UPDATE FROM SYS_ROLE SET AVAILABLE = 1 WHERE ID=#{roleId}")
@Update("UPDATE SYS_ROLE SET AVAILABLE = 1 WHERE ID=#{roleId}")
public void delRole(@Param("roleId") Integer roleId);
/**
* 启用角色
* @param roleId
*/
@Update("UPDATE SYS_ROLE SET AVAILABLE = 0 WHERE ID=#{roleId}")
public void backRole(@Param("roleId") Integer roleId);
/**
* 通过角色id查角色和权限
* @param roleId
* @return
*/
@Select("select * from SYS_ROLE where id=#{roleId}")
@Results({@Result(property = "id",column = "id"),
@Result(property = "role",column = "role"),
@Result(property = "description",column = "description"),
@Result(property = "available",column = "available"),
@Result(property = "permissions",javaType = List.class,column ="id",
many = @Many(select = "com.yxproject.start.mapper.SysPermissionMapper.selectPermissionByRoleId"))})
public SysRole selectRoleByRoleId(@Param("roleId") Integer roleId);
/**
* 修改角色信息
* @param sysRole
*/
@Update("update SYS_ROLE set role=#{role},description=#{description} where id=#{id}")
public void updateSysRole(SysRole sysRole);
/**
* 删除角色权限关系表中旧关系
* @param roleId
* @param oldPermissionId
*/
@Delete("delete from SYS_ROLE_PERMISSION WHERE ROLE_ID=#{roleId} AND PERMISSION_ID=#{oldPermissionId}")
public void delRolePermission(@Param("roleId") Integer roleId,@Param("oldPermissionId") Integer oldPermissionId);
}
......@@ -33,15 +33,52 @@ public interface UserInfoMapper {
* @return
*/
@Select("select * from USER_INFO")
@Results({@Result(property = "id",column = "id"),
@Result(property = "username",column = "username"),
@Result(property = "name",column = "name"),
@Result(property = "password",column = "password"),
@Result(property = "salt",column = "salt"),
@Result(property = "state",column = "state"),
@Result(property = "roleList",javaType = List.class,column ="id",
many = @Many(select = "com.yxproject.start.mapper.SysRoleMapper.selectRoleByUserId"))})
public List<UserInfo> selectAllUserInfo();
/**
* 通过id查询用户
* @param userId
* @return
*/
@Select("select * from USER_INFO WHERE id=#{userId}")
@Results({@Result(property = "id",column = "id"),
@Result(property = "username",column = "username"),
@Result(property = "name",column = "name"),
@Result(property = "password",column = "password"),
@Result(property = "salt",column = "salt"),
@Result(property = "state",column = "state"),
@Result(property = "roleList",javaType = List.class,column ="id",
many = @Many(select = "com.yxproject.start.mapper.SysRoleMapper.selectRoleByUserId"))})
public UserInfo selectUserInfoByUserId(@Param("userId") Integer userId);
/**
* 删除用户
* @param userId
*/
@Update("UPDATE FROM USER_INFO SET STATE = 1 WHERE ID=#{userId}")
@Update("UPDATE USER_INFO SET STATE = 1 WHERE ID=#{userId}")
public void delUserInfo(@Param("userId") Integer userId);
/**
* 启用用户
* @param userId
*/
@Update("UPDATE USER_INFO SET STATE = 0 WHERE ID=#{userId}")
public void backUserInfo(@Param("userId") Integer userId);
/**
* 更新用户
* @param userInfo
*/
@Update("UPDATE USER_INFO SET USERNAME=#{username},NAME=#{name} where ID=#{id}")
public void updateUserInfo(UserInfo userInfo);
}
......@@ -21,11 +21,45 @@ public interface SysPermissionService {
*/
public List<SysPermission> getAllPermission();
/**
* 查询所有可用权限
* @return
*/
public List<SysPermission> getAllActivePermission();
/**
* 删除权限
* @param permissionId
* @return
*/
public boolean deletePermission(Integer permissionId);
/**
* 启用权限
* @param permissionId
* @return
*/
public boolean backPermission(Integer permissionId);
/**
* 通过权限id查询权限
* @param permissionId
* @return
*/
public SysPermission getPermissionByPId(Integer permissionId);
/**
* 通过父id查询父名称
* @param parentId
* @return
*/
public String getParentNameByParentId(Long parentId);
/**
* 修改权限信息
* @param sysPermission
* @return
*/
public boolean updatePermission(SysPermission sysPermission);
}
......@@ -16,6 +16,16 @@ public interface SysRoleService {
*/
public boolean addRole(SysRole sysRole,String[] ids);
/**
* 修改角色和权限
* @param sysRole
* @param ids
* @param oldIds
* @return
*/
public boolean updateRole(SysRole sysRole,String[] ids,String[] oldIds);
/**
* 查询所有角色
* @return
......@@ -34,4 +44,18 @@ public interface SysRoleService {
* @return
*/
public boolean deleteRole(Integer roleId);
/**
* 启用角色
* @param roleId
* @return
*/
public boolean backRole(Integer roleId);
/**
* 通过角色id查询角色和权限
* @param roleId
* @return
*/
public SysRole getRoleByRoleId(Integer roleId);
}
......@@ -2,6 +2,7 @@ package com.yxproject.start.service;
import com.yxproject.start.entity.UserInfo;
import javax.persistence.criteria.CriteriaBuilder;
import java.util.List;
import java.util.Map;
......@@ -29,6 +30,29 @@ public interface UserInfoService{
* @return
*/
public boolean deleteUserInfo(Integer userId);
/**
* 启用用户
* @param userId
* @return
*/
public boolean BackUserInfo(Integer userId);
/**
* 通过用户id查询用户和角色
* @param userId
* @return
*/
public UserInfo getUserInfoByUserId(Integer userId);
/**
* 更新用户
* @param userInfo
* @param roleId
* @return
*/
public boolean updateUser(UserInfo userInfo, Integer roleId,Integer oldRoleId);
// int delUsername( UserInfo userInfo);
// int updateUsername(UserInfo userInfo);
}
......@@ -3,6 +3,7 @@ package com.yxproject.start.service.impl;
import com.yxproject.start.entity.SysPermission;
import com.yxproject.start.mapper.SysPermissionMapper;
import com.yxproject.start.service.SysPermissionService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -24,6 +25,11 @@ public class SysPermissionServiceImpl implements SysPermissionService{
return true;
}
@Override
public List<SysPermission> getAllActivePermission() {
List<SysPermission> list = sysPermissionMapper.selectAllActivePermission();
return list;
}
@Override
public List<SysPermission> getAllPermission() {
List<SysPermission> list = sysPermissionMapper.selectAllPermission();
......@@ -37,5 +43,29 @@ public class SysPermissionServiceImpl implements SysPermissionService{
return true;
}
@Override
public boolean backPermission(Integer permissionId) {
sysPermissionMapper.backPermission(permissionId);
return true;
}
@Override
public SysPermission getPermissionByPId(Integer permissionId) {
SysPermission sysPermission = sysPermissionMapper.selectPermissionByPid(permissionId);
return sysPermission;
}
@Override
public String getParentNameByParentId(Long parentId) {
String parentName = sysPermissionMapper.selectParentNameById(parentId);
return parentName;
}
@Override
public boolean updatePermission(SysPermission sysPermission) {
sysPermissionMapper.updatePermission(sysPermission);
return true;
}
}
......@@ -31,34 +31,49 @@ public class SysRoleServiceImpl implements SysRoleService {
return true;
}
@Override
@Transactional(rollbackFor=Exception.class)
public boolean updateRole(SysRole sysRole, String[] ids, String[] oldIds) {
sysRoleMapper.updateSysRole(sysRole);
for (int i=0;i<oldIds.length;i++){
sysRoleMapper.delRolePermission(sysRole.getId(),Integer.parseInt(oldIds[i]));
}
for (int i=0;i<ids.length;i++){
sysRoleMapper.addRolePermission(sysRole.getId(),Integer.parseInt(ids[i]));
}
return true;
}
@Override
public List<SysRole> getAllRoleInfo() {
List<SysRole> list = sysRoleMapper.selectAllRole();
return list;
}
/**
* 查询所有可用的角色
*
* @return
*/
@Override
public List<SysRole> getAllActiveRoleInfo() {
List<SysRole> list = sysRoleMapper.selectAllActiveRole();
return list;
}
/**
* 删除角色
*
* @param roleId
* @return
*/
@Override
public boolean deleteRole(Integer roleId) {
sysRoleMapper.delRole(roleId);
return true;
}
@Override
public boolean backRole(Integer roleId) {
sysRoleMapper.backRole(roleId);
return true;
}
@Override
public SysRole getRoleByRoleId(Integer roleId) {
SysRole sysRole = sysRoleMapper.selectRoleByRoleId(roleId);
return sysRole;
}
}
......@@ -2,12 +2,15 @@ package com.yxproject.start.service.impl;
import com.yxproject.start.entity.UserInfo;
import com.yxproject.start.mapper.LoginMapper;
import com.yxproject.start.mapper.SysRoleMapper;
import com.yxproject.start.mapper.UserInfoMapper;
import com.yxproject.start.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -19,6 +22,8 @@ public class UserInfoServiceImpl implements UserInfoService {
@Autowired
private UserInfoMapper userInfoMapper;
@Autowired
private SysRoleMapper sysRoleMapper;
@Override
@Transactional(rollbackFor=Exception.class)
......@@ -39,7 +44,30 @@ public class UserInfoServiceImpl implements UserInfoService {
@Override
public boolean deleteUserInfo(Integer userId) {
userInfoMapper.delUserInfo(userId);
return true;
}
@Override
public boolean BackUserInfo(Integer userId) {
userInfoMapper.backUserInfo(userId);
return true;
}
@Override
public UserInfo getUserInfoByUserId(Integer userId) {
UserInfo userInfo = userInfoMapper.selectUserInfoByUserId(userId);
return userInfo;
}
@Override
@Transactional(rollbackFor=Exception.class)
public boolean updateUser(UserInfo userInfo, Integer roleId,Integer oldRoleId) {
userInfoMapper.updateUserInfo(userInfo);
if(roleId.equals(oldRoleId)){
return true;
}
sysRoleMapper.updateUserRole(userInfo.getId(),roleId);
return true;
}
//
......
......@@ -16,7 +16,7 @@
<body>
<!-- 顶部开始 -->
<div class="container">
<div class="logo"><a href="/index">Admin</a></div>
<div class="logo"><a href="/index">用户权限后台管理系统</a></div>
<!--<div class="left_open">-->
<!--<i title="展开左侧栏" class="layui-icon">&#xe699;</i>-->
<!--</div>-->
......@@ -74,7 +74,7 @@
<!-- 中部结束 -->
<!-- 底部开始 -->
<div class="footer">
<div class="copyright">国投盈信秦皇岛科技有限公司 Copyright ©2017 All Rights Reserved</div>
<div class="copyright">国投盈信秦皇岛科技有限公司 Copyright ©2018 All Rights Reserved</div>
</div>
<!-- 底部结束 -->
......
......@@ -34,14 +34,14 @@
<label class="col-xs-3 control-label">用户名</label>
<div class="col-xs-9">
<input type="text" class="form-control" id="yhid"
name="username" placeholder="请输入用户名称">
name="username" value="admin" placeholder="请输入用户名称">
</div>
</div>
<div class="form-group">
<label class="col-xs-3 control-label">密码</label>
<div class="col-xs-9">
<input type="password" class="form-control" id="passid"
name="password" placeholder="请输入密码">
name="password" value="123456" placeholder="请输入密码">
</div>
</div>
......
......@@ -14,7 +14,7 @@
<p>权限字符串:<input type="text" name="permission" value="userInfo.add"/></p>
<p>父类: <select name="parentId">
<option value="0"></option>
<option th:each="permission:${roleInfo.permissions}" th:value="${permission.id}">
<option th:each="permission:${permissionList}" th:value="${permission.id}">
<span th:text="${permission.name}"></span>
</option>
</select>
......
<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<title>用户管理页面</title>
<link rel="stylesheet" th:href="@{/css/font.css}">
<link rel="stylesheet" th:href="@{/css/xadmin.css}">
<link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}">
<script type="text/javascript" th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
<script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
<script type="text/javascript" th:src="@{/lib/layui/lay/modules/form.js}"></script>
<!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
<!--[if lt IE 9]>
<script th:src="@{/js/html5.min.js}"></script>
<script th:src="@{/js/respond.min.js}"></script>
<![endif]-->
</head>
<body class="layui-anim layui-anim-up">
<div class="x-body">
<xblock>
<button class="layui-btn" onclick="x_admin_show('添加权限','/permissionAdd',600,400)"><i class="layui-icon"></i>添加</button>
<!--<span class="x-right" style="line-height:40px">共有数据:88 条</span>-->
</xblock>
<table class="layui-table">
<thead>
<tr>
<th>ID</th>
<th>权限</th>
<th>名称</th>
<th>路径</th>
<th>类型</th>
<th>父类id</th>
<th>父类id树</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr th:each="permission:${permissionList}">
<td><span th:text="${permission.id}"></span></td>
<td><span th:text="${permission.permission}"></span></td>
<td><span th:text="${permission.name}"></span></td>
<td><span th:text="${permission.url}"></span></td>
<td><span th:text="${permission.resource_type}"></span></td>
<td><span th:text="${permission.parent_id}"></span></td>
<td><span th:text="${permission.parent_ids}"></span></td>
<td class="td-status">
<span th:if="${permission.available}==1" class="layui-btn layui-btn-normal layui-btn-mini layui-btn-disabled">已停用</span>
<span th:if="${permission.available}==0" class="layui-btn layui-btn-normal layui-btn-mini">已启用</span>
</td>
<td>
<a class="layui-btn layui-btn" href="#" th:href="@{/updatePermission(permissionId=${permission.id})}">修改</a>
<a class="layui-btn layui-btn-danger" onclick="return del()" href="#" th:href="@{/rest/user/permissionDel(permissionId=${permission.id})}">删除</a>
<a class="layui-btn layui-btn-info" href="#" th:href="@{/rest/user/permissionBack(permissionId=${permission.id})}">启用</a>
</td>
</tr>
</tbody>
</table>
</div>
<script>
layui.use('laydate', function(){
var laydate = layui.laydate;
//执行一个laydate实例
laydate.render({
elem: '#start' //指定元素
});
//执行一个laydate实例
laydate.render({
elem: '#end' //指定元素
});
});
/*用户-停用*/
function member_stop(obj,id){
layer.confirm('确认要停用吗?',function(index){
if($(obj).attr('title')=='启用'){
//发异步把用户状态进行更改
$(obj).attr('title','停用')
$(obj).find('i').html('&#xe62f;');
$(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
layer.msg('已停用!',{icon: 5,time:1000});
}else{
$(obj).attr('title','启用')
$(obj).find('i').html('&#xe601;');
$(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已启用');
layer.msg('已启用!',{icon: 5,time:1000});
}
});
}
/*用户-删除*/
function member_del(obj,id){
layer.confirm('确认要删除吗?',function(index){
//发异步删除数据
$(obj).parents("tr").remove();
layer.msg('已删除!',{icon:1,time:1000});
});
}
function delAll (argument) {
var data = tableCheck.getData();
layer.confirm('确认要删除吗?'+data,function(index){
//捉到所有被选中的,发异步进行删除
layer.msg('删除成功', {icon: 1});
$(".layui-form-checked").not('.header').parents('tr').remove();
});
}
function del() {
if (confirm("您确定要删除吗?")) {
return true;
} else {
return false;
}
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<title>用户管理页面</title>
<link rel="stylesheet" th:href="@{/css/font.css}">
<link rel="stylesheet" th:href="@{/css/xadmin.css}">
<link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}">
<script type="text/javascript" th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
<script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
<script type="text/javascript" th:src="@{/lib/layui/lay/modules/form.js}"></script>
<!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
<!--[if lt IE 9]>
<script th:src="@{/js/html5.min.js}"></script>
<script th:src="@{/js/respond.min.js}"></script>
<![endif]-->
</head>
<body class="layui-anim layui-anim-up">
<div class="x-body">
<xblock>
<button class="layui-btn" onclick="x_admin_show('添加角色','/roleAdd',600,400)"><i class="layui-icon"></i>添加</button>
</xblock>
<table class="layui-table">
<thead>
<tr>
<th>ID</th>
<th>角色名</th>
<th>描述</th>
<th>权限</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr th:each="role:${roleInfoList}">
<td><span th:text="${role.id}"></span></td>
<td><span th:text="${role.role}"></span></td>
<td><span th:text="${role.description}"></span></td>
<td><span th:each="permission:${role.permissions}">
<span th:text="${permission.name}"></span>&nbsp;
</span>
</td>
<td class="td-status">
<span th:if="${role.available}==1" class="layui-btn layui-btn-normal layui-btn-mini layui-btn-disabled">已停用</span>
<span th:if="${role.available}==0" class="layui-btn layui-btn-normal layui-btn-mini">已启用</span>
</td>
<td>
<a class="layui-btn layui-btn" href="#" th:href="@{/updateRoleInfo(roleId=${role.id})}">修改</a>
<a class="layui-btn layui-btn-danger" onclick="return del()" href="#" th:href="@{/rest/user/roleDel(roleId=${role.id})}">删除</a>
<a class="layui-btn layui-btn-info" href="#" th:href="@{/rest/user/roleBack(roleId=${role.id})}">启用</a>
</td>
</tr>
</tbody>
</table>
</div>
<script>
layui.use('laydate', function(){
var laydate = layui.laydate;
//执行一个laydate实例
laydate.render({
elem: '#start' //指定元素
});
//执行一个laydate实例
laydate.render({
elem: '#end' //指定元素
});
});
/*用户-停用*/
function member_stop(obj,id){
layer.confirm('确认要停用吗?',function(index){
if($(obj).attr('title')=='启用'){
//发异步把用户状态进行更改
$(obj).attr('title','停用')
$(obj).find('i').html('&#xe62f;');
$(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
layer.msg('已停用!',{icon: 5,time:1000});
}else{
$(obj).attr('title','启用')
$(obj).find('i').html('&#xe601;');
$(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已启用');
layer.msg('已启用!',{icon: 5,time:1000});
}
});
}
/*用户-删除*/
function member_del(obj,id){
layer.confirm('确认要删除吗?',function(index){
//发异步删除数据
$(obj).parents("tr").remove();
layer.msg('已删除!',{icon:1,time:1000});
});
}
function delAll (argument) {
var data = tableCheck.getData();
layer.confirm('确认要删除吗?'+data,function(index){
//捉到所有被选中的,发异步进行删除
layer.msg('删除成功', {icon: 1});
$(".layui-form-checked").not('.header').parents('tr').remove();
});
}
function del() {
if (confirm("您确定要删除吗?")) {
return true;
} else {
return false;
}
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<title>Add</title>
</head>
<body>
<h3>权限添加界面</h3>
<form action="" th:action="@{rest/user/permissionUpdate}" method="post">
<input type="hidden" name="id" th:value="${sysPermission.id}"/>
<p>名称:<input type="text" name="name" th:value="${sysPermission.name}"/></p>
<p>资源类型:<input type="radio" name="resourceType" value="menu"/>menu
<input type="radio" name="resourceType" value="button"/>button</p>
<p>资源路径:<input type="text" name="url" th:value="${sysPermission.url}"/></p>
<p>权限字符串:<input type="text" name="permission" th:value="${sysPermission.permission}"/></p>
<p>父类: <select name="parentId">
<option value="0"></option>
<option th:each="permission:${permissionList}" th:value="${permission.id}">
<span th:text="${permission.name}"></span>
</option>
</select>
</p>
</select>
<p><input type="submit" value="添加"/></p>
</form>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<title>Add</title>
</head>
<body>
<h3>角色修改界面</h3>
<form action="" th:action="@{rest/user/roleInfoUpdate}" method="post">
<p><input type="hidden" name="roleId" th:value="${sysRole.id}" /></p>
<p th:each="permission:${sysRole.permissions}">
<input type="hidden" name="permissionIds" th:value="${permission.id}" />
</p>
<p>角色名称:<input type="text" name="role" th:value="${sysRole.role}" /></p>
<p>角色描述:<input type="text" name="description" th:value="${sysRole.description}"/></p>
<!--<p><input type="hidden" name="permissions"/></p>-->
<p>分配权限: <span th:each="permList:${permissionList}">
<input type="checkbox" th:name="permissions" th:value="${permList.id}"><span th:text="${permList.name}"></span>
</span>
</p>
<p><input type="submit" value="添加"/></p>
</form>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<title>Add</title>
</head>
<link rel="stylesheet" th:href="@{/css/font.css}">
<link rel="stylesheet" th:href="@{/css/xadmin.css}">
<link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}">
<script type="text/javascript" th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
<script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
<script type="text/javascript" th:src="@{/lib/layui/lay/modules/form.js}"></script>
<!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
<!--[if lt IE 9]>
<script th:src="@{/js/html5.min.js}"></script>
<script th:src="@{/js/respond.min.js}"></script>
<![endif]-->
<body>
<!--<h3>用户添加界面</h3>-->
<!--<form th:action="@{rest/user/userInfoAdd}" method="post">-->
<!--<p>用户名:<input type="text" name="username" value="用户名"/></p>-->
<!--<p>名称:<input type="text" name="name" value="会员"/></p>-->
<!--<p>密码:<input type="password" name="password" value="123456"/></p>-->
<!--<p>角色:<select name="roleId">-->
<!--&lt;!&ndash;<option value="-1">不分配角色</option>&ndash;&gt;-->
<!--<option th:each="roleList:${roleList}" th:value="${roleList.id}">-->
<!--<span th:text="${roleList.role}"></span>-->
<!--</option>-->
<!--</select>-->
<!--</p>-->
<!--<p><input type="submit" value="添加"/></p>-->
<!--</form>-->
<div class="x-body layui-anim layui-anim-up">
<form class="layui-form" th:action="@{rest/user/userInfoUpdate}" method="post">
<div class="layui-form-item">
<div class="layui-input-inline">
<input type="hidden" name="userId" required="" th:value="${userInfo.id}"
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-inline" th:each="role:${userInfo.roleList}">
<input type="hidden" name="oldRoleId" required="" th:value="${role.id}"
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label for="L_username" class="layui-form-label">
<span class="x-red">*</span>用户名
</label>
<div class="layui-input-inline">
<input type="text" id="L_username" name="username" required="" th:value="${userInfo.username}"
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label for="L_name" class="layui-form-label">
<span class="x-red">*</span>昵称
</label>
<div class="layui-input-inline">
<input type="text" id="L_name" name="name" required="" lay-verify="name" th:value="${userInfo.name}"
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label for="role" class="layui-form-label">
<span class="x-red">*</span>角色
</label>
<div class="layui-input-inline">
<select name="roleId" id="role">
<option th:each="roleList:${roleList}" th:value="${roleList.id}">
<span style="text-align: left" th:text="${roleList.role}"></span>
</option>
</select>
</div>
</div>
<div class="layui-form-item">
<input type="submit" class="layui-btn" value="修改"/>
</div>
</form>
</div>
<script>
layui.use(['form','layer'], function(){
$ = layui.jquery;
var form = layui.form
,layer = layui.layer;
//自定义验证规则
form.verify({
pass: [/(.+){6,12}$/, '密码必须6到12位']
,repass: function(value){
if($('#L_pass').val()!=$('#L_repass').val()){
return '两次密码不一致';
}
}
});
});
</script>
</body>
</html>
\ No newline at end of file
......@@ -22,53 +22,37 @@
<body class="layui-anim layui-anim-up">
<div class="x-body">
<xblock>
<button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>
<button class="layui-btn" onclick="x_admin_show('添加用户','/userAdd',600,400)"><i class="layui-icon"></i>添加</button>
<!--<span class="x-right" style="line-height:40px">共有数据:88 条</span>-->
</xblock>
<table class="layui-table">
<thead>
<tr>
<th>
<div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
</th>
<th>ID</th>
<th>用户名</th>
<th>别名</th>
<th>角色</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr th:each="userInfo:${userInfo}">
<td>
<div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='2'><i class="layui-icon">&#xe605;</i></div>
</td>
<tr th:each="userInfo:${userInfoList}">
<td><span th:text="${userInfo.id}"></span></td>
<td><span th:text="${userInfo.username}"></span></td>
<td><span th:text="${userInfo.name}"></span></td>
<td><span th:each="role:${userInfo.roleList}">
<span th:text="${role.role}"></span>
</span>
</td>
<td class="td-status">
<span th:if="${userInfo.state}==1" class="layui-btn layui-btn-normal layui-btn-mini layui-btn-disabled">已停用</span>
<span th:if="${userInfo.state}==0" class="layui-btn layui-btn-normal layui-btn-mini">已启用</span>
</td>
<td>
<a class="layui-btn layui-btn" href="/updateUserInfo/${userInfo.id}">修改</a>
<a class="layui-btn layui-btn-danger" href="/delUserInfo/${userInfo.id}">删除</a>
<a class="layui-btn layui-btn" href="#" th:href="@{updateUserInfo(userId=${userInfo.id})}">修改</a>
<a class="layui-btn layui-btn-danger" onclick="return del()" href="#" th:href="@{/rest/user/userDel(userId=${userInfo.id})}">删除</a>
<a class="layui-btn layui-btn-info" href="#" th:href="@{/rest/user/userBack(userId=${userInfo.id})}">启用</a>
</td>
<!--<td class="td-manage">-->
<!--<a onclick="member_stop(this,'10001')" href="javascript:;" title="启用">-->
<!--<i class="layui-icon">&#xe601;</i>-->
<!--</a>-->
<!--<a title="编辑" onclick="x_admin_show('编辑','member-edit.html',600,400)" href="javascript:;">-->
<!--<i class="layui-icon">&#xe642;</i>-->
<!--</a>-->
<!--<a onclick="x_admin_show('修改密码','member-password.html',600,400)" title="修改密码" href="javascript:;">-->
<!--<i class="layui-icon">&#xe631;</i>-->
<!--</a>-->
<!--<a title="删除" onclick="member_del(this,'要删除的id')" href="javascript:;">-->
<!--<i class="layui-icon">&#xe640;</i>-->
<!--</a>-->
<!--</td>-->
</tr>
</tbody>
</table>
......@@ -134,6 +118,15 @@
$(".layui-form-checked").not('.header').parents('tr').remove();
});
}
function del() {
if (confirm("您确定要删除吗?")) {
return true;
} else {
return false;
}
}
</script>
</body>
......
......@@ -77,9 +77,9 @@
<span class="x-red">*</span>角色
</label>
<div class="layui-input-inline">
<select name="roleId" id="role">
<select name="roleId" id="role">
<option th:each="roleList:${activeRoleList}" th:value="${roleList.id}">
<span th:text="${roleList.role}"></span>
<span style="text-align: left" th:text="${roleList.role}"></span>
</option>
</select>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment