TenantAlbumMapper.xml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. , t.purchase_types_ AS purchaseTypes
  23. , t.purchase_json_ AS purchaseJson
  24. </sql>
  25. <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumWrapper$TenantAlbum">
  26. SELECT
  27. <include refid="baseColumns"/>
  28. , (t.sale_price_ - t.original_price_) AS tenantProfits
  29. , i.name_ AS tenantName
  30. FROM tenant_album t
  31. LEFT JOIN tenant_album_ref r on t.id_ = r.tenant_album_id_
  32. left join tenant_info i on r.tenant_id_ = i.id_
  33. <where>
  34. <if test="param.keyword !=null and param.keyword.trim() !=''">
  35. and (t.name_ like concat('%',#{param.keyword},'%')
  36. or i.name_ like concat('%',#{param.keyword},'%')
  37. or t.describe_ like concat('%',#{param.keyword},'%')
  38. )
  39. </if>
  40. <if test="param.tenantId != null ">
  41. and i.id_= #{param.tenantId}
  42. </if>
  43. <if test="param.status != null">
  44. and t.status_ = #{param.status}
  45. </if>
  46. </where>
  47. order by t.create_time_ DESC
  48. </select>
  49. <select id="selectListByTenantIds"
  50. resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumWrapper$SmallTenantAlbum">
  51. SELECT
  52. t.id_ as id ,
  53. t.name_ as name,
  54. r.tenant_id_ as tenantId
  55. from tenant_album t
  56. left join tenant_album_ref r on t.id_ = r.tenant_album_id_
  57. where tenant_id_ in
  58. <foreach collection="tenantIds" item="tenantId" open="(" close=")" separator=",">
  59. #{tenantId}
  60. </foreach>
  61. and t.del_flag_ =0 and t.status_ = 1
  62. </select>
  63. </mapper>