From 540c238d3963a79b96103357b7757f9457831224 Mon Sep 17 00:00:00 2001 From: wxy Date: Mon, 1 Apr 2024 21:10:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/controller/TypeController.java | 11 ++++++---- .../com/muyu/product/mapper/TypeMapper.java | 3 ++- .../product/service/impl/TypeServiceImpl.java | 2 +- .../resources/mapper/product/TypeMapper.xml | 22 ++----------------- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/TypeController.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/TypeController.java index 6ed1b66..1f21343 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/TypeController.java +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/TypeController.java @@ -24,16 +24,19 @@ public class TypeController { private TypeService typeService; - @GetMapping("/queryType") + @GetMapping("/queryTypeAll") public AjaxResult queryTypeAll(){ - Listlist=typeService.queryTypeAll(); + List list =typeService.queryTypeAll(); return AjaxResult.success(list); } - + /** + * 类型所有查询 + * @return + */ @GetMapping("/queryTypeAttr/{flag}/{id}") public AjaxResult queryType(@PathVariable Integer flag,@PathVariable Integer id){ - Listlist=typeService.queryType(flag,id); + List list =typeService.queryType(flag,id); return AjaxResult.success(list); } diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/mapper/TypeMapper.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/mapper/TypeMapper.java index 6422f19..f63b4b4 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/mapper/TypeMapper.java +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/mapper/TypeMapper.java @@ -3,6 +3,7 @@ package com.muyu.product.mapper; import com.muyu.product.domain.DTO.ProductTypeAttr; import com.muyu.product.domain.Resp.ProductTypeResp; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -16,6 +17,6 @@ public interface TypeMapper { List queryTypeAll(); - List queryType(); + List queryType(@Param("flag") Integer flag, @Param("id") Integer id); } diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/TypeServiceImpl.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/TypeServiceImpl.java index 4828349..3300a7a 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/TypeServiceImpl.java +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/TypeServiceImpl.java @@ -27,6 +27,6 @@ public class TypeServiceImpl implements TypeService { @Override public List queryType(Integer flag, Integer id) { - return typeMapper.queryType(); + return typeMapper.queryType(flag,id); } } diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/resources/mapper/product/TypeMapper.xml b/muyu-modules/muyu-product/muyu-product-server/src/main/resources/mapper/product/TypeMapper.xml index 1439802..586983b 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/resources/mapper/product/TypeMapper.xml +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/resources/mapper/product/TypeMapper.xml @@ -26,7 +26,7 @@ type_name, ta.product_type_id, attr_name, - MAX(ta.multiple_choice) AS multiple_choice, + multiple_choice, ta.input_method, sort, flag, @@ -37,29 +37,11 @@ input, selection, manual_operation, - tav.type_attr_id, - CAST(GROUP_CONCAT(tav.type_attr_value) AS CHAR) AS typeAttrValue + tav.type_attr_id FROM t_product_type t INNER JOIN t_product_type_attr ta ON t.id = ta.product_type_id INNER JOIN t_product_type_attr_value tav ON tav.type_attr_id = ta.id - WHERE - ta.flag = ? AND t.id = ? - GROUP BY - type_name, - ta.product_type_id, - attr_name, - ta.input_method, - sort, - flag, - screen, - search, - association, - stats, - input, - selection, - manual_operation, - tav.type_attr_id;