diff --git a/muyu-modules/muyu-customer-business/muyu-customer-business-common/src/main/java/com/muyu/customer/business/domain/Fence.java b/muyu-modules/muyu-customer-business/muyu-customer-business-common/src/main/java/com/muyu/customer/business/domain/Fence.java new file mode 100644 index 0000000..40ae606 --- /dev/null +++ b/muyu-modules/muyu-customer-business/muyu-customer-business-common/src/main/java/com/muyu/customer/business/domain/Fence.java @@ -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(); + } + +} diff --git a/muyu-modules/muyu-customer-business/muyu-customer-business-common/src/main/java/com/muyu/customer/business/domain/req/FenceEditReq.java b/muyu-modules/muyu-customer-business/muyu-customer-business-common/src/main/java/com/muyu/customer/business/domain/req/FenceEditReq.java new file mode 100644 index 0000000..90a34f5 --- /dev/null +++ b/muyu-modules/muyu-customer-business/muyu-customer-business-common/src/main/java/com/muyu/customer/business/domain/req/FenceEditReq.java @@ -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; + +} diff --git a/muyu-modules/muyu-customer-business/muyu-customer-business-common/src/main/java/com/muyu/customer/business/domain/req/FenceQueryReq.java b/muyu-modules/muyu-customer-business/muyu-customer-business-common/src/main/java/com/muyu/customer/business/domain/req/FenceQueryReq.java new file mode 100644 index 0000000..f80157d --- /dev/null +++ b/muyu-modules/muyu-customer-business/muyu-customer-business-common/src/main/java/com/muyu/customer/business/domain/req/FenceQueryReq.java @@ -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; + +} diff --git a/muyu-modules/muyu-customer-business/muyu-customer-business-common/src/main/java/com/muyu/customer/business/domain/req/FenceSaveReq.java b/muyu-modules/muyu-customer-business/muyu-customer-business-common/src/main/java/com/muyu/customer/business/domain/req/FenceSaveReq.java new file mode 100644 index 0000000..9244ffe --- /dev/null +++ b/muyu-modules/muyu-customer-business/muyu-customer-business-common/src/main/java/com/muyu/customer/business/domain/req/FenceSaveReq.java @@ -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; + +} diff --git a/muyu-modules/muyu-customer-business/muyu-customer-business-server/src/main/java/com/muyu/customer/business/controller/FenceController.java b/muyu-modules/muyu-customer-business/muyu-customer-business-server/src/main/java/com/muyu/customer/business/controller/FenceController.java new file mode 100644 index 0000000..61fd27c --- /dev/null +++ b/muyu-modules/muyu-customer-business/muyu-customer-business-server/src/main/java/com/muyu/customer/business/controller/FenceController.java @@ -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> list(FenceQueryReq fenceQueryReq) { + startPage(); + List 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 list = fenceService.list(fence); + ExcelUtil util = new ExcelUtil(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 getInfo(@PathVariable("id") Long id) { + return Result.success(fenceService.getById(id)); + } + + /** + * 新增电子围栏 + */ + @RequiresPermissions("customerBusiness:fence:add") + @Log(title = "电子围栏", businessType = BusinessType.INSERT) + @PostMapping + @ApiOperation("新增电子围栏") + public Result 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 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 remove(@PathVariable List ids) { + return toAjax(fenceService.removeBatchByIds(ids)); + } +} diff --git a/muyu-modules/muyu-customer-business/muyu-customer-business-server/src/main/java/com/muyu/customer/business/mapper/FenceMapper.java b/muyu-modules/muyu-customer-business/muyu-customer-business-server/src/main/java/com/muyu/customer/business/mapper/FenceMapper.java new file mode 100644 index 0000000..3c9b260 --- /dev/null +++ b/muyu-modules/muyu-customer-business/muyu-customer-business-server/src/main/java/com/muyu/customer/business/mapper/FenceMapper.java @@ -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 { + +} diff --git a/muyu-modules/muyu-customer-business/muyu-customer-business-server/src/main/java/com/muyu/customer/business/service/FenceService.java b/muyu-modules/muyu-customer-business/muyu-customer-business-server/src/main/java/com/muyu/customer/business/service/FenceService.java new file mode 100644 index 0000000..5c7970d --- /dev/null +++ b/muyu-modules/muyu-customer-business/muyu-customer-business-server/src/main/java/com/muyu/customer/business/service/FenceService.java @@ -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 { + /** + * 查询电子围栏列表 + * + * @param fence 电子围栏 + * @return 电子围栏集合 + */ + public List list(Fence fence); + +} diff --git a/muyu-modules/muyu-customer-business/muyu-customer-business-server/src/main/java/com/muyu/customer/business/service/impl/FenceServiceImpl.java b/muyu-modules/muyu-customer-business/muyu-customer-business-server/src/main/java/com/muyu/customer/business/service/impl/FenceServiceImpl.java new file mode 100644 index 0000000..bd60d0c --- /dev/null +++ b/muyu-modules/muyu-customer-business/muyu-customer-business-server/src/main/java/com/muyu/customer/business/service/impl/FenceServiceImpl.java @@ -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 implements FenceService { + + /** + * 查询电子围栏列表 + * + * @param fence 电子围栏 + * @return 电子围栏 + */ + @Override + public List list(Fence fence) { + LambdaQueryWrapper 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); + } +} diff --git a/muyu-modules/muyu-customer-business/muyu-customer-business-server/src/main/resources/mapper/customerBusiness/FenceMapper.xml b/muyu-modules/muyu-customer-business/muyu-customer-business-server/src/main/resources/mapper/customerBusiness/FenceMapper.xml new file mode 100644 index 0000000..7df3b30 --- /dev/null +++ b/muyu-modules/muyu-customer-business/muyu-customer-business-server/src/main/resources/mapper/customerBusiness/FenceMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + select id, name, fence_type, longitude_and_latitude, create_by, create_time, update_by, update_time, remark from fence + +