// Path: spring-boot-oauth-authorization-server/src/main/java/com/sdcuike/practice/domain/Company.java
// @Data
// @NoArgsConstructor
// public class Company {
//     private Long id;
//     
//    
//     private String companyOid;
//     
//    
//     private String name;
//     
//     private Long logoId;
//     
//     private String createdBy;
//     
//     private LocalDateTime createdDate;
//     
//     private Boolean doneRegisterLead;
//     
//     private String taxId;
//     
//     private CompanyType companyType;
//     
//     private LocalDateTime updateDate;
//     
//   
// }
// 
// Path: spring-boot-oauth-authorization-server/src/main/java/com/sdcuike/practice/mapper/CompanyMapper.java
// @UseDataSourceTest
// public interface CompanyMapper {
//     /**
//      * This method was generated by MyBatis Generator.
//      * This method corresponds to the database table company
//      *
//      * @mbg.generated Tue Apr 11 15:11:59 CST 2017
//      */
//     int deleteByPrimaryKey(Long id);
// 
//     /**
//      * This method was generated by MyBatis Generator.
//      * This method corresponds to the database table company
//      *
//      * @mbg.generated Tue Apr 11 15:11:59 CST 2017
//      */
//     int insert(Company record);
// 
//     /**
//      * This method was generated by MyBatis Generator.
//      * This method corresponds to the database table company
//      *
//      * @mbg.generated Tue Apr 11 15:11:59 CST 2017
//      */
//     int insertSelective(Company record);
// 
//     /**
//      * This method was generated by MyBatis Generator.
//      * This method corresponds to the database table company
//      *
//      * @mbg.generated Tue Apr 11 15:11:59 CST 2017
//      */
//     Company selectByPrimaryKey(Long id);
//     
//     List<Company> selectAll();
//     
//     Page<Company> selectAllPageable(@Param("page") Pageable pageable);
//     /**
//      * This method was generated by MyBatis Generator.
//      * This method corresponds to the database table company
//      *
//      * @mbg.generated Tue Apr 11 15:11:59 CST 2017
//      */
//     int updateByPrimaryKeySelective(Company record);
// 
//     /**
//      * This method was generated by MyBatis Generator.
//      * This method corresponds to the database table company
//      *
//      * @mbg.generated Tue Apr 11 15:11:59 CST 2017
//      */
//     int updateByPrimaryKey(Company record);
// }


import com.doctor.beaver.domain.result.ModelResult;
import com.sdcuike.practice.domain.Company;
import com.sdcuike.practice.mapper.CompanyMapper;
import com.sdcuike.spring.extend.web.util.PaginationUtil;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.URISyntaxException;
import java.util.List;
package com.sdcuike.practice.controller;



@RestController
@RequestMapping(path = "/example", produces = MediaType.APPLICATION_JSON_VALUE)
@Slf4j
public class ExampleController {
    
    @Resource
    private CompanyMapper companyMapper;
    
    @GetMapping("/")
    public ModelResult<String> home() {
        ModelResult<String> modelResult = new ModelResult<>();
        modelResult.setData("hello world spring boot");
        return modelResult;
    }
    
    @GetMapping("/all_company")
    public List<Company> queryAllCompany() {
        return companyMapper.selectAll();
    }
    
    @ApiOperation(value = "queryCompanys", notes = "获取 公司分页")
    @GetMapping("/all_company/page")
    public ModelResult<List<Company>> queryCompanys(Pageable pageable,
                                                    HttpServletRequest request,
                                                    HttpServletResponse response) throws URISyntaxException {
        
        ModelResult<List<Company>> result = new ModelResult<>();
// Path: spring-boot-oauth-authorization-server/src/main/java/com/sdcuike/practice/domain/Company.java
// @Data
// @NoArgsConstructor
// public class Company {
//     private Long id;
//     
//    
//     private String companyOid;
//     
//    
//     private String name;
//     
//     private Long logoId;
//     
//     private String createdBy;
//     
//     private LocalDateTime createdDate;
//     
//     private Boolean doneRegisterLead;
//     
//     private String taxId;
//     
//     private CompanyType companyType;
//     
//     private LocalDateTime updateDate;
//     
//   
// }
// 
// Path: spring-boot-oauth-authorization-server/src/main/java/com/sdcuike/practice/mapper/CompanyMapper.java
// @UseDataSourceTest
// public interface CompanyMapper {
//     /**
//      * This method was generated by MyBatis Generator.
//      * This method corresponds to the database table company
//      *
//      * @mbg.generated Tue Apr 11 15:11:59 CST 2017
//      */
//     int deleteByPrimaryKey(Long id);
// 
//     /**
//      * This method was generated by MyBatis Generator.
//      * This method corresponds to the database table company
//      *
//      * @mbg.generated Tue Apr 11 15:11:59 CST 2017
//      */
//     int insert(Company record);
// 
//     /**
//      * This method was generated by MyBatis Generator.
//      * This method corresponds to the database table company
//      *
//      * @mbg.generated Tue Apr 11 15:11:59 CST 2017
//      */
//     int insertSelective(Company record);
// 
//     /**
//      * This method was generated by MyBatis Generator.
//      * This method corresponds to the database table company
//      *
//      * @mbg.generated Tue Apr 11 15:11:59 CST 2017
//      */
//     Company selectByPrimaryKey(Long id);
//     
//     List<Company> selectAll();
//     
//     Page<Company> selectAllPageable(@Param("page") Pageable pageable);
//     /**
//      * This method was generated by MyBatis Generator.
//      * This method corresponds to the database table company
//      *
//      * @mbg.generated Tue Apr 11 15:11:59 CST 2017
//      */
//     int updateByPrimaryKeySelective(Company record);
// 
//     /**
//      * This method was generated by MyBatis Generator.
//      * This method corresponds to the database table company
//      *
//      * @mbg.generated Tue Apr 11 15:11:59 CST 2017
//      */
//     int updateByPrimaryKey(Company record);
// }


// Path: spring-boot-oauth-authorization-server/src/main/java/com/sdcuike/practice/controller/ExampleController.java
import com.doctor.beaver.domain.result.ModelResult;
import com.sdcuike.practice.domain.Company;
import com.sdcuike.practice.mapper.CompanyMapper;
import com.sdcuike.spring.extend.web.util.PaginationUtil;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.URISyntaxException;
import java.util.List;

package com.sdcuike.practice.controller;



@RestController
@RequestMapping(path = "/example", produces = MediaType.APPLICATION_JSON_VALUE)
@Slf4j
public class ExampleController {
    
    @Resource
    private CompanyMapper companyMapper;
    
    @GetMapping("/")
    public ModelResult<String> home() {
        ModelResult<String> modelResult = new ModelResult<>();
        modelResult.setData("hello world spring boot");
        return modelResult;
    }
    
    @GetMapping("/all_company")
    public List<Company> queryAllCompany() {
        return companyMapper.selectAll();
    }
    
    @ApiOperation(value = "queryCompanys", notes = "获取 公司分页")
    @GetMapping("/all_company/page")
    public ModelResult<List<Company>> queryCompanys(Pageable pageable,
                                                    HttpServletRequest request,
                                                    HttpServletResponse response) throws URISyntaxException {
        
        ModelResult<List<Company>> result = new ModelResult<>();
        Page<Company> companies = companyMapper.selectAllPageable(pageable);