增加口门区域与设备的绑定

0927cmt
songwenxuan 2024-06-03 10:40:36 +08:00
parent 90fe7a39ae
commit b20f28af7b
26 changed files with 863 additions and 13 deletions

View File

@ -3,6 +3,7 @@ package com.zcloud.controller.anemometer;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.announcement.AnemometerLocalService;
import com.zcloud.service.announcement.AnemometerMachineService;
import com.zcloud.service.announcement.AnemometerService;
import com.zcloud.service.gatemachine.GateAreaService;
@ -25,6 +26,8 @@ public class AnemometerController extends BaseController {
@Resource
private AnemometerMachineService anemometerMachineService;
@Resource
private AnemometerLocalService anemometerLocalService;
@Resource
private AnemometerService anemometerService;
@ -57,6 +60,15 @@ public class AnemometerController extends BaseController {
return returnMap;
}
@RequestMapping(value = "/getFourAnemometerData")
public ReturnMap getFourAnemometerData() throws Exception{
ReturnMap returnMap = new ReturnMap();
PageData pd = this.getPageData();
PageData data = anemometerMachineService.getFourAnemometerData(pd);
returnMap.put("pd", data);
return returnMap;
}
@RequestMapping(value = "/edit")
public ReturnMap edit() throws Exception{
PageData pd = this.getPageData();
@ -68,7 +80,7 @@ public class AnemometerController extends BaseController {
public ReturnMap anemometerCount() throws Exception {
ReturnMap returnMap = new ReturnMap();
PageData pd = this.getPageData();
List<PageData> dataList = anemometerService.listAll(pd);
List<PageData> dataList = anemometerLocalService.detailListAll(pd);
returnMap.put("anemometerCount",dataList.size());
returnMap.put("varList",dataList);
return returnMap;

View File

@ -100,6 +100,28 @@ public class MkmjAreaController extends BaseController {
return map;
}
/**
* @param page
* @throws Exception
*/
@RequestMapping(value="/listForDevice")
@RequiresPermissions("mkmjArea:list")
@ResponseBody
public Object listForDevice(Page page) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件
if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim());
page.setPd(pd);
List<PageData> varList = mkmjAreaService.listForDevice(page); //列出Coursectk列表
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
/**
* @param
* @throws Exception

View File

@ -100,6 +100,24 @@ public class MkmjDeviceController extends BaseController {
return map;
}
/**
* @param page
* @throws Exception
*/
@RequestMapping(value="/listAllForArea")
@RequiresPermissions("mkmjDoor:list")
@ResponseBody
public Object listAllForArea() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<PageData> varList = mkmjDeviceService.listAllForArea(pd); //列出Coursectk列表
map.put("varList", varList);
map.put("result", errInfo);
return map;
}
/**
* @param
* @throws Exception
@ -118,6 +136,24 @@ public class MkmjDeviceController extends BaseController {
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/findById")
@RequiresPermissions("mkmjDoor:edit")
@ResponseBody
public Object findById() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd = mkmjDeviceService.findById(pd); //根据ID读取
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
/**
* @param
* @throws Exception

View File

@ -0,0 +1,176 @@
package com.zcloud.controller.mkmj;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.mkmj.MkmjRelationService;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.Tools;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.*;
@Controller
@RequestMapping("/mkmjRelation")
public class MkmjRelationController extends BaseController {
@Autowired
private MkmjRelationService mkmjRelationService;
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/add")
@RequiresPermissions("mkmjDoor:add")
@ResponseBody
public Object add() throws Exception{
PageData pd = new PageData();
pd = this.getPageData();
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); // 添加时间
pd.put("CREATOR", Jurisdiction.getUSER_ID()); // 添加人
pd.put("CREATTIME", DateUtil.date2Str(new Date())); // 添加时间
pd.put("ISDELETE", "0"); //是否删除
pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人
pd.put("OPERATTIME", DateUtil.date2Str(new Date()));//修改时间
return mkmjRelationService.save(pd);
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/delete")
@RequiresPermissions("mkmjDoor:del")
@ResponseBody
public Object delete() throws Exception{
PageData pd = new PageData();
pd = this.getPageData();
return mkmjRelationService.delete(pd);
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/edit")
@RequiresPermissions("mkmjDoor:edit")
@ResponseBody
public Object edit() throws Exception{
PageData pd = new PageData();
pd = this.getPageData();
pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人
pd.put("OPERATTIME", DateUtil.date2Str(new Date()));//修改时间
return mkmjRelationService.edit(pd);
}
/**
* @param page
* @throws Exception
*/
@RequestMapping(value="/list")
@RequiresPermissions("mkmjDoor:list")
@ResponseBody
public Object list(Page page) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件
if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim());
page.setPd(pd);
List<PageData> varList = mkmjRelationService.list(page); //列出Coursectk列表
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
@RequestMapping(value="/listAllForArea")
@RequiresPermissions("mkmjDoor:list")
@ResponseBody
public Object listAllForArea() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<PageData> varList = mkmjRelationService.listAllForArea(pd); //列出Coursectk列表
map.put("varList", varList);
map.put("result", errInfo);
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/goEdit")
@RequiresPermissions("mkmjDoor:edit")
@ResponseBody
public Object goEdit() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd = mkmjRelationService.findById(pd); //根据ID读取
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/findById")
@RequiresPermissions("mkmjDoor:edit")
@ResponseBody
public Object findById() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd = mkmjRelationService.findById(pd); //根据ID读取
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/savePosition")
@ResponseBody
public Object savePosition() throws Exception{
PageData pd = new PageData();
pd = this.getPageData();
return mkmjRelationService.savePosition(pd); //根据ID读取
}
/**
* @param page
* @throws Exception
*/
@RequestMapping(value="/getInfoList")
@RequiresPermissions("mkmjDoor:list")
@ResponseBody
public Object getInfoList(Page page) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
page.setPd(pd);
List<PageData> varList = new ArrayList<>();
varList = mkmjRelationService.getCarAndPeopleInfolistPage(page); //列出人闸机信息列表
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
}

