dev798
parent
c3107b22be
commit
d9b22a8dd7
|
@ -0,0 +1,25 @@
|
|||
package com.nuyu.product.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/23 下午7:30
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Book {
|
||||
|
||||
private Integer bookId;
|
||||
|
||||
private String bookName;
|
||||
|
||||
private String bookSex;
|
||||
|
||||
private String bookAge;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.nuyu.product.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/23 下午7:39
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class BookReq {
|
||||
private Integer pageSize=3;
|
||||
|
||||
private Integer pageNum=1;
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.muyu.product;
|
||||
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/23 下午7:44
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
public class MuYuProductApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MuYuProductApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.muyu.product.controller;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.test.admin.Book;
|
||||
import com.muyu.common.core.web.domain.AjaxResult;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.product.service.BookService;
|
||||
import com.nuyu.product.req.BookReq;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.muyu.common.core.web.domain.AjaxResult.success;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/23 下午7:33
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/info")
|
||||
public class BookController {
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private BookService bookService;
|
||||
|
||||
@ApiOperation("查询信息")
|
||||
@RequiresPermissions("product:info:list")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult queryProduct(@RequestBody BookReq bookReq){
|
||||
PageInfo<Book> pageInfo = bookService.queryProduct(bookReq);
|
||||
return success(pageInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.muyu.product.mapper;
|
||||
|
||||
import com.muyu.common.core.test.admin.Book;
|
||||
import com.nuyu.product.req.BookReq;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/23 下午7:33
|
||||
*/
|
||||
@Mapper
|
||||
public interface BookMapper {
|
||||
|
||||
|
||||
|
||||
List<Book> queryProduct(BookReq bookReq);
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.product.service;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.muyu.common.core.test.admin.Book;
|
||||
import com.nuyu.product.req.BookReq;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/23 下午7:33
|
||||
*/
|
||||
public interface BookService {
|
||||
|
||||
|
||||
PageInfo<Book> queryProduct(BookReq bookReq);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.product.service.Impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.muyu.common.core.test.admin.Book;
|
||||
import com.muyu.product.mapper.BookMapper;
|
||||
import com.muyu.product.service.BookService;
|
||||
import com.nuyu.product.req.BookReq;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/23 下午7:33
|
||||
*/
|
||||
@Service
|
||||
public class BookServiceImpl implements BookService {
|
||||
|
||||
@Autowired
|
||||
private BookMapper bookMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public PageInfo<Book> queryProduct(BookReq bookReq) {
|
||||
PageHelper.startPage(bookReq.getPageNum(),bookReq.getPageSize());
|
||||
List<Book> products = bookMapper.queryProduct(bookReq);
|
||||
PageInfo<Book> pageInfo = new PageInfo<>(products);
|
||||
return pageInfo;
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 111.231.174.71:8848
|
||||
namespace: 9facbf7b-873b-4e11-b54f-00627208906d
|
||||
namespace: addbe994-b6ee-4b87-bde0-76f34d2681bd
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 111.231.174.71:8848
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?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.BookMapper">
|
||||
|
||||
|
||||
<select id="queryProduct" resultType="com.muyu.common.core.test.admin.Book">
|
||||
select * from book
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue