dev798
parent
1e24c67a5b
commit
3811098481
|
@ -0,0 +1,30 @@
|
|||
package com.muyu.product.controller;
|
||||
|
||||
import com.muyu.common.core.domain.AjaxResult;
|
||||
import com.muyu.product.domain.DTO.Category;
|
||||
import com.muyu.product.service.CategoryService;
|
||||
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 10:31
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/category")
|
||||
public class CategoryController {
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
|
||||
@GetMapping("/queryCategory")
|
||||
public AjaxResult queryCategory(){
|
||||
List<Category>list=categoryService.queryCategory();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.product.mapper;
|
||||
|
||||
import com.muyu.product.domain.DTO.Category;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/1 10:32
|
||||
*/
|
||||
@Mapper
|
||||
public interface CategoryMapper {
|
||||
List<Category> queryCategory();
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.muyu.product.service;
|
||||
|
||||
import com.muyu.product.domain.DTO.Category;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/1 10:31
|
||||
*/
|
||||
public interface CategoryService {
|
||||
List<Category> queryCategory();
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.product.service.impl;
|
||||
|
||||
import com.muyu.product.domain.DTO.Category;
|
||||
import com.muyu.product.mapper.CategoryMapper;
|
||||
import com.muyu.product.service.CategoryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/1 10:32
|
||||
*/
|
||||
@Service
|
||||
public class CategoryServiceImpl implements CategoryService {
|
||||
|
||||
@Autowired
|
||||
private CategoryMapper categoryMapper;
|
||||
@Override
|
||||
public List<Category> queryCategory() {
|
||||
return categoryMapper.queryCategory();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?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.CategoryMapper">
|
||||
|
||||
<sql id="sqlCategory">
|
||||
id,parent_id,category_name,level,product_count
|
||||
,product_unit,nav_status,show_status,sort,icon,keywords,description
|
||||
</sql>
|
||||
|
||||
<select id="queryCategory" resultType="com.muyu.product.domain.DTO.Category">
|
||||
select <include refid="sqlCategory"></include> from t_product_category
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue