<?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.yeejoin.amos.boot.module.hygf.api.mapper.ToDoTasksMapper">


    <select id="getTasksRole"  resultType="com.yeejoin.amos.boot.module.hygf.api.dto.TasksRole">
    select
    privilege_user_org_role.USER_ID  amosUserId
    from privilege_user_org_role

    LEFT JOIN privilege_agency_user on privilege_agency_user.USER_ID=privilege_user_org_role.USER_ID

    LEFT JOIN privilege_company  on privilege_company.SEQUENCE_NBR =privilege_user_org_role.COMPANY_SEQ

    where  privilege_user_org_role.AGENCY_CODE='JXIOP'  and privilege_agency_user.IS_DELETED=0 and privilege_agency_user.LOCK_STATUS='UNLOCK'

    and privilege_user_org_role.ROLE_SEQ=#{roleId}

    <if test="orgCode!=null">
        and    privilege_company.ORG_CODE   like concat(#{orgCode},'%')
    </if>
     ORDER BY  privilege_agency_user.USER_ID DESC
    </select>

</mapper>
