<?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.web.modules.screen.mapper.HomeScreenStandardMapper">

    <resultMap type="com.ruoyi.web.modules.screen.domain.vo.HomeScreenStandardListItemVo" id="StandardListItemResult">
        <id     property="id"               column="id"/>
        <result property="standardName"     column="standard_name"/>
        <result property="standardType"     column="standard_type"/>
        <result property="introduction"     column="introduction"/>
        <result property="contentFileUrl"   column="content_file_url"/>
        <result property="coverFileUrl"     column="cover_file_url"/>
        <result property="createTime"       column="create_time"/>
        <result property="publishTime"      column="publish_time"/>
    </resultMap>

    <sql id="screenStandardWhere">
        where publish_status = 1
          and create_time &gt;= #{yearStart}
          and create_time &lt;= #{yearEnd}
    </sql>

    <select id="selectBreedingMgmtForScreen" resultMap="StandardListItemResult">
        select id, standard_name, standard_type, introduction,
               content_file_url, cover_file_url, create_time, publish_time
        from biz_breeding_standard
        <include refid="screenStandardWhere"/>
          and standard_type in ('001001','001002','001003','001004')
        order by create_time desc, id desc
    </select>

    <select id="selectFeedingForScreen" resultMap="StandardListItemResult">
        select id, standard_name, standard_type, introduction,
               content_file_url, cover_file_url, create_time, publish_time
        from biz_feeding_standard
        <include refid="screenStandardWhere"/>
          and standard_type in ('001005','001006')
        order by create_time desc, id desc
    </select>

    <select id="selectEquipmentForScreen" resultMap="StandardListItemResult">
        select id, standard_name, standard_type, introduction,
               content_file_url, cover_file_url, create_time, publish_time
        from biz_equipment_work_standard
        <include refid="screenStandardWhere"/>
          and standard_type in ('001007','001008','001009','001010')
        order by create_time desc, id desc
    </select>

    <select id="selectTreatmentForScreen" resultMap="StandardListItemResult">
        select id, standard_name, standard_type, introduction,
               content_file_url, cover_file_url, create_time, publish_time
        from biz_epidemic_treatment_standard
        <include refid="screenStandardWhere"/>
          and standard_type in ('001013')
        order by create_time desc, id desc
    </select>

    <select id="selectGrowthForScreen" resultMap="StandardListItemResult">
        select id, standard_name, standard_type, introduction,
               content_file_url, cover_file_url, create_time, publish_time
        from biz_growth_slaughter_standard
        <include refid="screenStandardWhere"/>
          and standard_type in ('001011','001012')
        order by create_time desc, id desc
    </select>
</mapper>
