<?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="cn.com.ctop.common.mapper.UserAllocationMapper">

    <select id="queryListWithPermission" resultType="cn.com.ctop.common.entity.UserAllocation">
        select * from `jeecg-boot`.user_allocation where 1=1 ${permissionSql}
    </select>
    <select id="getAccountListByProjectList" resultType="com.alibaba.fastjson.JSONObject">
        select
        t1.project_id as 'projectId',
        t1.account_id as 'accountId',
        (select realname from `jeecg-boot`.sys_user where id = t1.user_id ) as 'userName',
        t1.auth_name as 'authName',
        t1.account_status as 'accountStatus'
        from `jeecg-boot`.ctop_user_allocation t1
        where t1.project_id in
        <foreach collection="list" item="item" separator=","
                 open="(" close=")">
            #{item}
        </foreach>
        <if test="designUserId!=null">
            and t1.user_id = #{designUserId}
        </if>
        order by t1.create_time desc
    </select>
</mapper>
