select * from cash_out where state=1 order by out_at desc limit 3
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 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 money from user_money where user_id=#{userId}
update user_money set
money=money+#{money}
money=money-#{money}
where user_id=#{userId}
select ifnull(sum(money), 0) from cash_out where 1 = 1
and date_format(create_at,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
and date_format(create_at,'%Y-%m')=date_format(#{date},'%Y-%m')
and date_format(create_at,'%Y')=date_format(#{date},'%Y')
and state = #{state}
and type = #{type}
select count(*) from cash_out where 1 = 1
and date_format(create_at,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
and date_format(create_at,'%Y-%m')=date_format(#{date},'%Y-%m')
and date_format(create_at,'%Y')=date_format(#{date},'%Y')
and state = #{state}
and type = #{type}
select count(*) from cash_out where 1 = 1
and date_format(create_at,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
and date_format(create_at,'%Y-%m')=date_format(#{date},'%Y-%m')
and date_format(create_at,'%Y')=date_format(#{date},'%Y')
and state=0
and type = #{type}
select ifnull(sum(money), 0) from cash_out where 1 = 1
and date_format(create_at,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
and date_format(create_at,'%Y-%m')=date_format(#{date},'%Y-%m')
and date_format(create_at,'%Y')=date_format(#{date},'%Y')
and state = 0
and type = #{type}
select ifnull(sum(money), 0) from cash_out where 1 = 1
and date_format(create_at,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
and date_format(create_at,'%Y-%m')=date_format(#{date},'%Y-%m')
and date_format(create_at,'%Y')=date_format(#{date},'%Y')
and state = 1
and type = #{type}
select ifnull(sum(money), 0) from cash_out where 1 = 1
and date_format(create_at,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
and date_format(create_at,'%Y-%m')=date_format(#{date},'%Y-%m')
and date_format(create_at,'%Y')=date_format(#{date},'%Y')
and state = -1
and type = #{type}
select ifnull(sum(money), 0) from cash_out where 1 = 1
and date_format(create_at,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
and date_format(create_at,'%Y-%m')=date_format(#{date},'%Y-%m')
and date_format(create_at,'%Y')=date_format(#{date},'%Y')
and classify = 1 and state = 1
and type = #{type}
select ifnull(sum(money), 0) from cash_out where 1 = 1
and date_format(create_at,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
and date_format(create_at,'%Y-%m')=date_format(#{date},'%Y-%m')
and date_format(create_at,'%Y')=date_format(#{date},'%Y')
and classify = 2 and state = 1
and type = #{type}
select ifnull(sum(money), 0) from cash_out where 1 = 1
and date_format(create_at,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
and date_format(create_at,'%Y-%m')=date_format(#{date},'%Y-%m')
and date_format(create_at,'%Y')=date_format(#{date},'%Y')
and state = 1 and type = 3
select ifnull(sum(cargo_insurance), 0) from tb_indent where 1 = 1
and date_format(create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
and date_format(create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
and date_format(create_time,'%Y')=date_format(#{query.date},'%Y')
and create_time>=#{query.startTime}
and create_time #{query.endTime}
and indent_state =6
select ifnull(sum(platform_money), 0) from tb_indent where 1 = 1
and date_format(create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
and date_format(create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
and date_format(create_time,'%Y')=date_format(#{query.date},'%Y')
and create_time>=#{query.startTime}
and create_time #{query.endTime}
and indent_state = 6 and indent_type = #{indentType}
select ifnull(sum(money), 0) from pay_details where 1 = 1
and date_format(create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
and date_format(create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
and date_format(create_time,'%Y')=date_format(#{query.date},'%Y')
and create_time>=#{query.startTime}
and create_time #{query.endTime}
and type = 3 and state = 1
and co.zhifubao_name = #{params.zhifubaoName}
and co.zhifubao = #{params.zhifubao}
and co.user_id = #{params.userId}
and co.type = #{params.type}
and co.state = #{params.state}
and co.phone like concat('%',#{params.phone},'%')
and co.classify = #{params.classify}
and co.classify in (2, 3, 4)
and co.create_at = ]]> #{params.startTime}
and co.create_at #{params.endTime}
and co.out_at = ]]> #{params.outStartTime}
and co.out_at #{params.outEndTime}
and gh.shop_name like concat('%',#{params.shopName},'%')
and co.bank_card_no = #{params.bankCardNo}
and co.bank_real_name = #{params.bankRealName}
and co.open_bank = #{params.openBank}
and tu.rider_station_id = #{params.riderStationId}
select gh.shop_name, co.*,rs.station_name as stationName,tu.user_name as userName, gh.mch_id as mchId, tu.phone as phoneNumber
from cash_out co
left join goods_shop gh on gh.shop_id = co.shop_id
left join tb_user tu on tu.user_id=co.user_id
left join rider_station rs on tu.rider_station_id=rs.id
order by id desc
select co.*, rs.station_name as stationName, tu.user_name as userName, rbci.mch_id as mchId
from cash_out co
left join tb_user tu on tu.user_id = co.user_id
left join rider_bank_card_info rbci on rbci.user_id = co.user_id
left join rider_station rs on tu.rider_station_id=rs.id
order by co.id desc
select ifnull(sum(co.money), 0.0) as totalMoney
from cash_out co
left join goods_shop gh on gh.shop_id = co.shop_id
select ifnull(sum(co.rate), 0.0) as totalMoney
from cash_out co
left join goods_shop gh on gh.shop_id = co.shop_id
select gh.shop_name, co.*,rs.station_name as stationName
from cash_out co
left join goods_shop gh on gh.shop_id = co.shop_id
left join tb_user tu on tu.user_id=co.user_id
left join rider_station rs on tu.rider_station_id=rs.id
order by id desc