首页数据
This commit is contained in:
117
src/main/resources/mapper/TagProductDeptsMapper.xml
Normal file
117
src/main/resources/mapper/TagProductDeptsMapper.xml
Normal file
@@ -0,0 +1,117 @@
|
||||
<?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.TagProductDeptsMapper">
|
||||
|
||||
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TagProductDepts" id="TagProductDeptsMap">
|
||||
<result property="tagId" column="tag_id" jdbcType="INTEGER"/>
|
||||
<result property="productId" column="product_id" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="TagProductDeptsMap">
|
||||
select
|
||||
tag_id, product_id, create_time
|
||||
from tag_product_depts
|
||||
where tag_id = #{tagId}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="TagProductDeptsMap">
|
||||
select
|
||||
tag_id, product_id, create_time
|
||||
from tag_product_depts
|
||||
<where>
|
||||
<if test="tagId != null">
|
||||
and tag_id = #{tagId}
|
||||
</if>
|
||||
<if test="productId != null">
|
||||
and product_id = #{productId}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
</where>
|
||||
limit #{pageable.offset}, #{pageable.pageSize}
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from tag_product_depts
|
||||
<where>
|
||||
<if test="tagId != null">
|
||||
and tag_id = #{tagId}
|
||||
</if>
|
||||
<if test="productId != null">
|
||||
and product_id = #{productId}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="queryTagAndProduct" resultType="com.chaozhanggui.system.cashierservice.entity.vo.TagProductVO">
|
||||
SELECT
|
||||
pro.id AS productId,
|
||||
pro.`name` AS `name`,
|
||||
GROUP_CONCAT(dict.`name`) AS tags
|
||||
FROM
|
||||
tag_product_depts AS depts
|
||||
LEFT JOIN tb_product AS pro ON depts.product_id = pro.id
|
||||
LEFT JOIN tb_platform_dict AS dict ON dict.id = depts.tag_id
|
||||
WHERE
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
GROUP BY
|
||||
pro.id,
|
||||
pro.name;
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="tagId" useGeneratedKeys="true">
|
||||
insert into tag_product_depts(product_id, create_time)
|
||||
values (#{productId}, #{createTime})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="tagId" useGeneratedKeys="true">
|
||||
insert into tag_product_depts(product_id, create_time)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.productId}, #{entity.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="tagId" useGeneratedKeys="true">
|
||||
insert into tag_product_depts(product_id, create_time)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.productId}, #{entity.createTime})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
product_id = values(product_id),
|
||||
create_time = values(create_time)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update tag_product_depts
|
||||
<set>
|
||||
<if test="productId != null">
|
||||
product_id = #{productId},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
</set>
|
||||
where tag_id = #{tagId}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete from tag_product_depts where tag_id = #{tagId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
detail, lat, lng, mch_id, register_type, is_wx_ma_independent, address, city, type,
|
||||
industry, industry_name, business_time, post_time, post_amount_line, on_sale, settle_type,
|
||||
settle_time, enter_at, expire_at, status, average, order_wait_pay_minute, support_device_number,
|
||||
distribute_level, created_at, updated_at, proxy_id
|
||||
distribute_level, created_at, updated_at, proxy_id, shop_qrcode, tag
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
view
|
||||
|
||||
Reference in New Issue
Block a user