<?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.shop.BanLiShopGoodsMapper">
|
<resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.shop.BanLiShopGoods">
|
<id column="sg_id" property="id" jdbcType="BIGINT" />
|
<result column="sg_title" property="title" jdbcType="VARCHAR" />
|
<result column="sg_sales_count" property="salesCount" jdbcType="BIGINT" />
|
<result column="sg_picture" property="picture" jdbcType="VARCHAR" />
|
<result column="sg_desc" property="desc" jdbcType="VARCHAR" />
|
<result column="sg_charge_type" property="chargeType" jdbcType="VARCHAR" />
|
<result column="sg_state" property="state" jdbcType="INTEGER" />
|
<result column="sg_create_time" property="createTime" jdbcType="TIMESTAMP" />
|
<result column="sg_update_time" property="updateTime" jdbcType="TIMESTAMP" />
|
<result column="sg_weight" property="weight" jdbcType="INTEGER" />
|
<result column="so_square_picture" property="squarePicture"
|
jdbcType="VARCHAR" />
|
<association property="goodsClass" column="sg_class_id"
|
javaType="com.yeshi.fanli.entity.shop.BanLiShopGoodsClass">
|
<id column="sg_class_id" property="id" jdbcType="BIGINT" />
|
</association>
|
</resultMap>
|
<resultMap id="BaseResultDetailMap" type="com.yeshi.fanli.entity.shop.BanLiShopGoods">
|
<id column="sg_id" property="id" jdbcType="BIGINT" />
|
<result column="sg_title" property="title" jdbcType="VARCHAR" />
|
<result column="sg_sales_count" property="salesCount" jdbcType="BIGINT" />
|
<result column="sg_picture" property="picture" jdbcType="VARCHAR" />
|
<result column="sg_desc" property="desc" jdbcType="VARCHAR" />
|
<result column="sg_charge_type" property="chargeType" jdbcType="VARCHAR" />
|
<result column="sg_state" property="state" jdbcType="INTEGER" />
|
<result column="sg_create_time" property="createTime" jdbcType="TIMESTAMP" />
|
<result column="sg_update_time" property="updateTime" jdbcType="TIMESTAMP" />
|
<result column="sg_weight" property="weight" jdbcType="INTEGER" />
|
<result column="so_square_picture" property="squarePicture"
|
jdbcType="VARCHAR" />
|
<association property="goodsClass" column="sg_class_id"
|
javaType="com.yeshi.fanli.entity.shop.BanLiShopGoodsClass"
|
select="com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsClassMapper.selectByPrimaryKey" />
|
<collection property="setsList" column="sg_id"
|
select="com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsSetsMapper.listDetailByGoodsId" />
|
<collection property="imgList" column="sg_id"
|
select="com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsImgMapper.listByGoodsId" />
|
</resultMap>
|
<sql id="Base_Column_List">sg_id,sg_title,sg_class_id,sg_sales_count,sg_picture,sg_desc,sg_charge_type,sg_state,sg_create_time,sg_update_time,sg_weight,so_square_picture
|
</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
parameterType="java.lang.Long">
|
select
|
<include refid="Base_Column_List" />
|
from yeshi_ec_shop_goods where sg_id = #{id,jdbcType=BIGINT}
|
</select>
|
<select id="selectDetailByPrimaryKey" resultMap="BaseResultDetailMap"
|
parameterType="java.lang.Long">
|
select
|
<include refid="Base_Column_List" />
|
from yeshi_ec_shop_goods where sg_id = #{0}
|
</select>
|
<select id="listGoods" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List" />
|
from yeshi_ec_shop_goods where 1=1
|
<if test="key != null and key != ''">
|
and sg_title like '%${key}%'
|
</if>
|
<if test="state!=null">and sg_state=#{state}</if>
|
order by sg_weight desc limit #{start},#{count}
|
</select>
|
<select id="countGoods" resultType="java.lang.Long">
|
select count(*) from yeshi_ec_shop_goods where 1=1
|
<if test="key != null and key != ''">
|
and sg_title like '%${key}%'
|
</if>
|
<if test="state!=null">and sg_state=#{state}</if>
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
yeshi_ec_shop_goods where sg_id = #{id,jdbcType=BIGINT}</delete>
|
<insert id="insert" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoods"
|
useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_shop_goods
|
(sg_id,sg_title,sg_class_id,sg_sales_count,sg_picture,sg_desc,sg_charge_type,sg_state,sg_create_time,sg_update_time,sg_weight,so_square_picture)
|
values
|
(#{id,jdbcType=BIGINT},#{title,jdbcType=VARCHAR},#{goodsClass.id,jdbcType=BIGINT},#{salesCount,jdbcType=BIGINT},#{picture,jdbcType=VARCHAR},#{desc,jdbcType=VARCHAR},#{chargeType,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{weight,jdbcType=INTEGER},#{squarePicture,jdbcType=VARCHAR})
|
</insert>
|
<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoods"
|
useGeneratedKeys="true" keyProperty="id">
|
insert into yeshi_ec_shop_goods
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">sg_id,</if>
|
<if test="title != null">sg_title,</if>
|
<if test="goodsClass != null">sg_class_id,</if>
|
<if test="salesCount != null">sg_sales_count,</if>
|
<if test="picture != null">sg_picture,</if>
|
<if test="desc != null">sg_desc,</if>
|
<if test="chargeType != null">sg_charge_type,</if>
|
<if test="state != null">sg_state,</if>
|
<if test="createTime != null">sg_create_time,</if>
|
<if test="updateTime != null">sg_update_time,</if>
|
<if test="weight != null">sg_weight,</if>
|
<if test="squarePicture != null">so_square_picture,</if>
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="title != null">#{title,jdbcType=VARCHAR},</if>
|
<if test="goodsClass != null">#{goodsClass.id,jdbcType=BIGINT},</if>
|
<if test="salesCount != null">#{salesCount,jdbcType=BIGINT},</if>
|
<if test="picture != null">#{picture,jdbcType=VARCHAR},</if>
|
<if test="desc != null">#{desc,jdbcType=VARCHAR},</if>
|
<if test="chargeType != null">#{chargeType,jdbcType=VARCHAR},</if>
|
<if test="state != null">#{state,jdbcType=INTEGER},</if>
|
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
<if test="weight != null">#{weight,jdbcType=INTEGER}</if>
|
<if test="squarePicture != null">#{squarePicture,jdbcType=VARCHAR}</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoods">update
|
yeshi_ec_shop_goods set sg_title =
|
#{title,jdbcType=VARCHAR},sg_class_id =
|
#{goodsClass.id,jdbcType=BIGINT},sg_sales_count =
|
#{salesCount,jdbcType=BIGINT},sg_picture =
|
#{picture,jdbcType=VARCHAR},sg_desc =
|
#{desc,jdbcType=VARCHAR},sg_charge_type =
|
#{chargeType,jdbcType=VARCHAR},sg_state =
|
#{state,jdbcType=INTEGER},sg_create_time =
|
#{createTime,jdbcType=TIMESTAMP},sg_update_time =
|
#{updateTime,jdbcType=TIMESTAMP} ,sg_weight
|
=#{weight,jdbcType=INTEGER} ,so_square_picture
|
=#{squarePicture,jdbcType=VARCHAR} where sg_id = #{id,jdbcType=BIGINT}
|
</update>
|
<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoods">
|
update yeshi_ec_shop_goods
|
<set>
|
<if test="title != null">sg_title=#{title,jdbcType=VARCHAR},</if>
|
<if test="goodsClass != null">sg_class_id=#{goodsClass.id,jdbcType=BIGINT},</if>
|
<if test="salesCount != null">sg_sales_count=#{salesCount,jdbcType=BIGINT},</if>
|
<if test="picture != null">sg_picture=#{picture,jdbcType=VARCHAR},</if>
|
<if test="desc != null">sg_desc=#{desc,jdbcType=VARCHAR},</if>
|
<if test="chargeType != null">sg_charge_type=#{chargeType,jdbcType=VARCHAR},</if>
|
<if test="state != null">sg_state=#{state,jdbcType=INTEGER},</if>
|
<if test="createTime != null">sg_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">sg_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
<if test="weight !=null">sg_weight =#{weight,jdbcType=INTEGER},</if>
|
<if test="squarePicture !=null">so_square_picture =#{squarePicture,jdbcType=VARCHAR},
|
</if>
|
</set>
|
where sg_id = #{id,jdbcType=BIGINT}
|
</update>
|
</mapper>
|