<?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.yeshi.fanli.dao.mybatis.push.PushGoodsGroupMapper">
|
<resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.push.PushGoodsGroup">
|
<id column="gro_id" property="id" jdbcType="BIGINT"/>
|
<result column="gro_push_id" property="pushId" jdbcType="BIGINT"/>
|
|
<association property="commonGoods" column="gro_goods_id"
|
resultMap="com.yeshi.fanli.dao.mybatis.goods.CommonGoodsMapper.BaseResultMap" />
|
|
</resultMap>
|
<sql id="Base_Column_List">gro_id,gro_push_id,gro_goods_id</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
|
<include refid="Base_Column_List"/>from yeshi_ec_push_goods_group where gro_id = #{id,jdbcType=BIGINT}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_push_goods_group where gro_id = #{id,jdbcType=BIGINT}</delete>
|
<insert id="insert" parameterType="com.yeshi.fanli.entity.push.PushGoodsGroup" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_goods_group (gro_id,gro_push_id,gro_goods_id) values (#{id,jdbcType=BIGINT},#{pushId,jdbcType=BIGINT},#{commonGoods.id,jdbcType=BIGINT})</insert>
|
<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.push.PushGoodsGroup" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_goods_group
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">gro_id,</if>
|
<if test="pushId != null">gro_push_id,</if>
|
<if test="commonGoods != null">gro_goods_id,</if>
|
</trim>values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="pushId != null">#{pushId,jdbcType=BIGINT},</if>
|
<if test="commonGoods != null">#{commonGoods.id,jdbcType=BIGINT},</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.push.PushGoodsGroup">update yeshi_ec_push_goods_group set gro_push_id = #{pushId,jdbcType=BIGINT},gro_goods_id = #{commonGoods.id,jdbcType=BIGINT} where gro_id = #{id,jdbcType=BIGINT}</update>
|
<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.push.PushGoodsGroup">update yeshi_ec_push_goods_group
|
<set>
|
<if test="pushId != null">gro_push_id=#{pushId,jdbcType=BIGINT},</if>
|
<if test="commonGoods != null">gro_goods_id=#{commonGoods.id,jdbcType=BIGINT},</if>
|
</set> where gro_id = #{id,jdbcType=BIGINT}
|
</update>
|
|
<delete id="deleteBatchByPrimaryKey" parameterType="java.util.List">
|
delete from yeshi_ec_push_goods_group where gro_id in
|
<foreach item="item" collection="list" open="(" separator=","
|
close=")">#{item}</foreach>
|
</delete>
|
|
<delete id="deleteByPushId" parameterType="java.lang.Long">
|
delete from yeshi_ec_push_goods_group
|
where gro_push_id = #{pushId,jdbcType=BIGINT}
|
</delete>
|
|
|
<delete id="deleteBatchByPushId" parameterType="java.util.List">
|
delete from yeshi_ec_push_goods_group where gro_push_id in
|
<foreach item="item" collection="list" open="(" separator=","
|
close=")">#{item}</foreach>
|
</delete>
|
|
<select id="selectByPushId" resultMap="BaseResultMap" parameterType="java.lang.Long">
|
select gro_id,gro_push_id,gro_goods_id as cg_id from yeshi_ec_push_goods_group
|
where gro_push_id = #{pushId,jdbcType=BIGINT}
|
</select>
|
|
<insert id="insertBatch" parameterType="java.util.List">
|
insert into yeshi_ec_push_goods_group
|
(<include refid="Base_Column_List" />)
|
values
|
<foreach collection="list" item="item" separator=",">
|
(
|
#{item.id,jdbcType=BIGINT},
|
#{item.pushId,jdbcType=BIGINT},
|
#{item.commonGoods.id,jdbcType=BIGINT}
|
)
|
</foreach>
|
</insert>
|
|
<select id="countByPushId" resultType="java.lang.Long" parameterType="java.lang.Long">
|
SELECT IFNULL(count(gro_id),0) from yeshi_ec_push_goods_group
|
where gro_push_id = #{pushId,jdbcType=BIGINT}
|
</select>
|
|
<select id="getAllInfoByPushId" resultMap="BaseResultMap" parameterType="java.lang.Long">
|
SELECT * FROM yeshi_ec_push_goods_group ph
|
LEFT JOIN `yeshi_ec_common_goods` gg ON ph.`gro_goods_id` = gg.`cg_id`
|
WHERE gro_push_id = #{pushId,jdbcType=BIGINT}
|
</select>
|
|
</mapper>
|