<?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.ShopPayLogDao">
|
<!-- 定义ShopPayLog 的复杂关联map -->
|
<resultMap type="com.matrix.system.shopXcx.bean.ShopPayLog" id="ShopPayLogMap">
|
<id property="payId" column="pay_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="joinId" column="join_id" />
|
<result property="payType" column="pay_type" />
|
<result property="payMoney" column="pay_money" />
|
<result property="payNo" column="pay_no" />
|
<result property="payOrderNo" column="pay_order_no" />
|
<result property="userId" column="user_id" />
|
<result property="payStatus" column="pay_status" />
|
<result property="payRemark" column="pay_remark" />
|
</resultMap>
|
|
|
<!-- 定义ShopPayLog 的简单map ,本map不添加其他的关联属性 -->
|
<resultMap type="com.matrix.system.shopXcx.bean.ShopPayLog" id="ShopPayLogSimpleMap">
|
<id property="payId" column="pay_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="joinId" column="join_id" />
|
<result property="payType" column="pay_type" />
|
<result property="payMoney" column="pay_money" />
|
<result property="payNo" column="pay_no" />
|
<result property="payOrderNo" column="pay_order_no" />
|
<result property="userId" column="user_id" />
|
<result property="payStatus" column="pay_status" />
|
<result property="payRemark" column="pay_remark" />
|
</resultMap>
|
|
<!-- 字段sql -->
|
<sql id="columns">
|
create_by,
|
create_time,
|
update_by,
|
update_time,
|
pay_id,
|
join_id,
|
pay_type,
|
pay_money,
|
pay_no,
|
pay_order_no,
|
user_id,
|
pay_status,
|
pay_remark
|
</sql>
|
|
<!-- 属性sql -->
|
<sql id="propertys">
|
#{item.createBy},
|
now(),
|
#{item.updateBy},
|
now(),
|
#{item.payId},
|
#{item.joinId},
|
#{item.payType},
|
#{item.payMoney},
|
#{item.payNo},
|
#{item.payOrderNo},
|
#{item.userId},
|
#{item.payStatus},
|
#{item.payRemark}
|
</sql>
|
|
<!-- where sql -->
|
<sql id="where_sql">
|
|
<if test="record!=null">
|
<if test="(record.payId!=null and record.payId!='') or (record.payId!='' and record.payId==0) ">
|
and pay_id = #{record.payId}
|
</if>
|
<if test="(record.joinId!=null and record.joinId!='') or (record.joinId!='' and record.joinId==0) ">
|
and join_id = #{record.joinId}
|
</if>
|
<if test="(record.payType!=null and record.payType!='') or (record.payType!='' and record.payType==0) ">
|
and pay_type = #{record.payType}
|
</if>
|
<if test="(record.payMoney!=null and record.payMoney!='') or (record.payMoney!='' and record.payMoney==0) ">
|
and pay_money = #{record.payMoney}
|
</if>
|
<if test="(record.payNo!=null and record.payNo!='') or (record.payNo!='' and record.payNo==0) ">
|
and pay_no = #{record.payNo}
|
</if>
|
<if test="(record.payOrderNo!=null and record.payOrderNo!='') or (record.payOrderNo!='' and record.payOrderNo==0) ">
|
and pay_order_no = #{record.payOrderNo}
|
</if>
|
<if test="(record.userId!=null and record.userId!='') or (record.userId!='' and record.userId==0) ">
|
and user_id = #{record.userId}
|
</if>
|
<if test="(record.payStatus!=null and record.payStatus!='') or (record.payStatus!='' and record.payStatus==0) ">
|
and pay_status = #{record.payStatus}
|
</if>
|
<if test="(record.payRemark!=null and record.payRemark!='') or (record.payRemark!='' and record.payRemark==0) ">
|
and pay_remark = #{record.payRemark}
|
</if>
|
</if>
|
|
</sql>
|
|
<!-- 插入方法 -->
|
<insert id="insert" parameterType="com.matrix.system.shopXcx.bean.ShopPayLog"
|
useGeneratedKeys="true" keyProperty="item.payId">
|
INSERT INTO shop_pay_log (
|
<include refid="columns"></include>
|
)
|
VALUES (
|
<include refid="propertys"></include>
|
)
|
</insert>
|
|
|
|
<!-- 批量插入 -->
|
<insert id="batchInsert" parameterType="java.util.List">
|
INSERT INTO shop_pay_log (
|
<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_pay_log
|
<set>
|
<if test="_parameter.containsKey('joinId')">
|
join_id = #{joinId},
|
</if>
|
<if test="_parameter.containsKey('payType')">
|
pay_type = #{payType},
|
</if>
|
<if test="_parameter.containsKey('payMoney')">
|
pay_money = #{payMoney},
|
</if>
|
<if test="_parameter.containsKey('payNo')">
|
pay_no = #{payNo},
|
</if>
|
<if test="_parameter.containsKey('payOrderNo')">
|
pay_order_no = #{payOrderNo},
|
</if>
|
<if test="_parameter.containsKey('userId')">
|
user_id = #{userId},
|
</if>
|
<if test="_parameter.containsKey('payStatus')">
|
pay_status = #{payStatus},
|
</if>
|
<if test="_parameter.containsKey('payRemark')">
|
pay_remark = #{payRemark},
|
</if>
|
</set>
|
WHERE pay_id=#{payId}
|
</update>
|
|
|
<!-- 根据对象更新 部分更新 -->
|
<update id="updateByModel" parameterType="Integer">
|
UPDATE shop_pay_log
|
<set>
|
<if test="record.joinId != null ">
|
join_id = #{record.joinId},
|
</if>
|
<if test="record.payType != null ">
|
pay_type = #{record.payType},
|
</if>
|
<if test="record.payMoney != null ">
|
pay_money = #{record.payMoney},
|
</if>
|
<if test="record.payNo != null and record.payNo != '' ">
|
pay_no = #{record.payNo},
|
</if>
|
<if test="record.payOrderNo != null and record.payOrderNo != '' ">
|
pay_order_no = #{record.payOrderNo},
|
</if>
|
<if test="record.userId != null and record.userId != '' ">
|
user_id = #{record.userId},
|
</if>
|
<if test="record.payStatus != null ">
|
pay_status = #{record.payStatus},
|
</if>
|
<if test="record.payRemark != null and record.payRemark != '' ">
|
pay_remark = #{record.payRemark},
|
</if>
|
</set>
|
WHERE pay_id=#{record.payId}
|
</update>
|
|
<!-- 批量删除 -->
|
<delete id="deleteByIds" parameterType="java.util.List">
|
delete from shop_pay_log where pay_id in
|
<foreach collection="list" index="index" item="item" open="("
|
separator="," close=")">
|
#{item}
|
</foreach>
|
</delete>
|
|
<!-- 根据id删除-->
|
<delete id="deleteById" parameterType="Integer">
|
DELETE FROM shop_pay_log
|
where pay_id=#{payId}
|
</delete>
|
|
<!-- 根据对象删除-->
|
<delete id="deleteByModel" parameterType="com.matrix.system.shopXcx.bean.ShopPayLog">
|
DELETE FROM shop_pay_log
|
<where>
|
<include refid="where_sql" ></include>
|
</where>
|
</delete>
|
|
|
|
<!-- 分页查询 -->
|
<select id="selectInPage" resultMap="ShopPayLogMap">
|
select
|
<include refid="columns" ></include>
|
from shop_pay_log
|
<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_pay_log
|
<where>
|
<include refid="where_sql"></include>
|
</where>
|
</select>
|
|
<!-- 根据id查询-->
|
<select id="selectById" resultMap="ShopPayLogMap">
|
select
|
<include refid="columns" ></include>
|
from shop_pay_log
|
where pay_id=#{payId}
|
</select>
|
|
|
<!-- 根据id 锁表查询-->
|
<select id="selectForUpdate" resultMap="ShopPayLogMap">
|
select
|
<include refid="columns" ></include>
|
from shop_pay_log
|
where pay_id=#{pay_id}
|
for update
|
</select>
|
|
|
|
<!-- 根据对象查询-->
|
<select id="selectByModel" resultMap="ShopPayLogMap">
|
select
|
<include refid="columns" ></include>
|
from shop_pay_log
|
<where>
|
<include refid="where_sql"></include>
|
</where>
|
</select>
|
</mapper>
|