feat(后端): 用户代码提交
parent
65b71d61ac
commit
88dea8dfd8
|
@ -37,8 +37,40 @@
|
||||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
<version>3.18.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>5.8.24</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
<version>2.0.49</version>
|
||||||
|
</dependency>
|
||||||
|
<!--postgresql驱动-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
<version>42.7.7</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-extension</artifactId>
|
||||||
|
<version>3.4.3.1</version>
|
||||||
|
</dependency>
|
||||||
|
<!--MP的依赖-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
<version>3.4.3.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
|
||||||
<groupId>com.dampcake</groupId>
|
<groupId>com.dampcake</groupId>
|
||||||
<artifactId>bencode</artifactId>
|
<artifactId>bencode</artifactId>
|
||||||
<version>1.4</version>
|
<version>1.4</version>
|
||||||
|
@ -49,6 +81,11 @@
|
||||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||||
<version>3.0.3</version>
|
<version>3.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.unisinsight.project;
|
package com.unisinsight.project;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@ -7,6 +8,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
* 分片上传应用启动类
|
* 分片上传应用启动类
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@MapperScan(basePackages = "com.unisinsight.project.mapper")
|
||||||
public class Application {
|
public class Application {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.unisinsight.project.config;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.DbType;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description:
|
||||||
|
* @author: rdpnr_puzhi
|
||||||
|
* @create: 2025/08/06
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class MyBatisPlusPageConfig {
|
||||||
|
// 最新版
|
||||||
|
@Bean
|
||||||
|
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||||
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||||
|
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.POSTGRE_SQL));
|
||||||
|
return interceptor;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.unisinsight.project.config;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||||
|
import org.apache.ibatis.reflection.MetaObject;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description:
|
||||||
|
* @author: rdpnr_puzhi
|
||||||
|
* @create: 2025/08/06
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertFill(MetaObject metaObject) {
|
||||||
|
this.strictInsertFill(metaObject, "createTime", Date.class, new Date());
|
||||||
|
this.strictInsertFill(metaObject, "updateTime", Date.class, new Date());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateFill(MetaObject metaObject) {
|
||||||
|
this.strictUpdateFill(metaObject, "updateTime", Date.class, new Date());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
package com.unisinsight.project.controller;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.unisinsight.project.entity.req.DeleteIdReq;
|
||||||
|
import com.unisinsight.project.entity.req.UserReq;
|
||||||
|
import com.unisinsight.project.exception.BaseErrorCode;
|
||||||
|
import com.unisinsight.project.exception.Result;
|
||||||
|
import com.unisinsight.project.service.UserService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
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;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description:
|
||||||
|
* @author: rdpnr_puzhi
|
||||||
|
* @create: 2025/08/06
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/nex/v1/user")
|
||||||
|
@Api(tags = "用户处理Controller")
|
||||||
|
public class UserController {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@ApiOperation(value = "用户新增")
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result<?> insertUser(@RequestBody UserReq userReq) {
|
||||||
|
if (Objects.isNull(userReq)) {
|
||||||
|
return Result.errorResult(BaseErrorCode.PARAMS_CHK_ERROR);
|
||||||
|
}
|
||||||
|
log.info("用户新增请求参数为:{}", JSONUtil.toJsonStr(userReq));
|
||||||
|
return userService.insert(userReq);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "用户修改")
|
||||||
|
@PostMapping("/update")
|
||||||
|
public Result<?> updateUser(@RequestBody UserReq userReq) {
|
||||||
|
if (Objects.isNull(userReq)) {
|
||||||
|
return Result.errorResult(BaseErrorCode.PARAMS_CHK_ERROR);
|
||||||
|
}
|
||||||
|
log.info("用户修改请求参数为:{}", JSONUtil.toJsonStr(userReq));
|
||||||
|
return userService.update(userReq);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "用户删除")
|
||||||
|
@PostMapping("/delete")
|
||||||
|
public Result<?> deleteUser(@RequestBody DeleteIdReq deleteIdReq) {
|
||||||
|
if (Objects.isNull(deleteIdReq)) {
|
||||||
|
return Result.errorResult(BaseErrorCode.PARAMS_CHK_ERROR);
|
||||||
|
}
|
||||||
|
log.info("用户删除请求参数为:{}", JSONUtil.toJsonStr(deleteIdReq));
|
||||||
|
return userService.delete(deleteIdReq);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "分页查询用户")
|
||||||
|
@PostMapping("/select/page")
|
||||||
|
public Result<?> selectPageUser(@RequestBody UserReq userReq) {
|
||||||
|
if (Objects.isNull(userReq)) {
|
||||||
|
return Result.errorResult(BaseErrorCode.PARAMS_CHK_ERROR);
|
||||||
|
}
|
||||||
|
log.info("分页查询用户请求参数为:{}", JSONUtil.toJsonStr(userReq));
|
||||||
|
return userService.selectPageUser(userReq);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,97 @@
|
||||||
|
package com.unisinsight.project.entity.dao;
|
||||||
|
|
||||||
|
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.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @TableName device
|
||||||
|
*/
|
||||||
|
@TableName(value ="device")
|
||||||
|
@Data
|
||||||
|
public class Device implements Serializable {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long deviceGroupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String deviceGroupName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer deviceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String ipAddr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String macAddr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String updateUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
package com.unisinsight.project.entity.dao;
|
||||||
|
|
||||||
|
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.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @TableName device_image_mapping
|
||||||
|
*/
|
||||||
|
@TableName(value ="device_image_mapping")
|
||||||
|
@Data
|
||||||
|
public class DeviceImageMapping implements Serializable {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long deviceGroupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long imageId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer restoreType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String updateUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
package com.unisinsight.project.entity.dao;
|
||||||
|
|
||||||
|
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.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @TableName device_user_mapping
|
||||||
|
*/
|
||||||
|
@TableName(value ="device_user_mapping")
|
||||||
|
@Data
|
||||||
|
public class DeviceUserMapping implements Serializable {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long deviceGroupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long userGroupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String updateUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
package com.unisinsight.project.entity.dao;
|
||||||
|
|
||||||
|
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.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @TableName image
|
||||||
|
*/
|
||||||
|
@TableName(value ="image")
|
||||||
|
@Data
|
||||||
|
public class Image implements Serializable {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String imageName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer imageType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer imageStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String imageVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String osVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String btPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String storagePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String updateUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
|
@ -0,0 +1,111 @@
|
||||||
|
package com.unisinsight.project.entity.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @TableName user
|
||||||
|
*/
|
||||||
|
@TableName(value ="\"user\"")
|
||||||
|
@Data
|
||||||
|
public class User implements Serializable {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long userGroupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String birthday;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String cellPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer gender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String identityNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long priority;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer userType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String updateUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
|
@ -0,0 +1,83 @@
|
||||||
|
package com.unisinsight.project.entity.dao;
|
||||||
|
|
||||||
|
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.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @TableName user_device_group
|
||||||
|
*/
|
||||||
|
@TableName(value ="user_device_group")
|
||||||
|
@Data
|
||||||
|
public class UserDeviceGroup implements Serializable {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String parentName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String index;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String updateUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.unisinsight.project.entity.req;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description:
|
||||||
|
* @author: rdpnr_puzhi
|
||||||
|
* @create: 2025/08/06
|
||||||
|
*/
|
||||||
|
@ApiModel("删除ID类")
|
||||||
|
@Data
|
||||||
|
public class DeleteIdReq {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "ID", dataType = "Long")
|
||||||
|
public Long id;
|
||||||
|
}
|
|
@ -0,0 +1,101 @@
|
||||||
|
package com.unisinsight.project.entity.req;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @TableName user
|
||||||
|
*/
|
||||||
|
@ApiModel("用户新增类")
|
||||||
|
@Data
|
||||||
|
public class UserReq implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "ID", dataType = "Long")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户组ID
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "用户组ID", dataType = "Long")
|
||||||
|
private Long userGroupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "用户名", dataType = "String")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "密码", dataType = "String")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生日
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "生日", dataType = "String")
|
||||||
|
private String birthday;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电话
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "电话", dataType = "String")
|
||||||
|
private String cellPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "邮箱", dataType = "String")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 身份证
|
||||||
|
*/
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "身份证", dataType = "Integer")
|
||||||
|
private Integer gender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 身份证
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "身份证", dataType = "String")
|
||||||
|
private String identityNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "暂时不清楚", dataType = "Integer")
|
||||||
|
private Integer priority;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "用户类型", dataType = "Integer")
|
||||||
|
private Integer userType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "状态", dataType = "Integer")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询页
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "查询页", notes = "分页查询时再传", dataType = "Integer")
|
||||||
|
private Integer pageNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每页数量
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "每页数量", notes = "分页查询时再传", dataType = "Integer")
|
||||||
|
private Integer pageSize;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
package com.unisinsight.project.entity.res;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @TableName user
|
||||||
|
*/
|
||||||
|
@ApiModel("用户响应类")
|
||||||
|
@Data
|
||||||
|
public class UserRes implements Serializable {
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "ID", dataType = "Long")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户组ID
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "用户组ID", dataType = "Long")
|
||||||
|
private Long userGroupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "用户名", dataType = "String")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "密码", dataType = "String")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生日
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "生日", dataType = "String")
|
||||||
|
private String birthday;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电话
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "电话", dataType = "String")
|
||||||
|
private String cellPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "邮箱", dataType = "String")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 身份证
|
||||||
|
*/
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "身份证", dataType = "Integer")
|
||||||
|
private Integer gender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 身份证
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "身份证", dataType = "String")
|
||||||
|
private String identityNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "", dataType = "Integer")
|
||||||
|
private Integer priority;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "用户类型", dataType = "Integer")
|
||||||
|
private Integer userType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "状态", dataType = "Integer")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,172 @@
|
||||||
|
package com.unisinsight.project.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangmengfei [yf_zhang.mengfei@unisinsight.com]
|
||||||
|
* @description 通用错误码定义
|
||||||
|
* @date 2020/8/10 19:53
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public enum BaseErrorCode implements ErrorCode{
|
||||||
|
INTERNAL_EXCEPTION("00001", "系统内部异常"),
|
||||||
|
INIT_EXCEPTION("00002", "系统初始化异常"),
|
||||||
|
UNKNOWN_ERROR("00003", "未知错误"),
|
||||||
|
MEMORY_ALLOCA_ERROR("00004", "内存分配失败"),
|
||||||
|
OUT_OF_MEMORY("00005", "内存溢出"),
|
||||||
|
REQUEST_TIMEOUT("00006", "请求超时"),
|
||||||
|
ILLEGAL_HANDLE("00007", "非法句柄"),
|
||||||
|
ENVIRONMENT_GET_FAIL("00008", "环境变量获取失败"),
|
||||||
|
FREQUENT_SYSTEM("00009", "系统繁忙"),
|
||||||
|
ILLEGAL_DATASOURCE("00010", "数据源异常"),
|
||||||
|
FREQUENT_OPERATION("00011", "当前操作频繁"),
|
||||||
|
UNKNOWN_REQUEST("00012", "未知的请求源"),
|
||||||
|
REQUEST_EXCEEDED("00013", "请求超过次数限制"),
|
||||||
|
CONFIG_GET_ERROR("00014", "获取配置错误"),
|
||||||
|
CONFIG_SET_ERROR("00015", "设置配置错误"),
|
||||||
|
PROGRAM_NEED_RESTART("00016", "需要重启程序"),
|
||||||
|
SYSTEM_NEED_RESTART("00017", "需要重启系统"),
|
||||||
|
CHARACTERISTICS_NOT_SUPPORT("00018", "特性不支持"),
|
||||||
|
VERIFY_FAILURE("00019", "验证失败"),
|
||||||
|
CALL_FAILURE("00020", "调用失败"),
|
||||||
|
MESSAGE_COMPONENT_EXCEPTION("00021", "消息组件异常"),
|
||||||
|
INSUFFICIENT_STORAGE_CAPACITY("00022", "存储容量不足"),
|
||||||
|
STORAGE_SERVICE_ERROR("00023", "存储服务错误"),
|
||||||
|
NETWORK_ERROR("00024", "网络错误"),
|
||||||
|
IP_ILLEGAL_ADDRESS("00025", "非法IP错误"),
|
||||||
|
IP_FORBIDDEN("00026", "被禁止的IP"),
|
||||||
|
IP_RESOLVE_DOMAIN("00027", "解析域名获取IP错误"),
|
||||||
|
PORT_ERROR("00028", "端口错误"),
|
||||||
|
API_DOMAIN_ERROR("00029", "域名错误"),
|
||||||
|
IP_ACCESS_EXCEEDED("00030", "当前IP请求超过限制"),
|
||||||
|
IP_NULL_ERROR("00031", "IP地址不能为空"),
|
||||||
|
CONNECTION_FAILURE("00032", "连接失败"),
|
||||||
|
DATA_SEND_FAILURE("00033", "数据发送失败"),
|
||||||
|
DATA_RECE_FAILURE("00034", "数据接收失败"),
|
||||||
|
HTTP_CLIENT_INIT_FAILURE("00035", "HTTP客户端初始化失败"),
|
||||||
|
HTTP_REQUEST_FAILURE("00036", "HTTP请求失败"),
|
||||||
|
HTTP_REQUEST_TIME_OUT("00037", "HTTP请求超时"),
|
||||||
|
HTTP_ERROR_CODE_400("00038", "HTTP错误码400"),
|
||||||
|
HTTP_ERROR_CODE_404("00039", "HTTP错误码404"),
|
||||||
|
HTTP_ERROR_CODE_500("00040", "HTTP错误码500"),
|
||||||
|
KAFKA_TOPICE_INVALID("00041", "kafka的topic无效"),
|
||||||
|
KAFKA_MESSAGE_SEND_FAILURE("00042", " kafka消息发送失败"),
|
||||||
|
DATABASE_ERROR("00043", "数据库错误"),
|
||||||
|
DATABASE_OPERATION_FAILED("00044", "数据库操作失败"),
|
||||||
|
QUERIER_EMPTY_RESULT("00045", "查询无结果"),
|
||||||
|
ID_REQUIRE("00046", "ID不能为空"),
|
||||||
|
DATA_DUPLICATED("00047", "数据重复"),
|
||||||
|
DATA_IN_UPDATING("00048", "数据更新中"),
|
||||||
|
QUERY_RESULT_NOT_UNIQURE("00049", "查询结果不唯一"),
|
||||||
|
DICTIONARY_GET_FAILED("00050", "字典获取失败"),
|
||||||
|
INTERFACE_NOT_EXISTS("00051", "接口不存在"),
|
||||||
|
PARAMS_CHK_ERROR("00052", "参数校验错误"),
|
||||||
|
PARAMETERS_INVALID("00053", "无效入参"),
|
||||||
|
NECESSARY_PARAMS_REQURIED("00054", "必填参数缺失,核对后重试"),
|
||||||
|
TYPE_NOT_SUPPORTED("00055", "类型不支持"),
|
||||||
|
NAME_REPEATED("00056", "名称重复"),
|
||||||
|
PARAMETERS_EMPTY("00057", "参数为空"),
|
||||||
|
LANGUAGE_NOT_SUPPORT("00058", "不支持该语言"),
|
||||||
|
API_ABANDONED("00059", "接口停用"),
|
||||||
|
API_MAINTENANCE("00060", "接口维护"),
|
||||||
|
API_VER_ERROR("00061", "版本号错误"),
|
||||||
|
VERIFICATION_CODE_WRONG("00062", "验证码错误"),
|
||||||
|
FORMAT_NOT_EMPTY("00063", "%s不能为空"),
|
||||||
|
MOBILE_FORMAT_ERROR("00064", "手机号码格式错误"),
|
||||||
|
IDCARD_FORMAT_ERROR("00065", "身份证错误"),
|
||||||
|
EMAIL_FORMAT_ERROR("00066", "邮箱错误"),
|
||||||
|
LONGITUDE_LATITUDE_ERROR("00067", "经纬度错误"),
|
||||||
|
REQUEST_PATH_ERROR("00068", "请求路径错误"),
|
||||||
|
DATA_FORMAT_ERROR("00069", "数据格式错误"),
|
||||||
|
TIME_PARAMS_ERROR("00070", "时间参数错误"),
|
||||||
|
CAR_LICENSE_ERROR("00071", "车牌号错误"),
|
||||||
|
CAMERA_NUMBER_ERROR("00072", "摄像头编号错误"),
|
||||||
|
CALLBACK_ADDR_ERROR("00073", "回调地址URL错误"),
|
||||||
|
TIME_FORMAT_ERROR("00074", "时间格式必须是ISO-8601"),
|
||||||
|
PAGE_NUM_OVERLIMIT("00075", "页码超出限制"),
|
||||||
|
PAGE_SIZE_OVERLIMIT("00076", "分页大小超出限制"),
|
||||||
|
THRID_PARTY_INTERFACE_FAILURE("00077", "调用第三方接口失败"),
|
||||||
|
JSON_PARSE_ERROR("00078", "json解析错误"),
|
||||||
|
JSON_MESSAGE_FIELD_TYPE_WRONG("00079", "json消息字段类型错误"),
|
||||||
|
JSON_MESSAGE_FIELD_VALUE_WRONG("00080", "json消息字段取值错误"),
|
||||||
|
JSON_MESSAGE_FIELD_MISSING("00081", "json消息字段缺失"),
|
||||||
|
CREATING_JSON_OBJECT_FAILED("00082", "创建json对象失败"),
|
||||||
|
CREATING_JSON_ARRAY_FAILED("00083", "创建json数组失败"),
|
||||||
|
JSON_FORMAT_CONTENT_WRONG("00084", "json格式或内容错误"),
|
||||||
|
FILENAME_ERROR("00085", "文件名错误"),
|
||||||
|
FILE_ADDRESS_ERROR("00086", "文件地址不存在"),
|
||||||
|
FILE_ID_NOT_EXIST("00087", "文件ID不存在"),
|
||||||
|
FILE_ID_LONG("00088", "文件ID过长"),
|
||||||
|
FILE_TYPE_WRONG("00089", "文件类型错误"),
|
||||||
|
FILE_CREATE_FAILED("00090", "创建文件失败"),
|
||||||
|
FILE_OPEN_FAILED("00091", "打开文件失败"),
|
||||||
|
FILE_DOWNLOAD_FAILED("00092", "下载文件失败"),
|
||||||
|
FILE_READ_FAILED("00093", "读取文件失败"),
|
||||||
|
FILE_WRITE_FAILED("00094", "写入文件失败"),
|
||||||
|
FILE_FORMAT_ERROR("00095", "文件格式错误"),
|
||||||
|
FILE_ENCRYPTED("00096", "文件被加密"),
|
||||||
|
EXEL_GENERATE_FAILED("00097", "EXEL生成失败"),
|
||||||
|
EXEL_IMPORT_FAILED("00098", "EXEL导入失败"),
|
||||||
|
TEXT_ENCODING_CONVERSION_FAILED("00099", "文本编码转换失败"),
|
||||||
|
FILE_NOT_RECOGNIZED("00100", "未识别文件"),
|
||||||
|
FILE_SIZE_EXCEEDS_LIMIT("00101", "文件大小超过限制"),
|
||||||
|
FILE_UPLOAD_FAILED("00102", "文件上传失败"),
|
||||||
|
OTHER_USER_UPLOAD_FILE("00103", "其他用户正在上传该文件"),
|
||||||
|
USER_NOT_FOUND("00104", "用户不存在"),
|
||||||
|
USER_NOT_LOGIN("00105", "用户未登录"),
|
||||||
|
USER_NOT_PERMISSON("00106", "用户没权限"),
|
||||||
|
PASSWORD_ERROR("00107", "密码错误"),
|
||||||
|
USER_NAME_EXIST("00108", "用户名已存在"),
|
||||||
|
USER_NAME_WRONG_LENGTH("00109", "用户名长度错误"),
|
||||||
|
PASSWORD_WRONG_LENGTH("00110", "密码长度错误"),
|
||||||
|
USER_NAME_OR_PASSWORD_WRONG_FORMAT("00111", "用户名或密码格式错误"),
|
||||||
|
USER_NAME_OR_PASSWORD_EMPTY("00112", "用户名或密码为空"),
|
||||||
|
USER_LOGIN_EXPIRED("00113", "用户登录已过期"),
|
||||||
|
SECURITY_AUTHENTICATION_FAILED("00114", "安全认证失败"),
|
||||||
|
ACCOUNT_NUMBER_LOCKED("00115", "账号被锁定"),
|
||||||
|
USER_ADD_FAILED("00116", "添加用户失败"),
|
||||||
|
USER_DELETE_FAILED("00117", "删除用户失败"),
|
||||||
|
USER_UPDATE_FAILED("00118", "修改用户失败"),
|
||||||
|
USER_QUERY_FAILED("00119", "查询用户失败"),
|
||||||
|
PASSWORD_UPDATE_FAILED("00120", "修改密码失败"),
|
||||||
|
PASSWORD_NEW_WRONG("00121", "新密码错误"),
|
||||||
|
PASSWORD_NEW_WRONG_LENGTH("00122", "新密码长度错误"),
|
||||||
|
PASSWORD_OLD_WRONG_LENGTH("00123", "原密码长度错误"),
|
||||||
|
PASSWORD_OLD_WRONG("00124", "原密码错误"),
|
||||||
|
PASSWORD_OLD_NEW_SAME("00125", "新密码和原密码相同"),
|
||||||
|
USER_NAME_OR_PASSWORD_INCORRECT("00126", "用户名或密码错误,需重新配置"),
|
||||||
|
DEVICE_GET_FAILED("00127", "设备获取失败"),
|
||||||
|
CHANNEL_GET_FAILED("00128", "通道获取失败"),
|
||||||
|
DEVICE_OFFLINE("00129", "设备离线"),
|
||||||
|
RESOURCES_TREE_GET_FAILED("00130", "资源树获取失败"),
|
||||||
|
RESOURCES_EXIST("00131", "资源已经存在"),
|
||||||
|
DEVICE_NOT_EXIST("00132", "设备不存在"),
|
||||||
|
DEVICE_EXIST("00133", "设备已经存在"),
|
||||||
|
DEVICE_NUMBER_REACHE_MAX("00134", "设备数达到上限"),
|
||||||
|
CHANNEL_NUMBER_REACHE_MAX("00135", "设备数达到上限"),
|
||||||
|
CAMERA_ID_WRONG("00136", "相机ID错误"),
|
||||||
|
CAMERA_NAME_WRONG("00137", "相机名错误"),
|
||||||
|
IPC_DEVICE_CODE_EXCEEDS_LONG("00138", "IPC设备编码超长"),
|
||||||
|
IPC_DEVICE_NAME_EXCEEDS_LONG("00139", "IPC设备名称超长"),
|
||||||
|
IPC_TYPE_GET_FAILED("00140", "获取IPC款型失败"),
|
||||||
|
FORMAT_VALIDATE_ERROR("00141", "%s"),
|
||||||
|
EXPORT_ERROR("00142", "导出EXCEL失败"),
|
||||||
|
SUCCESS("0000000000", "处理成功");
|
||||||
|
|
||||||
|
private String errorCode;
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
BaseErrorCode(String errorCode, String message) {
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getErrorCode() {
|
||||||
|
return this.errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return this.message;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,117 @@
|
||||||
|
package com.unisinsight.project.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangmengfei [yf_zhang.mengfei@unisinsight.com]
|
||||||
|
* @description BizExceptions
|
||||||
|
* @date 2020/9/2 14:21
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public class BizException extends RuntimeException {
|
||||||
|
private int httpStatus = 500;
|
||||||
|
private String errorCode;
|
||||||
|
private Object body;
|
||||||
|
|
||||||
|
public BizException(String message, Throwable cause, int httpStatus, String errorCode, Object body) {
|
||||||
|
super(message, cause);
|
||||||
|
this.httpStatus = httpStatus;
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
this.body = body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BizException(ErrorCode errorCode) {
|
||||||
|
super(errorCode.getMessage());
|
||||||
|
this.errorCode = errorCode.getErrorCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public BizException(ErrorCode errorCode, Object data) {
|
||||||
|
super(errorCode.getMessage());
|
||||||
|
this.errorCode = errorCode.getErrorCode();
|
||||||
|
this.body = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BizException(ErrorCode errorCode, Object... params) {
|
||||||
|
super(String.format(errorCode.getMessage(), params));
|
||||||
|
this.errorCode = errorCode.getErrorCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public BizException(ErrorCode errorCode, Throwable cause, Object... params) {
|
||||||
|
super(String.format(errorCode.getMessage(), params), cause);
|
||||||
|
this.errorCode = errorCode.getErrorCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> BizExceptionBuilder<T> builder() {
|
||||||
|
return new BizExceptionBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BizException of(ErrorCode errorCode) {
|
||||||
|
return new BizException(errorCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BizException of(ErrorCode errorCode, Object... params) {
|
||||||
|
return new BizException(errorCode, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHttpStatus() {
|
||||||
|
return this.httpStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHttpStatus(int httpStatus) {
|
||||||
|
this.httpStatus = httpStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getErrorCode() {
|
||||||
|
return this.errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorCode(String errorCode) {
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getBody() {
|
||||||
|
return this.body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBody(Object body) {
|
||||||
|
this.body = body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class BizExceptionBuilder<T> {
|
||||||
|
private ErrorCode errorCode;
|
||||||
|
private Object[] params;
|
||||||
|
private Throwable cause;
|
||||||
|
private int status;
|
||||||
|
private T body;
|
||||||
|
|
||||||
|
public BizExceptionBuilder() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public BizExceptionBuilder<T> errorCode(ErrorCode errorCode) {
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BizExceptionBuilder<T> params(Object... params) {
|
||||||
|
this.params = params;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BizExceptionBuilder<T> cause(Throwable cause) {
|
||||||
|
this.cause = cause;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BizExceptionBuilder<T> status(int status) {
|
||||||
|
this.status = status;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BizExceptionBuilder<T> body(T body) {
|
||||||
|
this.body = body;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BizException build() {
|
||||||
|
return new BizException(String.format(this.errorCode.getMessage(), this.params), this.cause, this.status, this.errorCode.getErrorCode(), this.body);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.unisinsight.project.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangmengfei [yf_zhang.mengfei@unisinsight.com]
|
||||||
|
* @description 错误码接口
|
||||||
|
* @date 2020/8/10 19:53
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public interface ErrorCode {
|
||||||
|
String getErrorCode();
|
||||||
|
|
||||||
|
String getMessage();
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.unisinsight.project.exception;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangmengfei [yf_zhang.mengfei@unisinsight.com]
|
||||||
|
* @description 返回结果类
|
||||||
|
* @date 2020/8/10 19:53
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Result<T> implements ErrorCode {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回码
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "error_code")
|
||||||
|
private String errorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回信息
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "message")
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回数据
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "data")
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
public Result() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result(String errorCode, String message) {
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result(String errorCode, String message, T data) {
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
this.message = message;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> successResult(T data) {
|
||||||
|
return new Result<>(BaseErrorCode.SUCCESS.getErrorCode(), BaseErrorCode.SUCCESS.getMessage(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> successResult() {
|
||||||
|
return new Result<>(BaseErrorCode.SUCCESS.getErrorCode(), BaseErrorCode.SUCCESS.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> errorResult(ErrorCode errorCode) {
|
||||||
|
return new Result<>(errorCode.getErrorCode(), errorCode.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> errorResult(ErrorCode errorCode, T data) {
|
||||||
|
return new Result<>(errorCode.getErrorCode(), errorCode.getMessage(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> errorResultMessage(ErrorCode errorCode, String message) {
|
||||||
|
return new Result<>(errorCode.getErrorCode(), message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断当前返回是否成功
|
||||||
|
*/
|
||||||
|
public boolean success() {
|
||||||
|
return BaseErrorCode.SUCCESS.getErrorCode().equals(this.errorCode);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.unisinsight.project.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.unisinsight.project.entity.dao.DeviceImageMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rdpnr_puzhi
|
||||||
|
* @description 针对表【device_image_mapping】的数据库操作Mapper
|
||||||
|
* @createDate 2025-08-06 11:07:16
|
||||||
|
* @Entity com.unisinsight.project.entity.DeviceImageMapping
|
||||||
|
*/
|
||||||
|
public interface DeviceImageMappingMapper extends BaseMapper<DeviceImageMapping> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.unisinsight.project.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.unisinsight.project.entity.dao.Device;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rdpnr_puzhi
|
||||||
|
* @description 针对表【device】的数据库操作Mapper
|
||||||
|
* @createDate 2025-08-06 11:04:49
|
||||||
|
* @Entity com.unisinsight.project.entity.Device
|
||||||
|
*/
|
||||||
|
public interface DeviceMapper extends BaseMapper<Device> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.unisinsight.project.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.unisinsight.project.entity.dao.DeviceUserMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rdpnr_puzhi
|
||||||
|
* @description 针对表【device_user_mapping】的数据库操作Mapper
|
||||||
|
* @createDate 2025-08-06 11:07:39
|
||||||
|
* @Entity com.unisinsight.project.entity.DeviceUserMapping
|
||||||
|
*/
|
||||||
|
public interface DeviceUserMappingMapper extends BaseMapper<DeviceUserMapping> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.unisinsight.project.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.unisinsight.project.entity.dao.Image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rdpnr_puzhi
|
||||||
|
* @description 针对表【image】的数据库操作Mapper
|
||||||
|
* @createDate 2025-08-06 11:12:22
|
||||||
|
* @Entity com.unisinsight.project.entity.Image
|
||||||
|
*/
|
||||||
|
public interface ImageMapper extends BaseMapper<Image> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.unisinsight.project.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.unisinsight.project.entity.dao.UserDeviceGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rdpnr_puzhi
|
||||||
|
* @description 针对表【user_device_group】的数据库操作Mapper
|
||||||
|
* @createDate 2025-08-06 10:52:20
|
||||||
|
* @Entity com.unisinsight.project.entity.UserDeviceGroup
|
||||||
|
*/
|
||||||
|
public interface UserDeviceGroupMapper extends BaseMapper<UserDeviceGroup> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.unisinsight.project.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.unisinsight.project.entity.dao.User;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rdpnr_puzhi
|
||||||
|
* @description 针对表【user】的数据库操作Mapper
|
||||||
|
* @createDate 2025-08-06 11:12:08
|
||||||
|
* @Entity com.unisinsight.project.entity.User
|
||||||
|
*/
|
||||||
|
public interface UserMapper extends BaseMapper<User> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.unisinsight.project.service;
|
||||||
|
|
||||||
|
import com.unisinsight.project.entity.dao.DeviceImageMapping;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rdpnr_puzhi
|
||||||
|
* @description 针对表【device_image_mapping】的数据库操作Service
|
||||||
|
* @createDate 2025-08-06 11:07:16
|
||||||
|
*/
|
||||||
|
public interface DeviceImageMappingService extends IService<DeviceImageMapping> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.unisinsight.project.service;
|
||||||
|
|
||||||
|
import com.unisinsight.project.entity.dao.Device;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rdpnr_puzhi
|
||||||
|
* @description 针对表【device】的数据库操作Service
|
||||||
|
* @createDate 2025-08-06 11:04:49
|
||||||
|
*/
|
||||||
|
public interface DeviceService extends IService<Device> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.unisinsight.project.service;
|
||||||
|
|
||||||
|
import com.unisinsight.project.entity.dao.DeviceUserMapping;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rdpnr_puzhi
|
||||||
|
* @description 针对表【device_user_mapping】的数据库操作Service
|
||||||
|
* @createDate 2025-08-06 11:07:39
|
||||||
|
*/
|
||||||
|
public interface DeviceUserMappingService extends IService<DeviceUserMapping> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.unisinsight.project.service;
|
||||||
|
|
||||||
|
import com.unisinsight.project.entity.dao.Image;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rdpnr_puzhi
|
||||||
|
* @description 针对表【image】的数据库操作Service
|
||||||
|
* @createDate 2025-08-06 11:12:22
|
||||||
|
*/
|
||||||
|
public interface ImageService extends IService<Image> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.unisinsight.project.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.unisinsight.project.entity.dao.UserDeviceGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rdpnr_puzhi
|
||||||
|
* @description 针对表【user_device_group】的数据库操作Service
|
||||||
|
* @createDate 2025-08-06 10:52:20
|
||||||
|
*/
|
||||||
|
public interface UserDeviceGroupService extends IService<UserDeviceGroup> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.unisinsight.project.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.unisinsight.project.entity.dao.User;
|
||||||
|
import com.unisinsight.project.entity.req.DeleteIdReq;
|
||||||
|
import com.unisinsight.project.entity.req.UserReq;
|
||||||
|
import com.unisinsight.project.exception.Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rdpnr_puzhi
|
||||||
|
* @description 针对表【user】的数据库操作Service
|
||||||
|
* @createDate 2025-08-06 11:12:08
|
||||||
|
*/
|
||||||
|
public interface UserService extends IService<User> {
|
||||||
|
|
||||||
|
|
||||||
|
Result<?> insert(UserReq userReq);
|
||||||
|
|
||||||
|
Result<?> update(UserReq userReq);
|
||||||
|
|
||||||
|
Result<?> delete(DeleteIdReq deleteIdReq);
|
||||||
|
|
||||||
|
Result<?> selectPageUser(UserReq userReq);
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.unisinsight.project.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.unisinsight.project.entity.dao.DeviceImageMapping;
|
||||||
|
import com.unisinsight.project.service.DeviceImageMappingService;
|
||||||
|
import com.unisinsight.project.mapper.DeviceImageMappingMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rdpnr_puzhi
|
||||||
|
* @description 针对表【device_image_mapping】的数据库操作Service实现
|
||||||
|
* @createDate 2025-08-06 11:07:16
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class DeviceImageMappingServiceImpl extends ServiceImpl<DeviceImageMappingMapper, DeviceImageMapping>
|
||||||
|
implements DeviceImageMappingService{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.unisinsight.project.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.unisinsight.project.entity.dao.Device;
|
||||||
|
import com.unisinsight.project.service.DeviceService;
|
||||||
|
import com.unisinsight.project.mapper.DeviceMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rdpnr_puzhi
|
||||||
|
* @description 针对表【device】的数据库操作Service实现
|
||||||
|
* @createDate 2025-08-06 11:04:49
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device>
|
||||||
|
implements DeviceService{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.unisinsight.project.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.unisinsight.project.entity.dao.DeviceUserMapping;
|
||||||
|
import com.unisinsight.project.service.DeviceUserMappingService;
|
||||||
|
import com.unisinsight.project.mapper.DeviceUserMappingMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rdpnr_puzhi
|
||||||
|
* @description 针对表【device_user_mapping】的数据库操作Service实现
|
||||||
|
* @createDate 2025-08-06 11:07:39
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class DeviceUserMappingServiceImpl extends ServiceImpl<DeviceUserMappingMapper, DeviceUserMapping>
|
||||||
|
implements DeviceUserMappingService{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.unisinsight.project.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.unisinsight.project.entity.dao.Image;
|
||||||
|
import com.unisinsight.project.service.ImageService;
|
||||||
|
import com.unisinsight.project.mapper.ImageMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rdpnr_puzhi
|
||||||
|
* @description 针对表【image】的数据库操作Service实现
|
||||||
|
* @createDate 2025-08-06 11:12:22
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ImageServiceImpl extends ServiceImpl<ImageMapper, Image>
|
||||||
|
implements ImageService{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.unisinsight.project.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.unisinsight.project.entity.dao.UserDeviceGroup;
|
||||||
|
import com.unisinsight.project.mapper.UserDeviceGroupMapper;
|
||||||
|
import com.unisinsight.project.service.UserDeviceGroupService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rdpnr_puzhi
|
||||||
|
* @description 针对表【user_device_group】的数据库操作Service实现
|
||||||
|
* @createDate 2025-08-06 10:52:20
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class UserDeviceGroupServiceImpl extends ServiceImpl<UserDeviceGroupMapper, UserDeviceGroup>
|
||||||
|
implements UserDeviceGroupService{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,98 @@
|
||||||
|
package com.unisinsight.project.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.unisinsight.project.entity.dao.User;
|
||||||
|
import com.unisinsight.project.entity.req.DeleteIdReq;
|
||||||
|
import com.unisinsight.project.entity.req.UserReq;
|
||||||
|
import com.unisinsight.project.exception.BaseErrorCode;
|
||||||
|
import com.unisinsight.project.exception.Result;
|
||||||
|
import com.unisinsight.project.mapper.UserMapper;
|
||||||
|
import com.unisinsight.project.service.UserService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rdpnr_puzhi
|
||||||
|
* @description 针对表【user】的数据库操作Service实现
|
||||||
|
* @createDate 2025-08-06 11:12:08
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
|
||||||
|
implements UserService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserMapper userMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<?> insert(UserReq userReq) {
|
||||||
|
User user = BeanUtil.copyProperties(userReq, User.class);
|
||||||
|
user.setCreateUser("admin");
|
||||||
|
int insert = userMapper.insert(user);
|
||||||
|
log.info("用户新增insert:{}", insert);
|
||||||
|
if (insert == 1) {
|
||||||
|
return Result.successResult();
|
||||||
|
} else {
|
||||||
|
return Result.errorResult(BaseErrorCode.HTTP_ERROR_CODE_500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<?> update(UserReq userReq) {
|
||||||
|
User user = BeanUtil.copyProperties(userReq, User.class);
|
||||||
|
user.setUpdateUser("admin");
|
||||||
|
int updated = userMapper.updateById(user);
|
||||||
|
log.info("用户修改insert:{}", updated);
|
||||||
|
if (updated == 1) {
|
||||||
|
return Result.successResult();
|
||||||
|
} else {
|
||||||
|
return Result.errorResult(BaseErrorCode.HTTP_ERROR_CODE_500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<?> delete(DeleteIdReq deleteIdReq) {
|
||||||
|
int deleted = userMapper.deleteById(deleteIdReq.getId());
|
||||||
|
log.info("用户删除insert:{}", deleted);
|
||||||
|
if (deleted == 1) {
|
||||||
|
return Result.successResult();
|
||||||
|
} else {
|
||||||
|
return Result.errorResult(BaseErrorCode.HTTP_ERROR_CODE_500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<?> selectPageUser(UserReq userReq) {
|
||||||
|
|
||||||
|
Page<User> page = new Page<>(userReq.getPageNum(), userReq.getPageSize());
|
||||||
|
|
||||||
|
QueryWrapper<User> queryWrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
|
if (StringUtils.isNoneBlank(userReq.getUserName())) {
|
||||||
|
queryWrapper.lambda().like(User::getUserName, userReq.getUserName());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNoneBlank(userReq.getIdentityNo())) {
|
||||||
|
queryWrapper.lambda().like(User::getIdentityNo, userReq.getIdentityNo());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNoneBlank(userReq.getCellPhone())) {
|
||||||
|
queryWrapper.lambda().like(User::getCellPhone, userReq.getCellPhone());
|
||||||
|
}
|
||||||
|
|
||||||
|
IPage<User> userPage = userMapper.selectPage(page, queryWrapper);
|
||||||
|
log.info("分页查询用户返回:{}", JSONUtil.toJsonStr(userPage));
|
||||||
|
|
||||||
|
return Result.successResult(userPage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class BtTorrentUtil {
|
||||||
|
|
||||||
if (torrentInfo.getFiles() != null && !torrentInfo.getFiles().isEmpty()) {
|
if (torrentInfo.getFiles() != null && !torrentInfo.getFiles().isEmpty()) {
|
||||||
// 多文件模式
|
// 多文件模式
|
||||||
java.util.List<java.util.Map<String, Object>> fileList = new ArrayList<>();
|
List<java.util.Map<String, Object>> fileList = new ArrayList<>();
|
||||||
for (FileInfo file : torrentInfo.getFiles()) {
|
for (FileInfo file : torrentInfo.getFiles()) {
|
||||||
java.util.Map<String, Object> fileMap = new java.util.HashMap<>();
|
java.util.Map<String, Object> fileMap = new java.util.HashMap<>();
|
||||||
fileMap.put("length", file.getLength());
|
fileMap.put("length", file.getLength());
|
||||||
|
@ -271,9 +271,9 @@ public class BtTorrentUtil {
|
||||||
|
|
||||||
// 处理文件列表
|
// 处理文件列表
|
||||||
Object filesObj = infoMap.get("files");
|
Object filesObj = infoMap.get("files");
|
||||||
if (filesObj instanceof java.util.List) {
|
if (filesObj instanceof List) {
|
||||||
java.util.List<java.util.Map<String, Object>> fileList =
|
List<java.util.Map<String, Object>> fileList =
|
||||||
(java.util.List<java.util.Map<String, Object>>) filesObj;
|
(List<java.util.Map<String, Object>>) filesObj;
|
||||||
|
|
||||||
List<FileInfo> files = new ArrayList<>();
|
List<FileInfo> files = new ArrayList<>();
|
||||||
for (java.util.Map<String, Object> fileMap : fileList) {
|
for (java.util.Map<String, Object> fileMap : fileList) {
|
||||||
|
@ -409,7 +409,7 @@ public class BtTorrentUtil {
|
||||||
);
|
);
|
||||||
|
|
||||||
// 解析种子文件
|
// 解析种子文件
|
||||||
BtTorrentUtil.TorrentInfo info = BtTorrentUtil.parseTorrent("/path/to/output.torrent");
|
TorrentInfo info = BtTorrentUtil.parseTorrent("/path/to/output.torrent");
|
||||||
System.out.println("种子名称: " + info.getName());
|
System.out.println("种子名称: " + info.getName());
|
||||||
System.out.println("创建时间: " + new Date(info.getCreationDate() * 1000));
|
System.out.println("创建时间: " + new Date(info.getCreationDate() * 1000));
|
||||||
|
|
|
@ -11,8 +11,31 @@ spring:
|
||||||
multipart:
|
multipart:
|
||||||
max-file-size: 10MB
|
max-file-size: 10MB
|
||||||
max-request-size: 10MB
|
max-request-size: 10MB
|
||||||
|
datasource:
|
||||||
|
driver-class-name: org.postgresql.Driver
|
||||||
|
url: jdbc:postgresql://10.100.51.86:5432/postgres?serverTimeZone=UTC
|
||||||
|
username: unis
|
||||||
|
password: unis@123
|
||||||
|
|
||||||
knife4j:
|
knife4j:
|
||||||
production: false
|
production: false
|
||||||
basic:
|
basic:
|
||||||
enable: false
|
enable: false
|
||||||
|
|
||||||
|
|
||||||
|
mybatis-plus:
|
||||||
|
mapper-locations: classpath*:mappers/*.xml
|
||||||
|
typeAliasesPackage: com.unisinsight.project.entity
|
||||||
|
global-config:
|
||||||
|
db-config:
|
||||||
|
logic-delete-value: 1
|
||||||
|
logic-not-delete-value: 0
|
||||||
|
logic-delete-field: deleted
|
||||||
|
id-type: auto
|
||||||
|
field-strategy: 0
|
||||||
|
db-column-underline: true
|
||||||
|
db-type: pgsql
|
||||||
|
configuration:
|
||||||
|
map-underscore-to-camel-case: true
|
||||||
|
cache-enabled: false
|
||||||
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?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.unisinsight.project.mapper.DeviceImageMappingMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.unisinsight.project.entity.dao.DeviceImageMapping">
|
||||||
|
<id property="id" column="id" />
|
||||||
|
<result property="deviceId" column="device_id" />
|
||||||
|
<result property="deviceGroupId" column="device_group_id" />
|
||||||
|
<result property="imageId" column="image_id" />
|
||||||
|
<result property="restoreType" column="restore_type" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="createUser" column="create_user" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="updateUser" column="update_user" />
|
||||||
|
<result property="description" column="description" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id,device_id,device_group_id,image_id,restore_type,create_time,
|
||||||
|
create_user,update_time,update_user,description
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?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.unisinsight.project.mapper.DeviceMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.unisinsight.project.entity.dao.Device">
|
||||||
|
<id property="id" column="id" />
|
||||||
|
<result property="deviceId" column="device_id" />
|
||||||
|
<result property="deviceName" column="device_name" />
|
||||||
|
<result property="deviceGroupId" column="device_group_id" />
|
||||||
|
<result property="deviceGroupName" column="device_group_name" />
|
||||||
|
<result property="deviceType" column="device_type" />
|
||||||
|
<result property="ipAddr" column="ip_addr" />
|
||||||
|
<result property="macAddr" column="mac_addr" />
|
||||||
|
<result property="model" column="model" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="createUser" column="create_user" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="updateUser" column="update_user" />
|
||||||
|
<result property="deleted" column="deleted" />
|
||||||
|
<result property="description" column="description" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id,device_id,device_name,device_group_id,device_group_name,device_type,
|
||||||
|
ip_addr,mac_addr,model,create_time,create_user,
|
||||||
|
update_time,update_user,deleted,description
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?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.unisinsight.project.mapper.DeviceUserMappingMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.unisinsight.project.entity.dao.DeviceUserMapping">
|
||||||
|
<id property="id" column="id" />
|
||||||
|
<result property="deviceId" column="device_id" />
|
||||||
|
<result property="deviceGroupId" column="device_group_id" />
|
||||||
|
<result property="userGroupId" column="user_group_id" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="createUser" column="create_user" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="updateUser" column="update_user" />
|
||||||
|
<result property="description" column="description" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id,device_id,device_group_id,user_group_id,user_id,create_time,
|
||||||
|
create_user,update_time,update_user,description
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?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.unisinsight.project.mapper.ImageMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.unisinsight.project.entity.dao.Image">
|
||||||
|
<id property="id" column="id" />
|
||||||
|
<result property="imageName" column="image_name" />
|
||||||
|
<result property="imageType" column="image_type" />
|
||||||
|
<result property="imageStatus" column="image_status" />
|
||||||
|
<result property="imageVersion" column="image_version" />
|
||||||
|
<result property="osVersion" column="os_version" />
|
||||||
|
<result property="btPath" column="bt_path" />
|
||||||
|
<result property="storagePath" column="storage_path" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="createUser" column="create_user" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="updateUser" column="update_user" />
|
||||||
|
<result property="deleted" column="deleted" />
|
||||||
|
<result property="description" column="description" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id,image_name,image_type,image_status,image_version,os_version,
|
||||||
|
bt_path,storage_path,create_time,create_user,update_time,
|
||||||
|
update_user,deleted,description
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?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.unisinsight.project.mapper.UserDeviceGroupMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.unisinsight.project.entity.dao.UserDeviceGroup">
|
||||||
|
<id property="id" column="id" />
|
||||||
|
<result property="name" column="name" />
|
||||||
|
<result property="parentId" column="parent__id" />
|
||||||
|
<result property="parentName" column="parent__name" />
|
||||||
|
<result property="index" column="index" />
|
||||||
|
<result property="type" column="type" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="createUser" column="create_user" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="updateUser" column="update_user" />
|
||||||
|
<result property="path" column="path" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id,name,parent__id,parent__name,index,type,
|
||||||
|
create_time,create_user,update_time,update_user,path
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?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.unisinsight.project.mapper.UserMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.unisinsight.project.entity.dao.User">
|
||||||
|
<id property="id" column="id" />
|
||||||
|
<result property="userGroupId" column="user_group_id" />
|
||||||
|
<result property="userName" column="user_name" />
|
||||||
|
<result property="password" column="password" />
|
||||||
|
<result property="birthday" column="birthday" />
|
||||||
|
<result property="cellPhone" column="cell_phone" />
|
||||||
|
<result property="email" column="email" />
|
||||||
|
<result property="gender" column="gender" />
|
||||||
|
<result property="identityNo" column="identity_no" />
|
||||||
|
<result property="priority" column="priority" />
|
||||||
|
<result property="userType" column="user_type" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="createUser" column="create_user" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="updateUser" column="update_user" />
|
||||||
|
<result property="deleted" column="deleted" />
|
||||||
|
<result property="description" column="description" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id,user_group_id,user_name,password,birthday,cell_phone,
|
||||||
|
email,gender,identity_no,priority,user_type,
|
||||||
|
status,create_time,create_user,update_time,update_user,
|
||||||
|
deleted,description
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue