258 lines
8.9 KiB
XML
258 lines
8.9 KiB
XML
<?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.chaozhanggui.system.cashierservice.dao.TbProductGroupMapper">
|
|
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbProductGroup">
|
|
<id column="id" jdbcType="INTEGER" property="id" />
|
|
<result column="name" jdbcType="VARCHAR" property="name" />
|
|
<result column="merchant_id" jdbcType="VARCHAR" property="merchantId" />
|
|
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
|
|
<result column="pic" jdbcType="VARCHAR" property="pic" />
|
|
<result column="is_show" jdbcType="TINYINT" property="isShow" />
|
|
<result column="detail" jdbcType="VARCHAR" property="detail" />
|
|
<result column="style" jdbcType="VARCHAR" property="style" />
|
|
<result column="sort" jdbcType="INTEGER" property="sort" />
|
|
<result column="sort_mode" jdbcType="VARCHAR" property="sortMode" />
|
|
<result column="use_time" jdbcType="INTEGER" property="useTime" />
|
|
<result column="sale_start_time" jdbcType="INTEGER" property="saleStartTime" />
|
|
<result column="sale_end_time" jdbcType="INTEGER" property="saleEndTime" />
|
|
<result column="created_at" jdbcType="BIGINT" property="createdAt" />
|
|
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
|
|
</resultMap>
|
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbProductGroup">
|
|
<result column="product_ids" jdbcType="LONGVARCHAR" property="productIds" />
|
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
|
id, name, merchant_id, shop_id, pic, is_show, detail, style, sort, sort_mode, created_at, updated_at , use_time, sale_start_time, sale_end_time
|
|
</sql>
|
|
<sql id="Blob_Column_List">
|
|
product_ids
|
|
</sql>
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
,
|
|
<include refid="Blob_Column_List" />
|
|
from tb_product_group
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</select>
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
delete from tb_product_group
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</delete>
|
|
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductGroup">
|
|
insert into tb_product_group (id, name, merchant_id,
|
|
shop_id, pic, is_show,
|
|
detail, style, sort, sort_mode,
|
|
created_at, updated_at, product_ids
|
|
)
|
|
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{merchantId,jdbcType=VARCHAR},
|
|
#{shopId,jdbcType=INTEGER}, #{pic,jdbcType=VARCHAR}, #{isShow,jdbcType=TINYINT},
|
|
#{detail,jdbcType=VARCHAR}, #{style,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{sortMode,jdbcType=VARCHAR},
|
|
#{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}, #{productIds,jdbcType=LONGVARCHAR}
|
|
)
|
|
</insert>
|
|
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductGroup">
|
|
insert into tb_product_group
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
id,
|
|
</if>
|
|
<if test="name != null">
|
|
name,
|
|
</if>
|
|
<if test="merchantId != null">
|
|
merchant_id,
|
|
</if>
|
|
<if test="shopId != null">
|
|
shop_id,
|
|
</if>
|
|
<if test="pic != null">
|
|
pic,
|
|
</if>
|
|
<if test="isShow != null">
|
|
is_show,
|
|
</if>
|
|
<if test="detail != null">
|
|
detail,
|
|
</if>
|
|
<if test="style != null">
|
|
style,
|
|
</if>
|
|
<if test="sort != null">
|
|
sort,
|
|
</if>
|
|
<if test="sortMode != null">
|
|
sort_mode,
|
|
</if>
|
|
<if test="createdAt != null">
|
|
created_at,
|
|
</if>
|
|
<if test="updatedAt != null">
|
|
updated_at,
|
|
</if>
|
|
<if test="productIds != null">
|
|
product_ids,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
#{id,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="name != null">
|
|
#{name,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="merchantId != null">
|
|
#{merchantId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="shopId != null">
|
|
#{shopId,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="pic != null">
|
|
#{pic,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="isShow != null">
|
|
#{isShow,jdbcType=TINYINT},
|
|
</if>
|
|
<if test="detail != null">
|
|
#{detail,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="style != null">
|
|
#{style,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="sort != null">
|
|
#{sort,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="sortMode != null">
|
|
#{sortMode,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="createdAt != null">
|
|
#{createdAt,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="updatedAt != null">
|
|
#{updatedAt,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="productIds != null">
|
|
#{productIds,jdbcType=LONGVARCHAR},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductGroup">
|
|
update tb_product_group
|
|
<set>
|
|
<if test="name != null">
|
|
name = #{name,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="merchantId != null">
|
|
merchant_id = #{merchantId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="shopId != null">
|
|
shop_id = #{shopId,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="pic != null">
|
|
pic = #{pic,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="isShow != null">
|
|
is_show = #{isShow,jdbcType=TINYINT},
|
|
</if>
|
|
<if test="detail != null">
|
|
detail = #{detail,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="style != null">
|
|
style = #{style,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="sort != null">
|
|
sort = #{sort,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="sortMode != null">
|
|
sort_mode = #{sort,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="createdAt != null">
|
|
created_at = #{createdAt,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="updatedAt != null">
|
|
updated_at = #{updatedAt,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="productIds != null">
|
|
product_ids = #{productIds,jdbcType=LONGVARCHAR},
|
|
</if>
|
|
</set>
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductGroup">
|
|
update tb_product_group
|
|
set name = #{name,jdbcType=VARCHAR},
|
|
merchant_id = #{merchantId,jdbcType=VARCHAR},
|
|
shop_id = #{shopId,jdbcType=INTEGER},
|
|
pic = #{pic,jdbcType=VARCHAR},
|
|
is_show = #{isShow,jdbcType=TINYINT},
|
|
detail = #{detail,jdbcType=VARCHAR},
|
|
style = #{style,jdbcType=VARCHAR},
|
|
sort = #{sort,jdbcType=INTEGER},
|
|
sort_mode = #{sortMode,jdbcType=VARCHAR},
|
|
created_at = #{createdAt,jdbcType=BIGINT},
|
|
updated_at = #{updatedAt,jdbcType=BIGINT},
|
|
product_ids = #{productIds,jdbcType=LONGVARCHAR}
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductGroup">
|
|
update tb_product_group
|
|
set name = #{name,jdbcType=VARCHAR},
|
|
merchant_id = #{merchantId,jdbcType=VARCHAR},
|
|
shop_id = #{shopId,jdbcType=INTEGER},
|
|
pic = #{pic,jdbcType=VARCHAR},
|
|
is_show = #{isShow,jdbcType=TINYINT},
|
|
detail = #{detail,jdbcType=VARCHAR},
|
|
style = #{style,jdbcType=VARCHAR},
|
|
sort = #{sort,jdbcType=INTEGER},
|
|
sort_mode = #{sortMode,jdbcType=VARCHAR},
|
|
created_at = #{createdAt,jdbcType=BIGINT},
|
|
updated_at = #{updatedAt,jdbcType=BIGINT}
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
|
|
<select id="selectByIdAndShopId" resultMap="BaseResultMap">
|
|
|
|
SELECT
|
|
g.*
|
|
FROM
|
|
tb_shop_table t
|
|
left join tb_product_group g on t.shop_id=g.shop_id
|
|
where t.qrcode=#{code} and g.is_show=1
|
|
<!-- <if test="shopId != null">-->
|
|
<!-- and g.id = #{shopId}-->
|
|
<!-- </if>-->
|
|
order by g.sort asc
|
|
</select>
|
|
|
|
<select id="selectByQrcode" resultMap="BaseResultMap">
|
|
|
|
SELECT
|
|
g.*
|
|
FROM
|
|
tb_shop_table t
|
|
left join tb_product_group g on t.shop_id=g.shop_id
|
|
where t.qrcode=#{qrCode} and g.is_show=1
|
|
<if test="groupId != null">
|
|
and g.id = #{groupId}
|
|
</if>
|
|
order by g.sort asc
|
|
</select>
|
|
|
|
<select id="selectByShopId" resultMap="BaseResultMap">
|
|
SELECT
|
|
*
|
|
FROM
|
|
tb_product_group
|
|
where shop_id=#{shopId} and is_show=1
|
|
<if test="groupId != null and groupId != ''">
|
|
and id = #{groupId}
|
|
</if>
|
|
order by sort asc
|
|
</select>
|
|
|
|
<select id="selectByProductId" resultMap="BaseResultMap">
|
|
SELECT * FROM tb_product_group WHERE `shop_id` = #{shopId,jdbcType=VARCHAR} AND is_show = 1
|
|
AND `product_ids` LIKE concat('%',#{productId,jdbcType=VARCHAR},'%')
|
|
</select>
|
|
</mapper>
|