| | |
| | | <result column="category_id" property="categoryId"/> |
| | | <result column="second_category_id" property="secondCategoryId"/> |
| | | <result column="status" property="status"/> |
| | | <result column="shelf_status" property="shelfStatus"/> |
| | | <result column="main_image_id" property="mainImageId"/> |
| | | <result column="main_image_Url" property="mainImageUrl"/> |
| | | <result column="description" property="description"/> |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | product_id, store_id, code, barcode, name, title, category_id, second_category_id, status, main_image_id, main_image_url, description, price, stock_quantity, min_purchase_quantity, warn_stock, weight, width, length, height, returns, self_pickup, deleted_flag, create_by, create_time, update_by, update_time, version |
| | | product_id, store_id, code, barcode, name, title, category_id, second_category_id, status, shelf_status, main_image_id, main_image_url, description, price, stock_quantity, min_purchase_quantity, warn_stock, weight, width, length, height, returns, self_pickup, deleted_flag, create_by, create_time, update_by, update_time, version |
| | | </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} |
| | |
| | | <if test="criteria.status != null"> |
| | | and status = #{criteria.status} |
| | | </if> |
| | | <if test="criteria.shelfStatus != null"> |
| | | and shelf_status = #{criteria.shelfStatus} |
| | | </if> |
| | | <if test="criteria.active != null"> |
| | | and active = #{criteria.active} |
| | | </if> |
| | | </where> |
| | | <!--<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> |
| | | order by product_id desc |
| | | </select> |
| | | |
| | | </mapper> |