<?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.njcn.device.mapper.ProgramVersionMapper">

    <select id="getVersion" resultType="VersionVO">
        SELECT
        A.`Id` id,
        B.`Name` devType,
        A.`Name` name,
        A.`Protocol` protocol,
        A.`Date` date,
        C.`Name` updateBy,
        A.`Update_Time` updateTime,
        A.`Remark` remark,
        A.`Version_Type` versionType,
        A.`Version_Flag` versionFlag
        FROM
        cld_version A,
        sys_dict_data B,
        sys_user C
        WHERE A.State = 1
        AND A.Dev_Type = B.Id
        AND A.Update_By = C.Id
        <if test="devType != null and devType != ''">
            AND A.Dev_Type = '${devType}'
        </if>
    </select>

<!--    <select id="getProgramVersionById" resultType="ShowVersionVO">-->
<!--        SELECT-->
<!--        FROM-->
<!--        WHERE-->
<!--    </select>-->

    <update id="updateVersionFlag">
        UPDATE
        cld_version
        SET
        Version_Flag = 0
        WHERE Id = #{id}
    </update>

    <update id="updateVersionState">
        UPDATE
        cld_version
        SET
        State = 0
        WHERE Id = #{id}
    </update>

</mapper>