<?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="cn.xluobo.business.stock.category.repo.mapper.StockCategoryPropertyMapper">

    <select id="selectByCondition" resultType="cn.xluobo.business.stock.category.repo.model.StockCategoryProperty">
        select a.*,b.category_name from stock_category_property a left join stock_category b on a.category_id=b.category_id
        where 1=1
        <if test="reqSearchStockCategoryProperty.categoryId != null and reqSearchStockCategoryProperty.categoryId != ''">
            and a.category_id=#{reqSearchStockCategoryProperty.categoryId}
        </if>
        <if test="reqSearchStockCategoryProperty.categoryName != null and reqSearchStockCategoryProperty.categoryName != ''">
            and b.category_name like concat('%', #{reqSearchStockCategoryProperty.categoryName}, '%')
        </if>
        <if test="reqSearchStockCategoryProperty.propertyCode != null and reqSearchStockCategoryProperty.propertyCode != ''">
            and a.property_code=#{reqSearchStockCategoryProperty.propertyCode}
        </if>
        <if test="reqSearchStockCategoryProperty.propertyName != null and reqSearchStockCategoryProperty.propertyName != ''">
            and a.property_name like concat('%', #{reqSearchStockCategoryProperty.propertyName}, '%')
        </if>
        order by a.category_id,a.sort
    </select>
</mapper>
