美文网首页
mybatis like 使用

mybatis like 使用

作者: wangxiaoda | 来源:发表于2017-05-03 18:43 被阅读229次
<select id="selectByBcIdLikeName" resultMap="PlayServiceWithPic_ResultMap"
            parameterType="java.util.Map">
        SELECT
        <include refid="PlayService_Column_List"/>
        ,
        <include refid="PlayServiceMultimedia_Column_List"/>
        FROM
        playservice AS ps

        LEFT OUTER JOIN playservicemultimedia AS psm ON ps.objectId = psm.serviceId

        WHERE
        ps.bcId = #{bcId,jdbcType=VARCHAR}
        and name like CONCAT('%',#{name,jdbcType=VARCHAR},'%' )
        AND ps.STATUS = 1
        AND UNIX_TIMESTAMP() > UNIX_TIMESTAMP(ps.saleStartTime)
        AND UNIX_TIMESTAMP() &lt; UNIX_TIMESTAMP(ps.saleEndTime)
        ORDER BY
        ps.orderField ASC,
        ps.updatedAt DESC,
        ps.createdAt DESC
</select>
<sql id="PlayService_Column_List">
        ps.objectId AS ps_objectId,
        ps.NAME AS ps_name,
        ps.bcId AS ps_bcId,
        ps.bcType AS ps_bcType,
        ps.saleCount AS ps_saleCount,
        ps.commentCount AS ps_commentCount,
        ps.starCount AS ps_starCount,
        ps.ageStart AS ps_ageStart,
        ps.ageEnd AS ps_ageEnd,
        ps.currentPrice AS ps_currentPrice,
        ps.price AS ps_price,
        ps.updatedAt AS ps_updatedAt,
        ps.starTotalCount AS ps_starTotalCount,
        ps.starTotalTimes AS ps_starTotalTimes
</sql>

<sql id="PlayServiceMultimedia_Column_List">
        psm.objectId AS psm_objectId,
        psm.url AS psm_url
</sql>

相关文章

网友评论

      本文标题:mybatis like 使用

      本文链接:https://www.haomeiwen.com/subject/ilrltxtx.html