master
xiaohuang 2024-06-03 21:13:07 +08:00
parent b4076353ae
commit 1b9827bd0c
22 changed files with 976 additions and 143 deletions

View File

@ -6,7 +6,7 @@ import com.muyu.common.core.constant.ServiceNameConstants;
import com.muyu.common.core.domain.Result;
import com.muyu.common.system.domain.LoginUser;
import com.muyu.common.system.domain.SysUser;
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
import lombok.extern.java.Log;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.*;
*
* @author zhiLian
*/
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = com.zhiLian.common.system.remote.factory.RemoteUserFallbackFactory.class)
public interface RemoteUserService {
/**
*

View File

@ -1,4 +1,5 @@
package com.muyu.common.system.remote.factory;
package com.zhiLian.common.system.remote.factory;
import com.muyu.common.core.domain.Result;
import com.muyu.common.system.domain.LoginUser;
@ -31,13 +32,26 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
public Result<Boolean> registerUserInfo (SysUser sysUser, String source) {
return Result.error("注册用户失败:" + throwable.getMessage());
}
//好像写有 添加用户 远程调用是这个不知道启动一下吧应该没问题OK 你先学 我自己再看看
@Override
public Result add(SysUser user) {
return Result.error("注册用户失败:" + throwable.getMessage());
}
@Override
public Result<LoginUser> info(String username) {
return Result.error("注册用户失败:" + throwable.getMessage());
}
@Override
public Result authRole(Long userId) {
return Result.error("注册用户失败:" + throwable.getMessage());
}
@Override
public SysUser selectByUserId(Long userId) {
return null;
}
};
}
}

View File

@ -1,3 +1,7 @@
com.muyu.common.system.remote.factory.RemoteUserFallbackFactory
com.muyu.common.system.remote.factory.RemoteLogFallbackFactory
com.muyu.common.system.remote.factory.RemoteFileFallbackFactory
org.springframework.boot.autoconfigure.EnableAutoConfiguration=
cn.muyu.common.system.remote.factory.RemoteUserFallbackFactory.SecretAutoConfiguration,
cn.muyu.common.system.remote.factory.RemoteUserFallbackFactory.secret.modules.cors.WebMvcConfiguration

View File

@ -29,6 +29,7 @@ public class GaoDe {
s.append("key=").append(key).append("&location=").append(log).append(",").append(lat);
return null;
}
}

View File

@ -9,6 +9,7 @@ import com.muyu.common.system.domain.SysUser;
import com.muyu.common.system.remote.RemoteUserService;
import com.xiaohuang.business.domain.Business;
import com.xiaohuang.business.mapper.BusinessMapper;
import com.xiaohuang.business.remote.factory.RemoteUserLoginFactory;
import com.xiaohuang.business.service.IBusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
@ -52,9 +53,10 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business> i
@Override
public Business selectBusinessById(Long id)
{
return businessMapper.selectBusinessById(id);
return businessMapper.selectBusinessById(id);
}
/**
*
*
@ -74,13 +76,19 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business> i
return businessMapper.selectBusinessList(business);
}
//新增企业
/**
*
*
* @param business
* @return
*/
@Autowired
private RemoteUserLoginFactory remoteUserLoginFactory;
@Override
public int insertBusiness(Business business)
{
business.setCreateTime(DateUtils.getNowDate());
int i = this.baseMapper.insertBusiness(business);
int i = businessMapper.insertBusiness(business);
System.out.println(business);
SysUser sysUser = SysUser.builder()
.userName(business.getName() + business.getId())
@ -88,76 +96,56 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business> i
.nickName(business.getName())
.email(business.getBusinessEmail())
.phonenumber(business.getBusinessPhone())
.loginIp("175.24.138.82")
.loginIp("111.229.102.61")
.userType(String.valueOf(business.getId()))
.build();
Result add = remoteUserService.add(sysUser);
return i;
}
public void httpConnectMysql(Business business){
if (business.getBusinessStates().equals(2)){
if (business.getBusinessStates().equals(2) ) {
if (!redisTemplate.hasKey(business.getId()+business.getName())){
redisTemplate.opsForValue().set(business.getId()+business.getName(), String.valueOf(3306+business.getId()));
redisTemplate.opsForValue().set(business.getId()+business.getName(),String.valueOf(3306+business.getId()));
extracted(business);
}
}
}
private static void extracted(Business business){
//建木
String postUrl = "http://175.24.138.82:10006/webhook/%E6%9C%AA%E5%91%BD%E5%90%8D%E9%A1%B9%E7%9B%AE";
private static void extracted(Business business) {
String postUrl="http://122.51.111.225:10006/webhook/%E6%96%B0%E5%BB%BA%E4%BC%81%E4%B8%9A%E6%95%B0%E6%8D%AE%E6%BA%90";
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("businessId",business.getId()+business.getName());
hashMap.put("businessId", business.getId()+ business.getName());
hashMap.put("mysqlPort",String.valueOf(3306+ business.getId()));
String json = JSON.toJSONString(hashMap);
//创建链接与设置连接参数
// 3.创建连接与设置连接参数
URL urlObj = null;
try {
urlObj = new URL(postUrl);
urlObj = new URL(postUrl);
HttpURLConnection httpConn = (HttpURLConnection) urlObj.openConnection();
httpConn.setRequestMethod("POST");
httpConn.setRequestProperty("Charset","UTF-8");
//post请求且JSON数据,必须要设置
httpConn.setRequestProperty("Content-Type","application/json");
//打开输出流.默认是false
httpConn.setDoOutput(false);
//打开输入流.默认是true,
httpConn.setRequestProperty("Charset", "UTF-8");
// POST请求且JSON数据,必须设置
httpConn.setRequestProperty("Content-Type", "application/json");
// 打开输出流,默认是false
httpConn.setDoOutput(true);
//获取输出流和写数据
// 打开输入流,默认是true,可省略
httpConn.setDoInput(true);
// 4.从HttpURLConnection获取输出流和写数据
OutputStream oStream = httpConn.getOutputStream();
oStream.write(json.getBytes());
oStream.flush();
//调用
if (httpConn.getResponseCode()!=200){
throw new Exception("调用服务端异常");
// 5.发起http调用(getInputStream触发http请求)
if (httpConn.getResponseCode() != 200) {
throw new Exception("调用服务端异常.");
}
//获取输入流和读取数据
// 6.从HttpURLConnection获取输入流和读数据
BufferedReader br = new BufferedReader(
new InputStreamReader(httpConn.getInputStream())
);
new InputStreamReader(httpConn.getInputStream()));
String resultData = br.readLine();
System.out.println("服务端返回结果: "+ resultData);
//关闭链接
System.out.println("从服务端返回结果: " + resultData);
// 7.关闭HttpURLConnection连接
httpConn.disconnect();
//打开输出流.
} catch (Exception e) {
throw new RuntimeException(e);
}

View File

@ -48,7 +48,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectBusinessVo"/>
where id = #{id}
</select>
<select id="info" resultType="com.muyu.common.system.domain.LoginUser">
select * from sys_user where id=#{userId}
</select>

View File

@ -0,0 +1,100 @@
package com.xiaohuang.vehicle.controller;
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.core.web.page.TableDataInfo;
import com.muyu.common.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType;
import com.xiaohuang.vehicle.domain.Fence;
import com.xiaohuang.vehicle.service.IFenceService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* Controller
*
* @author muyu
* @date 2024-05-31
*/
@RestController
@RequestMapping("/fence")
@Log4j2
public class FenceController extends BaseController {
@Autowired
private IFenceService fenceService;
/**
*
*/
// @RequiresPermissions("system:fence:list")
@GetMapping("/list")
public Result<TableDataInfo<Fence>> list(Fence fence)
{
startPage();
List<Fence> list = fenceService.selectFenceList(fence);
log.info("list:{}",list);
return getDataTable(list);
}
/**
*
*/
// @RequiresPermissions("system:fence:export")
@Log(title = "围栏", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Fence fence)
{
List<Fence> list = fenceService.selectFenceList(fence);
ExcelUtil<Fence> util = new ExcelUtil<Fence>(Fence.class);
util.exportExcel(response, list, "围栏数据");
}
/**
*
*/
// @RequiresPermissions("system:fence:query")
@GetMapping(value = "/{id}")
public Result getInfo(@PathVariable("id") Long id)
{
return success(fenceService.selectFenceById(id));
}
/**
*
*/
// @RequiresPermissions("system:fence:add")
@Log(title = "围栏", businessType = BusinessType.INSERT)
@PostMapping
public Result add(@RequestBody Fence fence)
{
return toAjax(fenceService.insertFence(fence));
}
/**
*
*/
// @RequiresPermissions("system:fence:edit")
@Log(title = "围栏", businessType = BusinessType.UPDATE)
@PutMapping
public Result edit(@RequestBody Fence fence)
{
return toAjax(fenceService.updateFence(fence));
}
/**
*
*/
// @RequiresPermissions("system:fence:remove")
@Log(title = "围栏", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public Result remove(@PathVariable Long[] ids)
{
return toAjax(fenceService.deleteFenceByIds(ids));
}
}

View File

@ -0,0 +1,97 @@
package com.xiaohuang.vehicle.controller;
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.core.web.page.TableDataInfo;
import com.muyu.common.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType;
import com.xiaohuang.vehicle.domain.Group;
import com.xiaohuang.vehicle.service.IGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* Controller
*
* @author muyu
* @date 2024-06-02
*/
@RestController
@RequestMapping("/group")
public class GroupController extends BaseController
{
@Autowired
private IGroupService groupService;
/**
*
*/
// @RequiresPermissions("system:group:list")
@GetMapping("/list")
public Result<TableDataInfo<Group>> list(Group group)
{
startPage();
List<Group> list = groupService.selectGroupList(group);
return getDataTable(list);
}
/**
*
*/
// @RequiresPermissions("system:group:export")
@Log(title = "围栏组", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Group group)
{
List<Group> list = groupService.selectGroupList(group);
ExcelUtil<Group> util = new ExcelUtil<Group>(Group.class);
util.exportExcel(response, list, "围栏组数据");
}
/**
*
*/
// @RequiresPermissions("system:group:query")
@GetMapping(value = "/{id}")
public Result getInfo(@PathVariable("id") Long id)
{
return success(groupService.selectGroupById(id));
}
/**
*
*/
// @RequiresPermissions("system:group:add")
@Log(title = "围栏组", businessType = BusinessType.INSERT)
@PostMapping
public Result add(@RequestBody Group group)
{
return toAjax(groupService.insertGroup(group));
}
/**
*
*/
// @RequiresPermissions("system:group:edit")
@Log(title = "围栏组", businessType = BusinessType.UPDATE)
@PutMapping
public Result edit(@RequestBody Group group)
{
return toAjax(groupService.updateGroup(group));
}
/**
*
*/
// @RequiresPermissions("system:group:remove")
@Log(title = "围栏组", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public Result remove(@PathVariable Long[] ids)
{
return toAjax(groupService.deleteGroupByIds(ids));
}
}

View File

@ -13,83 +13,59 @@ import lombok.experimental.SuperBuilder;
import java.util.List;
/**
* Fence
*
* @author xiaohuang
* on 2024/6/2
*/
/**
* fence
*
* @author muyu
* @date 2024-05-31
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("fence")
public class Fence extends BaseEntity {
public class Fence extends BaseEntity
{
private static final long serialVersionUID = 1L;
/**
*
*/
/** 围栏主键 */
private Long id;
/**
*
*/
/** 围栏名称 */
@Excel(name = "围栏名称")
private String name;
@Excel(name = "围栏组Id")
@Excel(name = "围栏组ID")
private Long groupId;
/**
*
*/
/** 围栏经纬集合 */
@TableField(exist = false)
private List<Path> path;
/**
*
*/
/** 围栏经纬 */
@Excel(name = "围栏经纬")
private String fenceLongitudeLatitude;
/**
*
*/
/** 围栏备注 */
@Excel(name = "围栏备注")
private String fenceDescription;
/**
*
*/
/** 半径 */
@Excel(name = "半径")
private Double redius;
private Double radius;
/**
* ,
*/
@Excel(name = "驶入,驶出")
/** 驶入,驶出 */
@Excel(name = "驶入,驶出")
private String eventType;
/**
*
*/
@Excel(name = "是否删除 0否 1是")
/** 是否删除 0 不删除 1删除 */
@Excel(name = "是否删除 0 不删除 1删除")
private String isDelete;
/**
*
*/
/** 围栏状态 */
@Excel(name = "围栏状态")
private String fenceState;
}

View File

@ -1,6 +1,8 @@
package com.xiaohuang.vehicle.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
@ -9,36 +11,36 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* Group
*
* @author xiaohuang
* on 2024/6/2
*/
import java.util.Date;
/**
* group
*
* @author muyu
* @date 2024-06-02
*/
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("group")
public class Group extends BaseEntity {
public class Group extends BaseEntity
{
private static final long serialVersionUID = 1L;
/**
* id
*/
/** 围栏组ID */
private Long id;
/**
*
*/
/** 围栏组名称 */
@Excel(name = "围栏组名称")
private String groupName;
/** 修改时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "修改时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updateTime;
/**
*
*/
}

View File

@ -1,11 +1,9 @@
package com.xiaohuang.vehicle.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -29,7 +27,6 @@ public class Vehicle extends BaseEntity
private static final long serialVersionUID = 1L;
/** 车辆主键 */
@TableId(type = IdType.AUTO)
private Long id;
/** 车辆vin */

View File

@ -1,27 +1,25 @@
package com.xiaohuang.vehicle.domain.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* Path
* BingRui.Hou
*
* @author xiaohuang
* on 2024/6/2
* @Description
* @ClassName Path
* @Date 2024/06/02 10:48
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Path {
private String Q;
private String R;
private String lng;
private String lat;
}

View File

@ -6,18 +6,17 @@ import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* VehicleReq
* vehicle
*
* @author xiaohuang
* on 2024/6/2
* @author muyu
* @date 2024-05-27
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class VehicleReq {
public class VehicleReq
{
/** 车辆主键 */

View File

@ -0,0 +1,66 @@
package com.xiaohuang.vehicle.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xiaohuang.vehicle.domain.Fence;
import java.util.List;
/**
* Mapper
*
* @author muyu
* @date 2024-05-31
*/
public interface FenceMapper extends BaseMapper<Fence>
{
/**
*
*
* @param id
* @return
*/
public Fence selectFenceById(Long id);
/**
*
*
* @param fence
* @return
*/
public List<Fence> selectFenceList(Fence fence);
/**
*
*
* @param fence
* @return
*/
public int insertFence(Fence fence);
/**
*
*
* @param fence
* @return
*/
public int updateFence(Fence fence);
/**
*
*
* @param id
* @return
*/
public int deleteFenceById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteFenceByIds(Long[] ids);
}

View File

@ -0,0 +1,66 @@
package com.xiaohuang.vehicle.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xiaohuang.vehicle.domain.Group;
import java.util.List;
/**
* Mapper
*
* @author muyu
* @date 2024-06-02
*/
public interface GroupMapper extends BaseMapper<Group>
{
/**
*
*
* @param id
* @return
*/
public Group selectGroupById(Long id);
/**
*
*
* @param group
* @return
*/
public List<Group> selectGroupList(Group group);
/**
*
*
* @param group
* @return
*/
public int insertGroup(Group group);
/**
*
*
* @param group
* @return
*/
public int updateGroup(Group group);
/**
*
*
* @param id
* @return
*/
public int deleteGroupById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteGroupByIds(Long[] ids);
}

View File

@ -0,0 +1,66 @@
package com.xiaohuang.vehicle.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xiaohuang.vehicle.domain.Fence;
import java.util.List;
/**
* Service
*
* @author muyu
* @date 2024-05-31
*/
public interface IFenceService extends IService<Fence>
{
/**
*
*
* @param id
* @return
*/
public Fence selectFenceById(Long id);
/**
*
*
* @param fence
* @return
*/
public List<Fence> selectFenceList(Fence fence);
/**
*
*
* @param fence
* @return
*/
public int insertFence(Fence fence);
/**
*
*
* @param fence
* @return
*/
public int updateFence(Fence fence);
/**
*
*
* @param ids
* @return
*/
public int deleteFenceByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteFenceById(Long id);
}

View File

@ -0,0 +1,64 @@
package com.xiaohuang.vehicle.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xiaohuang.vehicle.domain.Group;
import java.util.List;
/**
* Service
*
* @author muyu
* @date 2024-06-02
*/
public interface IGroupService extends IService<Group>
{
/**
*
*
* @param id
* @return
*/
public Group selectGroupById(Long id);
/**
*
*
* @param group
* @return
*/
public List<Group> selectGroupList(Group group);
/**
*
*
* @param group
* @return
*/
public int insertGroup(Group group);
/**
*
*
* @param group
* @return
*/
public int updateGroup(Group group);
/**
*
*
* @param ids
* @return
*/
public int deleteGroupByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteGroupById(Long id);
}

View File

@ -0,0 +1,103 @@
package com.xiaohuang.vehicle.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.utils.DateUtils;
import com.xiaohuang.vehicle.domain.Fence;
import com.xiaohuang.vehicle.mapper.FenceMapper;
import com.xiaohuang.vehicle.service.IFenceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author muyu
* @date 2024-05-31
*/
@Service
public class FenceServiceImpl extends ServiceImpl<FenceMapper, Fence> implements IFenceService
{
@Autowired
private FenceMapper fenceMapper;
/**
*
*
* @param id
* @return
*/
@Override
public Fence selectFenceById(Long id)
{
return fenceMapper.selectFenceById(id);
}
/**
*
*
* @param fence
* @return
*/
@Override
public List<Fence> selectFenceList(Fence fence)
{
return fenceMapper.selectFenceList(fence);
}
/**
*
*
* @param fence
* @return
*/
@Override
public int insertFence(Fence fence)
{
// String jsonString = JSON.toJSONString(fence.getPath());
String string = fence.getPath().toString();
fence.setFenceLongitudeLatitude(string);
fence.setCreateTime(DateUtils.getNowDate());
return fenceMapper.insertFence(fence);
}
/**
*
*
* @param fence
* @return
*/
@Override
public int updateFence(Fence fence)
{
fence.setUpdateTime(DateUtils.getNowDate());
return fenceMapper.updateFence(fence);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteFenceByIds(Long[] ids)
{
return fenceMapper.deleteFenceByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteFenceById(Long id)
{
return fenceMapper.deleteFenceById(id);
}
}

View File

@ -0,0 +1,99 @@
package com.xiaohuang.vehicle.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.utils.DateUtils;
import com.xiaohuang.vehicle.domain.Group;
import com.xiaohuang.vehicle.mapper.GroupMapper;
import com.xiaohuang.vehicle.service.IGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author muyu
* @date 2024-06-02
*/
@Service
public class GroupServiceImpl extends ServiceImpl<GroupMapper, Group> implements IGroupService
{
@Autowired
private GroupMapper groupMapper;
/**
*
*
* @param id
* @return
*/
@Override
public Group selectGroupById(Long id)
{
return groupMapper.selectGroupById(id);
}
/**
*
*
* @param group
* @return
*/
@Override
public List<Group> selectGroupList(Group group)
{
return groupMapper.selectGroupList(group);
}
/**
*
*
* @param group
* @return
*/
@Override
public int insertGroup(Group group)
{
group.setCreateTime(DateUtils.getNowDate());
return groupMapper.insertGroup(group);
}
/**
*
*
* @param group
* @return
*/
@Override
public int updateGroup(Group group)
{
return groupMapper.updateGroup(group);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteGroupByIds(Long[] ids)
{
return groupMapper.deleteGroupByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteGroupById(Long id)
{
return groupMapper.deleteGroupById(id);
}
}

View File

@ -0,0 +1,111 @@
<?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.xiaohuang.vehicle.mapper.FenceMapper">
<resultMap type="com.xiaohuang.vehicle.domain.Fence" id="FenceResult">
<result property="id" column="id" />
<result property="groupId" column="group_id" />
<result property="name" column="name" />
<result property="fenceLongitudeLatitude" column="fenceLongitudeLatitude" />
<result property="fenceDescription" column="fenceDescription" />
<result property="isDelete" column="isDelete" />
<result property="fenceState" column="fenceState" />
<result property="remark" column="remark" />
<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="radius" column="radius" />
<result property="eventType" column="event_type" />
</resultMap>
<sql id="selectFenceVo">
select id,group_id, name,radius,event_type, fenceLongitudeLatitude, fenceDescription, isDelete, fenceState, remark, create_by, create_time, update_by, update_time from fence
</sql>
<select id="selectFenceList" parameterType="com.xiaohuang.vehicle.domain.Fence" resultMap="FenceResult">
<include refid="selectFenceVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="groupId != null and groupId != ''"> and group_id like concat('%', #{groupId}, '%')</if>
<if test="radius != null and radius != ''"> and radius like concat('%', #{radius}, '%')</if>
<if test="eventType != null and eventType != ''"> and event_type like concat('%', #{eventType}, '%')</if>
<if test="fenceLongitudeLatitude != null and fenceLongitudeLatitude != ''"> and fenceLongitudeLatitude = #{fenceLongitudeLatitude}</if>
<if test="fenceDescription != null and fenceDescription != ''"> and fenceDescription = #{fenceDescription}</if>
<if test="isDelete != null and isDelete != ''"> and isDelete = #{isDelete}</if>
<if test="fenceState != null and fenceState != ''"> and fenceState = #{fenceState}</if>
</where>
</select>
<select id="selectFenceById" parameterType="Long" resultMap="FenceResult">
<include refid="selectFenceVo"/>
where id = #{id}
</select>
<insert id="insertFence" parameterType="com.xiaohuang.vehicle.domain.Fence" useGeneratedKeys="true" keyProperty="id">
insert into fence
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="groupId != null">group_id,</if>
<if test="radius != null">radius,</if>
<if test="eventType != null">event_type,</if>
<if test="fenceLongitudeLatitude != null">fenceLongitudeLatitude,</if>
<if test="fenceDescription != null">fenceDescription,</if>
<if test="isDelete != null">isDelete,</if>
<if test="fenceState != null">fenceState,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="groupId != null">#{groupId},</if>
<if test="radius != null">#{radius},</if>
<if test="eventType != null">#{eventType},</if>
<if test="fenceLongitudeLatitude != null">#{fenceLongitudeLatitude},</if>
<if test="fenceDescription != null">#{fenceDescription},</if>
<if test="isDelete != null">#{isDelete},</if>
<if test="fenceState != null">#{fenceState},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateFence" parameterType="com.xiaohuang.vehicle.domain.Fence">
update fence
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="groupId != null">group_id = #{groupId},</if>
<if test="eventType != null">event_type = #{eventType},</if>
<if test="radius != null">radius = #{radius},</if>
<if test="fenceLongitudeLatitude != null">fenceLongitudeLatitude = #{fenceLongitudeLatitude},</if>
<if test="fenceDescription != null">fenceDescription = #{fenceDescription},</if>
<if test="isDelete != null">isDelete = #{isDelete},</if>
<if test="fenceState != null">fenceState = #{fenceState},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteFenceById" parameterType="Long">
delete from fence where id = #{id}
</delete>
<delete id="deleteFenceByIds" parameterType="String">
delete from fence where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,77 @@
<?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.xiaohuang.vehicle.mapper.GroupMapper">
<resultMap type="com.xiaohuang.vehicle.domain.Group" id="GroupResult">
<result property="id" column="id" />
<result property="groupName" column="group_name" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectGroupVo">
select id, group_name, remark, create_by, create_time, update_by, update_time from `group`
</sql>
<select id="selectGroupList" parameterType="com.xiaohuang.vehicle.domain.Group" resultMap="GroupResult">
<include refid="selectGroupVo"/>
<where>
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
</where>
</select>
<select id="selectGroupById" parameterType="Long" resultMap="GroupResult">
<include refid="selectGroupVo"/>
where id = #{id}
</select>
<insert id="insertGroup" parameterType="com.xiaohuang.vehicle.domain.Group" useGeneratedKeys="true" keyProperty="id">
insert into `group`
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="groupName != null">group_name,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="groupName != null">#{groupName},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateGroup" parameterType="com.xiaohuang.vehicle.domain.Group">
update `group`
<trim prefix="SET" suffixOverrides=",">
<if test="groupName != null">group_name = #{groupName},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteGroupById" parameterType="Long">
delete from `group` where id = #{id}
</delete>
<delete id="deleteGroupByIds" parameterType="String">
delete from `group` where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -13,21 +13,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="battery" column="battery" />
<result property="motorNumber" column="motor_number" />
<result property="batteryNumber" column="battery_number" />
<result property="enterpriseId" column="enterprise_id" />
<result property="businessId" column="business_id" />
<result property="remark" column="remark" />
<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="groupId" column="group_id" />
</resultMap>
<sql id="selectVehicleVo">
select id, number, type_id, electonic_id, motor, battery, motor_number, battery_number, enterprise_id, remark, create_by, create_time, update_by, update_time from vehicle
select id, number,group_id, type_id, electonic_id, motor, battery, motor_number, battery_number, business_id, remark, create_by, create_time, update_by, update_time from vehicle
</sql>
<select id="selectVehicleList" parameterType="com.xiaohuang.vehicle.domain.Vehicle" resultMap="VehicleResult">
<include refid="selectVehicleVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="number != null "> and number = #{number}</if>
<if test="typeId != null "> and type_id = #{typeId}</if>
<if test="electonicId != null "> and electonic_id = #{electonicId}</if>
@ -35,7 +37,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="battery != null and battery != ''"> and battery = #{battery}</if>
<if test="motorNumber != null "> and motor_number = #{motorNumber}</if>
<if test="batteryNumber != null "> and battery_number = #{batteryNumber}</if>
<if test="enterpriseId != null "> and enterprise_id = #{enterpriseId}</if>
<if test="businessId != null "> and business_id = #{businessId}</if>
<if test="groupId != null "> and group_id = #{groupId}</if>
</where>
</select>
@ -55,13 +58,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="battery != null">battery,</if>
<if test="motorNumber != null">motor_number,</if>
<if test="batteryNumber != null">battery_number,</if>
<if test="enterpriseId != null">enterprise_id,</if>
<if test="businessId != null">business_id,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<if test="groupId != null">group_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="number != null">#{number},</if>
@ -71,13 +75,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="battery != null">#{battery},</if>
<if test="motorNumber != null">#{motorNumber},</if>
<if test="batteryNumber != null">#{batteryNumber},</if>
<if test="enterpriseId != null">#{enterpriseId},</if>
<if test="businessId != null">#{businessId},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
<if test="groupId != null">#{groupId},</if>
</trim>
</insert>
<update id="updateVehicle" parameterType="com.xiaohuang.vehicle.domain.Vehicle">
@ -90,12 +95,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="battery != null">battery = #{battery},</if>
<if test="motorNumber != null">motor_number = #{motorNumber},</if>
<if test="batteryNumber != null">battery_number = #{batteryNumber},</if>
<if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
<if test="businessId != null">business_id = #{businessId},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="groupId != null">group_id = #{groupId},</if>
</trim>
where id = #{id}
</update>