TenantAlbumMapper.xml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.yonge.cooleshow.biz.dal.mapper.TenantAlbumMapper">
  4. <!-- 表字段 -->
  5. <sql id="baseColumns">
  6. t.id_ AS id
  7. , t.name_ AS `name`
  8. , t.describe_ AS `describe`
  9. , t.cover_img_ AS coverImg
  10. , t.music_num_ AS musicNum
  11. , t.original_price_ AS originalPrice
  12. , t.sale_price_ AS salePrice
  13. , t.purchase_cycle_ AS purchaseCycle
  14. , t.subject_types_ AS subjectTypes
  15. , t.status_ AS status
  16. , t.del_flag_ AS delFlag
  17. , t.update_time_ AS updateTime
  18. , t.create_time_ AS createTime
  19. , t.cost_price_ AS costPrice
  20. , t.category_type_id_ AS categoryTypeId
  21. , t.category_level_id_ AS categoryLevelId
  22. </sql>
  23. <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumWrapper$TenantAlbum">
  24. SELECT
  25. <include refid="baseColumns"/>
  26. , (t.sale_price_ - t.original_price_) AS tenantProfits
  27. , i.name_ AS tenantName
  28. FROM tenant_album t
  29. LEFT JOIN tenant_album_ref r on t.id_ = r.tenant_album_id_
  30. left join tenant_info i on r.tenant_id_ = i.id_
  31. <where>
  32. <if test="param.keyword !=null and param.keyword.trim() !=''">
  33. and (t.name_ like concat('%',#{param.keyword},'%')
  34. or i.name_ like concat('%',#{param.keyword},'%')
  35. or t.describe_ like concat('%',#{param.keyword},'%')
  36. )
  37. </if>
  38. <if test="param.tenantId != null ">
  39. and i.id_= #{param.tenantId}
  40. </if>
  41. </where>
  42. order by t.create_time_ DESC
  43. </select>
  44. </mapper>