1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?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.yonge.cooleshow.biz.dal.mapper.TenantAlbumMapper">
- <!-- 表字段 -->
- <sql id="baseColumns">
- t.id_ AS id
- , t.name_ AS `name`
- , t.describe_ AS `describe`
- , t.cover_img_ AS coverImg
- , t.music_num_ AS musicNum
- , t.original_price_ AS originalPrice
- , t.sale_price_ AS salePrice
- , t.purchase_cycle_ AS purchaseCycle
- , t.subject_types_ AS subjectTypes
- , t.status_ AS status
- , t.del_flag_ AS delFlag
- , t.update_time_ AS updateTime
- , t.create_time_ AS createTime
- , t.cost_price_ AS costPrice
- , t.category_type_id_ AS categoryTypeId
- , t.category_level_id_ AS categoryLevelId
- , t.purchase_types_ AS purchaseTypes
- , t.purchase_json_ AS purchaseJson
- </sql>
- <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumWrapper$TenantAlbum">
- SELECT
- <include refid="baseColumns"/>
- , (t.sale_price_ - t.original_price_) AS tenantProfits
- , i.name_ AS tenantName
- FROM tenant_album t
- LEFT JOIN tenant_album_ref r on t.id_ = r.tenant_album_id_
- left join tenant_info i on r.tenant_id_ = i.id_
- <where>
- <if test="param.keyword !=null and param.keyword.trim() !=''">
- and (t.name_ like concat('%',#{param.keyword},'%')
- or i.name_ like concat('%',#{param.keyword},'%')
- or t.describe_ like concat('%',#{param.keyword},'%')
- )
- </if>
- <if test="param.tenantId != null ">
- and i.id_= #{param.tenantId}
- </if>
- <if test="param.status != null">
- and t.status_ = #{param.status}
- </if>
- </where>
- order by t.create_time_ DESC
- </select>
- <select id="selectListByTenantIds"
- resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumWrapper$SmallTenantAlbum">
- SELECT
- t.id_ as id ,
- t.name_ as name,
- r.tenant_id_ as tenantId
- from tenant_album t
- left join tenant_album_ref r on t.id_ = r.tenant_album_id_
- where tenant_id_ in
- <foreach collection="tenantIds" item="tenantId" open="(" close=")" separator=",">
- #{tenantId}
- </foreach>
- and t.del_flag_ =0 and t.status_ = 1
- </select>
- </mapper>
|