| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.mzl.flower.mapper.flower.FlowerCategoryMapper"> |
| | | |
| | | <select id="selectCategoryList" resultType="com.mzl.flower.dto.response.flower.FlowerCategoryTreeDTO"> |
| | | SELECT q.* |
| | | , (select count(1) from t_flower_category f where f.parent_id = q.id) childrenCount |
| | | FROM t_flower_category q |
| | | WHERE q.deleted = 0 |
| | | <if test="condition.name != null and condition.name != ''"> |
| | | AND (q.name LIKE concat('%', #{condition.name},'%') |
| | | or exists ( |
| | | select 1 from t_flower_category sq where sq.parent_id = q.id and sq.name LIKE concat('%', #{condition.name},'%') |
| | | ) |
| | | ) |
| | | </if> |
| | | <choose> |
| | | <when test="condition.parentId != null"> |
| | | AND q.parent_id = #{condition.parentId} |
| | | </when> |
| | | <otherwise> |
| | | AND q.parent_id is null |
| | | </otherwise> |
| | | </choose> |
| | | <if test="condition.shown != null and condition.shown"> |
| | | AND (q.shown = 1 or q.shown is null) |
| | | </if> |
| | | <if test="condition.shown != null and !condition.shown"> |
| | | AND q.shown = 0 |
| | | </if> |
| | | ORDER BY q.sort_by, q.create_time Desc |
| | | </select> |
| | | |
| | | <select id="selectTreeList" resultType="com.mzl.flower.dto.response.flower.FlowerCategoryTreeDTO"> |
| | | SELECT q.* |
| | | , (select min(f.price) from t_flower f where f.category = q.id and f.status = 'UP' and f.deleted = 0) priceLow |