server_2024_3_26_suzejing #6
|
@ -0,0 +1,17 @@
|
|||
package com.zhilian.business;
|
||||
|
||||
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.business.controller;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zhilian.common.core.domain.Result;
|
||||
import com.zhilian.common.core.web.controller.BaseController;
|
||||
import com.zhilian.business.domain.Fence;
|
||||
import com.zhilian.business.domain.FenceVo;
|
||||
import com.zhilian.business.service.FenceService;
|
||||
import com.zhilian.common.security.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @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: 围栏管理
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public Result<PageInfo<Fence>> fenceList(@RequestBody FenceVo fenceVo) {
|
||||
return success(fenceService.fenceList(fenceVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增围栏
|
||||
* @param fence
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/fenceAdd")
|
||||
public Result fenceAdd(@RequestBody Fence fence) {
|
||||
boolean i = fenceService.save(fence);
|
||||
return toAjax(i);
|
||||
}
|
||||
|
||||
// @PostMapping("insertFence")
|
||||
// public Result insertFence(@RequestBody Fence fence) {
|
||||
// Result result = fenceService.insertFence(fence);
|
||||
// return Result.success();
|
||||
// }
|
||||
|
||||
/**
|
||||
* 修改电子围栏
|
||||
*/
|
||||
// @RequiresPermissions("system:config:fenceAdd")
|
||||
@PostMapping("/fenceUpdate")
|
||||
public Result fenceUpdate(@RequestBody Fence fence) {
|
||||
boolean i = fenceService.updateById(fence);
|
||||
return toAjax(i);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除围栏
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/fenceDelete/{fenceId}")
|
||||
public Result fenceDelete(@PathVariable String fenceId) {
|
||||
boolean i = fenceService.removeById(fenceId);
|
||||
return toAjax(i);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.zhilian.business.domain;
|
||||
|
||||
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 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("business_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 = "电子围栏名称")
|
||||
@TableField("fence_name")
|
||||
private String fenceName;
|
||||
/**
|
||||
* 电子围栏类型编号
|
||||
*/
|
||||
@Excel(name = "电子围栏类型编号")
|
||||
@TableField("fence_type_id")
|
||||
private Long fenceTypeId;
|
||||
/**
|
||||
* 电子围栏状态
|
||||
*/
|
||||
@Excel(name = "电子围栏状态")
|
||||
@TableField("fence_state")
|
||||
private Long fenceState;
|
||||
/**
|
||||
* 电子围栏经纬度信息
|
||||
*/
|
||||
@Excel(name = "电子围栏经纬度信息")
|
||||
@TableField("fence_message")
|
||||
private String fenceMessage;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.zhilian.business.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @ClassName FenceResp //类名称
|
||||
* @Author: yannan //作者
|
||||
* @CreateDate: 2024/3/26 20:03 //创建时间
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class FenceVo {
|
||||
|
||||
|
||||
/**
|
||||
* 围栏名称
|
||||
*/
|
||||
private String fenceName;
|
||||
|
||||
/**
|
||||
* 围栏类型
|
||||
*/
|
||||
private Long fenceTypeId;
|
||||
|
||||
/**
|
||||
* 围栏状态
|
||||
*/
|
||||
private Long fenceState;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
private Integer pageNum=1;
|
||||
private Integer pageSize=5;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.zhilian.business.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;
|
||||
|
||||
@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;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.zhilian.business.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zhilian.business.domain.Fence;
|
||||
import com.zhilian.business.domain.FenceVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@Component
|
||||
public interface FenceMapper extends BaseMapper<Fence> {
|
||||
List<Fence> fenceList(FenceVo fenceVo);
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.zhilian.business.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zhilian.business.domain.Fence;
|
||||
import com.zhilian.business.domain.FenceVo;
|
||||
import com.zhilian.common.core.domain.Result;
|
||||
|
||||
public interface FenceService extends IService<Fence> {
|
||||
PageInfo<Fence> fenceList(FenceVo fenceVo);
|
||||
|
||||
|
||||
// Result insertFence(Fence fence);
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.zhilian.business.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zhilian.business.domain.Fence;
|
||||
import com.zhilian.business.domain.FenceVo;
|
||||
import com.zhilian.business.mapper.FenceMapper;
|
||||
import com.zhilian.business.service.FenceService;
|
||||
import com.zhilian.common.core.domain.Result;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class FenceServiceImpl extends ServiceImpl<FenceMapper, Fence> implements FenceService {
|
||||
@Autowired
|
||||
private FenceMapper fenceMapper;
|
||||
@Override
|
||||
public PageInfo<Fence> fenceList(FenceVo fenceVo) {
|
||||
|
||||
PageHelper.startPage(fenceVo.getPageNum(),fenceVo.getPageSize());
|
||||
|
||||
List<Fence> list=fenceMapper.fenceList(fenceVo);
|
||||
|
||||
PageInfo info = new PageInfo(list);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Result insertFence(Fence fence) {
|
||||
// boolean save = this.save(fence);
|
||||
// return Result.success(save);
|
||||
// }
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
<?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.business.mapper.FenceMapper">
|
||||
<!-- <resultMap type="com.zhilian.business.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_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>-->
|
||||
<select id="fenceList" resultType="com.zhilian.business.domain.Fence">
|
||||
select * from business_fence
|
||||
<where>
|
||||
<if test="fenceName!=null and fenceName!=''">
|
||||
and fence_name like concat('%',#{fenceName},'%')
|
||||
</if>
|
||||
|
||||
<if test="fenceTypeId!=null">
|
||||
and fence_type_id=#{fenceTypeId}
|
||||
</if>
|
||||
|
||||
<if test="fenceState!=null">
|
||||
and fence_state=#{fenceState}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<!-- <sql id="selectFenceVo">-->
|
||||
<!-- select fence_id,-->
|
||||
<!-- fence_name,-->
|
||||
<!-- fence_type_id,-->
|
||||
<!-- fence_state,-->
|
||||
<!-- fence_message,-->
|
||||
<!-- create_by,-->
|
||||
<!-- create_time,-->
|
||||
<!-- update_by,-->
|
||||
<!-- update_time,-->
|
||||
<!-- remark-->
|
||||
<!-- from business_fence-->
|
||||
<!-- </sql>-->
|
||||
|
||||
<!-- <select id="fenceList" parameterType="com.zhilian.business.domain.Fence">-->
|
||||
<!-- <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,2 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
|
@ -123,4 +123,6 @@ public class SysConfig extends BaseEntity {
|
|||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue