<?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.fzm.mall.server.front.asset.mapper.UserAssetMapper">
    <select id="searchAssetLike" resultType="com.fzm.mall.server.front.asset.model.UserAsset">
        SELECT
        a.* from user_asset a left join goods_sku k on
        a.coin = k.coin_name
        left join goods_spu p on k.goods_id = p.goods_id
        <where>
            <if test="uid!=null and uid!=''">
               and a.uid = #{uid}
            </if>
            <if test="type!=null and type!=''">
                and a.type = #{type}
            </if>
            <if test="keyWord!=null and keyWord!=''">
                and p.name like CONCAT('%', #{keyWord},'%') or k.coin_name like CONCAT('%', #{keyWord},'%')
            </if>
        </where>
        ORDER BY a.create_time DESC,a.id desc
    </select>
</mapper>
