<?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.sooka.system.medicine.industry.mapper.TGuijiMedicineIndustryMapper">

    <resultMap type="TGuijiMedicineIndustry" id="TGuijiMedicineIndustryResult">
        <result property="id"    column="id"    />
        <result property="createTime"    column="create_time"    />
        <result property="cdTime"    column="cd_time"    />
        <result property="cdBatch"    column="cd_batch"    />
        <result property="cdOperation"    column="cd_operation"    />
        <result property="cdSource"    column="cd_source"    />
        <result property="year"    column="year"    />
        <result property="month"    column="month"    />
        <result property="economyType"    column="economyType"    />
        <result property="number"    column="number"    />
        <result property="yearOnYear"    column="yearOnYear"    />
        <result property="cityProportion"    column="cityProportion"    />
    </resultMap>

    <sql id="selectTGuijiMedicineIndustryVo">
        select id, create_time, cd_time, cd_batch, cd_operation, cd_source, year, month, economyType, number, yearOnYear, cityProportion from t_guiji_medicine_industry
    </sql>

    <select id="selectTGuijiMedicineIndustryList" parameterType="TGuijiMedicineIndustry" resultMap="TGuijiMedicineIndustryResult">
        <include refid="selectTGuijiMedicineIndustryVo"/>
        <where>
            <if test="cdTime != null  and cdTime != ''"> and cd_time = #{cdTime}</if>
            <if test="cdBatch != null  and cdBatch != ''"> and cd_batch = #{cdBatch}</if>
            <if test="cdOperation != null  and cdOperation != ''"> and cd_operation = #{cdOperation}</if>
            <if test="cdSource != null  and cdSource != ''"> and cd_source = #{cdSource}</if>
            <if test="year != null  and year != ''"> and year = #{year}</if>
            <if test="month != null  and month != ''"> and month = #{month}</if>
            <if test="economyType != null  and economyType != ''"> and economyType = #{economyType}</if>
            <if test="number != null  and number != ''"> and number = #{number}</if>
            <if test="yearOnYear != null  and yearOnYear != ''"> and yearOnYear = #{yearOnYear}</if>
            <if test="cityProportion != null  and cityProportion != ''"> and cityProportion = #{cityProportion}</if>
        </where>
    </select>

    <select id="selectTGuijiMedicineIndustryById" parameterType="String" resultMap="TGuijiMedicineIndustryResult">
        <include refid="selectTGuijiMedicineIndustryVo"/>
        where id = #{id}
    </select>

    <insert id="insertTGuijiMedicineIndustry" parameterType="TGuijiMedicineIndustry">
        insert into t_guiji_medicine_industry
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="createTime != null">create_time,</if>
            <if test="cdTime != null">cd_time,</if>
            <if test="cdBatch != null">cd_batch,</if>
            <if test="cdOperation != null">cd_operation,</if>
            <if test="cdSource != null">cd_source,</if>
            <if test="year != null">year,</if>
            <if test="month != null">month,</if>
            <if test="economyType != null">economyType,</if>
            <if test="number != null">number,</if>
            <if test="yearOnYear != null">yearOnYear,</if>
            <if test="cityProportion != null">cityProportion,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="cdTime != null">#{cdTime},</if>
            <if test="cdBatch != null">#{cdBatch},</if>
            <if test="cdOperation != null">#{cdOperation},</if>
            <if test="cdSource != null">#{cdSource},</if>
            <if test="year != null">#{year},</if>
            <if test="month != null">#{month},</if>
            <if test="economyType != null">#{economyType},</if>
            <if test="number != null">#{number},</if>
            <if test="yearOnYear != null">#{yearOnYear},</if>
            <if test="cityProportion != null">#{cityProportion},</if>
         </trim>
    </insert>

    <update id="updateTGuijiMedicineIndustry" parameterType="TGuijiMedicineIndustry">
        update t_guiji_medicine_industry
        <trim prefix="SET" suffixOverrides=",">
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="cdTime != null">cd_time = #{cdTime},</if>
            <if test="cdBatch != null">cd_batch = #{cdBatch},</if>
            <if test="cdOperation != null">cd_operation = #{cdOperation},</if>
            <if test="cdSource != null">cd_source = #{cdSource},</if>
            <if test="year != null">year = #{year},</if>
            <if test="month != null">month = #{month},</if>
            <if test="economyType != null">economyType = #{economyType},</if>
            <if test="number != null">number = #{number},</if>
            <if test="yearOnYear != null">yearOnYear = #{yearOnYear},</if>
            <if test="cityProportion != null">cityProportion = #{cityProportion},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTGuijiMedicineIndustryById" parameterType="String">
        delete from t_guiji_medicine_industry where id = #{id}
    </delete>

    <delete id="deleteTGuijiMedicineIndustryByIds" parameterType="String">
        delete from t_guiji_medicine_industry where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

</mapper>
