diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPermission.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPermission.java new file mode 100644 index 0000000..a269d72 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPermission.java @@ -0,0 +1,122 @@ +package com.lyms.talkonlineweb.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * 权限表 + * @TableName lyms_permission + */ +@TableName(value ="lyms_permission") +@Data +public class LymsPermission implements Serializable { + /** + * + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 权限名称 + */ + @TableField(value = "pmname") + private String pmname; + + /** + * 权限 + */ + @TableField(value = "purl") + private String purl; + + /** + * 上级菜单ID;根菜单默认0 + */ + @TableField(value = "pid") + private Integer pid; + + /** + * 创建人 + */ + @TableField(value = "createdby") + private Integer createdby; + + /** + * 创建时间 + */ + @TableField(value = "createdtime") + private Date createdtime; + + /** + * 更新人 + */ + @TableField(value = "updatedby") + private Integer updatedby; + + /** + * 更新时间 + */ + @TableField(value = "updated_time") + private Date updatedTime; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + LymsPermission other = (LymsPermission) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getPmname() == null ? other.getPmname() == null : this.getPmname().equals(other.getPmname())) + && (this.getPurl() == null ? other.getPurl() == null : this.getPurl().equals(other.getPurl())) + && (this.getCreatedby() == null ? other.getCreatedby() == null : this.getCreatedby().equals(other.getCreatedby())) + && (this.getCreatedtime() == null ? other.getCreatedtime() == null : this.getCreatedtime().equals(other.getCreatedtime())) + && (this.getUpdatedby() == null ? other.getUpdatedby() == null : this.getUpdatedby().equals(other.getUpdatedby())) + && (this.getUpdatedTime() == null ? other.getUpdatedTime() == null : this.getUpdatedTime().equals(other.getUpdatedTime())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getPmname() == null) ? 0 : getPmname().hashCode()); + result = prime * result + ((getPurl() == null) ? 0 : getPurl().hashCode()); + result = prime * result + ((getCreatedby() == null) ? 0 : getCreatedby().hashCode()); + result = prime * result + ((getCreatedtime() == null) ? 0 : getCreatedtime().hashCode()); + result = prime * result + ((getUpdatedby() == null) ? 0 : getUpdatedby().hashCode()); + result = prime * result + ((getUpdatedTime() == null) ? 0 : getUpdatedTime().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", pmname=").append(pmname); + sb.append(", purl=").append(purl); + sb.append(", pid=").append(pid); + sb.append(", createdby=").append(createdby); + sb.append(", createdtime=").append(createdtime); + sb.append(", updatedby=").append(updatedby); + sb.append(", updatedTime=").append(updatedTime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsRole.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsRole.java new file mode 100644 index 0000000..019788f --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsRole.java @@ -0,0 +1,106 @@ +package com.lyms.talkonlineweb.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * 角色 + * @TableName lyms_role + */ +@TableName(value ="lyms_role") +@Data +public class LymsRole implements Serializable { + /** + * + */ + @TableId(value = "rid", type = IdType.AUTO) + private Integer rid; + + /** + * 角色名称 + */ + @TableField(value = "rname") + private String rname; + + /** + * 创建人 + */ + @TableField(value = "createdby") + private Integer createdby; + + /** + * 创建时间 + */ + @TableField(value = "createdtime") + private Date createdtime; + + /** + * 更新人 + */ + @TableField(value = "updatedby") + private Integer updatedby; + + /** + * 更新时间 + */ + @TableField(value = "updated_time") + private Date updatedTime; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + LymsRole other = (LymsRole) that; + return (this.getRid() == null ? other.getRid() == null : this.getRid().equals(other.getRid())) + && (this.getRname() == null ? other.getRname() == null : this.getRname().equals(other.getRname())) + && (this.getCreatedby() == null ? other.getCreatedby() == null : this.getCreatedby().equals(other.getCreatedby())) + && (this.getCreatedtime() == null ? other.getCreatedtime() == null : this.getCreatedtime().equals(other.getCreatedtime())) + && (this.getUpdatedby() == null ? other.getUpdatedby() == null : this.getUpdatedby().equals(other.getUpdatedby())) + && (this.getUpdatedTime() == null ? other.getUpdatedTime() == null : this.getUpdatedTime().equals(other.getUpdatedTime())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getRid() == null) ? 0 : getRid().hashCode()); + result = prime * result + ((getRname() == null) ? 0 : getRname().hashCode()); + result = prime * result + ((getCreatedby() == null) ? 0 : getCreatedby().hashCode()); + result = prime * result + ((getCreatedtime() == null) ? 0 : getCreatedtime().hashCode()); + result = prime * result + ((getUpdatedby() == null) ? 0 : getUpdatedby().hashCode()); + result = prime * result + ((getUpdatedTime() == null) ? 0 : getUpdatedTime().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", rid=").append(rid); + sb.append(", rname=").append(rname); + sb.append(", createdby=").append(createdby); + sb.append(", createdtime=").append(createdtime); + sb.append(", updatedby=").append(updatedby); + sb.append(", updatedTime=").append(updatedTime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsPermissionMapper.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsPermissionMapper.java new file mode 100644 index 0000000..fa234e0 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsPermissionMapper.java @@ -0,0 +1,21 @@ +package com.lyms.talkonlineweb.mapper; + +import com.lyms.talkonlineweb.domain.LymsPermission; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + * @Entity com.lyms.talkonlineweb.domain.LymsPermission + */ +public interface LymsPermissionMapper extends BaseMapper { + + @Select("SELECT * FROM lyms_permission p,lyms_rolepermiss rp WHERE rp.`pid`=p.`id` AND rp.`rid`=#{rid} AND p.`pid`=#{pid}") + List sltPermissByRole(@Param("rid") int rid, @Param("pid") int pid); +} + + + + diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsRoleMapper.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsRoleMapper.java new file mode 100644 index 0000000..76ebbd9 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsRoleMapper.java @@ -0,0 +1,29 @@ +package com.lyms.talkonlineweb.mapper; + +import com.lyms.talkonlineweb.domain.LymsRole; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + * @Entity com.lyms.talkonlineweb.domain.LymsRole + */ +public interface LymsRoleMapper extends BaseMapper { + + @Select(" SELECT * FROM lyms_role r,lyms_userrole ur WHERE ur.`rid`=r.`rid` AND ur.`uid`= #{uid} ") + List sltRoleByUser(@Param("uid") int uid); + + @Delete("delete FROM lyms_rolepermiss WHERE `rid` =#{rid} ") + int delPersByRole(@Param("rid") int rid); + + @Insert("insert lyms_rolepermiss(rid,pid) values(#{rid},#{pid})") + int addRoleByPerms(@Param("rid") int rid, @Param("pid") int pid); +} + + + + diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsPermissionService.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsPermissionService.java new file mode 100644 index 0000000..8489043 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsPermissionService.java @@ -0,0 +1,11 @@ +package com.lyms.talkonlineweb.service; + +import com.lyms.talkonlineweb.domain.LymsPermission; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * + */ +public interface LymsPermissionService extends IService { + +} diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsRoleService.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsRoleService.java new file mode 100644 index 0000000..1821d7a --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsRoleService.java @@ -0,0 +1,34 @@ +package com.lyms.talkonlineweb.service; + +import com.lyms.talkonlineweb.domain.LymsRole; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + * + */ +public interface LymsRoleService extends IService { + + /** + * 根据用户获取角色 + * @param uid + * @return + */ + List getRolesByUid(int uid); + + /** + * 角色权限关系表 + * @param rid + * @param pid + * @return + */ + int addRoleByPerms(int rid, int pid); + + /** + * 删除角色权限关系 + * @param rid + * @return + */ + int delPersByRole(int rid); +} diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsPermissionServiceImpl.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsPermissionServiceImpl.java new file mode 100644 index 0000000..fecca98 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsPermissionServiceImpl.java @@ -0,0 +1,20 @@ +package com.lyms.talkonlineweb.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.lyms.talkonlineweb.domain.LymsPermission; +import com.lyms.talkonlineweb.service.LymsPermissionService; +import com.lyms.talkonlineweb.mapper.LymsPermissionMapper; +import org.springframework.stereotype.Service; + +/** + * + */ +@Service +public class LymsPermissionServiceImpl extends ServiceImpl + implements LymsPermissionService{ + +} + + + + diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsRoleServiceImpl.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsRoleServiceImpl.java new file mode 100644 index 0000000..7fe4e67 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsRoleServiceImpl.java @@ -0,0 +1,40 @@ +package com.lyms.talkonlineweb.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.lyms.talkonlineweb.domain.LymsRole; +import com.lyms.talkonlineweb.service.LymsRoleService; +import com.lyms.talkonlineweb.mapper.LymsRoleMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * + */ +@Service +public class LymsRoleServiceImpl extends ServiceImpl + implements LymsRoleService{ + + @Autowired + private LymsRoleMapper lymsRoleMapper; + + @Override + public List getRolesByUid(int uid) { + return lymsRoleMapper.sltRoleByUser(uid); + } + + @Override + public int addRoleByPerms(int rid, int pid) { + return lymsRoleMapper.addRoleByPerms(rid,pid); + } + + @Override + public int delPersByRole(int rid) { + return lymsRoleMapper.delPersByRole(rid); + } +} + + + + diff --git a/talkonlineweb/src/main/resources/mapper/LymsPermissionMapper.xml b/talkonlineweb/src/main/resources/mapper/LymsPermissionMapper.xml new file mode 100644 index 0000000..87c6e21 --- /dev/null +++ b/talkonlineweb/src/main/resources/mapper/LymsPermissionMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + id,pmname,purl, + createdby,createdtime,updatedby, + updated_time + + diff --git a/talkonlineweb/src/main/resources/mapper/LymsRoleMapper.xml b/talkonlineweb/src/main/resources/mapper/LymsRoleMapper.xml new file mode 100644 index 0000000..c4957f9 --- /dev/null +++ b/talkonlineweb/src/main/resources/mapper/LymsRoleMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + rid,rname,createdby, + createdtime,updatedby,updated_time + + diff --git a/talkonlineweb/src/main/resources/mapper/LymsUserMapper.xml b/talkonlineweb/src/main/resources/mapper/LymsUserMapper.xml new file mode 100644 index 0000000..2263c54 --- /dev/null +++ b/talkonlineweb/src/main/resources/mapper/LymsUserMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + uid,uname,login, + passwd,hxid,createdby, + createdtime,updatedby,updated_time + +