diff --git a/fys-admin/pom.xml b/fys-admin/pom.xml index 36c4f36..636479c 100644 --- a/fys-admin/pom.xml +++ b/fys-admin/pom.xml @@ -65,6 +65,12 @@ fys-common-mail + + + com.fuyuanshen + fys-customer + + com.fuyuanshen diff --git a/fys-modules/fys-customer/src/main/java/com/fuyuanshen/fyscustomer/controller/CustomerController.java b/fys-modules/fys-customer/src/main/java/com/fuyuanshen/fyscustomer/controller/CustomerController.java new file mode 100644 index 0000000..5cb25b0 --- /dev/null +++ b/fys-modules/fys-customer/src/main/java/com/fuyuanshen/fyscustomer/controller/CustomerController.java @@ -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> queryAllCustomer(UserQueryCriteria criteria) { + List customers = customerService.queryAllCustomers(criteria); + return ResponseVO.success(customers); + } + + +} diff --git a/fys-modules/fys-customer/src/main/java/com/fuyuanshen/fyscustomer/domain/Customer.java b/fys-modules/fys-customer/src/main/java/com/fuyuanshen/fyscustomer/domain/Customer.java new file mode 100644 index 0000000..6708410 --- /dev/null +++ b/fys-modules/fys-customer/src/main/java/com/fuyuanshen/fyscustomer/domain/Customer.java @@ -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); + } + +} diff --git a/fys-modules/fys-customer/src/main/java/com/fuyuanshen/fyscustomer/domain/query/UserQueryCriteria.java b/fys-modules/fys-customer/src/main/java/com/fuyuanshen/fyscustomer/domain/query/UserQueryCriteria.java new file mode 100644 index 0000000..8a8d236 --- /dev/null +++ b/fys-modules/fys-customer/src/main/java/com/fuyuanshen/fyscustomer/domain/query/UserQueryCriteria.java @@ -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 ids; + + @Schema(name = "多个ID") + private Set deptIds = new HashSet<>(); + + @Schema(name = "模糊查询") + private String blurry; + + @Schema(name = "是否启用") + private Boolean enabled; + + @Schema(name = "部门ID") + private Long deptId; + + @Schema(name = "创建时间") + private List 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; + +} diff --git a/fys-modules/fys-customer/src/main/java/com/fuyuanshen/fyscustomer/mapper/CustomerMapper.java b/fys-modules/fys-customer/src/main/java/com/fuyuanshen/fyscustomer/mapper/CustomerMapper.java new file mode 100644 index 0000000..dc453cb --- /dev/null +++ b/fys-modules/fys-customer/src/main/java/com/fuyuanshen/fyscustomer/mapper/CustomerMapper.java @@ -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 { + + /** + * 查询所有客户 + * + * @param criteria + * @return + */ + List queryAllCustomers(@Param("criteria") UserQueryCriteria criteria); + + +} diff --git a/fys-modules/fys-customer/src/main/java/com/fuyuanshen/fyscustomer/service/CustomerService.java b/fys-modules/fys-customer/src/main/java/com/fuyuanshen/fyscustomer/service/CustomerService.java new file mode 100644 index 0000000..dff9ecd --- /dev/null +++ b/fys-modules/fys-customer/src/main/java/com/fuyuanshen/fyscustomer/service/CustomerService.java @@ -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 queryAllCustomers(UserQueryCriteria criteria); + +} diff --git a/fys-modules/fys-customer/src/main/java/com/fuyuanshen/fyscustomer/service/impl/CustomerServiceImpl.java b/fys-modules/fys-customer/src/main/java/com/fuyuanshen/fyscustomer/service/impl/CustomerServiceImpl.java new file mode 100644 index 0000000..4e1f0cf --- /dev/null +++ b/fys-modules/fys-customer/src/main/java/com/fuyuanshen/fyscustomer/service/impl/CustomerServiceImpl.java @@ -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 implements CustomerService { + + private final CustomerMapper customerMapper; + + + /** + * 查询所有客户 + * + * @param criteria + * @return + */ + @Override + public List queryAllCustomers(UserQueryCriteria criteria) { + List users = customerMapper.queryAllCustomers(criteria); + return users; + } + + +} diff --git a/fys-modules/fys-customer/src/main/resources/mapper/customer/CustomerMapper.xml b/fys-modules/fys-customer/src/main/resources/mapper/customer/CustomerMapper.xml new file mode 100644 index 0000000..b70ed49 --- /dev/null +++ b/fys-modules/fys-customer/src/main/resources/mapper/customer/CustomerMapper.xml @@ -0,0 +1,438 @@ + + + + + + + + + + + + + + + + + + + + + u + . + user_user_id + AS user_user_id, + u.username, + u.nick_name AS nickName, + u.email, + u.phone, + u.gender, + u.avatar_name AS avatarName, + u.avatar_path AS avatarPath, + u.enabled, + IF(u.is_admin = 1, true, false) AS isAdmin, + u.pwd_reset_time AS pwdResetTime, + u.dept_id AS deptId, + u.tenant_id AS tenantId + + + + u1.user_id + as user_user_id, u1.dept_id as user_dept_id, u1.username as user_username, + u1.nick_name as user_nick_name, u1.email as user_email, u1.phone as user_phone, + u1.gender as user_gender, u1.avatar_name as user_avatar_name, u1.avatar_path as user_avatar_path, + u1.enabled as user_enabled, u1.pwd_reset_time as user_pwd_reset_time, u1.create_by as user_create_by, + u1.update_by as user_update_by, u1.create_time as user_create_time, u1.update_time as user_update_time, + u1.user_level, u1.pid as user_pid,u1.is_admin AS admin, + d.dept_id as dept_id, d.name as dept_name + + + + j . job_id + as job_id, j.name as job_name + + + + r . role_id + as role_id, r.name as role_name, r.level as role_level, r.data_scope as role_data_scope + + + + + + and u1.user_id = #{criteria.id} + + + and u1.enabled = #{criteria.enabled} + + + and u1.dept_id in + + #{deptId} + + + + and ( + u1.username like concat('%', #{criteria.blurry}, '%') + or u1.nick_name like concat('%', #{criteria.blurry}, '%') + or u1.email like concat('%', #{criteria.blurry}, '%') + ) + + + and u1.create_time between #{criteria.createTime[0]} and #{criteria.createTime[1]} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + update sys_user set password = #{pwd} + where user_id in + + #{id} + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/fys-modules/fys-customer/web2/WEB-INF/web.xml b/fys-modules/fys-customer/web2/WEB-INF/web.xml new file mode 100644 index 0000000..d80081d --- /dev/null +++ b/fys-modules/fys-customer/web2/WEB-INF/web.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/fys-modules/pom.xml b/fys-modules/pom.xml index 551067b..478838d 100644 --- a/fys-modules/pom.xml +++ b/fys-modules/pom.xml @@ -16,6 +16,7 @@ fys-system fys-workflow fys-equipment + fys-customer fys-modules diff --git a/pom.xml b/pom.xml index 1c1623b..df4f1cb 100644 --- a/pom.xml +++ b/pom.xml @@ -351,6 +351,13 @@ ${revision} + + + com.fuyuanshen + fys-customer + ${revision} + + com.fuyuanshen fys-job