package com.java1234.controller;
import com.java1234.entity.BigType;
import com.java1234.entity.R;
import com.java1234.service.IBigTypeService;
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.HashMap;
import java.util.List;
import java.util.Map;
/**
* 商品大类Controller
*/
@RestController
@RequestMapping("/bigType")
public class BigTypeController {
@Autowired
private IBigTypeService bigTypeService;
/**
* 查询所有商品大类
* @return
*/
@GetMapping("/findAll")
public R findAll(){
List<BigType> bigTypeList = bigTypeService.list();
Map<String,Object> map = new HashMap<>();
map.put("message",bigTypeList);
return R.ok(map);
}
}
package com.java1234.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.java1234.entity.BigType;
import com.java1234.mapper.BigTypeMapper;
import com.java1234.service.IBigTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 商品大类Service实现类
*/
@Service("bigTypeService")
public class IBigTypeServiceImpl extends ServiceImpl<BigTypeMapper, BigType> implements IBigTypeService {
@Autowired
private BigTypeMapper bigTypeMapper;
}
package com.java1234.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.java1234.entity.BigType;
/**
* 商品大类Service接口
*/
public interface IBigTypeService extends IService<BigType> {
}
package com.java1234.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* 商品大类
* @author java1234_小锋
* @site www.java1234.com
* @company 南通小锋网络科技有限公司
* @create 2021-11-22 22:03
*/
@TableName("t_bigType")
@Data
public class BigType {
private Integer id; // 编号
private String name; // 名称
private String remark; // 备注
private String image="default.jpg"; // 封面图片
}