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") @GetMapping("/queryType")
public AjaxResult queryType(){ public AjaxResult queryType(){
List<ProductTypeResp>list=typeService.queryType(); List<ProductTypeResp>list=typeService.queryTypeAll();
return AjaxResult.success(list); return AjaxResult.success(list);
} }
} }

View File

@ -12,5 +12,8 @@ import java.util.List;
*/ */
@Mapper @Mapper
public interface TypeMapper { 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 * @Date: 2024/4/1 11:15
*/ */
public interface TypeService { public interface TypeService {
List<ProductTypeResp> queryType();
List<ProductTypeResp> queryTypeAll();
} }

View File

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

View File

@ -5,25 +5,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.muyu.product.mapper.TypeMapper"> <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 SELECT
t.id, t.id,
type_name, 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 = 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 (SELECT COUNT(id) FROM t_product_type_attr WHERE flag = 1 AND product_type_id = t.id) AS countParam
FROM FROM
@ -31,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
INNER JOIN t_product_type_attr ta ON t.id = ta.product_type_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 INNER JOIN t_product_type_attr_value tav ON tav.type_attr_id = ta.id
GROUP BY GROUP BY
ta.attr_name t.id, type_name;
</select> </select>