电子围栏CRUD
parent
979074fc11
commit
0b60c3ef68
|
@ -17,6 +17,7 @@
|
||||||
<module>zhilian-resolver</module>
|
<module>zhilian-resolver</module>
|
||||||
<module>zhilian-business</module>
|
<module>zhilian-business</module>
|
||||||
<module>zhilian-manager</module>
|
<module>zhilian-manager</module>
|
||||||
|
<module>zhilian-fence</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>zhilian-modules</artifactId>
|
<artifactId>zhilian-modules</artifactId>
|
||||||
|
|
|
@ -0,0 +1,115 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.zhilian</groupId>
|
||||||
|
<artifactId>zhilian-modules</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>zhilian-fence</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos Config -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Sentinel -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringBoot Actuator -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- FastDFS -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.tobato</groupId>
|
||||||
|
<artifactId>fastdfs-client</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Minio -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.minio</groupId>
|
||||||
|
<artifactId>minio</artifactId>
|
||||||
|
<version>${minio.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- zhilian Common Swagger -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.zhilian</groupId>
|
||||||
|
<artifactId>zhilian-common-swagger</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- zhilian Common System-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.zhilian</groupId>
|
||||||
|
<artifactId>zhilian-common-system</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.zhilian</groupId>
|
||||||
|
<artifactId>zhilian-common-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.zhilian</groupId>
|
||||||
|
<artifactId>zhilian-common-log</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<!-- 加入maven deploy插件,当在deploy时,忽略些model-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skip>true</skip>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.zhilian;
|
||||||
|
|
||||||
|
import com.zhilian.common.security.annotation.EnableCustomConfig;
|
||||||
|
import com.zhilian.common.security.annotation.EnableMyFeignClients;
|
||||||
|
import com.zhilian.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@EnableCustomConfig
|
||||||
|
@EnableCustomSwagger2
|
||||||
|
@EnableMyFeignClients
|
||||||
|
@SpringBootApplication
|
||||||
|
public class FenceApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(FenceApplication.class,args);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.zhilian.controller;
|
||||||
|
|
||||||
|
import com.zhilian.common.core.domain.Result;
|
||||||
|
import com.zhilian.common.core.web.controller.BaseController;
|
||||||
|
import com.zhilian.common.core.web.page.TableDataInfo;
|
||||||
|
import com.zhilian.common.security.utils.SecurityUtils;
|
||||||
|
import com.zhilian.domain.Fence;
|
||||||
|
import com.zhilian.domain.request.FenceRequest;
|
||||||
|
import com.zhilian.service.FenceService;
|
||||||
|
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
/**
|
||||||
|
* @ClassName FenceController
|
||||||
|
* @Description 电子围栏控制层
|
||||||
|
* @Author ZeJinG.Su
|
||||||
|
* @Date 14:37 2024/3/29
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("fence")
|
||||||
|
public class FenceController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private FenceService fenceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: 围栏管理
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<Fence>> list (FenceRequest fenceRequest) {
|
||||||
|
startPage();
|
||||||
|
List<Fence> list = fenceService.pageQuery(fenceRequest);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增围栏
|
||||||
|
* @param fence
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
public Result add(@Validated @RequestBody Fence fence){
|
||||||
|
fence.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
return toAjax(fenceService.save(fence));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑围栏
|
||||||
|
* @param fence
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PutMapping
|
||||||
|
public Result edit(@Validated @RequestBody Fence fence){
|
||||||
|
fence.setUpdateBy(SecurityUtils.getUsername());
|
||||||
|
return toAjax(fenceService.updateById(fence));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除围栏
|
||||||
|
* @param fenceIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{fenceIds}")
|
||||||
|
public Result remove(@PathVariable Long[] fenceIds){
|
||||||
|
fenceService.removeBatchByIds(Arrays.asList(fenceIds));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.zhilian.controller;
|
||||||
|
|
||||||
|
import com.zhilian.common.core.domain.Result;
|
||||||
|
import com.zhilian.common.core.web.controller.BaseController;
|
||||||
|
import com.zhilian.domain.FenceType;
|
||||||
|
import com.zhilian.service.FenceTypeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/fenceType")
|
||||||
|
public class FenceTypeController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private FenceTypeService fenceTypeService;
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<List<FenceType>> list(){
|
||||||
|
List<FenceType> list = fenceTypeService.selectFenceTypeList();
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,152 @@
|
||||||
|
package com.zhilian.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import com.zhilian.common.core.annotation.Excel;
|
||||||
|
import com.zhilian.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("vehicle_fence")
|
||||||
|
public class Fence extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
/**
|
||||||
|
* 电子围栏编号
|
||||||
|
*/
|
||||||
|
@Excel(name = "参数主键", cellType = Excel.ColumnType.NUMERIC)
|
||||||
|
@TableId(value = "fence_id", type = IdType.AUTO)
|
||||||
|
private Long fenceId;
|
||||||
|
/**
|
||||||
|
* 电子围栏名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "电子围栏名称")
|
||||||
|
private String fenceName;
|
||||||
|
/**
|
||||||
|
* 电子围栏类型编号
|
||||||
|
*/
|
||||||
|
@Excel(name = "电子围栏类型编号")
|
||||||
|
private Long fenceTypeId;
|
||||||
|
/**
|
||||||
|
* 电子围栏状态
|
||||||
|
*/
|
||||||
|
@Excel(name = "电子围栏状态")
|
||||||
|
private Long fenceState;
|
||||||
|
/**
|
||||||
|
* 电子围栏经纬度信息
|
||||||
|
*/
|
||||||
|
@Excel(name = "电子围栏经纬度信息")
|
||||||
|
private String fenceMessage;
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 创建者
|
||||||
|
// */
|
||||||
|
// @Excel(name = "创建者")
|
||||||
|
// private String createBy;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 创建时间
|
||||||
|
// */
|
||||||
|
// @Excel(name = "创建时间")
|
||||||
|
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
// private Date createTime;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 更新者
|
||||||
|
// */
|
||||||
|
// @Excel(name = "更新者")
|
||||||
|
// private String updateBy;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 更新时间
|
||||||
|
// */
|
||||||
|
// @Excel(name = "更新时间")
|
||||||
|
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
// private Date updateTime;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 备注
|
||||||
|
// */
|
||||||
|
// @Excel(name = "备注")
|
||||||
|
// private String remark;
|
||||||
|
|
||||||
|
public Long getFenceId() {
|
||||||
|
return fenceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFenceId(Long fenceId) {
|
||||||
|
this.fenceId = fenceId;
|
||||||
|
}
|
||||||
|
@NotBlank(message = "围栏名称不能为空")
|
||||||
|
@Size(min=0,max=100,message = "围栏名称不能超过100个字符")
|
||||||
|
public String getFenceName() {
|
||||||
|
return fenceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFenceName(String fenceName) {
|
||||||
|
this.fenceName = fenceName;
|
||||||
|
}
|
||||||
|
@NotBlank(message = "围栏类型不能为空")
|
||||||
|
@Size(min = 0,max = 10,message = "围栏类型不能超过10个字符")
|
||||||
|
public Long getFenceTypeId() {
|
||||||
|
return fenceTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFenceTypeId(Long fenceTypeId) {
|
||||||
|
this.fenceTypeId = fenceTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getFenceState() {
|
||||||
|
return fenceState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFenceState(Long fenceState) {
|
||||||
|
this.fenceState = fenceState;
|
||||||
|
}
|
||||||
|
@NotBlank(message = "围栏经纬度不能为空")
|
||||||
|
@Size(min = 0,max = 300,message = "围栏经纬度不能超过300个字符")
|
||||||
|
public String getFenceMessage() {
|
||||||
|
return fenceMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFenceMessage(String fenceMessage) {
|
||||||
|
this.fenceMessage = fenceMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @JsonIgnore // 忽略基类中的 params 字段
|
||||||
|
// private Map<String, Object> params;
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public String toString() {
|
||||||
|
// return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
// .append("fenceId", getFenceId())
|
||||||
|
// .append("fenceName", getFenceName())
|
||||||
|
// .append("fenceTypeId", getFenceTypeId())
|
||||||
|
// .append("fenceState", getFenceState())
|
||||||
|
// .append("fenceMessage", getFenceMessage())
|
||||||
|
// .append("createBy", getCreateBy())
|
||||||
|
// .append("createTime", getCreateTime())
|
||||||
|
// .append("updateBy", getUpdateBy())
|
||||||
|
// .append("updateTime", getUpdateTime())
|
||||||
|
// .append("remark", getRemark())
|
||||||
|
// .append("params", getParams())
|
||||||
|
// .toString();
|
||||||
|
// }
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.zhilian.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.zhilian.common.core.annotation.Excel;
|
||||||
|
import com.zhilian.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("fence_type")
|
||||||
|
public class FenceType extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 围栏类型编号
|
||||||
|
*/
|
||||||
|
@Excel(name = "参数主键", cellType = Excel.ColumnType.NUMERIC)
|
||||||
|
@TableId(value = "fence_type_id", type = IdType.AUTO)
|
||||||
|
private Long fenceTypeId;
|
||||||
|
/**
|
||||||
|
* 围栏类型名称:驶入驶出
|
||||||
|
*/
|
||||||
|
private String fenceTypeName;
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.zhilian.domain.request;
|
||||||
|
|
||||||
|
import com.zhilian.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class FenceRequest extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
/**
|
||||||
|
* 电子围栏名称
|
||||||
|
*/
|
||||||
|
private String fenceName;
|
||||||
|
/**
|
||||||
|
* 电子围栏类型编号
|
||||||
|
*/
|
||||||
|
private Long fenceTypeId;
|
||||||
|
/**
|
||||||
|
* 电子围栏状态
|
||||||
|
*/
|
||||||
|
private Long fenceState;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString () {
|
||||||
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("fenceName", getFenceName())
|
||||||
|
.append("fenceTypeId", getFenceTypeId())
|
||||||
|
.append("fenceState", getFenceState())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.append("remark", getRemark())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.zhilian.domain.response;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.zhilian.common.core.annotation.Excel;
|
||||||
|
import com.zhilian.domain.Fence;
|
||||||
|
import com.zhilian.domain.FenceType;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class FenceResponse {
|
||||||
|
/**
|
||||||
|
* 电子围栏表
|
||||||
|
*/
|
||||||
|
private Fence fence;
|
||||||
|
/**
|
||||||
|
* 电子围栏类型
|
||||||
|
*/
|
||||||
|
private FenceType fenceType;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.zhilian.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.zhilian.domain.Fence;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface FenceMapper extends BaseMapper<Fence> {
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.zhilian.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.zhilian.domain.FenceType;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface FenceTypeMapper extends BaseMapper<FenceType> {
|
||||||
|
List<FenceType> selectFenceTypeList();
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.zhilian.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.zhilian.domain.Fence;
|
||||||
|
import com.zhilian.domain.request.FenceRequest;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface FenceService extends IService<Fence> {
|
||||||
|
/**
|
||||||
|
* 围栏查询-list
|
||||||
|
* @param fenceRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Fence> pageQuery(FenceRequest fenceRequest);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.zhilian.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.zhilian.domain.FenceType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface FenceTypeService extends IService<FenceType>{
|
||||||
|
List<FenceType> selectFenceTypeList();
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.zhilian.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.zhilian.common.core.utils.StringUtils;
|
||||||
|
import com.zhilian.domain.Fence;
|
||||||
|
import com.zhilian.domain.request.FenceRequest;
|
||||||
|
import com.zhilian.mapper.FenceMapper;
|
||||||
|
import com.zhilian.service.FenceService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class FenceServiceImpl extends ServiceImpl<FenceMapper, Fence> implements FenceService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Fence> pageQuery(FenceRequest fenceRequest) {
|
||||||
|
LambdaQueryWrapper<Fence> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StringUtils.isNotEmpty(fenceRequest.getFenceName())){
|
||||||
|
queryWrapper.like(Fence::getFenceName, fenceRequest.getFenceName());
|
||||||
|
}
|
||||||
|
if (fenceRequest.getFenceTypeId()!= null){
|
||||||
|
queryWrapper.like(Fence::getFenceTypeId, fenceRequest.getFenceTypeId());
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.zhilian.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.zhilian.common.redis.service.RedisService;
|
||||||
|
import com.zhilian.domain.Fence;
|
||||||
|
import com.zhilian.domain.FenceType;
|
||||||
|
import com.zhilian.mapper.FenceTypeMapper;
|
||||||
|
import com.zhilian.service.FenceService;
|
||||||
|
import com.zhilian.service.FenceTypeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class FenceTypeServiceImpl extends ServiceImpl<FenceTypeMapper, FenceType> implements FenceTypeService {
|
||||||
|
@Autowired
|
||||||
|
private FenceTypeMapper fenceTypeMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisService redisService;
|
||||||
|
@Override
|
||||||
|
public List<FenceType> selectFenceTypeList() {
|
||||||
|
if(redisService.hasKey("fenceType")){
|
||||||
|
List<FenceType> fenceTypeShow = redisService.getCacheList("fenceType");
|
||||||
|
return fenceTypeShow;
|
||||||
|
}
|
||||||
|
List<FenceType> fenceTypes = fenceTypeMapper.selectFenceTypeList();
|
||||||
|
redisService.setCacheList("fenceType",fenceTypes);
|
||||||
|
return fenceTypes;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
Spring Boot Version: ${spring-boot.version}
|
||||||
|
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,74 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="logs/zhilian-system"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.zhilian" level="info"/>
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn"/>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="console"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info"/>
|
||||||
|
<appender-ref ref="file_error"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,61 @@
|
||||||
|
<?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.zhilian.mapper.FenceMapper">
|
||||||
|
<resultMap type="com.zhilian.domain.Fence" id="FenceResult">
|
||||||
|
<id property="fenceId" column="fence_id"/>
|
||||||
|
<result property="fenceName" column="fence_name"/>
|
||||||
|
<result property="fenceTypeId" column="fence_type_id"/>
|
||||||
|
<result property="fenceState" column="fence_state"/>
|
||||||
|
<result property="fenceMessage" column="fence_message"/>
|
||||||
|
<result property="createBy" column="create_user_id"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_user_id"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
<result property="remark" column="remark"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectFenceVo">
|
||||||
|
select fence_id,
|
||||||
|
fence_name,
|
||||||
|
fence_type_id,
|
||||||
|
fence_state,
|
||||||
|
fence_message,
|
||||||
|
create_user_id,
|
||||||
|
create_time,
|
||||||
|
update_user_id,
|
||||||
|
update_time,
|
||||||
|
remark
|
||||||
|
from vehicle_fence
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 查询条件 -->
|
||||||
|
<sql id="sqlwhereSearch">
|
||||||
|
<where>
|
||||||
|
<if test="fenceId !=null">
|
||||||
|
and fence_id = #{fenceId}
|
||||||
|
</if>
|
||||||
|
<if test="fenceName !=null and fenceName != ''">
|
||||||
|
and fence_name = #{fenceName}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectFence" parameterType="com.zhilian.domain.Fence" resultMap="FenceResult">
|
||||||
|
<include refid="selectFenceVo"/>
|
||||||
|
<include refid="sqlwhereSearch"/>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectFenceByCondition" parameterType="com.zhilian.domain.Fence" resultMap="FenceResult">
|
||||||
|
<include refid="selectFenceVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="fenceName != null and fenceName != ''">
|
||||||
|
AND fence_name like concat('%', #{fenceName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="fenceTypeId != null">
|
||||||
|
AND fenceTypeId = #{fenceTypeId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?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.zhilian.mapper.FenceTypeMapper">
|
||||||
|
<resultMap type="com.zhilian.domain.FenceType" id="FenceTypeResult">
|
||||||
|
<id property="fenceTypeId" column="fence_type_id"/>
|
||||||
|
<result property="fenceTypeName" column="fence_type_name"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="fenceTypeSelect">
|
||||||
|
select t.fence_type_id,
|
||||||
|
t.fence_type_name
|
||||||
|
from fence_type t
|
||||||
|
</sql>
|
||||||
|
<select id="selectFenceTypeList" resultType="com.zhilian.domain.FenceType">
|
||||||
|
<include refid="fenceTypeSelect"/>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -123,4 +123,6 @@ public class SysConfig extends BaseEntity {
|
||||||
.append("remark", getRemark())
|
.append("remark", getRemark())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue