10 changed files with 178 additions and 8 deletions
@ -0,0 +1,25 @@ |
|||||||
|
package com.water.watersys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.water.watersys.model.domain.RoleSys; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Select; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author mac |
||||||
|
* @description 针对表【role_sys】的数据库操作Mapper |
||||||
|
* @createDate 2025-04-13 10:57:50 |
||||||
|
* @Entity generator.domain.RoleSys |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface RoleSysMapper extends BaseMapper<RoleSys> { |
||||||
|
|
||||||
|
@Select("select b.id, b.role_name from user_role_sys a left join role_sys b on a.role_id = b.id where a.user_id = #{loginId}") |
||||||
|
List<RoleSys> getRoleList(Object loginId); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,69 @@ |
|||||||
|
package com.water.watersys.model.domain; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @TableName role_sys |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class RoleSys { |
||||||
|
/** |
||||||
|
* |
||||||
|
*/ |
||||||
|
private Integer id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 角色名 |
||||||
|
*/ |
||||||
|
private String roleName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建时间 |
||||||
|
*/ |
||||||
|
private Date createdTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改时间 |
||||||
|
*/ |
||||||
|
private Date updatedTime; |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean equals(Object that) { |
||||||
|
if (this == that) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
if (that == null) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
if (getClass() != that.getClass()) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
RoleSys other = (RoleSys) that; |
||||||
|
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) |
||||||
|
&& (this.getRoleName() == null ? other.getRoleName() == null : this.getRoleName().equals(other.getRoleName())); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public int hashCode() { |
||||||
|
final int prime = 31; |
||||||
|
int result = 1; |
||||||
|
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); |
||||||
|
result = prime * result + ((getRoleName() == null) ? 0 : getRoleName().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(", roleName=").append(roleName); |
||||||
|
sb.append("]"); |
||||||
|
return sb.toString(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,17 @@ |
|||||||
|
package com.water.watersys.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import com.water.watersys.model.domain.RoleSys; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author mac |
||||||
|
* @description 针对表【role_sys】的数据库操作Service |
||||||
|
* @createDate 2025-04-13 10:57:50 |
||||||
|
*/ |
||||||
|
|
||||||
|
public interface RoleSysService extends IService<RoleSys> { |
||||||
|
|
||||||
|
List<RoleSys> getRole(Object loginId); |
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
package com.water.watersys.service.impl; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
|
import com.water.watersys.mapper.RoleSysMapper; |
||||||
|
import com.water.watersys.model.domain.RoleSys; |
||||||
|
import com.water.watersys.service.RoleSysService; |
||||||
|
import jakarta.annotation.Resource; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author mac |
||||||
|
* @description 针对表【role_sys】的数据库操作Service实现 |
||||||
|
* @createDate 2025-04-13 10:57:50 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class RoleSysServiceImpl extends ServiceImpl<RoleSysMapper, RoleSys> |
||||||
|
implements RoleSysService { |
||||||
|
@Resource |
||||||
|
private RoleSysMapper roleSysMapper; |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<RoleSys> getRole(Object loginId) { |
||||||
|
return roleSysMapper.getRoleList(loginId); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,15 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper |
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.water.watersys.mapper.RoleSysMapper"> |
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.water.watersys.model.domain.RoleSys"> |
||||||
|
<id property="id" column="id" /> |
||||||
|
<result property="roleName" column="role_name" /> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
<sql id="Base_Column_List"> |
||||||
|
id,role_name |
||||||
|
</sql> |
||||||
|
</mapper> |
Loading…
Reference in new issue