<?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.yami.shop.dao.CategoryProdHbMapper">


    <select id="pageByCode" resultType="com.yami.shop.bean.model.CategoryProdHb">
        select cp.*, p.prod_name as prodName, p.status
        from tz_category_prod_hb cp
        join tz_prod p on cp.prod_id = p.prod_id
        where p.is_delete = 0 and cp.is_delete = 0
        <if test="categoryProd.code != null">
            and cp.code = #{categoryProd.code}
        </if>
        <if test="categoryProd.prodName != null">
            and p.prod_name like concat('%',#{categoryProd.prodName},'%')
        </if>
        order by cp.id desc
    </select>


</mapper>
