<?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.ey.biz.module.system.dal.mapper.app.AppMapper">

    <resultMap id="BaseResultMap" type="cn.ey.biz.module.system.controller.admin.app.vo.AppRespVO">
        <result column="id" jdbcType="BIGINT" property="id"/>
        <result column="app_code" jdbcType="VARCHAR" property="code"/>
        <result column="app_road" jdbcType="VARCHAR" property="appRoad"/>
        <result column="app_name" jdbcType="VARCHAR" property="name"/>
        <result column="url" jdbcType="VARCHAR" property="url"/>
        <result column="url_dev" jdbcType="VARCHAR" property="urlDev"/>
        <result column="status" jdbcType="VARCHAR" property="status"/>
        <result column="remark" jdbcType="VARCHAR" property="remark"/>
        <result column="app_type" jdbcType="VARCHAR" property="appType"/>
    </resultMap>

    <select id="selectPageApp"  resultMap="BaseResultMap">
        select
        app.id,
        app.app_code,
        app.app_road,
        app.url,
        app.url_dev,
        app.status,
        app.remark,
        app.app_type,
        i18.label app_name
        from system_app app
        LEFT JOIN infra_i18n i18 on i18.key= app.id AND i18.deleted = 0 AND i18.type = 'app' AND
        i18.lang=#{acceptLanguage}
        where app.deleted=0
        <if test="appPageReqVO.code != null  and appPageReqVO.code != ''">
            AND app.app_code like concat('%', #{appPageReqVO.code},'%')
        </if>
        <if test="appPageReqVO.status != null  and appPageReqVO.status != ''">
            AND app.status like concat('%', #{status},'%')
        </if>
        <if test="appPageReqVO.name != null  and appPageReqVO.name != ''">
            AND i18.label like concat('%', #{appPageReqVO.name},'%')
        </if>
        ORDER BY app.id desc
    </select>

</mapper>

