dev798
wxy 2024-04-01 13:58:43 +08:00
parent 73c40ddbad
commit cec44c36d3
5 changed files with 23 additions and 27 deletions

View File

@ -25,8 +25,11 @@ public class TypeController {
@GetMapping("/queryType")
public AjaxResult queryType(){
List<ProductTypeResp>list=typeService.queryType();
List<ProductTypeResp>list=typeService.queryTypeAll();
return AjaxResult.success(list);
}
}

View File

@ -12,5 +12,8 @@ import java.util.List;
*/
@Mapper
public interface TypeMapper {
List<ProductTypeResp> queryType();
List<ProductTypeResp> queryTypeAll();
}

View File

@ -10,6 +10,7 @@ import java.util.List;
* @Date: 2024/4/1 11:15
*/
public interface TypeService {
List<ProductTypeResp> queryType();
List<ProductTypeResp> queryTypeAll();
}

View File

@ -18,8 +18,10 @@ public class TypeServiceImpl implements TypeService {
@Autowired
private TypeMapper typeMapper;
@Override
public List<ProductTypeResp> queryType() {
return typeMapper.queryType();
public List<ProductTypeResp> queryTypeAll() {
return typeMapper.queryTypeAll();
}
}

View File

@ -1,37 +1,24 @@
<?xml version="1.0" encoding="UTF-8" ?>
<?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">
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 id="queryTypeAll" 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
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
t.id, type_name;
</select>