dev798
parent
3811098481
commit
73c40ddbad
|
@ -0,0 +1,68 @@
|
|||
package com.muyu.product.domain.Resp;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/1 11:19
|
||||
*/
|
||||
@Data
|
||||
public class ProductTypeResp {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
private String typeName;
|
||||
|
||||
@ApiModelProperty(value = "属性名称")
|
||||
private String attrName;
|
||||
|
||||
@ApiModelProperty(value = "是否支持多选:0-是,1-否")
|
||||
private Integer multipleChoice;
|
||||
|
||||
@ApiModelProperty(value = "录入方式:0-列表选择,1-手动")
|
||||
private Integer inputMethod;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "分类标识:0-属性,1-参数")
|
||||
private Integer flag;
|
||||
|
||||
@ApiModelProperty(value = "筛选:0-普通,1-颜色")
|
||||
private Integer screen;
|
||||
|
||||
@ApiModelProperty(value = "检索:1-不需要,2-关键字,3-范围检索")
|
||||
private Integer search;
|
||||
|
||||
@ApiModelProperty(value = "商品属性关联:1-是,2-否")
|
||||
private Integer association;
|
||||
|
||||
@ApiModelProperty(value = "属性是否可选:1-唯一,2-单选,3-复选")
|
||||
private Integer stats;
|
||||
|
||||
@ApiModelProperty(value = "属性值的录入方式:1-手工录入,2-从列表中选择")
|
||||
private Integer input;
|
||||
|
||||
@ApiModelProperty(value = "属性值可选值列表")
|
||||
private String selection;
|
||||
|
||||
@ApiModelProperty(value = "手动新增:0-是,1-否")
|
||||
private Integer manualOperation;
|
||||
|
||||
@ApiModelProperty(value = "属性ID")
|
||||
private Integer typeAttrId;
|
||||
|
||||
@ApiModelProperty(value = "属性值详情")
|
||||
private Integer typeAttrValue;
|
||||
|
||||
@ApiModelProperty(value = "属性数量")
|
||||
private Integer countNum;
|
||||
|
||||
@ApiModelProperty(value = "参数数量")
|
||||
private Integer countParam;
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.product.controller;
|
||||
|
||||
import com.muyu.common.core.domain.AjaxResult;
|
||||
import com.muyu.product.domain.DTO.ProductTypeAttr;
|
||||
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.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/1 11:15
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/type")
|
||||
public class TypeController {
|
||||
|
||||
@Autowired
|
||||
private TypeService typeService;
|
||||
|
||||
|
||||
@GetMapping("/queryType")
|
||||
public AjaxResult queryType(){
|
||||
List<ProductTypeResp>list=typeService.queryType();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/1 11:15
|
||||
*/
|
||||
@Mapper
|
||||
public interface TypeMapper {
|
||||
List<ProductTypeResp> queryType();
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.product.service;
|
||||
|
||||
import com.muyu.product.domain.DTO.ProductTypeAttr;
|
||||
import com.muyu.product.domain.Resp.ProductTypeResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/1 11:15
|
||||
*/
|
||||
public interface TypeService {
|
||||
List<ProductTypeResp> queryType();
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.muyu.product.service.impl;
|
||||
|
||||
import com.muyu.product.domain.DTO.ProductTypeAttr;
|
||||
import com.muyu.product.domain.Resp.ProductTypeResp;
|
||||
import com.muyu.product.mapper.TypeMapper;
|
||||
import com.muyu.product.service.TypeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/1 11:15
|
||||
*/
|
||||
@Service
|
||||
public class TypeServiceImpl implements TypeService {
|
||||
|
||||
@Autowired
|
||||
private TypeMapper typeMapper;
|
||||
@Override
|
||||
public List<ProductTypeResp> queryType() {
|
||||
return typeMapper.queryType();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.product.mapper.TypeMapper">
|
||||
|
||||
|
||||
<select id="queryType" resultType="com.muyu.product.domain.Resp.ProductTypeResp">
|
||||
SELECT
|
||||
t.id,
|
||||
type_name,
|
||||
ta.product_type_id,
|
||||
attr_name,
|
||||
multiple_choice,
|
||||
ta.input_method,
|
||||
sort,
|
||||
flag,
|
||||
screen,
|
||||
search,
|
||||
association,
|
||||
stats,
|
||||
input,
|
||||
selection,
|
||||
manual_operation,
|
||||
tav.type_attr_id,
|
||||
GROUP_CONCAT(tav.type_attr_value) as typeAttrValue,
|
||||
(SELECT COUNT(id) FROM t_product_type_attr WHERE flag = 0 AND product_type_id = t.id) AS countNum,
|
||||
(SELECT COUNT(id) FROM t_product_type_attr WHERE flag = 1 AND product_type_id = t.id) AS countParam
|
||||
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
|
||||
GROUP BY
|
||||
ta.attr_name
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue