dev798
wxy 2024-04-01 20:09:13 +08:00
parent cec44c36d3
commit 197359727b
6 changed files with 74 additions and 4 deletions

View File

@ -6,6 +6,7 @@ import com.muyu.product.domain.Resp.ProductTypeResp;
import com.muyu.product.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -24,12 +25,19 @@ public class TypeController {
@GetMapping("/queryType")
public AjaxResult queryType(){
public AjaxResult queryTypeAll(){
List<ProductTypeResp>list=typeService.queryTypeAll();
return AjaxResult.success(list);
}
@GetMapping("/queryTypeAttr/{flag}/{id}")
public AjaxResult queryType(@PathVariable Integer flag,@PathVariable Integer id){
List<ProductTypeAttr>list=typeService.queryType(flag,id);
return AjaxResult.success(list);
}
}

View File

@ -16,4 +16,6 @@ public interface TypeMapper {
List<ProductTypeResp> queryTypeAll();
List<ProductTypeAttr> queryType();
}

View File

@ -13,4 +13,6 @@ public interface TypeService {
List<ProductTypeResp> queryTypeAll();
List<ProductTypeAttr> queryType(Integer flag, Integer id);
}

View File

@ -24,4 +24,9 @@ public class TypeServiceImpl implements TypeService {
public List<ProductTypeResp> queryTypeAll() {
return typeMapper.queryTypeAll();
}
@Override
public List<ProductTypeAttr> queryType(Integer flag, Integer id) {
return typeMapper.queryType();
}
}

View File

@ -5,16 +5,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.muyu.product.mapper.ArgumentMapper">
<sql id="sql">id,
brand_name,first_letter,sort,factory_status,show_status,product_count,product_comment_count,logo,big_pic,brand_story
</sql>
<select id="queryBrand" resultType="com.muyu.product.domain.DTO.Brand">
select id,brand_name from t_product_brand
select <include refid="sql"></include>
from t_product_brand
<where>
id_delete= 1
<if test="brandName != null and brandName != 'null' and brandName != ''">
and brand_Name like concat('%',#{brandName},'%')
</if>
</where>
</select>
<select id="queryService" resultType="com.muyu.product.domain.DTO.Services">
select id,service_name from t_product_service
select id,service_name from
t_product_service
</select>
<select id="queryCategory" resultType="com.muyu.product.domain.DTO.Category">
select id,category_name,parent_id from t_product_category
select id,parent_id,category_name from t_product_category
</select>

View File

@ -21,5 +21,46 @@
t.id, type_name;
</select>
<select id="queryType" resultType="com.muyu.product.domain.DTO.ProductTypeAttr">
SELECT
type_name,
ta.product_type_id,
attr_name,
MAX(ta.multiple_choice) AS multiple_choice,
ta.input_method,
sort,
flag,
screen,
search,
association,
stats,
input,
selection,
manual_operation,
tav.type_attr_id,
CAST(GROUP_CONCAT(tav.type_attr_value) AS CHAR) AS typeAttrValue
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;
</select>
</mapper>