ZhuDongming
2019-10-22 28215e381131b0919567ec5c3f236b29ebd3ad5c
update
14 files modified
306 ■■■■ changed files
src/main/java/com/moral/controller/AccountController.java 1 ●●●● patch | view | raw | blame | history
src/main/java/com/moral/controller/MenuController.java 12 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/controller/RoleController.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/entity/Role.java 6 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/mapper/AccountMapper.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/security/auth/login/LoginAuthenticationProvider.java 10 ●●●● patch | view | raw | blame | history
src/main/java/com/moral/security/endpoint/RefreshTokenEndpoint.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/service/AccountService.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/service/impl/AccountServiceImpl.java 82 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/service/impl/MenuServiceImpl.java 4 ●●● patch | view | raw | blame | history
src/main/java/com/moral/service/impl/RoleServiceImpl.java 1 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/AccountMapper.xml 132 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/MenuMapper.xml 3 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/RoleMapper.xml 20 ●●●● patch | view | raw | blame | history
src/main/java/com/moral/controller/AccountController.java
@@ -51,4 +51,5 @@
        Integer result = accountService.getAccountCountByAccountName(accountName);
        return new ResultBean<Integer>(result);
    }
}
src/main/java/com/moral/controller/MenuController.java
@@ -1,5 +1,7 @@
package com.moral.controller;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
@@ -12,6 +14,7 @@
import com.moral.common.bean.PageBean;
import com.moral.common.bean.ResultBean;
import com.moral.entity.Menu;
import com.moral.service.AccountService;
import com.moral.service.ChannelService;
import com.moral.service.MenuService;
@@ -24,6 +27,9 @@
    @Resource
    ChannelService channelService;
    @Resource
    AccountService accountService;
    @GetMapping("count-by-example")
    public ResultBean<Integer> countByExample(PageBean pageBean) {
@@ -67,4 +73,10 @@
        ResultBean resultBean = new ResultBean(ResultBean.SUCCESS);
        return resultBean;
    }
    @GetMapping("menu-by-account")
    public Map<String,Object> getMenuListsByAccountName(String accountName) {
        Map<String,Object> mapResult = accountService.getMenuListsByAccountName(accountName);
        return mapResult;
    }
}
src/main/java/com/moral/controller/RoleController.java
@@ -22,9 +22,6 @@
    @Autowired
    RoleService roleService;
    @Autowired
    ChannelService channelService;
    @GetMapping("count-by-example")
    public ResultBean<Integer> countByExample(PageBean pageBean){
        return  new ResultBean<Integer>(roleService.countByExample(pageBean));
@@ -33,13 +30,6 @@
    @GetMapping("role-list")
    public PageBean getRoleList(PageBean pageBean) {
        return roleService.getRoleList(pageBean);
    }
    @GetMapping("channel-list")
    public ResultBean getChannelList(String channelName) {
        ResultBean resultBean = new ResultBean(ResultBean.SUCCESS);
        resultBean.setData(channelService.getChannelList(channelName));
        return resultBean;
    }
    @PostMapping("add-or-modify")
src/main/java/com/moral/entity/Role.java
@@ -3,7 +3,6 @@
import java.util.Date;
import javax.persistence.Id;
import javax.persistence.Transient;
import lombok.Data;
@@ -16,8 +15,6 @@
    private String roleName;
    private Integer channelId;
    private String isDelete;
    private String roleRemark;
@@ -29,8 +26,5 @@
    private Date updateTime;
    private String updateUser;
    @Transient
    private Channel channel;
}
src/main/java/com/moral/mapper/AccountMapper.java
@@ -7,6 +7,8 @@
import com.moral.common.mapper.BaseMapper;
import com.moral.entity.Account;
import com.moral.entity.Menu;
import com.moral.entity.Role;
public interface AccountMapper extends BaseMapper<Account> {
@@ -18,4 +20,12 @@
    List<Account> getAccountList(@Param("accountName") String accountName);
    List<Role> getRolesByAccountName(@Param("accountName") String accountName);
    List<Menu> getParentMenuListsByAccountName(@Param("accountName") String accountName);
    String getEmailByAccountName(@Param("accountName") String accountName);
    List<Menu> getChildMenuIdsByAccountName(@Param("accountName") String accountName, @Param("id") Integer id);
}
src/main/java/com/moral/security/auth/login/LoginAuthenticationProvider.java
@@ -1,9 +1,11 @@
package com.moral.security.auth.login;
import com.moral.entity.Account;
import com.moral.entity.Role;
import com.moral.security.exceptions.AccountExpiredBadCredentialsException;
import com.moral.security.model.UserContext;
import com.moral.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.BadCredentialsException;
@@ -17,6 +19,7 @@
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.List;
@@ -54,6 +57,7 @@
        String password = (String) authentication.getCredentials();
        LoginMode mode = (LoginMode) authentication.getDetails();
        Account account = accountService.queryAccountByName(accountName).orElseThrow(() -> new UsernameNotFoundException("User not found: " + accountName));
        List<Role> roleList = accountService.getRolesByAccountName(accountName);
        Date expireTime = Optional.ofNullable(account.getExpireTime())
                .orElseThrow(
        ()-> new AccountExpiredBadCredentialsException("Authentication Failed. Account has expired.")
@@ -66,10 +70,10 @@
            throw new BadCredentialsException("Authentication Failed. Username or Password not valid.");
        }
        if (account.getRoles() == null) {
            throw new InsufficientAuthenticationException("User has no roles assigned");
        if (CollectionUtils.isEmpty(roleList)) {
            throw new InsufficientAuthenticationException("Authentication Failed. User has no roles assigned");
        }
        List<GrantedAuthority> authorities = account.getRoles().stream()
        List<GrantedAuthority> authorities = roleList.stream()
                .map(authority -> new SimpleGrantedAuthority(authority.getRoleName()))
                .collect(Collectors.toList());
src/main/java/com/moral/security/endpoint/RefreshTokenEndpoint.java
@@ -1,7 +1,7 @@
package com.moral.security.endpoint;
import com.moral.entity.Account;
import com.moral.security.auth.JwtAuthenticationToken;
import com.moral.entity.Role;
import com.moral.security.auth.login.LoginMode;
import com.moral.security.model.token.JwtTokenFactory;
import com.moral.security.auth.jwt.extractor.TokenExtractor;
@@ -14,6 +14,8 @@
import com.moral.security.model.token.RawAccessJwtToken;
import com.moral.security.model.token.RefreshToken;
import com.moral.service.AccountService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.MediaType;
@@ -69,9 +71,9 @@
        // 从refresh token里 拿到登录方式
        LoginMode mode = LoginMode.valueOf(refreshToken.getClaims().getBody().get("mode").toString());
        Account account = accountService.queryAccountByName(subject).orElseThrow(() -> new UsernameNotFoundException("User not found: " + subject));
        if (account.getRoles() == null) throw new InsufficientAuthenticationException("User has no roles assigned");
        List<GrantedAuthority> authorities = account.getRoles().stream()
        List<Role> roleList = accountService.getRolesByAccountName(account.getAccountName());
        if (CollectionUtils.isEmpty(roleList)) throw new InsufficientAuthenticationException("User has no roles assigned");
        List<GrantedAuthority> authorities = roleList.stream()
                .map(authority -> new SimpleGrantedAuthority(authority.getRoleName()))
                .collect(Collectors.toList());
src/main/java/com/moral/service/AccountService.java
@@ -6,6 +6,7 @@
import com.moral.common.bean.PageBean;
import com.moral.entity.Account;
import com.moral.entity.Role;
public interface AccountService {
@@ -32,4 +33,8 @@
    Map<String, Object> getOrganizationIdByAccountId(String id);
    List<Account> getAccountList(String accountName);
    List<Role> getRolesByAccountName(String accountName);
    Map<String, Object> getMenuListsByAccountName(String accountName);
}
src/main/java/com/moral/service/impl/AccountServiceImpl.java
@@ -1,12 +1,20 @@
package com.moral.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import static com.moral.common.bean.Constants.IS_DELETE_FALSE;
import static com.moral.common.bean.Constants.IS_DELETE_TRUE;
import static com.moral.common.util.ResourceUtil.getValue;
import static org.apache.commons.lang3.StringUtils.isNumeric;
import static org.springframework.util.ObjectUtils.isEmpty;
import java.util.*;
import javax.annotation.Resource;
@@ -14,18 +22,21 @@
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import com.github.pagehelper.PageHelper;
import com.moral.common.bean.Constants;
import com.moral.common.bean.PageBean;
import com.moral.common.exception.BusinessException;
import com.moral.common.util.Crypto;
import com.moral.common.util.ResourceUtil;
import com.moral.common.util.ValidateUtil;
import com.moral.entity.Account;
import com.moral.entity.Menu;
import com.moral.entity.Organization;
import com.moral.entity.Role;
import com.moral.mapper.AccountMapper;
import com.moral.mapper.MenuMapper;
import com.moral.mapper.OrganizationMapper;
import com.moral.service.AccountService;
import com.moral.service.OrganizationService;
@@ -37,6 +48,7 @@
public class AccountServiceImpl implements AccountService {
    @Resource
    private  BCryptPasswordEncoder encoder;
    @Resource
    private AccountMapper accountMapper;
@@ -212,4 +224,68 @@
        List<Account> accountList = accountMapper.getAccountList(accountName);
        return accountList;
    }
    @Override
    public List<Role> getRolesByAccountName(String accountName) {
        List<Role> roleList = accountMapper.getRolesByAccountName(accountName);
        return roleList;
    }
    @Override
    public Map<String, Object> getMenuListsByAccountName(String accountName) {
        List<Menu> menuList=accountMapper.getParentMenuListsByAccountName(accountName);
        String email=accountMapper.getEmailByAccountName(accountName);
        Map<String,Object> mapList=new LinkedHashMap<>();
        Map<String,Object> appMap=new LinkedHashMap<>();
        appMap.put("name","七星瓢虫环境监测");
        appMap.put("description","七星瓢虫环境监测后台配置中心");
        mapList.put("app",appMap);
        Map<String,Object> userMap=new LinkedHashMap<>();
        userMap.put("name",accountName);
        userMap.put("avatar","./assets/img/zorro.svg");
        userMap.put("email",email);
        mapList.put("user",userMap);
        Map<String,Object> navigationMap=new LinkedHashMap<>();
        Map<String,Object> navigationChildMap=new LinkedHashMap<>();
        navigationChildMap.put("text","工作台");
        navigationChildMap.put("link", "/dashboard/workplace");
        navigationChildMap.put("icon","icon-speedometer");
        navigationChildMap.put("translate","dashboard_workplace");
        List<Map> navigationChildList=new ArrayList<>();
        navigationChildList.add(navigationChildMap);
        navigationMap.put("text","主导航");
        navigationMap.put("translate","main_navigation");
        navigationMap.put("group",true);
        navigationMap.put("children",navigationChildList);
        Map<String,Object> systemMap=new LinkedHashMap<>();
        systemMap.put("text","系统模块");
        systemMap.put("group",true);
        List<Map> systemList=new ArrayList<>();
        if(!CollectionUtils.isEmpty(menuList)){
            for(Menu m:menuList){
                Map<String,Object> systemChildMap=new LinkedHashMap<>();
                systemChildMap.put("text",m.getMenuName());
                systemChildMap.put("icon",m.getMenuIcon());
                List<Menu> childMenuLists=accountMapper.getChildMenuIdsByAccountName(accountName,m.getId());
                List<Map> systemSonList=new ArrayList<>();
                if(!CollectionUtils.isEmpty(childMenuLists)){
                    for(Menu childMenu:childMenuLists){
                        Map<String,Object> systemSonMap=new LinkedHashMap<>();
                        systemSonMap.put("text",childMenu.getMenuName());
                        systemSonMap.put("link",childMenu.getMenuUrl());
                        systemSonList.add(systemSonMap);
                    }
                }
                systemChildMap.put("children",systemSonList);
                systemList.add(systemChildMap);
            }
        }
        systemMap.put("children",systemList);
        List<Map> list=new ArrayList<>();
        list.add(navigationMap);
        list.add(systemMap);
        mapList.put("menu",list);
        return mapList;
    }
}
src/main/java/com/moral/service/impl/MenuServiceImpl.java
@@ -34,6 +34,9 @@
    @Transactional
    public void addOrModify(Menu menu) {
        try {
            if(menu.getMenuParentId()==null){
                menu.setMenuParentId(0);
            }
            menu.setUpdateTime(new Date());
            menu.setUpdateUser(menu.getUpdateUser());
            if (menu.getId() != null) {
@@ -47,7 +50,6 @@
                    menu.setId(menuResult.getId());
                    menuMapper.updateByPrimaryKeySelective(menu);
                } else {
                    System.out.println("channelId:"+menu.getChannelId());
                    menu.setChannelId(menu.getChannelId());
                    menu.setIsDelete(Constants.IS_DELETE_FALSE);
                    menu.setCreateTime(new Date());
src/main/java/com/moral/service/impl/RoleServiceImpl.java
@@ -42,7 +42,6 @@
                roleQuery.setIsDelete(Constants.IS_DELETE_FALSE);
                Role roleResult = roleMapper.selectOne(roleQuery);
                if (roleResult == null) {
                    role.setChannelId(role.getChannelId());
                    role.setIsDelete(Constants.IS_DELETE_FALSE);
                    role.setCreateTime(new Date());
                    role.setCreateUser(role.getCreateUser());
src/main/resources/mapper/AccountMapper.xml
@@ -1,35 +1,56 @@
<?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.moral.mapper.AccountMapper">
  <resultMap id="BaseResultMap" type="com.moral.entity.Account">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="account_name" jdbcType="VARCHAR" property="accountName" />
    <result column="password" jdbcType="VARCHAR" property="password" />
    <result column="organization_id" jdbcType="INTEGER" property="organizationId" />
    <result column="email" jdbcType="VARCHAR" property="email" />
    <result column="mobile" jdbcType="VARCHAR" property="mobile" />
    <result column="weixin" jdbcType="VARCHAR" property="weixin" />
    <result column="is_delete" jdbcType="CHAR" property="isDelete" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime" />
    <result column="user_name" jdbcType="VARCHAR" property="userName" />
      <association property="jwtTokenVersion" javaType="com.moral.entity.JwtTokenVersion">
          <result column="jwt_token_version_id" property="id" jdbcType="INTEGER" />
          <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
      </association>
  </resultMap>
  <sql id="Base_Column_List">
    <resultMap id="BaseResultMap" type="com.moral.entity.Account">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="account_name" jdbcType="VARCHAR" property="accountName"/>
        <result column="password" jdbcType="VARCHAR" property="password"/>
        <result column="organization_id" jdbcType="INTEGER" property="organizationId"/>
        <result column="email" jdbcType="VARCHAR" property="email"/>
        <result column="mobile" jdbcType="VARCHAR" property="mobile"/>
        <result column="weixin" jdbcType="VARCHAR" property="weixin"/>
        <result column="is_delete" jdbcType="CHAR" property="isDelete"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime"/>
        <result column="user_name" jdbcType="VARCHAR" property="userName"/>
        <association property="jwtTokenVersion" javaType="com.moral.entity.JwtTokenVersion">
            <result column="jwt_token_version_id" property="id" jdbcType="INTEGER"/>
            <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
        </association>
    </resultMap>
    <resultMap id="RoleResultMap" type="com.moral.entity.Role">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="role_code" property="roleCode" jdbcType="VARCHAR"/>
        <result column="role_name" property="roleName" jdbcType="VARCHAR"/>
        <result column="is_delete" property="isDelete" jdbcType="CHAR"/>
        <result column="role_remark" property="roleRemark" jdbcType="VARCHAR"/>
        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
        <result column="create_user" property="createUser" jdbcType="VARCHAR"/>
        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
        <result column="update_user" property="updateUser" jdbcType="VARCHAR"/>
    </resultMap>
    <resultMap id="MenuResultMap" type="com.moral.entity.Menu">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="menu_name" property="menuName" jdbcType="VARCHAR"/>
        <result column="menu_icon" property="menuIcon" jdbcType="VARCHAR"/>
        <result column="menu_url" property="menuUrl" jdbcType="VARCHAR"/>
        <result column="menu_parent_id" property="menuParentId" jdbcType="INTEGER"/>
    </resultMap>
    <sql id="Base_Column_List">
    id, account_name, password, organization_id, email, mobile, weixin, is_delete, create_time, 
    expire_time, user_name
  </sql>
  <select id="getByAccountName" parameterType="java.lang.String" resultMap="BaseResultMap">
    <select id="getByAccountName" parameterType="java.lang.String" resultMap="BaseResultMap">
    select 
      acc.*,jtv.id as jwt_token_version_id,jtv.update_time as update_time
    from account acc
    left join jwt_token_version jtv on acc.account_name = jtv.account_name
    where acc.account_name = #{name,jdbcType=VARCHAR}
   </select>
    <select id="getRoleNameByAccountId" resultType="java.util.Map">
    <select id="getRoleNameByAccountId" resultType="java.util.Map">
        SELECT
            r.role_name
        FROM
@@ -39,8 +60,8 @@
            ar.role_id = r.id
        AND ar.account_id = #{accountId}
    </select>
    <select id="getOrganizationIdByAccountId" resultType="java.util.Map">
    <select id="getOrganizationIdByAccountId" resultType="java.util.Map">
        SELECT organization_id
        FROM account
        WHERE id=#{id}
@@ -55,4 +76,71 @@
            and account_name like concat('%',#{accountName},'%')
        </if>
    </select>
    <select id="getRolesByAccountName" resultMap="RoleResultMap" parameterType="java.lang.String">
        select
        r.*
        from
        role r
        right join account_role ar on ar.role_id = r.id
        right join account a on a.id = ar.account_id
        where
        a.account_name = #{accountName} and r.id is not null
    </select>
    <select id="getParentMenuListsByAccountName" resultMap="MenuResultMap" parameterType="java.lang.String">
        select
        DISTINCT
        m.id,m.menu_name,m.menu_icon,m.menu_url,m.menu_order,m.menu_parent_id
        from
        menu m
        right join role_menu rm on rm.channel_id = m.channel_id and rm.menu_id=m.id and m.channel_id=2
        right join role on rm.role_id in
        (
            select
                r.id
            from
                role r
            right join
                account_role ar on ar.role_id = r.id
            right join
                account a on a.id = ar.account_id
            where
                a.account_name = #{accountName} and r.is_delete=0 and r.id is not null
        )
        where m.menu_parent_id=0
        order by m.menu_order
    </select>
    <select id="getChildMenuIdsByAccountName" resultMap="MenuResultMap">
        select
        DISTINCT
        m.id,m.menu_name,m.menu_icon,m.menu_url,m.menu_order,m.menu_parent_id
        from
        menu m
        right join role_menu rm on rm.channel_id = m.channel_id and rm.menu_id=m.id and m.channel_id=2
        right join role on rm.role_id in
        (
            select
                r.id
            from
                role r
            right join
                account_role ar on ar.role_id = r.id
            right join
                account a on a.id = ar.account_id
            where
                a.account_name = #{accountName} and r.is_delete=0 and r.id is not null
        )
        where m.menu_parent_id = #{id}
        order by m.menu_order
    </select>
    <select id="getEmailByAccountName" resultType="java.lang.String">
        select
        email
        from account
        where account_name = #{accountName}
    </select>
</mapper>
src/main/resources/mapper/MenuMapper.xml
@@ -104,7 +104,7 @@
        from menu
        where id IN
        (select distinct(menu_parent_Id) from menu
        where menu_parent_Id is not null)
        where menu_parent_Id <![CDATA[ <> ]]> 0)
        <if test="menuName != 'null'">
            and menu_name like concat('%',#{menuName},'%')
        </if>
@@ -119,4 +119,5 @@
            and menu_name like concat('%',#{menuName},'%')
        </if>
    </select>
</mapper>
src/main/resources/mapper/RoleMapper.xml
@@ -2,11 +2,10 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.moral.mapper.RoleMapper">
    <resultMap id="ResultMap" type="com.moral.entity.Role">
    <resultMap id="BaseResultMap" type="com.moral.entity.Role">
        <id column="id" property="id" jdbcType="INTEGER" />
        <result column="role_code" property="roleCode" jdbcType="VARCHAR" />
        <result column="role_name" property="roleName" jdbcType="VARCHAR" />
        <result column="channel_id" property="channelId" jdbcType="INTEGER" />
        <result column="is_delete" property="isDelete" jdbcType="CHAR" />
        <result column="role_remark" property="roleRemark" jdbcType="VARCHAR" />
        <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
@@ -15,15 +14,8 @@
        <result column="update_user" property="updateUser" jdbcType="VARCHAR" />
    </resultMap>
    <resultMap id="BaseResultMap" type="com.moral.entity.Role" extends="ResultMap">
        <association property="channel" javaType="com.moral.entity.Channel">
            <result column="channel_id" jdbcType="INTEGER" property="id" />
            <result column="channel_name" jdbcType="VARCHAR" property="channelName" />
        </association>
    </resultMap>
    <sql id="Base_Column_List" >
        id, role_code, role_name, channel_id, is_delete, role_remark, create_time, create_user,
        id, role_code, role_name, is_delete, role_remark, create_time, create_user,
        update_time, update_user
    </sql>
@@ -57,7 +49,7 @@
        </where>
    </sql>
    <select id="getRoleListByName" resultMap="ResultMap">
    <select id="getRoleListByName" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from role
@@ -69,10 +61,8 @@
    <select id="getRoleList" resultMap="BaseResultMap">
        select
        r.*,
        c.channel_name
        from role r
        left join channel c on r.channel_id = c.id
        <include refid="Base_Column_List"/>
        from role
        <if test="_parameter != null" >
            <include refid="Example_Where_Clause" />
        </if>