|
- <?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.WxFinanceReceiveBillMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxFinanceReceiveBill">
- <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="bill_id" jdbcType="BIGINT" property="billId"/>
- <result column="bill_cus_name" jdbcType="VARCHAR" property="billCusName"/>
- <result column="shop_id" jdbcType="BIGINT" property="shopId"/>
- <result column="fees_id" jdbcType="BIGINT" property="feesId"/>
- <result column="pay_way" jdbcType="BIGINT" property="payWay"/>
- <result column="receive_id" jdbcType="BIGINT" property="receiveId"/>
- <result column="receive" jdbcType="VARCHAR" property="receive"/>
- <result column="pay" jdbcType="VARCHAR" property="pay"/>
- <result column="starttime" jdbcType="TIMESTAMP" property="starttime"/>
- <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/>
- <result column="is_del" jdbcType="INTEGER" property="isDel"/>
- <result column="type" jdbcType="INTEGER" property="type"/>
- <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate"/>
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`bill_id`,`bill_cus_name`,`shop_id`,`fees_id`,
- `pay_way`,`receive_id`,`receive`,`pay`,`starttime`,`endtime`,`is_del`,`type`,`receive_date`
- </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 != billId ">and `bill_id` = #{billId}</if>
- <if test=" null != billCusName and '' != billCusName">
- and `bill_cus_name` like concat('%',#{billCusName},'%')
- </if>
- <if test=" null != shopId ">and `shop_id` = #{shopId}</if>
- <if test=" null != feesId ">and `fees_id` = #{feesId}</if>
- <if test=" null != payWay ">and `pay_way` = #{payWay}</if>
- <if test=" null != receiveId ">and `receive_id` = #{receiveId}</if>
- <if test=" null != isDel ">and `is_del` = #{isDel}</if>
- <if test=" null != createTimeBegin ">and `create_time` >= #{createTimeBegin}</if>
- <if test=" null != createTimeEnd ">and `create_time` <= #{createTimeEnd}</if>
- <if test=" null != starttime ">and `starttime` >= #{starttime}</if>
- <if test=" null != endtime ">and `endtime` <= #{endtime}</if>
- <if test=" 1 == noReduce ">and `pay_way` != 4 </if>
- <if test=" null != type ">and type = #{type} </if>
-
- <if test=" null != shopIdList ">
- and shop_id in
- <foreach collection="shopIdList" index="index" item="shidItem" open="(" separator="," close=")">
- #{shidItem}
- </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 != payWayList ">
- and pay_way in
- <foreach collection="payWayList" index="index" item="paidItem" open="(" separator="," close=")">
- #{paidItem}
- </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.WxFinanceReceiveBill" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_finance_receive_bill
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_finance_receive_bill where id = #{id} and `tenant_id` = #{tenantId}
- </select>
-
- <update id = "deleteByConditon" parameterType="com.iformall.domain.po.WxFinanceReceiveBill">
- update wx_finance_receive_bill set is_del = 1 ,update_time = #{updateTime}
- <include refid="dynamicWhereConditions"/>
- </update>
-
- <select id="findBillIdList" parameterType="com.iformall.domain.po.WxFinanceReceiveBill" resultType="Long">
- select distinct bill_id
- from wx_finance_receive_bill
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="findReceiveIdList" parameterType="com.iformall.domain.po.WxFinanceReceiveBill" resultType="Long">
- select distinct receive_id
- from wx_finance_receive_bill
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <resultMap id="sumResultMap" type="com.iformall.domain.vo.WxFinanceReceiveBillSum">
- <result column="receive" jdbcType="VARCHAR" property="receive"/>
- <result column="pay" jdbcType="VARCHAR" property="pay" />
- </resultMap>
- <select id="findSum" parameterType="com.iformall.domain.po.WxFinanceReceiveBill" resultMap="sumResultMap">
- select
- sum(CAST(ifnull(receive,'0') AS DECIMAL(20,2))) receive ,
- sum(CAST(ifnull(pay,'0') AS DECIMAL(20,2))) pay
- from wx_finance_receive_bill
- <include refid="dynamicWhereConditions"/>
- </select>
-
- </mapper>
|