You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.6 KiB

<?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.example.demo.mapper.coin.BeanRechargeMapper1">
<insert id="add" parameterType="com.example.demo.domain.vo.bean.BeanRecharge" useGeneratedKeys="true" keyProperty="id">
INSERT INTO audit
<trim prefix="(" suffix=")" suffixOverrides=",">
jwcode,
buy_jd,
free_jd,
type,
admin_name,
remark,
audit_status
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{jwcode},
#{permanentBean},
#{freeBean},
0,
#{adminName},
#{remark},
0
</trim>
</insert>
<!--筛选查询小黄车消费数据-->
<select id="selectCartBy" resultType="com.example.demo.domain.vo.bean.BeanConsumeCartVo">
select
co.id, co.nickname,co.jwcode,m.name AS market,pd.name AS productName,co.total_money,co.source_name,co.live_name, FROM_UNIXTIME(co.created_at) AS createdAt
from cart_order co
left join user u on u.jwcode = co.jwcode
left join market m on m.id = u.market
left join product_dict pd on pd.id = co.product_id
<where>
<if test="jwcode!= null and jwcode!=''">
and co.jwcode =#{jwcode}
</if>
<if test="market!= null and market!=''">
and m.id = #{market}
</if>
<if test="productName!= null and productName!=''">
and pd.name = #{productName}
</if>
<if test="liveName!= null and liveName!=''">
and co.live_name = #{liveName}
</if>
<if test="sourceName!= null and sourceName!=''">
and co.source_name = #{sourceName}
</if>
<if test="startAt!= null and startAt!='' and endAt!=null and endAt!=''">
and co.created_at between
UNIX_TIMESTAMP(#{beanConsumeCartDTO.startTime}) and
UNIX_TIMESTAMP(#{beanConsumeCartDTO.endTime})
</if>
</where>
<choose>
<when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
ORDER BY ${sortField} ${sortOrder}
</when>
<otherwise>
ORDER BY created_at DESC
</otherwise>
</choose>
</select>
</mapper>