初始化
parent
1558179b40
commit
9a05a1265a
|
@ -0,0 +1,79 @@
|
|||
package com.muyu.cloud.background.domin;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.cloud.background.domin
|
||||
* @Project:cloud-background
|
||||
* @name:Company
|
||||
* @Date:2024/8/26 18:44
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@TableName(value = "company",autoResultMap = true)
|
||||
public class Company {
|
||||
/**
|
||||
* 企业ID
|
||||
*/
|
||||
@TableId(value = "company_id",type = IdType.AUTO)
|
||||
private Integer companyId;
|
||||
/**
|
||||
*企业名称
|
||||
*/
|
||||
private String companyName;
|
||||
/**
|
||||
*企业头像
|
||||
*/
|
||||
private String companyPhoto;
|
||||
/**
|
||||
*注册人姓名
|
||||
*/
|
||||
private String registrantName;
|
||||
/**
|
||||
*注册人联系方式
|
||||
*/
|
||||
private String registrantPhone;
|
||||
/**
|
||||
*注册人职位
|
||||
*/
|
||||
private String registrantPosition;
|
||||
/**
|
||||
*注册日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "注册日期",defaultValue = "2024-8-9 10:47:57",type = "Date")
|
||||
private Date registrantDate;
|
||||
/**
|
||||
*社会统一信用代码
|
||||
*/
|
||||
private String USCI;
|
||||
/**
|
||||
*企业营业执照
|
||||
*/
|
||||
private String businessLicense;
|
||||
/**
|
||||
*企业地址
|
||||
*/
|
||||
private String companyAddress;
|
||||
/**
|
||||
*审核状态
|
||||
*/
|
||||
private Integer reviewStatus;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.muyu.cloud.background.domin.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.cloud.background.domin.req
|
||||
* @Project:cloud-background
|
||||
* @name:CompanyListReq
|
||||
* @Date:2024/8/26 20:04
|
||||
*/
|
||||
|
||||
@Tag(name = "企业列表请求对象")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class CompanyListReq {
|
||||
|
||||
|
||||
/**
|
||||
*审核状态
|
||||
*/
|
||||
private Integer reviewStatus;
|
||||
/**
|
||||
* 页码,从1开始
|
||||
*/
|
||||
private Integer pageNum=1;
|
||||
/**
|
||||
* 每页大小
|
||||
*/
|
||||
private Integer pageSize=8;
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.muyu.cloud.background.domin.resp;
|
||||
|
||||
import com.muyu.cloud.background.domin.Company;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.cloud.background.domin.resp
|
||||
* @Project:cloud-background
|
||||
* @name:CompanyListResp
|
||||
* @Date:2024/8/26 20:01
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Tag(name="数据总数列表",description = "数据和总数的响应")
|
||||
public class CompanyListResp {
|
||||
|
||||
private List<Company> companytotalList;
|
||||
|
||||
private long total;
|
||||
|
||||
|
||||
public static CompanyListResp of(List<Company> companyList, long total) {
|
||||
CompanyListResp response = new CompanyListResp();
|
||||
response.setCompanytotalList(companyList);
|
||||
response.setTotal(total);
|
||||
return response;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.muyu.cloud.background.controller;
|
||||
|
||||
import com.muyu.cloud.background.domin.req.CompanyListReq;
|
||||
import com.muyu.cloud.background.domin.resp.CompanyListResp;
|
||||
import com.muyu.cloud.background.service.CompanyService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.cloud.background.controller
|
||||
* @Project:cloud-background
|
||||
* @name:CompanyController
|
||||
* @Date:2024/8/26 19:57
|
||||
*/
|
||||
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("/company")
|
||||
@Tag(name = "企业管理控制层",description = "进行企业管理、查看等相关操作")
|
||||
public class CompanyController {
|
||||
@Autowired
|
||||
private CompanyService companyService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询企业列表
|
||||
* @param companyListReq
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(path = "/list")
|
||||
@Operation(summary = "企业列表",description = "查询全部企业信息")
|
||||
public Result<CompanyListResp> selectList(@Validated @RequestBody CompanyListReq companyListReq){
|
||||
return Result.success(companyService.selectList(companyListReq));
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.cloud.background.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.cloud.background.domin.Company;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.cloud.background.mapper
|
||||
* @Project:cloud-background
|
||||
* @name:CompanyMapper
|
||||
* @Date:2024/8/26 19:58
|
||||
*/
|
||||
@Mapper
|
||||
public interface CompanyMapper extends BaseMapper<Company> {
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.muyu.cloud.background.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.cloud.background.domin.Company;
|
||||
import com.muyu.cloud.background.domin.req.CompanyListReq;
|
||||
import com.muyu.cloud.background.domin.resp.CompanyListResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.cloud.background.service
|
||||
* @Project:cloud-background
|
||||
* @name:CompanyService
|
||||
* @Date:2024/8/26 19:58
|
||||
*/
|
||||
public interface CompanyService extends IService<Company> {
|
||||
|
||||
|
||||
/**
|
||||
* 查询企业列表
|
||||
* @param companyListReq
|
||||
* @return
|
||||
*/
|
||||
CompanyListResp selectList(CompanyListReq companyListReq);
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.muyu.cloud.background.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.cloud.background.domin.Company;
|
||||
import com.muyu.cloud.background.domin.req.CompanyListReq;
|
||||
import com.muyu.cloud.background.domin.resp.CompanyListResp;
|
||||
import com.muyu.cloud.background.mapper.CompanyMapper;
|
||||
import com.muyu.cloud.background.service.CompanyService;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.cloud.background.service.impl
|
||||
* @Project:cloud-background
|
||||
* @name:CompanyServiceImpl
|
||||
* @Date:2024/8/26 19:58
|
||||
*/
|
||||
@Service
|
||||
public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> implements CompanyService {
|
||||
@Autowired
|
||||
private CompanyMapper companyMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询企业列表
|
||||
* @param companyListReq
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public CompanyListResp selectList(CompanyListReq companyListReq) {
|
||||
Integer pageNum = companyListReq.getPageNum();
|
||||
Integer pageSize = companyListReq.getPageSize();
|
||||
LambdaQueryWrapper<Company> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Company::getReviewStatus,companyListReq.getReviewStatus());
|
||||
long count = this.count(queryWrapper);
|
||||
queryWrapper.last("LIMIT " + ((pageNum - 1) * pageSize) + ", " + pageSize);
|
||||
List<Company> companyList = this.list(queryWrapper);
|
||||
return CompanyListResp.of(companyList, count);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue