|
- <?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.iformall.mapper.WxFinanceReceiveMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxFinanceReceive">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
- <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
- <result column="receive_money" jdbcType="VARCHAR" property="receiveMoney"/>
- <result column="pay_money" jdbcType="VARCHAR" property="payMoney"/>
- <result column="set_off_money" jdbcType="VARCHAR" property="setOffMoney"/>
- <result column="use_money" jdbcType="VARCHAR" property="useMoney"/>
- <result column="status" jdbcType="INTEGER" property="status"/>
- <result column="type" jdbcType="INTEGER" property="type"/>
- <result column="receive_type" jdbcType="INTEGER" property="receiveType"/>
- <result column="money_detail" jdbcType="VARCHAR" property="moneyDetail"/>
- <result column="create_by" jdbcType="BIGINT" property="createBy"/>
- <result column="create_by_name" jdbcType="VARCHAR" property="createByName"/>
- <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
- <result column="update_by_name" jdbcType="VARCHAR" property="updateByName"/>
- <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
- <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
- <result column="remark" jdbcType="VARCHAR" property="remark"/>
- <result column="fees_id" jdbcType="BIGINT" property="feesId"/>
- <result column="is_print" jdbcType="INTEGER" property="isPrint"/>
- <result column="is_finish" jdbcType="INTEGER" property="isFinish"/>
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`receive_money`,`pay_money`,`set_off_money`,`use_money`,`status`,`type`,
- `receive_type`,`money_detail`,`create_by`,`create_by_name`,`update_by`,`update_by_name`,`merchant_id`,`rent_shop_type`,`remark`,
- `fees_id`,`is_print`,`is_finish`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where 1=1
- <if test=" null != id ">and `id` = #{id}</if>
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != status ">and `status` = #{status}</if>
- <if test=" null != type ">and `type` = #{type}</if>
- <if test=" null != receiveType ">and `receive_type` = #{receiveType}</if>
- <if test=" null != merchantId ">and `merchant_id` = #{merchantId}</if>
- <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
- <if test=" null != createTimeBegin ">and `create_time` >= #{createTimeBegin}</if>
- <if test=" null != createTimeEnd ">and `create_time` <= #{createTimeEnd}</if>
- <if test=" null != feesId ">and `fees_id` = #{feesId}</if>
- <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
- <if test=" null != isPrint ">and `is_print` = #{isPrint}</if>
- <if test=" null != isFinish ">and `is_finish` = #{isFinish}</if>
- <if test=" null != finishStatus ">and `status` in (1,3)</if>
- <if test=" null != hasExtraMoney ">and receive_money - IFNULL(use_money,'0') > 0</if>
- <if test=" null != merchantIdList ">
- and merchant_id in
- <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")">
- #{midItem}
- </foreach>
- </if>
- <if test=" null != feesIdList ">
- and fees_id in
- <foreach collection="feesIdList" index="index" item="fidItem" open="(" separator="," close=")">
- #{fidItem}
- </foreach>
- </if>
- <if test=" null != ids ">
- and id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- </sql>
-
- <select id="findList" parameterType="com.iformall.domain.po.WxFinanceReceive" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_finance_receive
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="findCount" parameterType="com.iformall.domain.po.WxFinanceReceive" resultType="Integer">
- select count(1)
- from wx_finance_receive
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_finance_receive where id = #{id} and `tenant_id` = #{tenantId}
- </select>
-
- <update id = "setIsDel" parameterType="HashMap">
- update wx_finance_receive set is_del = #{isDel} where id = #{id} and `tenant_id` = #{tenantId}
- </update>
-
- <select id="getMerchantAdvanceGroupSumList" parameterType="com.iformall.domain.po.WxFinanceReceive" resultMap="BaseResultMap">
- select fees_id,sum(CAST(receive_money AS DECIMAL(20,4))) as receive_money,sum(CAST(IFNULL(use_money,'0') AS DECIMAL(20,4))) as use_money
- from wx_finance_receive
- <include refid="dynamicWhereConditions"/>
- and receive_money - IFNULL(use_money,'0') > 0
- group by fees_id
- </select>
-
-
- <resultMap id="SumResultMap" type="com.iformall.domain.vo.WxFinanceReceiveSumVo">
- <result column="total_receive" jdbcType="VARCHAR" property="totalReceive"/>
- <result column="total_setoff" jdbcType="VARCHAR" property="totalSetoff" />
- <result column="total_pay" jdbcType="VARCHAR" property="totalPay"/>
- </resultMap>
- <select id="getReceiveSum" parameterType="com.iformall.domain.po.WxFinanceReceive" resultMap="SumResultMap">
- select
- sum(CAST(ifnull(receive_money,'0') AS DECIMAL(20,2))) total_receive ,
- sum(CAST(ifnull(set_off_money,'0') AS DECIMAL(20,2))) total_setoff,
- sum(CAST(ifnull(pay_money,'0') AS DECIMAL(20,2))) total_pay
- from wx_finance_receive
- <include refid="dynamicWhereConditions"/>
- </select>
- <resultMap id="PayWaySumResultMap" type="com.iformall.domain.po.WxFinanceReceivePayway">
- <result column="pay_way" jdbcType="BIGINT" property="payWay"/>
- <result column="receive" jdbcType="VARCHAR" property="receive"/>
- </resultMap>
- <select id="getReceivePayWaySum" parameterType="com.iformall.domain.po.WxFinanceReceive" resultMap="PayWaySumResultMap">
- select pay_way, sum(CAST(ifnull(receive,'0') AS DECIMAL(20,2))) receive
- from wx_finance_receive_payway where is_del = 0 and receive_id in (
- select id from wx_finance_receive
- <include refid="dynamicWhereConditions"/>
- )
- group by pay_way
- </select>
-
- <update id="finish" parameterType="com.iformall.domain.po.WxFinanceReceive">
- update wx_finance_receive set is_finish = 1
- <include refid="dynamicWhereConditions"/>
- </update>
-
- <update id="updatePrint" parameterType="com.iformall.domain.po.WxFinanceReceive">
- update wx_finance_receive set is_print = 1 where id = #{id} and tenant_id = #{tenantId}
- </update>
-
- </mapper>
|