package com.terra.common.mapper;
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.terra.common.entity.lf.OperatePo;
|
import com.terra.common.entity.lf.TokenPo;
|
import com.terra.common.entity.lf.UserPo;
|
import org.apache.ibatis.annotations.Insert;
|
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Select;
|
import org.springframework.stereotype.Repository;
|
|
import java.util.List;
|
import java.util.Map;
|
|
@Mapper
|
@Repository
|
public interface CommonMapper extends BaseMapper<OperatePo> {
|
@Insert("INSERT INTO lf.sys_operate(url, ip, exec, clazz, type, userid, bak, modular1, modular2) VALUES (#{url}, #{ip}, #{exec}, #{clazz}, #{type}, #{userid}, #{bak}, #{modular1}, #{modular2})")
|
int insertOperate(Map<String, Object> map);
|
|
@Select("select * from lf.sys_user where id = (select create_user from lf.sys_token where token=#{token} and expire > now() limit 1)")
|
UserPo selectByToken(String token);
|
|
@Select("select a.* from lf.sys_token a where token = #{token} and expire > now() limit 1")
|
TokenPo selectOneByToken(String token);
|
|
@Select("select ip from lf.sys_blacklist where type = #{type}")
|
List<String> selectIpList(Integer type);
|
|
@Select("SELECT DISTINCT e.perms || f.tag AS perms " +
|
"FROM lf.sys_user a " +
|
"INNER JOIN lf.sys_role_user b ON a.id = b.userid " +
|
"INNER JOIN lf.sys_role_menu_auth c ON b.roleid = c.roleid " +
|
"INNER JOIN lf.sys_menu_auth d ON c.menu_auth_id = d.id " +
|
"INNER JOIN lf.sys_menu e ON d.menuid = e.id " +
|
"INNER JOIN lf.sys_auth f ON d.authid = f.id " +
|
"WHERE e.perms IS NOT NULL " +
|
"AND (#{uid} IS NULL OR a.uid = #{uid}) " +
|
"ORDER BY perms")
|
List<String> selectPerms(String type);
|
}
|