<?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.mall.mapper.MallPrintSettingMapper">

    <resultMap type="MallPrintSetting" id="MallPrintSettingResult">
        <result property="printSettingId"    column="print_setting_id"    />
        <result property="preparer"    column="preparer"    />
        <result property="checker"    column="checker"    />
        <result property="printed"    column="printed"    />
        <result property="phone"    column="phone"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectMallPrintSettingVo">
        select print_setting_id, preparer, checker, printed, phone, remark from mall_print_setting
    </sql>

    <select id="selectMallPrintSettingList" parameterType="MallPrintSetting" resultMap="MallPrintSettingResult">
        <include refid="selectMallPrintSettingVo"/>
        <where>
            <if test="printSettingId != null "> and print_setting_id = #{printSettingId}</if>
            <if test="preparer != null  and preparer != ''"> and preparer = #{preparer}</if>
            <if test="checker != null  and checker != ''"> and checker = #{checker}</if>
            <if test="printed != null  and printed != ''"> and printed = #{printed}</if>
            <if test="phone != null  and phone != ''"> and phone = #{phone}</if>
            <if test="remark != null  and remark != ''"> and remark = #{remark}</if>
        </where>
    </select>

    <select id="selectMallPrintSettingByPrintSettingId" parameterType="Integer" resultMap="MallPrintSettingResult">
        <include refid="selectMallPrintSettingVo"/>
        where print_setting_id = #{printSettingId}
    </select>

    <insert id="insertMallPrintSetting" parameterType="MallPrintSetting" useGeneratedKeys="true" keyProperty="printSettingId">
        insert into mall_print_setting
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="preparer != null">preparer,</if>
            <if test="checker != null">checker,</if>
            <if test="printed != null">printed,</if>
            <if test="phone != null">phone,</if>
            <if test="remark != null">remark,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="preparer != null">#{preparer},</if>
            <if test="checker != null">#{checker},</if>
            <if test="printed != null">#{printed},</if>
            <if test="phone != null">#{phone},</if>
            <if test="remark != null">#{remark},</if>
        </trim>
    </insert>

    <update id="updateMallPrintSetting" parameterType="MallPrintSetting">
        update mall_print_setting
        <trim prefix="SET" suffixOverrides=",">
            <if test="preparer != null">preparer = #{preparer},</if>
            <if test="checker != null">checker = #{checker},</if>
            <if test="printed != null">printed = #{printed},</if>
            <if test="phone != null">phone = #{phone},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where print_setting_id = #{printSettingId}
    </update>

    <delete id="deleteMallPrintSettingByPrintSettingId" parameterType="Integer">
        delete from mall_print_setting where print_setting_id = #{printSettingId}
    </delete>

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