<?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.matrix.system.shopXcx.dao.ShopActivitiesGroupPriceDao">
|
<!-- 定义ShopActivitiesGroupPrice 的复杂关联map -->
|
<resultMap type="com.matrix.system.shopXcx.bean.ShopActivitiesGroupPrice" id="ShopActivitiesGroupPriceMap">
|
<id property="id" column="id" />
|
<result property="createBy" column="create_by" />
|
<result property="createTime" column="create_time" />
|
<result property="updateBy" column="update_by" />
|
<result property="updateTime" column="update_time" />
|
<result property="actId" column="act_id" />
|
<result property="gpId" column="gp_id" />
|
<result property="gpCount" column="gp_count" />
|
<result property="gpPrice" column="gp_price" />
|
<result property="gpHeadPrice" column="gp_head_price" />
|
</resultMap>
|
|
|
<!-- 定义ShopActivitiesGroupPrice 的简单map ,本map不添加其他的关联属性 -->
|
<resultMap type="com.matrix.system.shopXcx.bean.ShopActivitiesGroupPrice" id="ShopActivitiesGroupPriceSimpleMap">
|
<id property="id" column="id" />
|
<result property="createBy" column="create_by" />
|
<result property="createTime" column="create_time" />
|
<result property="updateBy" column="update_by" />
|
<result property="updateTime" column="update_time" />
|
<result property="actId" column="act_id" />
|
<result property="gpId" column="gp_id" />
|
<result property="gpCount" column="gp_count" />
|
<result property="gpPrice" column="gp_price" />
|
<result property="gpHeadPrice" column="gp_head_price" />
|
</resultMap>
|
|
<!-- 字段sql -->
|
<sql id="columns">
|
create_by,
|
create_time,
|
update_by,
|
update_time,
|
id,
|
act_id,
|
gp_id,
|
gp_count,
|
gp_price,
|
gp_head_price,
|
seq,
|
company_id
|
</sql>
|
|
<!-- 属性sql -->
|
<sql id="propertys">
|
#{item.createBy},
|
now(),
|
#{item.updateBy},
|
now(),
|
#{item.id},
|
#{item.actId},
|
#{item.gpId},
|
#{item.gpCount},
|
#{item.gpPrice},
|
#{item.gpHeadPrice},
|
#{item.seq},
|
#{item.companyId}
|
</sql>
|
|
<!-- where sql -->
|
<sql id="where_sql">
|
|
<if test="record!=null">
|
<if test="(record.id!=null and record.id!='') or (record.id!='' and record.id==0) ">
|
and id = #{record.id}
|
</if>
|
<if test="(record.companyId!=null and record.companyId!='') or (record.companyId!='' and record.companyId==0) ">
|
and company_id = #{record.companyId}
|
</if>
|
<if test="(record.actId!=null and record.actId!='') or (record.actId!='' and record.actId==0) ">
|
and act_id = #{record.actId}
|
</if>
|
<if test="(record.gpId!=null and record.gpId!='') or (record.gpId!='' and record.gpId==0) ">
|
and gp_id = #{record.gpId}
|
</if>
|
<if test="(record.gpCount!=null and record.gpCount!='') or (record.gpCount!='' and record.gpCount==0) ">
|
and gp_count = #{record.gpCount}
|
</if>
|
<if test="(record.gpPrice!=null and record.gpPrice!='') or (record.gpPrice!='' and record.gpPrice==0) ">
|
and gp_price = #{record.gpPrice}
|
</if>
|
<if test="(record.gpHeadPrice!=null and record.gpHeadPrice!='') or (record.gpHeadPrice!='' and record.gpHeadPrice==0) ">
|
and gp_head_price = #{record.gpHeadPrice}
|
</if>
|
</if>
|
|
</sql>
|
|
<!-- 插入方法 -->
|
<insert id="insert" parameterType="com.matrix.system.shopXcx.bean.ShopActivitiesGroupPrice"
|
useGeneratedKeys="true" keyProperty="item.id">
|
INSERT INTO shop_activities_group_price (
|
<include refid="columns"></include>
|
)
|
VALUES (
|
<include refid="propertys"></include>
|
)
|
</insert>
|
|
|
|
<!-- 批量插入 -->
|
<insert id="batchInsert" parameterType="java.util.List">
|
INSERT INTO shop_activities_group_price (
|
<include refid="columns"></include>
|
)
|
VALUES
|
<foreach collection="list" item="item" index="index" separator=",">(
|
<include refid="propertys"></include>
|
)</foreach>
|
</insert>
|
|
|
|
|
|
<!-- 根据Map更新 部分更新 -->
|
<update id="updateByMap" parameterType="java.util.HashMap" >
|
UPDATE shop_activities_group_price
|
<set>
|
<if test="_parameter.containsKey('actId')">
|
act_id = #{actId},
|
</if>
|
<if test="_parameter.containsKey('gpId')">
|
gp_id = #{gpId},
|
</if>
|
<if test="_parameter.containsKey('gpCount')">
|
gp_count = #{gpCount},
|
</if>
|
<if test="_parameter.containsKey('gpPrice')">
|
gp_price = #{gpPrice},
|
</if>
|
<if test="_parameter.containsKey('gpHeadPrice')">
|
gp_head_price = #{gpHeadPrice},
|
</if>
|
</set>
|
WHERE id=#{id}
|
</update>
|
|
|
<!-- 根据对象更新 部分更新 -->
|
<update id="updateByModel" parameterType="Long">
|
UPDATE shop_activities_group_price
|
<set>
|
<if test="record.actId != null ">
|
act_id = #{record.actId},
|
</if>
|
<if test="record.gpId != null ">
|
gp_id = #{record.gpId},
|
</if>
|
<if test="record.gpCount != null ">
|
gp_count = #{record.gpCount},
|
</if>
|
<if test="record.gpPrice != null ">
|
gp_price = #{record.gpPrice},
|
</if>
|
<if test="record.gpHeadPrice != null ">
|
gp_head_price = #{record.gpHeadPrice},
|
</if>
|
</set>
|
WHERE id=#{record.id}
|
</update>
|
|
<!-- 批量删除 -->
|
<delete id="deleteByIds" parameterType="java.util.List">
|
delete from shop_activities_group_price where id in
|
<foreach collection="list" index="index" item="item" open="("
|
separator="," close=")">
|
#{item}
|
</foreach>
|
</delete>
|
|
<!-- 根据id删除-->
|
<delete id="deleteById" parameterType="Long">
|
DELETE FROM shop_activities_group_price
|
where id=#{id}
|
</delete>
|
|
<!-- 根据对象删除-->
|
<delete id="deleteByModel" parameterType="com.matrix.system.shopXcx.bean.ShopActivitiesGroupPrice">
|
DELETE FROM shop_activities_group_price
|
<where>
|
<include refid="where_sql" ></include>
|
</where>
|
</delete>
|
|
|
|
<!-- 分页查询 -->
|
<select id="selectInPage" resultMap="ShopActivitiesGroupPriceMap">
|
select
|
<include refid="columns" ></include>
|
from shop_activities_group_price
|
<where>
|
<include refid="where_sql"></include>
|
</where>
|
<if test="pageVo !=null"><!-- 判断pageVo对象是否为空 -->
|
<if test="pageVo.sort !=null and pageVo.order !=null">
|
order by
|
${pageVo.sort} ${pageVo.order}
|
</if>
|
<if test="pageVo.offset >=0 and pageVo.limit >0">
|
limit
|
#{pageVo.offset},#{pageVo.limit}
|
</if>
|
</if>
|
</select>
|
|
<!-- 查询总条数 -->
|
<select id="selectTotalRecord" parameterType="long" resultType="java.lang.Integer">
|
select count(*)
|
from shop_activities_group_price
|
<where>
|
<include refid="where_sql"></include>
|
</where>
|
</select>
|
|
<!-- 根据id查询-->
|
<select id="selectById" resultMap="ShopActivitiesGroupPriceMap">
|
select
|
<include refid="columns" ></include>
|
from shop_activities_group_price
|
where id=#{id}
|
</select>
|
|
|
<!-- 根据id 锁表查询-->
|
<select id="selectForUpdate" resultMap="ShopActivitiesGroupPriceMap">
|
select
|
<include refid="columns" ></include>
|
from shop_activities_group_price
|
where id=#{id}
|
for update
|
</select>
|
|
|
|
<!-- 根据对象查询-->
|
<select id="selectByModel" resultMap="ShopActivitiesGroupPriceMap">
|
select
|
<include refid="columns" ></include>
|
from shop_activities_group_price
|
<where>
|
<include refid="where_sql"></include>
|
</where>
|
</select>
|
|
<select id="selectGroupPriceByActId" resultMap="ShopActivitiesGroupPriceMap">
|
select * from shop_activities_group_price where act_id=#{actId}
|
</select>
|
|
<delete id="deleteByActId">
|
delete from shop_activities_group_price where act_id=#{actId}
|
</delete>
|
</mapper>
|