13693261870
3 天以前 bbbc39611d232e013b900ba5e6a5a483a062e2f3
se-common/src/main/java/com/terra/common/mapper/CommonMapper.java
@@ -1,15 +1,41 @@
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 {
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})")
    public int insertOperate(Map<String,Object> map);
    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);
}