diff --git a/src/main/java/com/xujie/sys/modules/customer/controller/CustomerController.java b/src/main/java/com/xujie/sys/modules/customer/controller/CustomerController.java new file mode 100644 index 00000000..cbf5ca9e --- /dev/null +++ b/src/main/java/com/xujie/sys/modules/customer/controller/CustomerController.java @@ -0,0 +1,31 @@ +package com.xujie.sys.modules.customer.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.xujie.sys.common.utils.R; +import com.xujie.sys.modules.customer.entity.Customer; +import com.xujie.sys.modules.customer.service.CustomerService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping("/customer") +public class CustomerController { + + @Autowired + private CustomerService customerService; + @PostMapping + public R queryCustomerList(@RequestBody Customer customer){ + List list = customerService.queryCustomerList(customer); + return R.ok().put("rows",list); + } + + @PostMapping("/{no}/{size}") + public R queryCustomerListByPage(@RequestBody Customer customer, + @PathVariable Integer no, + @PathVariable Integer size){ + IPage page = customerService.queryCustomerListByPage(customer, no, size); + return R.ok().put("rows",page.getRecords()).put("total",page.getTotal()); + } +} diff --git a/src/main/java/com/xujie/sys/modules/customer/entity/Customer.java b/src/main/java/com/xujie/sys/modules/customer/entity/Customer.java new file mode 100644 index 00000000..27fa49c7 --- /dev/null +++ b/src/main/java/com/xujie/sys/modules/customer/entity/Customer.java @@ -0,0 +1,28 @@ +package com.xujie.sys.modules.customer.entity; + + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.util.Date; + +@TableName("plm_customer_information") +@Data +public class Customer { + + private String site; + + private String customerNo; + + private String customerDesc; + + private String active; + + private Date createDate; + + private String createBy; + + private Date updateDate; + + private String updateBy; +} diff --git a/src/main/java/com/xujie/sys/modules/customer/mapper/CustomerMapper.java b/src/main/java/com/xujie/sys/modules/customer/mapper/CustomerMapper.java new file mode 100644 index 00000000..159ed06b --- /dev/null +++ b/src/main/java/com/xujie/sys/modules/customer/mapper/CustomerMapper.java @@ -0,0 +1,19 @@ +package com.xujie.sys.modules.customer.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.xujie.sys.modules.customer.entity.Customer; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + + +@Mapper +public interface CustomerMapper extends BaseMapper { + List queryCustomerList(Customer customer); + + IPage queryCustomerListByPage(@Param("page") Page page, @Param("params") Customer customer); + +} diff --git a/src/main/java/com/xujie/sys/modules/customer/service/CustomerService.java b/src/main/java/com/xujie/sys/modules/customer/service/CustomerService.java new file mode 100644 index 00000000..17753291 --- /dev/null +++ b/src/main/java/com/xujie/sys/modules/customer/service/CustomerService.java @@ -0,0 +1,14 @@ +package com.xujie.sys.modules.customer.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.xujie.sys.modules.customer.entity.Customer; + +import java.util.List; + + +public interface CustomerService extends IService { + List queryCustomerList(Customer customer); + + IPage queryCustomerListByPage(Customer customer, Integer no, Integer size); +} diff --git a/src/main/java/com/xujie/sys/modules/customer/service/impl/CustomerServiceImpl.java b/src/main/java/com/xujie/sys/modules/customer/service/impl/CustomerServiceImpl.java new file mode 100644 index 00000000..8a9d9770 --- /dev/null +++ b/src/main/java/com/xujie/sys/modules/customer/service/impl/CustomerServiceImpl.java @@ -0,0 +1,29 @@ +package com.xujie.sys.modules.customer.service.impl; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.xujie.sys.modules.customer.entity.Customer; +import com.xujie.sys.modules.customer.mapper.CustomerMapper; +import com.xujie.sys.modules.customer.service.CustomerService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +@Slf4j +public class CustomerServiceImpl extends ServiceImpl implements CustomerService { + + @Override + public List queryCustomerList(Customer customer) { + return baseMapper.queryCustomerList(customer); + } + + @Override + public IPage queryCustomerListByPage(Customer customer, Integer no, Integer size) { + Page page = new Page<>(no, size); + return baseMapper.queryCustomerListByPage(page,customer); + } +} diff --git a/src/main/resources/mapper/customer/CustomerMapper.xml b/src/main/resources/mapper/customer/CustomerMapper.xml new file mode 100644 index 00000000..7091c623 --- /dev/null +++ b/src/main/resources/mapper/customer/CustomerMapper.xml @@ -0,0 +1,56 @@ + + + + + + + + \ No newline at end of file