<?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.zhyc.module.dairyProducts.mapper.XzParityCorrectionMapper">

    <resultMap type="XzParityCorrection" id="XzParityCorrectionResult">
        <result property="id"    column="id"    />
        <result property="parity"    column="parity"    />
        <result property="coef"    column="coef"    />
    </resultMap>

    <sql id="selectXzParityCorrectionVo">
        select id, parity, coef from xz_parity_correction
    </sql>

    <select id="selectXzParityCorrectionList" parameterType="XzParityCorrection" resultMap="XzParityCorrectionResult">
        <include refid="selectXzParityCorrectionVo"/>
        <where>
            <if test="parity != null "> and parity = #{parity}</if>
            <if test="coef != null "> and coef = #{coef}</if>
        </where>
    </select>

    <select id="selectXzParityCorrectionById" parameterType="Long" resultMap="XzParityCorrectionResult">
        <include refid="selectXzParityCorrectionVo"/>
        where id = #{id}
    </select>

    <insert id="insertXzParityCorrection" parameterType="XzParityCorrection" useGeneratedKeys="true" keyProperty="id">
        insert into xz_parity_correction
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="parity != null">parity,</if>
            <if test="coef != null">coef,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="parity != null">#{parity},</if>
            <if test="coef != null">#{coef},</if>
        </trim>
    </insert>

    <update id="updateXzParityCorrection" parameterType="XzParityCorrection">
        update xz_parity_correction
        <trim prefix="SET" suffixOverrides=",">
            <if test="parity != null">parity = #{parity},</if>
            <if test="coef != null">coef = #{coef},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteXzParityCorrectionById" parameterType="Long">
        delete from xz_parity_correction where id = #{id}
    </delete>

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