公司信息登记(去重)
parent
2c9529b834
commit
d600f45435
@ -0,0 +1,97 @@
|
||||
package com.glxp.api.controller.replicate;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.common.util.ResultVOUtils;
|
||||
import com.glxp.api.entity.replicate.replicates;
|
||||
import com.glxp.api.req.basic.FilterUdiRelRequest;
|
||||
import com.glxp.api.req.replicate.FilterReplicateRequest;
|
||||
import com.glxp.api.res.PageSimpleResponse;
|
||||
import com.glxp.api.res.replicate.FilterReplicateResponse;
|
||||
import com.glxp.api.service.replicate.replicateService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : zhangsan
|
||||
* @date : 2023/6/18 15:54
|
||||
* @modyified By :
|
||||
*/
|
||||
@RestController
|
||||
public class replicateController {
|
||||
|
||||
@Resource
|
||||
private replicateService replicateService;
|
||||
|
||||
|
||||
//获取全部数据
|
||||
@GetMapping("/replicate/company/cert/filterList")
|
||||
public BaseResponse filterList(FilterReplicateRequest filterReplicateRequest) {
|
||||
|
||||
List<FilterReplicateResponse> filterReplicateResponses = replicateService.filterList(filterReplicateRequest);
|
||||
PageInfo<FilterReplicateResponse> pageInfo;
|
||||
pageInfo = new PageInfo<>(filterReplicateResponses);
|
||||
PageSimpleResponse<FilterReplicateResponse> response = new PageSimpleResponse<>();
|
||||
response.setTotal(pageInfo.getTotal());
|
||||
response.setList(filterReplicateResponses);
|
||||
return ResultVOUtils.success(response);
|
||||
}
|
||||
|
||||
@PostMapping("/replicate/company/cert/insertReplicate")
|
||||
public BaseResponse insertReplicate(@RequestBody FilterReplicateRequest filterReplicateRequest) {
|
||||
|
||||
replicates replicates = new replicates();
|
||||
BeanUtils.copyProperties(filterReplicateRequest,replicates);
|
||||
replicates.setCreateTime(new Date());
|
||||
replicateService.insertReplicate(replicates);
|
||||
return ResultVOUtils.success();
|
||||
}
|
||||
|
||||
@GetMapping("/replicate/company/cert/deleteReplicate")
|
||||
public BaseResponse deleteReplicate(String id) {
|
||||
replicateService.deleteReplicate(id);
|
||||
return ResultVOUtils.success();
|
||||
}
|
||||
|
||||
@GetMapping("/replicate/company/cert/chceckCompany")
|
||||
public BaseResponse chceckCompany( String company) {
|
||||
|
||||
boolean b = replicateService.chceckCompany(company);
|
||||
if(b){
|
||||
return ResultVOUtils.error(999,company+"已存在!");
|
||||
}
|
||||
|
||||
return ResultVOUtils.success();
|
||||
|
||||
}
|
||||
@GetMapping("/replicate/company/cert/chceckMobile")
|
||||
public BaseResponse chceckMobile( String mobile) {
|
||||
|
||||
boolean b = replicateService.chceckMobile(mobile);
|
||||
if(b){
|
||||
return ResultVOUtils.error(999,"电话:"+mobile+"已存在!");
|
||||
}
|
||||
|
||||
return ResultVOUtils.success();
|
||||
}
|
||||
|
||||
@PostMapping("/replicate/company/cert/updateReplicate")
|
||||
public BaseResponse updateReplicate( @RequestBody FilterReplicateRequest filterReplicateRequest) {
|
||||
replicates replicates = new replicates();
|
||||
BeanUtils.copyProperties(filterReplicateRequest,replicates);
|
||||
|
||||
replicateService.updateReplicate(replicates);
|
||||
|
||||
return ResultVOUtils.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.glxp.api.dao.replicate;
|
||||
|
||||
import com.glxp.api.dao.BaseMapperPlus;
|
||||
import com.glxp.api.entity.replicate.replicates;
|
||||
import com.glxp.api.req.replicate.FilterReplicateRequest;
|
||||
import com.glxp.api.res.replicate.FilterReplicateResponse;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : zhangsan
|
||||
* @date : 2023/6/18 15:43
|
||||
* @modyified By :
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
public interface replicatesMapper extends BaseMapperPlus<replicatesMapper, replicates,replicates> {
|
||||
|
||||
List<FilterReplicateResponse> filterList(FilterReplicateRequest filterReplicateRequest);
|
||||
|
||||
List<FilterReplicateResponse> chceckCompany(String company);
|
||||
|
||||
List<FilterReplicateResponse> chceckMobile(String mobile);
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.glxp.api.entity.replicate;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Data
|
||||
@TableName("replicate")
|
||||
public class replicates {
|
||||
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
private Integer id;
|
||||
|
||||
@TableField(value = "company")
|
||||
private String company;
|
||||
|
||||
@TableField(value = "contacts")
|
||||
private String contacts;
|
||||
|
||||
@TableField(value = "mobile1")
|
||||
private String mobile1;
|
||||
|
||||
@TableField(value = "mobile2")
|
||||
private String mobile2;
|
||||
|
||||
@TableField(value = "mobile3")
|
||||
private String mobile3;
|
||||
|
||||
@TableField(value = "status")
|
||||
private int status;
|
||||
|
||||
@TableField(value = "remark")
|
||||
private String remark;
|
||||
|
||||
@TableField(value = "createTime")
|
||||
private Date createTime;
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.glxp.api.req.replicate;
|
||||
|
||||
import com.glxp.api.util.page.ListPageRequest;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author : zhangsan
|
||||
* @date : 2023/6/18 16:01
|
||||
* @modyified By :
|
||||
*/
|
||||
@Data
|
||||
public class FilterReplicateRequest extends ListPageRequest {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String company;
|
||||
|
||||
private String contacts;
|
||||
|
||||
private String mobile1;
|
||||
|
||||
private String mobile2;
|
||||
|
||||
private String mobile3;
|
||||
|
||||
private int status;
|
||||
|
||||
private String remark;
|
||||
|
||||
private Date createTime;
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.glxp.api.res.replicate;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author : zhangsan
|
||||
* @date : 2023/6/18 16:02
|
||||
* @modyified By :
|
||||
*/
|
||||
@Data
|
||||
public class FilterReplicateResponse {
|
||||
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String company;
|
||||
|
||||
private String contacts;
|
||||
|
||||
private String mobile1;
|
||||
|
||||
private String mobile2;
|
||||
|
||||
private String mobile3;
|
||||
|
||||
private int status;
|
||||
|
||||
private String remark;
|
||||
|
||||
private Date createTime;
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package com.glxp.api.service.replicate.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.api.dao.replicate.replicatesMapper;
|
||||
import com.glxp.api.entity.replicate.replicates;
|
||||
import com.glxp.api.req.replicate.FilterReplicateRequest;
|
||||
import com.glxp.api.res.replicate.FilterReplicateResponse;
|
||||
import com.glxp.api.service.replicate.replicateService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : zhangsan
|
||||
* @date : 2023/6/18 15:50
|
||||
* @modyified By :
|
||||
*/
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class replicateServiceImpl extends ServiceImpl<replicatesMapper, replicates> implements replicateService {
|
||||
|
||||
@Resource
|
||||
replicatesMapper replicatesMapper;
|
||||
|
||||
@Override
|
||||
public List<FilterReplicateResponse> filterList(FilterReplicateRequest filterReplicateRequest) {
|
||||
|
||||
if (filterReplicateRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (filterReplicateRequest.getPage() != null) {
|
||||
int offset = (filterReplicateRequest.getPage() - 1) * filterReplicateRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, filterReplicateRequest.getLimit());
|
||||
}
|
||||
return replicatesMapper.filterList(filterReplicateRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertReplicate(replicates replicates) {
|
||||
|
||||
return replicatesMapper.insert(replicates)>0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteReplicate(String id) {
|
||||
|
||||
return replicatesMapper.deleteById(id)>0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean chceckCompany(String company) {
|
||||
List<FilterReplicateResponse> filterReplicateResponses = replicatesMapper.chceckCompany(company);
|
||||
|
||||
if(filterReplicateResponses != null && filterReplicateResponses.size()>0){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean chceckMobile(String mobile) {
|
||||
List<FilterReplicateResponse> filterReplicateResponses = replicatesMapper.chceckMobile(mobile);
|
||||
if(filterReplicateResponses != null && filterReplicateResponses.size()>0){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateReplicate(replicates replicates) {
|
||||
|
||||
return replicatesMapper.updateById(replicates)>0;
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.glxp.api.service.replicate;
|
||||
|
||||
import com.glxp.api.entity.replicate.replicates;
|
||||
import com.glxp.api.req.replicate.FilterReplicateRequest;
|
||||
import com.glxp.api.res.replicate.FilterReplicateResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : zhangsan
|
||||
* @date : 2023/6/18 15:49
|
||||
* @modyified By :
|
||||
*/
|
||||
|
||||
public interface replicateService {
|
||||
|
||||
List<FilterReplicateResponse> filterList(FilterReplicateRequest filterReplicateRequest);
|
||||
|
||||
boolean insertReplicate(replicates replicates);
|
||||
|
||||
boolean deleteReplicate(String id);
|
||||
|
||||
boolean chceckCompany(String company);
|
||||
|
||||
boolean chceckMobile(String mobile);
|
||||
|
||||
boolean updateReplicate(replicates replicates);
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
<?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.glxp.api.dao.replicate.replicatesMapper">
|
||||
|
||||
<select id="filterList" parameterType="com.glxp.api.req.replicate.FilterReplicateRequest"
|
||||
resultType="com.glxp.api.res.replicate.FilterReplicateResponse">
|
||||
select * from replicate
|
||||
<where>
|
||||
<if test="company != '' and company!=null">
|
||||
and company = #{company}
|
||||
</if>
|
||||
<if test="contacts != '' and contacts!=null">
|
||||
and contacts = #{contacts}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
ORDER BY createTime desc
|
||||
|
||||
</select>
|
||||
|
||||
<select id="chceckCompany" parameterType="com.glxp.api.req.replicate.FilterReplicateRequest"
|
||||
resultType="com.glxp.api.res.replicate.FilterReplicateResponse">
|
||||
select company from replicate
|
||||
where company = #{company}
|
||||
</select>
|
||||
|
||||
<select id="chceckMobile" parameterType="com.glxp.api.req.replicate.FilterReplicateRequest"
|
||||
resultType="com.glxp.api.res.replicate.FilterReplicateResponse">
|
||||
select mobile1,mobile2,mobile3 from replicate
|
||||
where mobile1 = #{mobile} or mobile2 = #{mobile} or mobile3 = #{mobile}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue