forked from dyf/fys-Multi-tenant
WEB:客户管理
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package com.fuyuanshen.customer.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.crypto.digest.BCrypt;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuyuanshen.common.core.domain.ResponseVO;
|
||||
import com.fuyuanshen.common.core.utils.StringUtils;
|
||||
@ -63,6 +64,7 @@ public class CustomerController {
|
||||
if (StringUtils.isBlank(customer.getPassword())) {
|
||||
throw new BadRequestException("账号密码不能为空");
|
||||
}
|
||||
customer.setPassword(BCrypt.hashpw(customer.getPassword()));
|
||||
customerService.addCustomer(customer);
|
||||
return ResponseVO.success("新增客户成功!!!");
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.fuyuanshen.customer.domain.vo;
|
||||
|
||||
|
||||
import com.fuyuanshen.common.tenant.core.TenantEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@ -16,11 +17,10 @@ import java.util.Objects;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ConsumerVo implements Serializable {
|
||||
public class ConsumerVo extends TenantEntity {
|
||||
|
||||
@Schema(name = "ID", hidden = true)
|
||||
private Long id;
|
||||
|
||||
private Long customerId;
|
||||
|
||||
@Schema(hidden = true)
|
||||
private Long deptId;
|
||||
@ -31,9 +31,8 @@ public class ConsumerVo implements Serializable {
|
||||
@Schema(hidden = true)
|
||||
private Byte userLevel;
|
||||
|
||||
|
||||
@Schema(name = "账号")
|
||||
private String username;
|
||||
private String userName;
|
||||
|
||||
@Schema(name = "用户昵称")
|
||||
private String nickName;
|
||||
@ -65,15 +64,9 @@ public class ConsumerVo implements Serializable {
|
||||
@Schema(name = "最后修改密码的时间", hidden = true)
|
||||
private Date pwdResetTime;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Schema(hidden = true)
|
||||
private Long tenantId;
|
||||
|
||||
|
||||
private List<ConsumerVo> children;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
@ -83,13 +76,13 @@ public class ConsumerVo implements Serializable {
|
||||
return false;
|
||||
}
|
||||
ConsumerVo consumer = (ConsumerVo) o;
|
||||
return Objects.equals(id, consumer.id) && Objects.equals(username, consumer.username);
|
||||
return Objects.equals(customerId, consumer.customerId) && Objects.equals(userName, consumer.userName);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, username);
|
||||
return Objects.hash(customerId, userName);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?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.fuyuanshen.fyscustomer.mapper.CustomerMapper">
|
||||
<mapper namespace="com.fuyuanshen.customer.mapper.CustomerMapper">
|
||||
<resultMap id="BaseResultMap" type="com.fuyuanshen.customer.domain.Customer">
|
||||
<id column="user_user_id" property="userId"/>
|
||||
<id column="user_user_id" property="customerId"/>
|
||||
<result column="user_dept_id" property="deptId"/>
|
||||
<result column="user_user_name" property="userName"/>
|
||||
<result column="user_nick_name" property="nickName"/>
|
||||
@ -94,7 +94,7 @@
|
||||
<!-- 分页查询客户 -->
|
||||
<select id="findCustomers" resultType="com.fuyuanshen.customer.domain.Customer">
|
||||
select
|
||||
u.user_id as id, u.nick_name , u.user_name, u.enabled, u.create_time
|
||||
u.user_id as customerId, u.nick_name , u.user_name, u.enabled, u.create_time
|
||||
from sys_user u
|
||||
<where>
|
||||
<if test="criteria.ids != null and !criteria.ids.isEmpty()">
|
||||
@ -180,7 +180,7 @@
|
||||
from sys_user u
|
||||
<where>
|
||||
<if test="criteria.customerName != null and criteria.customerName.trim() != ''">
|
||||
and u.user_name = concat('%', TRIM(#{criteria.customerName}), '%')
|
||||
and u.user_name = TRIM(#{criteria.customerName})
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
@ -120,7 +120,7 @@ public class DeviceController {
|
||||
|
||||
|
||||
// @Log("撤回设备")
|
||||
@Operation(summary = "撤回设备")
|
||||
@Operation(summary = "撤回分配设备")
|
||||
@PostMapping(value = "/withdraw")
|
||||
public ResponseVO<Object> withdrawDevice(@Validated @ModelAttribute DeviceForm deviceForm) {
|
||||
try {
|
||||
|
@ -253,6 +253,12 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
||||
device.setId( null);
|
||||
device.setCurrentOwnerId(customerId);
|
||||
deviceMapper.insert( device);
|
||||
|
||||
DeviceType deviceType = deviceTypeMapper.selectById(device.getDeviceType());
|
||||
deviceType.setId( null);
|
||||
device.setCurrentOwnerId(customerId);
|
||||
deviceTypeMapper.insert( deviceType);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user