<?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.ruoyi.api.mapper.LoginMapper">

    <!--登陆-->
    <select id="login_getUser" resultType="java.lang.Integer">
        SELECT user_id FROM sys_user where login_name=#{name} and `password`=#{passw}  limit 1;
    </select>
    <select id="login_findSalt" resultType="java.lang.String">

       SELECT salt FROM `sys_user` where login_name=#{name}
    </select>

    <select id="selectMenuName" resultType="java.lang.String">
        select menu_name
        from sys_menu where  parent_id=2027 order by order_num
    </select>
    <select id="selectMenuNameByUserID" resultType="java.lang.String">
        select menu_name
        from sys_role_menu r
                 left join sys_menu m on r.menu_id = m.menu_id
        where r.role_id in (select role_id from sys_user_role where user_id=#{userID})
          and parent_id=2027
        group by menu_name,m.menu_id,m.order_num
        order by m.order_num;
    </select>


    <resultMap type="com.ruoyi.api.domain.APKVersion" id="PdaApkVersionResult">
        <result property="VersionCode"    column="version_code"    />
        <result property="VersionName"    column="version_name"    />
        <result property="ModifyContent"    column="modify_content"    />
        <result property="DownloadUrl"    column="download_url"    />
        <result property="ApkSize"    column="apk_size"    />
        <result property="ApkMd5"    column="apk_md5"    />
    </resultMap>


    <select id="getVersion" resultMap="PdaApkVersionResult">
        select version_code, version_name, modify_content, download_url, apk_size, apk_md5 from pda_apk_version order by create_time desc limit 1

    </select>



</mapper>