<?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.huatek.busi.mapper.WiringDiagramMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.huatek.busi.entity.WiringDiagram">
        <id column="id" property="id" />
        <result column="file_name" property="fileName" />
        <result column="create_date" property="createDate" />
        <result column="file_size" property="fileSize" />
        <result column="file_type" property="fileType" />
        <result column="deleted" property="deleted" />
        <result column="file_path" property="filePath" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="BaseColumnList">
        id, file_name AS fileName, create_date AS createDate, file_size AS fileSize, file_type AS fileType, deleted, file_path AS filePath
    </sql>


    <select id="selectLists" parameterType="java.lang.String" resultType="com.huatek.busi.entity.WiringDiagram">
    select
    <include refid="BaseColumnList" />
    from wiring_diagram t  where deleted='0'

    <if test="fileName != null and fileName !=''" >
      and t.file_name like CONCAT("%",#{fileName},"%")
    </if>

    <if test="startTime != null">
      and t.create_date <![CDATA[>=]]> #{startTime}
    </if>
    <if test="endTime != null">
      and t.create_date <![CDATA[<=]]> #{endTime}
    </if>


    ORDER BY t.create_date DESC
  </select>


    <!-- 逻辑删除 -->
    <update id="deleteWiringDiagram" parameterType="java.util.List">
        update wiring_diagram set deleted='1'
        where id in
        <foreach collection="idList" index="index" item="id" separator="," open="(" close=")">
            #{id,jdbcType=VARCHAR}
        </foreach>
    </update>
    <!-- 逻辑删除 -->
    <update id="deleteModel" parameterType="java.util.List">
        update sys_model set deleted='1'
        where  model_id in
        <foreach collection="idList" index="index" item="id" separator="," open="(" close=")">
            #{id,jdbcType=VARCHAR}
        </foreach>
    </update>
</mapper>
