PromotionParamsMapper.xml 2.87 KB
<?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.yoho.search.dal.PromotionParamsMapper">
    <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.PromotionParams">
        <id column="promotion_id" property="promotionId" jdbcType="INTEGER"/>
        <result column="condition_param" property="conditionParam" jdbcType="VARCHAR"/>
        <result column="is_del" property="isDel" jdbcType="VARCHAR"/>
        <result column="promotion_type" property="promotionType" jdbcType="VARCHAR"/>
        <result column="action_param" property="actionParam" jdbcType="VARCHAR"/>
        <result column="reject_param" property="rejectParam" jdbcType="VARCHAR"/>
    </resultMap>
    <sql id="Base_Column_List">
    promotion_id, condition_param, is_del ,promotion_type,action_param,reject_param
    </sql>

    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
        select
        <include refid="Base_Column_List"/>
        from promotion_params
        where promotion_id = #{id,jdbcType=INTEGER}
        limit 1
    </select>

    <select id="selectByPromotionIdList" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from promotion_params where promotion_id in
        <foreach item="item" index="index" collection="list"
                 open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>

    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from promotion_params where promotion_id = #{id,jdbcType=INTEGER}
  </delete>

    <insert id="insert" parameterType="com.yoho.search.dal.model.PromotionParams">
    insert into promotion_params (promotion_id, condition_param, is_del,promotion_type,action_param,reject_param)
    values (#{promotionId,jdbcType=INTEGER},
    #{conditionParam,jdbcType=VARCHAR},
    #{isDel,jdbcType=VARCHAR},
    #{promotionType,jdbcType=VARCHAR},
    #{actionParam,jdbcType=VARCHAR},
    #{rejectParam,jdbcType=VARCHAR})
    </insert>

    <update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.PromotionParams">
    update promotion_params
    set condition_param = #{conditionParam,jdbcType=VARCHAR},
    is_del = #{isDel,jdbcType=VARCHAR},
    promotion_type= #{promotionType,jdbcType=VARCHAR},
    action_param= #{actionParam,jdbcType=VARCHAR},
    reject_param= #{rejectParam,jdbcType=VARCHAR}
    where promotion_id = #{promotionId,jdbcType=INTEGER}
  </update>

    <select id="selectByIds" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from promotion_params where promotion_id in
        <foreach item="item" index="index" collection="list"
                 open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>

</mapper>