| | |
| | | </sql> |
| | | |
| | | <select id="findAll" resultMap="BaseResultMap"> |
| | | select |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | from pc_product |
| | | FROM pc_product |
| | | <where> |
| | | <if test="criteria.storeId != null"> |
| | | and store_id = #{criteria.storeId} |
| | |
| | | and active = #{criteria.active} |
| | | </if> |
| | | </where> |
| | | order by product_id desc |
| | | <!--<if test="criteria.sortColumn != null and criteria.sortColumn != ''"> |
| | | order by ${criteria.sortColumn} ${criteria.sortDirection} |
| | | </if>--> |
| | | ORDER BY |
| | | <choose> |
| | | <!-- 价格升序 --> |
| | | <when test="criteria.sortColumn == 'price' and criteria.sortDirection == 'asc'">price ASC</when> |
| | | <!-- 价格降序 --> |
| | | <when test="criteria.sortColumn == 'price' and criteria.sortDirection == 'desc'">price DESC</when> |
| | | <!-- 创建时间降序(默认) --> |
| | | <otherwise>create_time DESC</otherwise> |
| | | </choose> |
| | | <if test="criteria.limit != null"> |
| | | limit #{criteria.limit} |
| | | LIMIT #{criteria.limit} |
| | | </if> |
| | | </select> |
| | | |