客户管理 接口

This commit is contained in:
2025-07-01 15:24:09 +08:00
parent 53356957f3
commit 9f6538b449
11 changed files with 782 additions and 0 deletions

View File

@ -0,0 +1,40 @@
package com.fuyuanshen.fyscustomer.controller;
import com.fuyuanshen.common.core.domain.ResponseVO;
import com.fuyuanshen.fyscustomer.domain.Customer;
import com.fuyuanshen.fyscustomer.domain.query.UserQueryCriteria;
import com.fuyuanshen.fyscustomer.service.CustomerService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author: 默苍璃
* @date: 2025-07-0114:20
*/
@Slf4j
@Tag(name = "WEB客户管理", description = "WEB客户管理")
@RestController
@RequestMapping("/api/customers")
@RequiredArgsConstructor
public class CustomerController {
private final CustomerService customerService;
@GetMapping(value = "/allCustomer")
@Operation(summary = "查询所有客户")
public ResponseVO<List<Customer>> queryAllCustomer(UserQueryCriteria criteria) {
List<Customer> customers = customerService.queryAllCustomers(criteria);
return ResponseVO.success(customers);
}
}

View File

@ -0,0 +1,120 @@
package com.fuyuanshen.fyscustomer.domain;
import com.baomidou.mybatisplus.annotation.*;
import com.fuyuanshen.common.core.constant.SystemConstants;
import com.fuyuanshen.common.tenant.core.TenantEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 用户对象 sys_user
*
* @author Lion Li
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("sys_user")
public class Customer extends TenantEntity {
/**
* 用户ID
*/
@TableId(value = "user_id")
private Long userId;
/**
* 父id
*/
private Long pid;
/**
* 部门ID
*/
private Long deptId;
/**
* 用户账号
*/
private String userName;
/**
* 用户昵称
*/
private String nickName;
/**
* 用户类型sys_user系统用户
*/
private String userType;
/**
* 用户邮箱
*/
private String email;
/**
* 手机号码
*/
private String phonenumber;
/**
* 用户性别
*/
private String sex;
/**
* 用户头像
*/
private Long avatar;
/**
* 密码
*/
@TableField(
insertStrategy = FieldStrategy.NOT_EMPTY,
updateStrategy = FieldStrategy.NOT_EMPTY,
whereStrategy = FieldStrategy.NOT_EMPTY
)
private String password;
/**
* 帐号状态0正常 1停用
*/
private String status;
/**
* 删除标志0代表存在 1代表删除
*/
@TableLogic
private String delFlag;
/**
* 最后登录IP
*/
private String loginIp;
/**
* 最后登录时间
*/
private Date loginDate;
/**
* 备注
*/
private String remark;
public Customer(Long userId) {
this.userId = userId;
}
public boolean isSuperAdmin() {
return SystemConstants.SUPER_ADMIN_ID.equals(this.userId);
}
}

View File

@ -0,0 +1,78 @@
/*
* Copyright 2019-2025 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.fuyuanshen.fyscustomer.domain.query;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* @author Zheng Jie
* @date 2018-11-23
*/
@Data
public class UserQueryCriteria implements Serializable {
@Schema(name = "ID")
private Long id;
@Schema(name = "ids")
private Set<Long> ids;
@Schema(name = "多个ID")
private Set<Long> deptIds = new HashSet<>();
@Schema(name = "模糊查询")
private String blurry;
@Schema(name = "是否启用")
private Boolean enabled;
@Schema(name = "部门ID")
private Long deptId;
@Schema(name = "创建时间")
private List<Timestamp> createTime;
@Schema(name = "页码", example = "1")
private Integer page = 1;
@Schema(name = "每页数据量", example = "10")
private Integer size = 10;
@Schema(name = "偏移量", hidden = true)
private long offset;
/**
* 用户类型
* 0 app
* 1 小程序
*/
@Schema(name = "用户类型 0 app 1 小程序")
private Integer userType;
/**
* 账号
*/
@Schema(name = "APP/小程序账号")
private String username;
}

View File

@ -0,0 +1,27 @@
package com.fuyuanshen.fyscustomer.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuyuanshen.fyscustomer.domain.Customer;
import com.fuyuanshen.fyscustomer.domain.query.UserQueryCriteria;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author: 默苍璃
* @date: 2025-07-0114:37
*/
@Mapper
public interface CustomerMapper extends BaseMapper<Customer> {
/**
* 查询所有客户
*
* @param criteria
* @return
*/
List<Customer> queryAllCustomers(@Param("criteria") UserQueryCriteria criteria);
}

View File

@ -0,0 +1,22 @@
package com.fuyuanshen.fyscustomer.service;
import com.fuyuanshen.fyscustomer.domain.Customer;
import com.fuyuanshen.fyscustomer.domain.query.UserQueryCriteria;
import java.util.List;
/**
* @author: 默苍璃
* @date: 2025-07-0114:31
*/
public interface CustomerService {
/**
* 查询所有客户
*
* @param criteria
* @return
*/
List<Customer> queryAllCustomers(UserQueryCriteria criteria);
}

View File

@ -0,0 +1,37 @@
package com.fuyuanshen.fyscustomer.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuyuanshen.fyscustomer.domain.Customer;
import com.fuyuanshen.fyscustomer.domain.query.UserQueryCriteria;
import com.fuyuanshen.fyscustomer.mapper.CustomerMapper;
import com.fuyuanshen.fyscustomer.service.CustomerService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author: 默苍璃
* @date: 2025-07-0114:31
*/
@Service
@RequiredArgsConstructor
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements CustomerService {
private final CustomerMapper customerMapper;
/**
* 查询所有客户
*
* @param criteria
* @return
*/
@Override
public List<Customer> queryAllCustomers(UserQueryCriteria criteria) {
List<Customer> users = customerMapper.queryAllCustomers(criteria);
return users;
}
}