feat(): 新增电子围栏增删改查
parent
c534086e82
commit
b828dc2f61
|
@ -0,0 +1,89 @@
|
||||||
|
package com.muyu.customer.business.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.customer.business.domain.req.FenceQueryReq;
|
||||||
|
import com.muyu.customer.business.domain.req.FenceSaveReq;
|
||||||
|
import com.muyu.customer.business.domain.req.FenceEditReq;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏对象 fence
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("fence")
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel(value = "Fence", description = "电子围栏")
|
||||||
|
public class Fence extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** id */
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
@ApiModelProperty(name = "id", value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 电子围栏名称 */
|
||||||
|
@Excel(name = "电子围栏名称")
|
||||||
|
@ApiModelProperty(name = "电子围栏名称", value = "电子围栏名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 围栏类型 */
|
||||||
|
@Excel(name = "围栏类型")
|
||||||
|
@ApiModelProperty(name = "围栏类型", value = "围栏类型")
|
||||||
|
private String fenceType;
|
||||||
|
|
||||||
|
/** 经纬度信息 */
|
||||||
|
@Excel(name = "经纬度信息")
|
||||||
|
@ApiModelProperty(name = "经纬度信息", value = "经纬度信息")
|
||||||
|
private String longitudeAndLatitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询构造器
|
||||||
|
*/
|
||||||
|
public static Fence queryBuild( FenceQueryReq fenceQueryReq){
|
||||||
|
return Fence.builder()
|
||||||
|
.name(fenceQueryReq.getName())
|
||||||
|
.fenceType(fenceQueryReq.getFenceType())
|
||||||
|
.longitudeAndLatitude(fenceQueryReq.getLongitudeAndLatitude())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加构造器
|
||||||
|
*/
|
||||||
|
public static Fence saveBuild(FenceSaveReq fenceSaveReq){
|
||||||
|
return Fence.builder()
|
||||||
|
.name(fenceSaveReq.getName())
|
||||||
|
.fenceType(fenceSaveReq.getFenceType())
|
||||||
|
.longitudeAndLatitude(fenceSaveReq.getLongitudeAndLatitude())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改构造器
|
||||||
|
*/
|
||||||
|
public static Fence editBuild(Long id, FenceEditReq fenceEditReq){
|
||||||
|
return Fence.builder()
|
||||||
|
.id(id)
|
||||||
|
.name(fenceEditReq.getName())
|
||||||
|
.fenceType(fenceEditReq.getFenceType())
|
||||||
|
.longitudeAndLatitude(fenceEditReq.getLongitudeAndLatitude())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏对象 fence
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "FenceEditReq", description = "电子围栏")
|
||||||
|
public class FenceEditReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 电子围栏名称 */
|
||||||
|
@ApiModelProperty(name = "电子围栏名称", value = "电子围栏名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 围栏类型 */
|
||||||
|
@ApiModelProperty(name = "围栏类型", value = "围栏类型")
|
||||||
|
private String fenceType;
|
||||||
|
|
||||||
|
/** 经纬度信息 */
|
||||||
|
@ApiModelProperty(name = "经纬度信息", value = "经纬度信息")
|
||||||
|
private String longitudeAndLatitude;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏对象 fence
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "FenceQueryReq", description = "电子围栏")
|
||||||
|
public class FenceQueryReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 电子围栏名称 */
|
||||||
|
@ApiModelProperty(name = "电子围栏名称", value = "电子围栏名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 围栏类型 */
|
||||||
|
@ApiModelProperty(name = "围栏类型", value = "围栏类型")
|
||||||
|
private String fenceType;
|
||||||
|
|
||||||
|
/** 经纬度信息 */
|
||||||
|
@ApiModelProperty(name = "经纬度信息", value = "经纬度信息")
|
||||||
|
private String longitudeAndLatitude;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏对象 fence
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "FenceSaveReq", description = "电子围栏")
|
||||||
|
public class FenceSaveReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** id */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "id", value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 电子围栏名称 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "电子围栏名称", value = "电子围栏名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 围栏类型 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "围栏类型", value = "围栏类型")
|
||||||
|
private String fenceType;
|
||||||
|
|
||||||
|
/** 经纬度信息 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "经纬度信息", value = "经纬度信息")
|
||||||
|
private String longitudeAndLatitude;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,111 @@
|
||||||
|
package com.muyu.customer.business.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.muyu.customer.business.domain.Fence;
|
||||||
|
import com.muyu.customer.business.domain.req.FenceQueryReq;
|
||||||
|
import com.muyu.customer.business.domain.req.FenceSaveReq;
|
||||||
|
import com.muyu.customer.business.domain.req.FenceEditReq;
|
||||||
|
import com.muyu.customer.business.service.FenceService;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-31
|
||||||
|
*/
|
||||||
|
@Api(tags = "电子围栏")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/fence")
|
||||||
|
public class FenceController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private FenceService fenceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询电子围栏列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取电子围栏列表")
|
||||||
|
@RequiresPermissions("customerBusiness:fence:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<Fence>> list(FenceQueryReq fenceQueryReq) {
|
||||||
|
startPage();
|
||||||
|
List<Fence> list = fenceService.list(Fence.queryBuild(fenceQueryReq));
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出电子围栏列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("导出电子围栏列表")
|
||||||
|
@RequiresPermissions("customerBusiness:fence:export")
|
||||||
|
@Log(title = "电子围栏", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, Fence fence) {
|
||||||
|
List<Fence> list = fenceService.list(fence);
|
||||||
|
ExcelUtil<Fence> util = new ExcelUtil<Fence>(Fence.class);
|
||||||
|
util.exportExcel(response, list, "电子围栏数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取电子围栏详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取电子围栏详细信息")
|
||||||
|
@RequiresPermissions("customerBusiness:fence:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||||
|
public Result<Fence> getInfo(@PathVariable("id") Long id) {
|
||||||
|
return Result.success(fenceService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增电子围栏
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:fence:add")
|
||||||
|
@Log(title = "电子围栏", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
@ApiOperation("新增电子围栏")
|
||||||
|
public Result<String> add(@RequestBody FenceSaveReq fenceSaveReq) {
|
||||||
|
return toAjax(fenceService.save(Fence.saveBuild(fenceSaveReq)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改电子围栏
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:fence:edit")
|
||||||
|
@Log(title = "电子围栏", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
@ApiOperation("修改电子围栏")
|
||||||
|
public Result<String> edit(@PathVariable Long id, @RequestBody FenceEditReq fenceEditReq) {
|
||||||
|
return toAjax(fenceService.updateById(Fence.editBuild(id,fenceEditReq)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除电子围栏
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:fence:remove")
|
||||||
|
@Log(title = "电子围栏", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
@ApiOperation("删除电子围栏")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||||
|
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||||
|
return toAjax(fenceService.removeBatchByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.muyu.customer.business.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.customer.business.domain.Fence;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-31
|
||||||
|
*/
|
||||||
|
public interface FenceMapper extends BaseMapper<Fence> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.muyu.customer.business.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.customer.business.domain.Fence;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏Service接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-31
|
||||||
|
*/
|
||||||
|
public interface FenceService extends IService<Fence> {
|
||||||
|
/**
|
||||||
|
* 查询电子围栏列表
|
||||||
|
*
|
||||||
|
* @param fence 电子围栏
|
||||||
|
* @return 电子围栏集合
|
||||||
|
*/
|
||||||
|
public List<Fence> list(Fence fence);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.muyu.customer.business.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.common.core.utils.ObjUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.muyu.customer.business.mapper.FenceMapper;
|
||||||
|
import com.muyu.customer.business.domain.Fence;
|
||||||
|
import com.muyu.customer.business.service.FenceService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏Service业务层处理
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-31
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class FenceServiceImpl extends ServiceImpl<FenceMapper, Fence> implements FenceService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询电子围栏列表
|
||||||
|
*
|
||||||
|
* @param fence 电子围栏
|
||||||
|
* @return 电子围栏
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Fence> list(Fence fence) {
|
||||||
|
LambdaQueryWrapper<Fence> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
|
|
||||||
|
if (ObjUtils.notNull(fence.getName())){
|
||||||
|
queryWrapper.like(Fence::getName, fence.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ObjUtils.notNull(fence.getFenceType())){
|
||||||
|
queryWrapper.eq(Fence::getFenceType, fence.getFenceType());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ObjUtils.notNull(fence.getLongitudeAndLatitude())){
|
||||||
|
queryWrapper.eq(Fence::getLongitudeAndLatitude, fence.getLongitudeAndLatitude());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return list(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?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.muyu.customer.business.mapper.FenceMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.muyu.customer.business.domain.Fence" id="FenceResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="name" column="name" />
|
||||||
|
<result property="fenceType" column="fence_type" />
|
||||||
|
<result property="longitudeAndLatitude" column="longitude_and_latitude" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectFenceVo">
|
||||||
|
select id, name, fence_type, longitude_and_latitude, create_by, create_time, update_by, update_time, remark from fence
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue