<?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.fuyuanshen.app.mapper.AppDeviceVoiceMapper">

    <resultMap type="com.fuyuanshen.app.domain.AppDeviceVoice" id="AppDeviceVoiceResult">
        <result property="id" column="id"/>
        <result property="videoName" column="video_name"/>
        <result property="videoUrl" column="video_url"/>
        <result property="deviceId" column="device_id"/>
        <result property="remark" column="remark"/>
        <result property="type" column="type"/>
        <result property="duration" column="duration"/>
        <result property="size" column="size"/>
        <result property="cover" column="cover"/>
        <result property="tenantId" column="tenant_id"/>
        <result property="createDept" column="create_dept"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>

    <sql id="selectAppDeviceVoiceVo">
        select id, video_name, video_url, device_id, remark, type, duration, size, cover, tenant_id, create_dept, create_by, create_time, update_by, update_time from app_device_voice
    </sql>

    <select id="selectPage" parameterType="com.fuyuanshen.app.domain.bo.AppDeviceVoiceBo" resultMap="AppDeviceVoiceResult">
        <include refid="selectAppDeviceVoiceVo"/>
        <where>
            <if test="videoName != null  and videoName != ''"> and video_name like concat('%', #{videoName}, '%')</if>
            <if test="videoUrl != null  and videoUrl != ''"> and video_url = #{videoUrl}</if>
            <if test="deviceId != null "> and device_id = #{deviceId}</if>
            <if test="type != null  and type != ''"> and type = #{type}</if>
            <if test="duration != null "> and duration = #{duration}</if>
            <if test="size != null "> and size = #{size}</if>
            <if test="cover != null  and cover != ''"> and cover = #{cover}</if>
        </where>
        order by create_time desc
    </select>

    <select id="selectList" parameterType="com.fuyuanshen.app.domain.bo.AppDeviceVoiceBo" resultMap="AppDeviceVoiceResult">
        <include refid="selectAppDeviceVoiceVo"/>
        <where>
            <if test="videoName != null  and videoName != ''"> and video_name like concat('%', #{videoName}, '%')</if>
            <if test="videoUrl != null  and videoUrl != ''"> and video_url = #{videoUrl}</if>
            <if test="deviceId != null "> and device_id = #{deviceId}</if>
            <if test="type != null  and type != ''"> and type = #{type}</if>
            <if test="duration != null "> and duration = #{duration}</if>
            <if test="size != null "> and size = #{size}</if>
            <if test="cover != null  and cover != ''"> and cover = #{cover}</if>
        </where>
        order by create_time desc
    </select>

</mapper>