View File

@ -28,6 +28,8 @@ public interface AnemometerLocalMapper {
*/
List<PageData> listAll(PageData pd)throws Exception;
List<PageData> detailListAll(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception

View File

@ -44,4 +44,6 @@ public interface AnemometerMachineMapper {
List<PageData> getDatalistPage(Page page);
PageData getDetailById(PageData pd);
PageData getFourAnemometerData(PageData pd);
}

View File

@ -37,6 +37,8 @@ public interface MkmjAreaMapper {
*/
List<PageData> datalistPage(Page page);
List<PageData> batchDevicelistPage(Page page);
/**()
* @param pd
* @throws Exception

View File

@ -43,6 +43,8 @@ public interface MkmjDeviceMapper {
*/
List<PageData> listAll(PageData pd);
List<PageData> listAllForArea(PageData pd);
/**id
* @param pd
* @throws Exception

View File

@ -0,0 +1,75 @@
package com.zcloud.mapper.datasource.mkmj;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* zhaoyu
* 2024-01-16
* www.zcloudchina.com
*/
public interface MkmjRelationMapper {
/**
* @param pd
* @throws Exception
*/
void save(PageData pd);
/**
* @param pd
* @throws Exception
*/
void delete(PageData pd);
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd);
/**
* @param page
* @throws Exception
*/
List<PageData> datalistPage(Page page);
/**()
* @param pd
* @throws Exception
*/
List<PageData> listAll(PageData pd);
List<PageData> listAllForArea(PageData pd);
List<PageData> getCarAndPeopleInfolistPage(Page page);
/**id
* @param pd
* @throws Exception
*/
PageData findById(PageData pd);
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
void deleteAll(String[] ArrayDATA_IDS);
/**.
* id
* @param pageData
* @return
*/
PageData findByOnly(PageData pageData);
/**
*
* @param pd
*/
void savePosition(PageData pd);
}

View File

@ -28,6 +28,8 @@ public interface AnemometerLocalService {
*/
public List<PageData> listAll(PageData pd)throws Exception;
public List<PageData> detailListAll(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception

View File

@ -44,4 +44,6 @@ public interface AnemometerMachineService {
public List<PageData> getDatalistpage(Page page);
public PageData getDetailById(PageData pd);
public PageData getFourAnemometerData(PageData pd);
}

View File

@ -36,6 +36,11 @@ public class AnemometerLocalServiceImpl implements AnemometerLocalService {
return anemometerLocalMapper.listAll(pd);
}
@Override
public List<PageData> detailListAll(PageData pd) throws Exception {
return anemometerLocalMapper.detailListAll(pd);
}
@Override
public List<PageData> findByName(PageData pd) throws Exception {
return anemometerLocalMapper.findByName(pd);

View File

@ -57,4 +57,9 @@ public class AnemometerMachineServiceImpl implements AnemometerMachineService {
public PageData getDetailById(PageData pd) {
return anemometerMachineMapper.getDetailById(pd);
}
@Override
public PageData getFourAnemometerData(PageData pd) {
return anemometerMachineMapper.getFourAnemometerData(pd);
}
}

View File

@ -37,6 +37,8 @@ public interface MkmjAreaService {
*/
public List<PageData> list(Page page)throws Exception;
public List<PageData> listForDevice(Page page)throws Exception;
/**()
* @param pd
* @throws Exception

View File

@ -43,6 +43,8 @@ public interface MkmjDeviceService {
*/
public List<PageData> listAll(PageData pd)throws Exception;
public List<PageData> listAllForArea(PageData pd)throws Exception;
/**id
* @param pd
* @throws Exception

View File

@ -0,0 +1,69 @@
package com.zcloud.service.mkmj;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* zhaoyu
* 2024-01-16
* www.zcloudchina.com
*/
public interface MkmjRelationService {
/**
* @param pd
* @throws Exception
*/
public Object save(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
public Object delete(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
public Object edit(PageData pd)throws Exception;
/**
* @param page
* @throws Exception
*/
public List<PageData> list(Page page)throws Exception;
/**()
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception;
public List<PageData> listAllForArea(PageData pd)throws Exception;
public List<PageData> getCarAndPeopleInfolistPage(Page page)throws Exception;
/**id
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception;
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
public Object deleteAll(String[] ArrayDATA_IDS)throws Exception;
/**
*
* @param pd
* @return
*/
Object savePosition(PageData pd);
}

View File

@ -103,6 +103,14 @@ public class MkmjAreaServiceImpl implements MkmjAreaService {
return mkmjAreaMapper.datalistPage(page);
}
/**
* @param page
* @throws Exception
*/
public List<PageData> listForDevice(Page page)throws Exception{
return mkmjAreaMapper.batchDevicelistPage(page);
}
/**()
* @param pd
* @throws Exception

View File

@ -99,6 +99,14 @@ public class MkmjDeviceServiceImpl implements MkmjDeviceService {
return mkmjDeviceMapper.listAll(pd);
}
/**()
* @param pd
* @throws Exception
*/
public List<PageData> listAllForArea(PageData pd)throws Exception{
return mkmjDeviceMapper.listAllForArea(pd);
}
/**id
* @param pd
* @throws Exception

View File

@ -0,0 +1,134 @@
package com.zcloud.service.mkmj.impl;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.mkmj.MkmjRelationMapper;
import com.zcloud.service.mkmj.MkmjRelationService;
import com.zcloud.util.UuidUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* zhaoyu
* 2024-01-16
* www.zcloudchina.com
*/
@Service
@Transactional //开启事物
public class MkmjRelationServiceImpl implements MkmjRelationService {
@Autowired
private MkmjRelationMapper mkmjRelationMapper;
/**
* @param pd
* @throws Exception
*/
public Object save(PageData pd)throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
pd.put("RELATION_ID", UuidUtil.get32UUID());
mkmjRelationMapper.save(pd);
map.put("result", errInfo);
map.put("msg", "保存成功");
return map;
}
/**
* @param pd
* @throws Exception
*/
public Object delete(PageData pd)throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
mkmjRelationMapper.delete(pd);
map.put("result", errInfo);
map.put("msg", "删除成功");
return map;
}
/**
* @param pd
* @throws Exception
*/
public Object edit(PageData pd)throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
mkmjRelationMapper.edit(pd);
map.put("result", errInfo);
map.put("msg", "编辑成功");
return map;
}
/**
* @param page
* @throws Exception
*/
public List<PageData> list(Page page)throws Exception{
return mkmjRelationMapper.datalistPage(page);
}
/**()
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception{
return mkmjRelationMapper.listAll(pd);
}
/**()
* @param pd
* @throws Exception
*/
public List<PageData> listAllForArea(PageData pd)throws Exception{
return mkmjRelationMapper.listAllForArea(pd);
}
/**()
* @param pd
* @throws Exception
*/
public List<PageData> getCarAndPeopleInfolistPage(Page page)throws Exception{
return mkmjRelationMapper.getCarAndPeopleInfolistPage(page);
}
/**id
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception{
return mkmjRelationMapper.findById(pd);
}
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
public Object deleteAll(String[] ArrayDATA_IDS)throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
mkmjRelationMapper.deleteAll(ArrayDATA_IDS);
map.put("result", errInfo);
map.put("msg", "删除成功");
return map;
}
@Override
public Object savePosition(PageData pd) {
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
mkmjRelationMapper.savePosition(pd);
map.put("result", errInfo);
map.put("msg", "定位成功");
return map;
}
}

View File

@ -123,6 +123,7 @@
<include refid="tableName"></include> f
LEFT JOIN bus_anemometer_machine m ON m.FID = f.ANEMOMETER_ID
where f.ISDELETE = '0'
ORDER BY f.CREATTIME DESC
</select>
<!-- 列表(全部) -->

View File

@ -76,6 +76,25 @@
<include refid="tableName"></include>
</select>
<select id="detailListAll" parameterType="pd" resultType="pd">
SELECT
f.FID,
f.FNAME,
CONCAT_WS( '--', f.LATITUDE, f.LONGITUDE ) LONGTITUDEANDLATITUDE,
f.LATITUDE,
f.LONGITUDE,
f.FNAME AS EQUIPMENTNAME,
al.FVALUE,
al.FTIME,
al.FVALUE AS WINDSPEED,
al.FTIME AS OPERATTIME
FROM
bus_anemometer_machine f
LEFT JOIN ( SELECT MAX( FTIME ) AS FTIME,FNAME FROM bus_anemometer_local GROUP BY FNAME ) ba ON f.FNAME = ba.FNAME
LEFT JOIN bus_anemometer_local al ON f.FNAME = al.FNAME and al.FTIME = ba.FTIME
ORDER BY f.FID DESC
</select>
<!--查询所有 -->
<select id="findByName" parameterType="pd" resultType="pd">
select

View File

@ -115,6 +115,27 @@
WHERE
f.FNAME = #{FNAME}
</select>
<select id="getFourAnemometerData" parameterType="pd" resultType="pd">
SELECT max(WINDSPEED) WINDSPEED FROM (SELECT
f.FID,
f.FNAME,
CONCAT_WS( '--', f.LATITUDE, f.LONGITUDE ) LONGTITUDEANDLATITUDE,
f.LATITUDE,
f.LONGITUDE,
f.FNAME AS EQUIPMENTNAME,
al.FVALUE,
al.FTIME,
al.FVALUE AS WINDSPEED,
al.FTIME AS OPERATTIME
FROM
bus_anemometer_machine f
LEFT JOIN ( SELECT MAX( FTIME ) AS FTIME, FNAME FROM bus_anemometer_local GROUP BY FNAME ) ba ON f.FNAME = ba.FNAME
LEFT JOIN bus_anemometer_local al ON f.FNAME = al.FNAME
AND al.FTIME = ba.FTIME
WHERE
f.FNAME IN ( 'SL1', 'SL2', 'SL3', 'SL4' )) ane
</select>
</mapper>

View File

@ -15,7 +15,7 @@
<!-- 字段 -->
<sql id="Field">
f.AREA_ID,
f.DOOR_IDS,
f.DEVICE_IDS,
f.AREA_NAME,
f.CORPINFO_ID,
f.CREATOR,
@ -28,7 +28,7 @@
<!-- 字段用于新增 -->
<sql id="Field2">
AREA_ID,
DOOR_IDS,
DEVICE_IDS,
AREA_NAME,
CORPINFO_ID,
CREATOR,
@ -41,7 +41,7 @@
<!-- 字段值 -->
<sql id="FieldValue">
#{AREA_ID},
#{DOOR_IDS},
#{DEVICE_IDS},
#{AREA_NAME},
#{CORPINFO_ID},
#{CREATOR},
@ -99,8 +99,8 @@
<if test="ISDELETE != null and ISDELETE != ''"><!-- 关键词检索 -->
,ISDELETE=#{ISDELETE}
</if>
<if test="DOOR_IDS != null and DOOR_IDS != ''"><!-- 关键词检索 -->
,DOOR_IDS=#{DOOR_IDS}
<if test="DEVICE_IDS != null and DEVICE_IDS != ''"><!-- 关键词检索 -->
,DEVICE_IDS=#{DEVICE_IDS}
</if>
where
AREA_ID=#{AREA_ID}
@ -120,10 +120,10 @@
<select id="datalistPage" parameterType="page" resultType="pd">
select
<include refid="Field"></include>,
COUNT(DISTINCT d.DOOR_ID) DOOR_COUNT
COUNT( DISTINCT r.RELATION_ID ) DEVICE_COUNT
from
<include refid="tableName"></include> f
LEFT JOIN mkmj_door d ON FIND_IN_SET(d.DOOR_ID,f.DOOR_IDS) AND d.ISDELETE = '0'
LEFT JOIN mkmj_relation r ON r.AREA_ID = f.AREA_ID AND r.ISDELETE = '0'
where f.ISDELETE = '0'
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
and
@ -137,6 +137,25 @@
f.CREATTIME DESC
</select>
<!-- 列表 -->
<select id="batchDevicelistPage" parameterType="page" resultType="pd">
SELECT
d.*,
f.RELATION_ID,
f.TYPE,
de.DEVICE_NAME DOCK_DEVICE_NAME,
de.DOOR_NAME DOCK_DOOR_NAME,
de.PATH_NAME DOCK_PATH_NAME
FROM
mkmj_relation f
LEFT JOIN mkmj_device d ON d.DEVICE_ID = f.DEVICE_ID
LEFT JOIN mkmj_dock_device de ON de.DOCK_DEVICE_ID = d.DOCK_DEVICE_ID
WHERE
f.ISDELETE = '0'
AND
f.AREA_ID = #{pd.AREA_ID}
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
@ -183,7 +202,7 @@
COUNT( CASE WHEN p.entrystatusStr = '离开' THEN p.person_log_id END ) PERSONOUTCOUNT
FROM
mkmj_area f
LEFT JOIN mkmj_door d ON FIND_IN_SET(d.DOOR_ID,f.DOOR_IDS)
LEFT JOIN mkmj_door d ON FIND_IN_SET(d.DOOR_ID,f.DEVICE_IDS)
LEFT JOIN dj_car_log c ON c.accId = d.SOURCE_ID AND DATE(c.chtime) = CURDATE()
LEFT JOIN dj_person_log p ON p.accId = d.SOURCE_ID AND DATE(p.chtime) = CURDATE()
WHERE

View File

@ -108,11 +108,18 @@
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
<include refid="Field"></include>,
d.DEVICE_NAME DOCK_DEVICE_NAME,
d.DOOR_NAME DOCK_DOOR_NAME,
d.PATH_NAME DOCK_PATH_NAME,
r.TYPE
from
<include refid="tableName"></include> f
LEFT JOIN mkmj_dock_device d ON f.DOCK_DEVICE_ID = d.DOCK_DEVICE_ID
LEFT JOIN mkmj_relation r ON r.DEVICE_ID = f.DEVICE_ID
where
f.DEVICE_ID=#{DEVICE_ID}
GROUP BY DEVICE_ID
</select>
<!-- 列表 -->
@ -151,6 +158,15 @@
</if>
</select>
<!-- 列表(全部) -->
<select id="listAllForArea" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
</select>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="String">
update

View File

@ -123,14 +123,12 @@
<include refid="Field"></include>,
COUNT(DISTINCT p.PATH_ID) PATHCOUNT,
COUNT(DISTINCT v.DOOR_VIDEO_ID) VIDEOCOUNT,
COUNT(DISTINCT d.DEVICE_ID) DEVICECOUNT,
GROUP_CONCAT(a.AREA_NAME SEPARATOR ',') AREANAME
COUNT(DISTINCT d.DEVICE_ID) DEVICECOUNT
from
<include refid="tableName"></include> f
LEFT JOIN mkmj_path p ON p.DOOR_ID = f.DOOR_ID AND p.ISDELETE = '0'
LEFT JOIN mkmj_door_video v ON v.DOOR_ID = f.DOOR_ID AND v.ISDELETE = '0'
LEFT JOIN mkmj_device d ON d.PATH_ID = p.PATH_ID AND d.ISDELETE = '0'
LEFT JOIN mkmj_area a ON FIND_IN_SET(f.DOOR_ID,a.DOOR_IDS) AND a.ISDELETE = '0'
where f.ISDELETE = '0'
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
and

View File

@ -0,0 +1,210 @@
<?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.zcloud.mapper.datasource.mkmj.MkmjRelationMapper">
<!--表名 -->
<sql id="tableName">
MKMJ_RELATION
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.RELATION_ID,
f.AREA_ID,
f.DEVICE_ID,
f.TYPE,
f.CORPINFO_ID,
f.CREATOR,
f.CREATTIME,
f.OPERATOR,
f.OPERATTIME,
f.ISDELETE
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
RELATION_ID,
AREA_ID,
DEVICE_ID,
TYPE,
CORPINFO_ID,
CREATOR,
CREATTIME,
OPERATOR,
OPERATTIME,
ISDELETE
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{RELATION_ID},
#{AREA_ID},
#{DEVICE_ID},
#{TYPE},
#{CORPINFO_ID},
#{CREATOR},
#{CREATTIME},
#{OPERATOR},
#{OPERATTIME},
#{ISDELETE}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<!-- 删除-->
<delete id="delete" parameterType="pd">
update
<include refid="tableName"></include>
set
ISDELETE = '1'
where
RELATION_ID = #{RELATION_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
RELATION_ID = RELATION_ID,
AREA_ID = #{AREA_ID},
DEVICE_ID = #{DEVICE_ID},
TYPE = #{TYPE},
CORPINFO_ID = #{CORPINFO_ID},
CREATOR = #{CREATOR},
CREATTIME = #{CREATTIME},
OPERATOR = #{OPERATOR},
OPERATTIME = #{OPERATTIME},
ISDELETE = #{ISDELETE}
where
RELATION_ID=#{RELATION_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.RELATION_ID=#{RELATION_ID}
</select>
<!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
<if test="pd.AREA_ID != null and pd.AREA_ID != ''"><!-- 关键词检索 -->
and f.AREA_ID=#{AREA_ID}
</if>
ORDER BY f.CREATTIME DESC
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
<if test="AREA_ID!='' and AREA_ID != null">
and f.AREA_ID = #{AREA_ID}
</if>
</select>
<!-- 列表(全部) -->
<select id="listAllForArea" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
</select>
<!-- 列表(全部) -->
<select id="getCarAndPeopleInfolistPage" parameterType="page" resultType="pd">
SELECT * FROM (
SELECT
i.personName NAME,
(CASE WHEN r.TYPE = '0' THEN '入口' ELSE '出口' END) STATUS,
DATE_FORMAT(i.eventTime,'%Y-%m-%d %H:%i:%s') TIME,
i.readerDevName BAYNAME,
i.devName DOORNAME
FROM
mkmj_area f
LEFT JOIN mkmj_relation r ON f.AREA_ID = r.AREA_ID AND r.ISDELETE = '0'
LEFT JOIN mkmj_device d ON r.DEVICE_ID = d.DEVICE_ID AND d.ISDELETE = '0'
LEFT JOIN mkmj_dock_device de ON d.DOCK_DEVICE_ID = de.DOCK_DEVICE_ID AND de.ISDELETE = '0'
LEFT JOIN mk_gate_person_machine_info i ON i.devName = de.DEVICE_NAME AND i.ISDELETE = '0'
WHERE
f.ISDELETE = '0'
AND
f.AREA_ID = #{pd.AREA_ID}
AND
i.MACHINE_INFO_ID IS NOT NULL
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
and
(
i.personName LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
)
</if>
GROUP BY i.MACHINE_INFO_ID UNION ALL
SELECT
i.PLATENO NAME,
(CASE WHEN r.TYPE = '0' THEN '入口' ELSE '出口' END) STATUS,
DATE_FORMAT(i.CROSSTIME,'%Y-%m-%d %H:%i:%s') TIME,
ENTRANCENAME BAYNAME,
ROADWAYNAME DOORNAME
FROM
mkmj_area f
LEFT JOIN mkmj_relation r ON f.AREA_ID = r.AREA_ID AND r.ISDELETE = '0'
LEFT JOIN mkmj_device d ON r.DEVICE_ID = d.DEVICE_ID AND d.ISDELETE = '0'
LEFT JOIN mkmj_dock_device de ON d.DOCK_DEVICE_ID = de.DOCK_DEVICE_ID AND de.ISDELETE = '0'
LEFT JOIN mk_gate_car_machine_info i ON i.ROADWAYNAME = de.DEVICE_NAME AND i.ISDELETE = '0'
WHERE
f.ISDELETE = '0'
AND
f.AREA_ID = #{pd.AREA_ID}
AND
i.CAR_MACHINE_INFO_ID IS NOT NULL
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
and
(
i.PLATENO LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
)
</if>
GROUP BY i.CAR_MACHINE_INFO_ID
) info
ORDER BY DATE_FORMAT(TIME,'%Y-%m-%d %H:%i:%s') DESC
</select>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="String">
update
<include refid="tableName"></include>
set
ISDELETE = '1'
where
DEVICE_ID in
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper>