分享好友
This commit is contained in:
164
src/main/resources/mapper/TbShopShareMapper.xml
Normal file
164
src/main/resources/mapper/TbShopShareMapper.xml
Normal file
@@ -0,0 +1,164 @@
|
||||
<?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.TbShopShareMapper">
|
||||
|
||||
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbShopShare" id="TbShopShareMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="title" column="title" jdbcType="VARCHAR"/>
|
||||
<result property="shareImg" column="share_img" jdbcType="VARCHAR"/>
|
||||
<result property="invitedImg" column="invited_img" jdbcType="VARCHAR"/>
|
||||
<result property="beInvitedImg" column="be_invited_img" jdbcType="VARCHAR"/>
|
||||
<result property="startTime" column="start_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="newCoupon" column="new_coupon" jdbcType="VARCHAR"/>
|
||||
<result property="invitedNum" column="invited_num" jdbcType="INTEGER"/>
|
||||
<result property="rewardCoupon" column="reward_coupon" jdbcType="VARCHAR"/>
|
||||
<result property="getMethod" column="get_method" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
, shop_id, title, share_img, invited_img, be_invited_img, start_time, end_time, new_coupon, invited_num, reward_coupon, get_method, status </sql>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="TbShopShareMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_shop_share
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="queryByShopId" resultMap="TbShopShareMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_shop_share
|
||||
where shop_id = #{shopId}
|
||||
and status = 1
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAll" resultMap="TbShopShareMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_shop_share
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
and shop_id = #{shopId}
|
||||
</if>
|
||||
<if test="title != null and title != ''">
|
||||
and title = #{title}
|
||||
</if>
|
||||
<if test="shareImg != null and shareImg != ''">
|
||||
and share_img = #{shareImg}
|
||||
</if>
|
||||
<if test="invitedImg != null and invitedImg != ''">
|
||||
and invited_img = #{invitedImg}
|
||||
</if>
|
||||
<if test="beInvitedImg != null and beInvitedImg != ''">
|
||||
and be_invited_img = #{beInvitedImg}
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
and start_time = #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and end_time = #{endTime}
|
||||
</if>
|
||||
<if test="newCoupon != null and newCoupon != ''">
|
||||
and new_coupon = #{newCoupon}
|
||||
</if>
|
||||
<if test="invitedNum != null">
|
||||
and invited_num = #{invitedNum}
|
||||
</if>
|
||||
<if test="rewardCoupon != null and rewardCoupon != ''">
|
||||
and reward_coupon = #{rewardCoupon}
|
||||
</if>
|
||||
<if test="getMethod != null and getMethod != ''">
|
||||
and get_method = #{getMethod}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
and status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_shop_share(shop_id, title, share_img, invited_img, be_invited_img, start_time, end_time,
|
||||
new_coupon, invited_num, reward_coupon, get_method, status)
|
||||
values (#{shopId}, #{title}, #{shareImg}, #{invitedImg}, #{beInvitedImg}, #{startTime}, #{endTime},
|
||||
#{newCoupon}, #{invitedNum}, #{rewardCoupon}, #{getMethod}, #{status})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_shop_share(shop_id, title, share_img, invited_img, be_invited_img, start_time, end_time,
|
||||
new_coupon, invited_num, reward_coupon, get_method, status)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.shopId}, #{entity.title}, #{entity.shareImg}, #{entity.invitedImg}, #{entity.beInvitedImg},
|
||||
#{entity.startTime}, #{entity.endTime}, #{entity.newCoupon}, #{entity.invitedNum}, #{entity.rewardCoupon},
|
||||
#{entity.getMethod}, #{entity.status})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update tb_shop_share
|
||||
<set>
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId},
|
||||
</if>
|
||||
<if test="title != null and title != ''">
|
||||
title = #{title},
|
||||
</if>
|
||||
<if test="shareImg != null and shareImg != ''">
|
||||
share_img = #{shareImg},
|
||||
</if>
|
||||
<if test="invitedImg != null and invitedImg != ''">
|
||||
invited_img = #{invitedImg},
|
||||
</if>
|
||||
<if test="beInvitedImg != null and beInvitedImg != ''">
|
||||
be_invited_img = #{beInvitedImg},
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
start_time = #{startTime},
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
end_time = #{endTime},
|
||||
</if>
|
||||
<if test="newCoupon != null and newCoupon != ''">
|
||||
new_coupon = #{newCoupon},
|
||||
</if>
|
||||
<if test="invitedNum != null">
|
||||
invited_num = #{invitedNum},
|
||||
</if>
|
||||
<if test="rewardCoupon != null and rewardCoupon != ''">
|
||||
reward_coupon = #{rewardCoupon},
|
||||
</if>
|
||||
<if test="getMethod != null and getMethod != ''">
|
||||
get_method = #{getMethod},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from tb_shop_share
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user