MallGoodsMapper.xml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.emato.biz.mapper.mall.MallGoodsMapper">
  6. <resultMap id="MallGoodsVO" type="com.emato.biz.domain.mall.MallGoodsVO">
  7. <result property="merchSn" column="merch_sn" />
  8. <result property="merchName" column="merch_name" />
  9. <result property="sku" column="sku" />
  10. <result property="plu" column="plu" />
  11. <result property="mychemId" column="mychem_id" />
  12. <result property="goodsName" column="name" />
  13. <result property="englishName" column="english_name" />
  14. <result property="brand" column="brand" />
  15. <result property="inveNum" column="goods_number" />
  16. </resultMap>
  17. <!-- 查询商品信息的字段 -->
  18. <sql id="selectMallGoodsVOColumns">
  19. t1.merch_sn,
  20. t1.sku,
  21. t1.plu,
  22. t1.mychem_id,
  23. t1.name,
  24. t1.english_name,
  25. t1.brand,
  26. t1.goods_number
  27. </sql>
  28. <!-- 查询商品信息 VO 列表 -->
  29. <select id="selectMallGoodsList" resultMap="MallGoodsVO">
  30. SELECT
  31. <include refid="selectMallGoodsVOColumns" />,
  32. t2.merch_name
  33. FROM
  34. mall_goods t1
  35. LEFT JOIN merchant_base t2 ON t1.merch_sn = t2.merch_sn
  36. <where>
  37. t1.is_delete = '0'
  38. <if test="merchSn != null and merchSn != ''"> and t1.merch_sn = #{merchSn}</if>
  39. <if test="sku != null and sku != ''"> and t1.sku = #{sku}</if>
  40. <if test="plu != null and plu != ''"> and t1.PLU = #{plu}</if>
  41. <if test="goodsName != null and goodsName != ''"> and t1.name like concat('%', #{goodsName}, '%')</if>
  42. </where>
  43. </select>
  44. </mapper>