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(#{date},'%Y-%m-%d')
and date_format(create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
and date_format(create_time,'%Y')=date_format(#{date},'%Y')
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(#{date},'%Y-%m-%d')
and date_format(create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
and date_format(create_time,'%Y')=date_format(#{date},'%Y')
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(#{date},'%Y-%m-%d')
and date_format(create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
and date_format(create_time,'%Y')=date_format(#{date},'%Y')
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 gh.shop_name like concat('%',#{params.shopName},'%')
select gh.shop_name, co.*
from cash_out co
left join goods_shop gh on gh.shop_id = co.shop_id
order by id desc
select sum(co.money)
from cash_out co
left join goods_shop gh on gh.shop_id = co.shop_id