| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- <?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.sqx.modules.pay.dao.CashOutDao">
- <select id="selectCashOutLimit3" resultType="com.sqx.modules.pay.entity.CashOut">
- select * from cash_out where state=1 order by out_at desc limit 3
- </select>
- <select id="selectCashOutSum" resultType="Double">
- select sum(money) from cash_out where state in (0,1) and user_id=#{userId} and date_format(create_at,'%Y-%m-%d') between #{startTime} and #{endTime}
- </select>
- <select id="selectCashOutSumsByNowMonth" resultType="Double">
- select ifnull(sum(money),0.00) from cash_out where `state` in (0,1) and user_id=#{userId} and date_format(create_at,'%Y-%m')=date_format(now(),'%Y-%m')
- </select>
- <select id="selectMayMoney" resultType="Double">
- select money from user_money where user_id=#{userId}
- </select>
- <update id="updateMayMoney">
- update user_money set
- <if test="type==1">
- money=money+#{money}
- </if>
- <if test="type==2">
- money=money-#{money}
- </if>
- where user_id=#{userId}
- </update>
- <select id="sumMoney" resultType="java.math.BigDecimal">
- select ifnull(sum(money), 0) from cash_out where 1 = 1
- <if test="dateType=='day'">
- and date_format(create_at,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
- </if>
- <if test="dateType=='month'">
- and date_format(create_at,'%Y-%m')=date_format(#{date},'%Y-%m')
- </if>
- <if test="dateType=='year'">
- and date_format(create_at,'%Y')=date_format(#{date},'%Y')
- </if>
- <if test="state!=null">
- and state = #{state}
- </if>
- <if test="type!=null">
- and type = #{type}
- </if>
- </select>
- <select id="countMoney" resultType="Integer">
- select count(*) from cash_out where 1 = 1
- <if test="dateType=='day'">
- and date_format(create_at,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
- </if>
- <if test="dateType=='month'">
- and date_format(create_at,'%Y-%m')=date_format(#{date},'%Y-%m')
- </if>
- <if test="dateType=='year'">
- and date_format(create_at,'%Y')=date_format(#{date},'%Y')
- </if>
- <if test="state!=null">
- and state = #{state}
- </if>
- <if test="type!=null">
- and type = #{type}
- </if>
- </select>
- <select id="stayMoney" resultType="Integer">
- select count(*) from cash_out where 1 = 1
- <if test="dateType=='day'">
- and date_format(create_at,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
- </if>
- <if test="dateType=='month'">
- and date_format(create_at,'%Y-%m')=date_format(#{date},'%Y-%m')
- </if>
- <if test="dateType=='year'">
- and date_format(create_at,'%Y')=date_format(#{date},'%Y')
- </if>
- and state=0
- <if test="type!=null">
- and type = #{type}
- </if>
- </select>
- <select id="applyMoneySum" resultType="java.math.BigDecimal">
- select ifnull(sum(money), 0) from cash_out where 1 = 1
- <if test="dateType=='day'">
- and date_format(create_at,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
- </if>
- <if test="dateType=='month'">
- and date_format(create_at,'%Y-%m')=date_format(#{date},'%Y-%m')
- </if>
- <if test="dateType=='year'">
- and date_format(create_at,'%Y')=date_format(#{date},'%Y')
- </if>
- and state = 0
- <if test="type!=null">
- and type = #{type}
- </if>
- </select>
- <select id="accomplishMoneySum" resultType="java.math.BigDecimal">
- select ifnull(sum(money), 0) from cash_out where 1 = 1
- <if test="dateType=='day'">
- and date_format(create_at,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
- </if>
- <if test="dateType=='month'">
- and date_format(create_at,'%Y-%m')=date_format(#{date},'%Y-%m')
- </if>
- <if test="dateType=='year'">
- and date_format(create_at,'%Y')=date_format(#{date},'%Y')
- </if>
- and state = 1
- <if test="type!=null">
- and type = #{type}
- </if>
- </select>
- <select id="refuseMoneySum" resultType="java.math.BigDecimal">
- select ifnull(sum(money), 0) from cash_out where 1 = 1
- <if test="dateType=='day'">
- and date_format(create_at,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
- </if>
- <if test="dateType=='month'">
- and date_format(create_at,'%Y-%m')=date_format(#{date},'%Y-%m')
- </if>
- <if test="dateType=='year'">
- and date_format(create_at,'%Y')=date_format(#{date},'%Y')
- </if>
- and state = -1
- <if test="type!=null">
- and type = #{type}
- </if>
- </select>
- <select id="zhifubaoMoneySum" resultType="java.math.BigDecimal">
- select ifnull(sum(money), 0) from cash_out where 1 = 1
- <if test="dateType=='day'">
- and date_format(create_at,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
- </if>
- <if test="dateType=='month'">
- and date_format(create_at,'%Y-%m')=date_format(#{date},'%Y-%m')
- </if>
- <if test="dateType=='year'">
- and date_format(create_at,'%Y')=date_format(#{date},'%Y')
- </if>
- and classify = 1 and state = 1
- <if test="type!=null">
- and type = #{type}
- </if>
- </select>
- <select id="weixinMoneySum" resultType="java.math.BigDecimal">
- select ifnull(sum(money), 0) from cash_out where 1 = 1
- <if test="dateType=='day'">
- and date_format(create_at,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
- </if>
- <if test="dateType=='month'">
- and date_format(create_at,'%Y-%m')=date_format(#{date},'%Y-%m')
- </if>
- <if test="dateType=='year'">
- and date_format(create_at,'%Y')=date_format(#{date},'%Y')
- </if>
- and classify = 2 and state = 1
- <if test="type!=null">
- and type = #{type}
- </if>
- </select>
- <select id="cashDepositMoneySum" resultType="java.math.BigDecimal">
- select ifnull(sum(money), 0) from cash_out where 1 = 1
- <if test="dateType=='day'">
- and date_format(create_at,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
- </if>
- <if test="dateType=='month'">
- and date_format(create_at,'%Y-%m')=date_format(#{date},'%Y-%m')
- </if>
- <if test="dateType=='year'">
- and date_format(create_at,'%Y')=date_format(#{date},'%Y')
- </if>
- and state = 1 and type = 3
- </select>
- <select id="cargoInsurance" resultType="java.math.BigDecimal">
- select ifnull(sum(cargo_insurance), 0) from tb_indent where 1 = 1
- <if test="dateType=='day'">
- and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
- </if>
- <if test="dateType=='month'">
- and date_format(create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
- </if>
- <if test="dateType=='year'">
- and date_format(create_time,'%Y')=date_format(#{date},'%Y')
- </if>
- and indent_state =6
- </select>
- <select id="MoneySumByIndentType" resultType="java.math.BigDecimal">
- select ifnull(sum(platform_money), 0) from tb_indent where 1 = 1
- <if test="dateType=='day'">
- and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
- </if>
- <if test="dateType=='month'">
- and date_format(create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
- </if>
- <if test="dateType=='year'">
- and date_format(create_time,'%Y')=date_format(#{date},'%Y')
- </if>
- and indent_state = 6 and indent_type = #{indentType}
- </select>
- <select id="cashDepositMoney" resultType="java.math.BigDecimal">
- select ifnull(sum(money), 0) from pay_details where 1 = 1
- <if test="dateType=='day'">
- and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
- </if>
- <if test="dateType=='month'">
- and date_format(create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
- </if>
- <if test="dateType=='year'">
- and date_format(create_time,'%Y')=date_format(#{date},'%Y')
- </if>
- and type = 3 and state = 1
- </select>
- <sql id="cashOutQueryCondition">
- <where>
- <if test="params.zhifubaoName != null and params.zhifubaoName != '' and params.zhifubaoName != 'null'">
- and co.zhifubao_name = #{params.zhifubaoName}
- </if>
- <if test="params.zhifubao != null and params.zhifubao != '' and params.zhifubao != 'null'">
- and co.zhifubao = #{params.zhifubao}
- </if>
- <if test="params.userId != null and params.userId != '' and params.userId != 'null'">
- and co.user_id = #{params.userId}
- </if>
- <if test="params.type != null and params.type != '' and params.type != 'null'">
- and co.type = #{params.type}
- </if>
- <if test="params.state != null and params.state != '' and params.state != 'null'">
- and co.state = #{params.state}
- </if>
- <if test="params.phone != null and params.phone != '' and params.phone != 'null'">
- and co.phone like concat('%',#{params.phone},'%')
- </if>
- <if test="params.classify == '1'">
- and co.classify = #{params.classify}
- </if>
- <if test="params.classify == '2'">
- and co.classify in ("2", "3", "4")
- </if>
- <if test="params.startTime != null and params.startTime != '' and params.startTime != 'null'">
- and co.create_at <![CDATA[ >= ]]> #{params.startTime}
- </if>
- <if test="params.endTime != null and params.endTime != '' and params.endTime != 'null'">
- and co.create_at <![CDATA[ ><= ]]> #{params.endTime}
- </if>
- <if test="params.shopName != null and params.shopName != '' and params.shopName != 'null'">
- and gh.shop_name like concat('%',#{params.shopName},'%')
- </if>
- </where>
- </sql>
- <select id="selectCashOutList" resultType="com.sqx.modules.pay.vo.CashOutVO">
- select gh.shop_name, co.*
- from cash_out co
- left join goods_shop gh on gh.shop_id = co.shop_id
- <include refid="cashOutQueryCondition"></include>
- order by id desc
- </select>
- <select id="selectCashOutTotal" resultType="java.lang.Double">
- select sum(co.money)
- from cash_out co
- left join goods_shop gh on gh.shop_id = co.shop_id
- <include refid="cashOutQueryCondition"></include>
- </select>
- </mapper>
|