<?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.WxWithdrawApplyDao">
|
<!-- 定义WxWithdrawApply 的复杂关联map -->
|
<resultMap type="com.matrix.system.shopXcx.bean.WxWithdrawApply" id="WxWithdrawApplyMap">
|
<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="shopId" column="shop_id" />
|
<result property="applyMoney" column="apply_money" />
|
<result property="applyStatus" column="apply_status" />
|
<result property="applyNo" column="apply_no" />
|
<result property="partnerTradeNo" column="partner_trade_no" />
|
<result property="bankNo" column="bank_no" />
|
<result property="withdrawTime" column="withdraw_time" />
|
<result property="userId" column="user_id" />
|
<result property="cmmsAnt" column="cmms_ant" />
|
<result property="comId" column="com_id" />
|
<result property="isHasPay" column="is_has_pay" />
|
<result property="userName" column="su_name" />
|
<result property="bankName" column="bank_name" />
|
<result property="bankOwnerName" column="bank_owner_name" />
|
</resultMap>
|
|
|
<!-- 定义WxWithdrawApply 的简单map ,本map不添加其他的关联属性 -->
|
<resultMap type="com.matrix.system.shopXcx.bean.WxWithdrawApply" id="WxWithdrawApplySimpleMap">
|
<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="shopId" column="shop_id" />
|
<result property="applyMoney" column="apply_money" />
|
<result property="applyStatus" column="apply_status" />
|
<result property="applyNo" column="apply_no" />
|
<result property="partnerTradeNo" column="partner_trade_no" />
|
<result property="bankNo" column="bank_no" />
|
<result property="withdrawTime" column="withdraw_time" />
|
<result property="userId" column="user_id" />
|
<result property="cmmsAnt" column="cmms_ant" />
|
<result property="comId" column="com_id" />
|
<result property="bankName" column="bank_name" />
|
<result property="bankOwnerName" column="bank_owner_name" />
|
</resultMap>
|
|
<!-- 字段sql -->
|
<sql id="columns">
|
create_by,
|
create_time,
|
update_by,
|
update_time,
|
id,
|
shop_id,
|
apply_money,
|
apply_status,
|
apply_no,
|
partner_trade_no,
|
bank_no,
|
withdraw_time,
|
user_id,
|
cmms_ant,
|
com_id,
|
is_has_pay,
|
bank_name,
|
bank_owner_name
|
</sql>
|
|
<!-- 属性sql -->
|
<sql id="propertys">
|
#{item.createBy},
|
now(),
|
#{item.updateBy},
|
now(),
|
#{item.id},
|
#{item.shopId},
|
#{item.applyMoney},
|
#{item.applyStatus},
|
#{item.applyNo},
|
#{item.partnerTradeNo},
|
#{item.bankNo},
|
#{item.withdrawTime},
|
#{item.userId},
|
#{item.cmmsAnt},
|
#{item.comId},
|
#{item.isHasPay},
|
#{item.bankName},
|
#{item.bankOwnerName}
|
</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.shopId!=null and record.shopId!='') or (record.shopId!='' and record.shopId==0) ">
|
and shop_id = #{record.shopId}
|
</if>
|
<if test="(record.applyMoney!=null and record.applyMoney!='') or (record.applyMoney!='' and record.applyMoney==0) ">
|
and apply_money = #{record.applyMoney}
|
</if>
|
<if test="(record.applyStatus!=null and record.applyStatus!='') or (record.applyStatus!='' and record.applyStatus==0) ">
|
and apply_status = #{record.applyStatus}
|
</if>
|
<if test="(record.applyNo!=null and record.applyNo!='') or (record.applyNo!='' and record.applyNo==0) ">
|
and apply_no = #{record.applyNo}
|
</if>
|
<if test="(record.partnerTradeNo!=null and record.partnerTradeNo!='') or (record.partnerTradeNo!='' and record.partnerTradeNo==0) ">
|
and partner_trade_no = #{record.partnerTradeNo}
|
</if>
|
<if test="(record.bankNo!=null and record.bankNo!='') or (record.bankNo!='' and record.bankNo==0) ">
|
and bank_no = #{record.bankNo}
|
</if>
|
<if test="(record.withdrawTime!=null and record.withdrawTime!='') or (record.withdrawTime!='' and record.withdrawTime==0) ">
|
and withdraw_time = #{record.withdrawTime}
|
</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.cmmsAnt!=null and record.cmmsAnt!='') or (record.cmmsAnt!='' and record.cmmsAnt==0) ">
|
and cmms_ant = #{record.cmmsAnt}
|
</if>
|
<if test="(record.comId!=null and record.comId!='') or (record.comId!='' and record.comId==0) ">
|
and com_id = #{record.comId}
|
</if>
|
</if>
|
|
</sql>
|
|
<!-- 插入方法 -->
|
<insert id="insert" parameterType="com.matrix.system.shopXcx.bean.WxWithdrawApply"
|
useGeneratedKeys="true" keyProperty="item.id">
|
INSERT INTO wx_withdraw_apply (
|
<include refid="columns"></include>
|
)
|
VALUES (
|
<include refid="propertys"></include>
|
)
|
</insert>
|
|
|
|
<!-- 批量插入 -->
|
<insert id="batchInsert" parameterType="java.util.List">
|
INSERT INTO wx_withdraw_apply (
|
<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 wx_withdraw_apply
|
<set>
|
<if test="_parameter.containsKey('shopId')">
|
shop_id = #{shopId},
|
</if>
|
<if test="_parameter.containsKey('applyMoney')">
|
apply_money = #{applyMoney},
|
</if>
|
<if test="_parameter.containsKey('applyStatus')">
|
apply_status = #{applyStatus},
|
</if>
|
<if test="_parameter.containsKey('applyNo')">
|
apply_no = #{applyNo},
|
</if>
|
<if test="_parameter.containsKey('partnerTradeNo')">
|
partner_trade_no = #{partnerTradeNo},
|
</if>
|
<if test="_parameter.containsKey('bankNo')">
|
bank_no = #{bankNo},
|
</if>
|
<if test="_parameter.containsKey('withdrawTime')">
|
withdraw_time = #{withdrawTime},
|
</if>
|
<if test="_parameter.containsKey('userId')">
|
user_id = #{userId},
|
</if>
|
<if test="_parameter.containsKey('cmmsAnt')">
|
cmms_ant = #{cmmsAnt},
|
</if>
|
<if test="_parameter.containsKey('comId')">
|
com_id = #{comId},
|
</if>
|
</set>
|
WHERE id=#{id}
|
</update>
|
|
|
<!-- 根据对象更新 部分更新 -->
|
<update id="updateByModel" parameterType="Long">
|
UPDATE wx_withdraw_apply
|
<set>
|
<if test="record.shopId != null ">
|
shop_id = #{record.shopId},
|
</if>
|
<if test="record.applyMoney != null ">
|
apply_money = #{record.applyMoney},
|
</if>
|
<if test="record.applyStatus != null ">
|
apply_status = #{record.applyStatus},
|
</if>
|
<if test="record.applyNo != null and record.applyNo != '' ">
|
apply_no = #{record.applyNo},
|
</if>
|
<if test="record.partnerTradeNo != null and record.partnerTradeNo != '' ">
|
partner_trade_no = #{record.partnerTradeNo},
|
</if>
|
<if test="record.bankNo != null and record.bankNo != '' ">
|
bank_no = #{record.bankNo},
|
</if>
|
<if test="record.withdrawTime != null ">
|
withdraw_time = #{record.withdrawTime},
|
</if>
|
<if test="record.userId != null ">
|
user_id = #{record.userId},
|
</if>
|
<if test="record.cmmsAnt != null ">
|
cmms_ant = #{record.cmmsAnt},
|
</if>
|
<if test="record.comId != null ">
|
com_id = #{record.comId},
|
</if>
|
<if test="record.isHasPay != null ">
|
is_has_pay = #{record.isHasPay},
|
</if>
|
</set>
|
WHERE id=#{record.id}
|
</update>
|
|
<!-- 批量删除 -->
|
<delete id="deleteByIds" parameterType="java.util.List">
|
delete from wx_withdraw_apply where id in
|
<foreach collection="list" index="index" item="item" open="("
|
separator="," close=")">
|
#{item}
|
</foreach>
|
</delete>
|
|
<!-- 根据id删除-->
|
<delete id="deleteById" parameterType="Long">
|
DELETE FROM wx_withdraw_apply
|
where id=#{id}
|
</delete>
|
|
<!-- 根据对象删除-->
|
<delete id="deleteByModel" parameterType="com.matrix.system.shopXcx.bean.WxWithdrawApply">
|
DELETE FROM wx_withdraw_apply
|
<where>
|
<include refid="where_sql" ></include>
|
</where>
|
</delete>
|
|
|
|
<!-- 分页查询 -->
|
<select id="selectInPage" resultMap="WxWithdrawApplyMap">
|
select
|
<include refid="columns" ></include>
|
from wx_withdraw_apply
|
<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 wx_withdraw_apply
|
<where>
|
<include refid="where_sql"></include>
|
</where>
|
</select>
|
|
<select id="selectInPageByQuery" resultMap="WxWithdrawApplyMap">
|
select a.*, b.shop_name, c.su_name
|
from wx_withdraw_apply a
|
inner join sys_shop_info b on a.shop_id=b.id
|
left join sys_users c on a.user_id=c.su_id
|
<where>
|
<if test="record!=null">
|
<if test="record.shopName != null and record.shopName != '' ">
|
and b.shop_name like CONCAT('%',CONCAT(#{record.shopName}, '%'))
|
</if>
|
<if test="record.shopId != null and record.shopId != '' ">
|
and a.shop_id=#{record.shopId}
|
</if>
|
<if test="record.applyNo != null and record.applyNo != '' ">
|
and a.apply_no = #{record.applyNo}
|
</if>
|
<if test="record.applyStatus != null and record.applyStatus != '' ">
|
and a.apply_status = #{record.applyStatus}
|
</if>
|
<if test="record.startTime != null and record.startTime != '' ">
|
and a.create_time >= DATE_FORMAT(#{record.startTime},'%Y-%m-%d')
|
</if>
|
<if test="record.endTime != null and record.endTime != '' ">
|
<![CDATA[and a.create_time <= DATE_FORMAT(#{record.endTime},'%Y-%m-%d')]]>
|
</if>
|
</if>
|
</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="selectTotalByQuery" parameterType="long" resultType="java.lang.Integer">
|
select count(*)
|
from wx_withdraw_apply a
|
inner join sys_shop_info b on a.shop_id=b.id
|
<where>
|
<if test="record!=null">
|
<if test="record.shopName != null and record.shopName != '' ">
|
and b.shop_name like CONCAT('%',CONCAT(#{record.shopName}, '%'))
|
</if>
|
<if test="record.applyNo != null and record.applyNo != '' ">
|
and a.apply_no = #{record.applyNo}
|
</if>
|
<if test="record.applyStatus != null and record.applyStatus != '' ">
|
and a.apply_status = #{record.applyStatus}
|
</if>
|
<if test="record.startTime != null and record.startTime != '' ">
|
and a.create_time >= DATE_FORMAT(#{record.startTime},'%Y-%m-%d')
|
</if>
|
<if test="record.endTime != null and record.endTime != '' ">
|
<![CDATA[and a.create_time <= DATE_FORMAT(#{record.endTime},'%Y-%m-%d')]]>
|
</if>
|
</if>
|
</where>
|
</select>
|
|
<!-- 根据id查询-->
|
<select id="selectById" resultMap="WxWithdrawApplyMap">
|
select
|
<include refid="columns" ></include>
|
from wx_withdraw_apply
|
where id=#{id}
|
</select>
|
|
|
<!-- 根据id 锁表查询-->
|
<select id="selectForUpdate" resultMap="WxWithdrawApplyMap">
|
select
|
<include refid="columns" ></include>
|
from wx_withdraw_apply
|
where id=#{id}
|
for update
|
</select>
|
|
|
|
<!-- 根据对象查询-->
|
<select id="selectByModel" resultMap="WxWithdrawApplyMap">
|
select
|
<include refid="columns" ></include>
|
from wx_withdraw_apply
|
<where>
|
<include refid="where_sql"></include>
|
</where>
|
</select>
|
|
<update id="updateApplyStatus">
|
update wx_withdraw_apply
|
set
|
apply_status=#{record.applyStatus},
|
user_id=#{record.userId},
|
withdraw_time=now(),
|
is_has_pay=#{record.isHasPay}
|
where id=#{record.id}
|
</update>
|
</mapper>
|