41 changed files with 3675 additions and 7 deletions
Binary file not shown.
Binary file not shown.
@ -0,0 +1,93 @@ |
|||||
|
package com.techsor.datacenter.business.controller; |
||||
|
|
||||
|
import com.techsor.datacenter.business.common.response.PageInfo; |
||||
|
import com.techsor.datacenter.business.common.response.PageResponse; |
||||
|
import com.techsor.datacenter.business.common.response.ResponseCode; |
||||
|
import com.techsor.datacenter.business.common.response.SimpleDataResponse; |
||||
|
import com.techsor.datacenter.business.configurator.interceptor.AccessRequired; |
||||
|
import com.techsor.datacenter.business.dto.facility.FacilityAddParam; |
||||
|
import com.techsor.datacenter.business.dto.facility.FacilityDeleteParam; |
||||
|
import com.techsor.datacenter.business.dto.facility.FacilityEditParam; |
||||
|
import com.techsor.datacenter.business.dto.facility.FacilityQueryParam; |
||||
|
import com.techsor.datacenter.business.service.FacilityService; |
||||
|
import com.techsor.datacenter.business.vo.facility.FacilityPageVO; |
||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||
|
import io.swagger.v3.oas.annotations.Parameter; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
@RestController |
||||
|
@AccessRequired |
||||
|
@RequestMapping("/facility") |
||||
|
@Tag(name = "FacilityController", description = "Facility Management Module - APIs for managing facility information") |
||||
|
@Slf4j |
||||
|
public class FacilityController { |
||||
|
|
||||
|
@Autowired |
||||
|
private FacilityService facilityService; |
||||
|
|
||||
|
@Operation(summary = "Get facility list by param") |
||||
|
@GetMapping(path = "/getListPage") |
||||
|
public PageResponse<PageInfo<FacilityPageVO>> getListPage( |
||||
|
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
||||
|
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
||||
|
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
||||
|
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
||||
|
@Parameter(name = "LanguageType", description = "Language type 0: Chinese 1: English 2: Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType, |
||||
|
@Parameter(name = "UTCOffset", description = "Offset between GMT and local time in minutes, e.g., -480 for GMT+8") @RequestHeader(required = true) Integer UTCOffset, |
||||
|
FacilityQueryParam param) { |
||||
|
PageResponse<PageInfo<FacilityPageVO>> pageResponse = new PageResponse<>(); |
||||
|
try { |
||||
|
pageResponse.setData(facilityService.query(param, UserId, CompanyId, LanguageType)); |
||||
|
pageResponse.setCode(ResponseCode.SUCCESS); |
||||
|
pageResponse.setMsg("success"); |
||||
|
} catch (Exception e) { |
||||
|
log.error("Error querying facility list", e); |
||||
|
pageResponse.setCode(ResponseCode.SERVER_ERROR); |
||||
|
pageResponse.setMsg("service error"); |
||||
|
} |
||||
|
return pageResponse; |
||||
|
} |
||||
|
|
||||
|
@Operation(summary = "Add facility") |
||||
|
@PostMapping(path = "/add") |
||||
|
public SimpleDataResponse add( |
||||
|
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
||||
|
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
||||
|
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
||||
|
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
||||
|
@Parameter(name = "LanguageType", description = "Language type 0: Chinese 1: English 2: Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType, |
||||
|
@Parameter(name = "UTCOffset", description = "Offset between GMT and local time in minutes, e.g., -480 for GMT+8") @RequestHeader(required = true) Integer UTCOffset, |
||||
|
@RequestBody FacilityAddParam param) { |
||||
|
return facilityService.add(param, UserId, CompanyId, LanguageType); |
||||
|
} |
||||
|
|
||||
|
@Operation(summary = "Edit facility") |
||||
|
@PostMapping(path = "/edit") |
||||
|
public SimpleDataResponse edit( |
||||
|
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
||||
|
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
||||
|
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
||||
|
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
||||
|
@Parameter(name = "LanguageType", description = "Language type 0: Chinese 1: English 2: Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType, |
||||
|
@Parameter(name = "UTCOffset", description = "Offset between GMT and local time in minutes, e.g., -480 for GMT+8") @RequestHeader(required = true) Integer UTCOffset, |
||||
|
@RequestBody FacilityEditParam param) { |
||||
|
return facilityService.edit(param, UserId, CompanyId, LanguageType); |
||||
|
} |
||||
|
|
||||
|
@Operation(summary = "Batch delete facilities") |
||||
|
@PostMapping(path = "/delete") |
||||
|
public SimpleDataResponse delete( |
||||
|
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
||||
|
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
||||
|
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
||||
|
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
||||
|
@Parameter(name = "LanguageType", description = "Language type 0: Chinese 1: English 2: Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType, |
||||
|
@Parameter(name = "UTCOffset", description = "Offset between GMT and local time in minutes, e.g., -480 for GMT+8") @RequestHeader(required = true) Integer UTCOffset, |
||||
|
@RequestBody FacilityDeleteParam param) { |
||||
|
return facilityService.batchDelete(param, UserId, CompanyId, LanguageType); |
||||
|
} |
||||
|
} |
||||
Binary file not shown.
@ -0,0 +1 @@ |
|||||
|
ALTER TABLE basic_building ADD `kvm_url` varchar(500) DEFAULT NULL COMMENT 'KVM URL'; |
||||
@ -0,0 +1,35 @@ |
|||||
|
CREATE TABLE `basic_facility` ( |
||||
|
`facility_id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID', |
||||
|
`building_id` bigint NOT NULL COMMENT '关联楼宇ID', |
||||
|
`company_id` bigint DEFAULT NULL COMMENT '企业ID', |
||||
|
`security_company_name` varchar(255) DEFAULT NULL COMMENT '常驻警备公司名称', |
||||
|
`machine_security_company` varchar(255) DEFAULT NULL COMMENT '机械警备公司名称', |
||||
|
`machine_security_tel` varchar(40) DEFAULT NULL COMMENT '机械警备联系电话', |
||||
|
`machine_security_customer_code` varchar(40) DEFAULT NULL COMMENT '机械警备客户代码', |
||||
|
`night_shift_type` varchar(50) DEFAULT NULL COMMENT '夜间体制区分', |
||||
|
`night_guard_count` int DEFAULT NULL COMMENT '夜间常驻人数', |
||||
|
`security_switch_time` varchar(10) DEFAULT NULL COMMENT '常驻→机械 切换时间', |
||||
|
`security_phs` varchar(40) DEFAULT NULL COMMENT '警备员PHS号码', |
||||
|
`mall_security_tel` varchar(40) DEFAULT NULL COMMENT '商场侧警备电话', |
||||
|
`facility_side_type` varchar(50) DEFAULT NULL COMMENT '商场/永旺侧区分', |
||||
|
`ad_direct_tel` varchar(40) DEFAULT NULL COMMENT 'AD直通电话', |
||||
|
`alarm_reception_note` varchar(2000) DEFAULT NULL COMMENT '警报接收特记', |
||||
|
`escalation_flow` varchar(2000) DEFAULT NULL COMMENT '联络流程', |
||||
|
`contract_start_date` date DEFAULT NULL COMMENT '合同开始日', |
||||
|
`open_date` date DEFAULT NULL COMMENT '开业日', |
||||
|
`contract_end_date` date DEFAULT NULL COMMENT '解约日/闭店日', |
||||
|
`legacy_address` varchar(20) DEFAULT NULL COMMENT '旧地址', |
||||
|
`legacy_property_flag` tinyint DEFAULT '0' COMMENT '旧物业标志 0:否 1:是', |
||||
|
`name_change_history` varchar(255) DEFAULT NULL COMMENT '名称变更履历', |
||||
|
`communication_info` varchar(255) DEFAULT NULL COMMENT 'SIM/通信线路', |
||||
|
`nap_time` varchar(20) DEFAULT NULL COMMENT '值班小睡时段', |
||||
|
`note_updated_by` varchar(128) DEFAULT NULL COMMENT '记载者/更新日', |
||||
|
`flag` int DEFAULT '0' COMMENT '删除标记 0:正常 1:已删除', |
||||
|
`create_time` bigint DEFAULT NULL COMMENT '创建时间', |
||||
|
`creator_id` bigint DEFAULT NULL COMMENT '创建人ID', |
||||
|
`modify_time` bigint DEFAULT NULL COMMENT '修改时间', |
||||
|
`modifier_id` bigint DEFAULT NULL COMMENT '修改人ID', |
||||
|
PRIMARY KEY (`facility_id`), |
||||
|
KEY `idx_building_id` (`building_id`), |
||||
|
KEY `idx_company_id` (`company_id`) |
||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='设施信息表'; |
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,31 @@ |
|||||
|
package com.techsor.datacenter.business.dao.auto; |
||||
|
|
||||
|
import com.techsor.datacenter.business.model.BasicFacility; |
||||
|
import com.techsor.datacenter.business.model.BasicFacilityExample; |
||||
|
import java.util.List; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
public interface BasicFacilityMapper { |
||||
|
|
||||
|
long countByExample(BasicFacilityExample example); |
||||
|
|
||||
|
int deleteByExample(BasicFacilityExample example); |
||||
|
|
||||
|
int deleteByPrimaryKey(Long facilityId); |
||||
|
|
||||
|
int insert(BasicFacility record); |
||||
|
|
||||
|
int insertSelective(BasicFacility record); |
||||
|
|
||||
|
List<BasicFacility> selectByExample(BasicFacilityExample example); |
||||
|
|
||||
|
BasicFacility selectByPrimaryKey(Long facilityId); |
||||
|
|
||||
|
int updateByExampleSelective(@Param("record") BasicFacility record, @Param("example") BasicFacilityExample example); |
||||
|
|
||||
|
int updateByExample(@Param("record") BasicFacility record, @Param("example") BasicFacilityExample example); |
||||
|
|
||||
|
int updateByPrimaryKeySelective(BasicFacility record); |
||||
|
|
||||
|
int updateByPrimaryKey(BasicFacility record); |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
package com.techsor.datacenter.business.dao.ex; |
||||
|
|
||||
|
import com.techsor.datacenter.business.dao.auto.BasicFacilityMapper; |
||||
|
import com.techsor.datacenter.business.dto.facility.FacilityQueryParam; |
||||
|
import com.techsor.datacenter.business.vo.facility.FacilityPageVO; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface BasicFacilityMapperExt extends BasicFacilityMapper { |
||||
|
|
||||
|
List<FacilityPageVO> getListPage(@Param("param") FacilityQueryParam param, @Param("companyId") Long companyId); |
||||
|
} |
||||
@ -0,0 +1,623 @@ |
|||||
|
<?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.techsor.datacenter.business.dao.auto.BasicFacilityMapper"> |
||||
|
|
||||
|
<resultMap id="BaseResultMap" type="com.techsor.datacenter.business.model.BasicFacility"> |
||||
|
<id column="facility_id" jdbcType="BIGINT" property="facilityId" /> |
||||
|
<result column="building_id" jdbcType="BIGINT" property="buildingId" /> |
||||
|
<result column="company_id" jdbcType="BIGINT" property="companyId" /> |
||||
|
<result column="security_company_name" jdbcType="VARCHAR" property="securityCompanyName" /> |
||||
|
<result column="machine_security_company" jdbcType="VARCHAR" property="machineSecurityCompany" /> |
||||
|
<result column="machine_security_tel" jdbcType="VARCHAR" property="machineSecurityTel" /> |
||||
|
<result column="machine_security_customer_code" jdbcType="VARCHAR" property="machineSecurityCustomerCode" /> |
||||
|
<result column="night_shift_type" jdbcType="VARCHAR" property="nightShiftType" /> |
||||
|
<result column="night_guard_count" jdbcType="INTEGER" property="nightGuardCount" /> |
||||
|
<result column="security_switch_time" jdbcType="VARCHAR" property="securitySwitchTime" /> |
||||
|
<result column="security_phs" jdbcType="VARCHAR" property="securityPhs" /> |
||||
|
<result column="mall_security_tel" jdbcType="VARCHAR" property="mallSecurityTel" /> |
||||
|
<result column="facility_side_type" jdbcType="VARCHAR" property="facilitySideType" /> |
||||
|
<result column="ad_direct_tel" jdbcType="VARCHAR" property="adDirectTel" /> |
||||
|
<result column="alarm_reception_note" jdbcType="VARCHAR" property="alarmReceptionNote" /> |
||||
|
<result column="escalation_flow" jdbcType="VARCHAR" property="escalationFlow" /> |
||||
|
<result column="contract_start_date" jdbcType="DATE" property="contractStartDate" /> |
||||
|
<result column="open_date" jdbcType="DATE" property="openDate" /> |
||||
|
<result column="contract_end_date" jdbcType="DATE" property="contractEndDate" /> |
||||
|
<result column="legacy_address" jdbcType="VARCHAR" property="legacyAddress" /> |
||||
|
<result column="legacy_property_flag" jdbcType="TINYINT" property="legacyPropertyFlag" /> |
||||
|
<result column="name_change_history" jdbcType="VARCHAR" property="nameChangeHistory" /> |
||||
|
<result column="communication_info" jdbcType="VARCHAR" property="communicationInfo" /> |
||||
|
<result column="nap_time" jdbcType="VARCHAR" property="napTime" /> |
||||
|
<result column="note_updated_by" jdbcType="VARCHAR" property="noteUpdatedBy" /> |
||||
|
<result column="flag" jdbcType="INTEGER" property="flag" /> |
||||
|
<result column="create_time" jdbcType="BIGINT" property="createTime" /> |
||||
|
<result column="creator_id" jdbcType="BIGINT" property="creatorId" /> |
||||
|
<result column="modify_time" jdbcType="BIGINT" property="modifyTime" /> |
||||
|
<result column="modifier_id" jdbcType="BIGINT" property="modifierId" /> |
||||
|
</resultMap> |
||||
|
|
||||
|
<sql id="Example_Where_Clause"> |
||||
|
<where> |
||||
|
<foreach collection="oredCriteria" item="criteria" separator="or"> |
||||
|
<if test="criteria.valid"> |
||||
|
<trim prefix="(" prefixOverrides="and" suffix=")"> |
||||
|
<foreach collection="criteria.criteria" item="criterion"> |
||||
|
<choose> |
||||
|
<when test="criterion.noValue"> |
||||
|
and ${criterion.condition} |
||||
|
</when> |
||||
|
<when test="criterion.singleValue"> |
||||
|
and ${criterion.condition} #{criterion.value} |
||||
|
</when> |
||||
|
<when test="criterion.betweenValue"> |
||||
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} |
||||
|
</when> |
||||
|
<when test="criterion.listValue"> |
||||
|
and ${criterion.condition} |
||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
||||
|
#{listItem} |
||||
|
</foreach> |
||||
|
</when> |
||||
|
</choose> |
||||
|
</foreach> |
||||
|
</trim> |
||||
|
</if> |
||||
|
</foreach> |
||||
|
</where> |
||||
|
</sql> |
||||
|
|
||||
|
<sql id="Update_By_Example_Where_Clause"> |
||||
|
<where> |
||||
|
<foreach collection="example.oredCriteria" item="criteria" separator="or"> |
||||
|
<if test="criteria.valid"> |
||||
|
<trim prefix="(" prefixOverrides="and" suffix=")"> |
||||
|
<foreach collection="criteria.criteria" item="criterion"> |
||||
|
<choose> |
||||
|
<when test="criterion.noValue"> |
||||
|
and ${criterion.condition} |
||||
|
</when> |
||||
|
<when test="criterion.singleValue"> |
||||
|
and ${criterion.condition} #{criterion.value} |
||||
|
</when> |
||||
|
<when test="criterion.betweenValue"> |
||||
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} |
||||
|
</when> |
||||
|
<when test="criterion.listValue"> |
||||
|
and ${criterion.condition} |
||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
||||
|
#{listItem} |
||||
|
</foreach> |
||||
|
</when> |
||||
|
</choose> |
||||
|
</foreach> |
||||
|
</trim> |
||||
|
</if> |
||||
|
</foreach> |
||||
|
</where> |
||||
|
</sql> |
||||
|
|
||||
|
<sql id="Base_Column_List"> |
||||
|
facility_id, building_id, company_id, security_company_name, machine_security_company, |
||||
|
machine_security_tel, machine_security_customer_code, night_shift_type, night_guard_count, |
||||
|
security_switch_time, security_phs, mall_security_tel, facility_side_type, ad_direct_tel, |
||||
|
alarm_reception_note, escalation_flow, contract_start_date, open_date, contract_end_date, |
||||
|
legacy_address, legacy_property_flag, name_change_history, communication_info, nap_time, |
||||
|
note_updated_by, flag, create_time, creator_id, modify_time, modifier_id |
||||
|
</sql> |
||||
|
|
||||
|
<select id="selectByExample" resultMap="BaseResultMap"> |
||||
|
select |
||||
|
<if test="distinct"> |
||||
|
distinct |
||||
|
</if> |
||||
|
<include refid="Base_Column_List" /> |
||||
|
from basic_facility |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Example_Where_Clause" /> |
||||
|
</if> |
||||
|
<if test="orderByClause != null"> |
||||
|
order by ${orderByClause} |
||||
|
</if> |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap"> |
||||
|
select |
||||
|
<include refid="Base_Column_List" /> |
||||
|
from basic_facility |
||||
|
where facility_id = #{facilityId,jdbcType=BIGINT} |
||||
|
</select> |
||||
|
|
||||
|
<delete id="deleteByPrimaryKey"> |
||||
|
delete from basic_facility |
||||
|
where facility_id = #{facilityId,jdbcType=BIGINT} |
||||
|
</delete> |
||||
|
|
||||
|
<delete id="deleteByExample"> |
||||
|
delete from basic_facility |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</delete> |
||||
|
|
||||
|
<insert id="insert" parameterType="com.techsor.datacenter.business.model.BasicFacility"> |
||||
|
insert into basic_facility (facility_id, building_id, company_id, |
||||
|
security_company_name, machine_security_company, machine_security_tel, |
||||
|
machine_security_customer_code, night_shift_type, night_guard_count, |
||||
|
security_switch_time, security_phs, mall_security_tel, |
||||
|
facility_side_type, ad_direct_tel, alarm_reception_note, |
||||
|
escalation_flow, contract_start_date, open_date, |
||||
|
contract_end_date, legacy_address, legacy_property_flag, |
||||
|
name_change_history, communication_info, nap_time, |
||||
|
note_updated_by, flag, create_time, |
||||
|
creator_id, modify_time, modifier_id) |
||||
|
values (#{facilityId,jdbcType=BIGINT}, #{buildingId,jdbcType=BIGINT}, #{companyId,jdbcType=BIGINT}, |
||||
|
#{securityCompanyName,jdbcType=VARCHAR}, #{machineSecurityCompany,jdbcType=VARCHAR}, #{machineSecurityTel,jdbcType=VARCHAR}, |
||||
|
#{machineSecurityCustomerCode,jdbcType=VARCHAR}, #{nightShiftType,jdbcType=VARCHAR}, #{nightGuardCount,jdbcType=INTEGER}, |
||||
|
#{securitySwitchTime,jdbcType=VARCHAR}, #{securityPhs,jdbcType=VARCHAR}, #{mallSecurityTel,jdbcType=VARCHAR}, |
||||
|
#{facilitySideType,jdbcType=VARCHAR}, #{adDirectTel,jdbcType=VARCHAR}, #{alarmReceptionNote,jdbcType=VARCHAR}, |
||||
|
#{escalationFlow,jdbcType=VARCHAR}, #{contractStartDate,jdbcType=DATE}, #{openDate,jdbcType=DATE}, |
||||
|
#{contractEndDate,jdbcType=DATE}, #{legacyAddress,jdbcType=VARCHAR}, #{legacyPropertyFlag,jdbcType=TINYINT}, |
||||
|
#{nameChangeHistory,jdbcType=VARCHAR}, #{communicationInfo,jdbcType=VARCHAR}, #{napTime,jdbcType=VARCHAR}, |
||||
|
#{noteUpdatedBy,jdbcType=VARCHAR}, #{flag,jdbcType=INTEGER}, #{createTime,jdbcType=BIGINT}, |
||||
|
#{creatorId,jdbcType=BIGINT}, #{modifyTime,jdbcType=BIGINT}, #{modifierId,jdbcType=BIGINT}) |
||||
|
</insert> |
||||
|
|
||||
|
<insert id="insertSelective" parameterType="com.techsor.datacenter.business.model.BasicFacility"> |
||||
|
insert into basic_facility |
||||
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
|
<if test="facilityId != null"> |
||||
|
facility_id, |
||||
|
</if> |
||||
|
<if test="buildingId != null"> |
||||
|
building_id, |
||||
|
</if> |
||||
|
<if test="companyId != null"> |
||||
|
company_id, |
||||
|
</if> |
||||
|
<if test="securityCompanyName != null"> |
||||
|
security_company_name, |
||||
|
</if> |
||||
|
<if test="machineSecurityCompany != null"> |
||||
|
machine_security_company, |
||||
|
</if> |
||||
|
<if test="machineSecurityTel != null"> |
||||
|
machine_security_tel, |
||||
|
</if> |
||||
|
<if test="machineSecurityCustomerCode != null"> |
||||
|
machine_security_customer_code, |
||||
|
</if> |
||||
|
<if test="nightShiftType != null"> |
||||
|
night_shift_type, |
||||
|
</if> |
||||
|
<if test="nightGuardCount != null"> |
||||
|
night_guard_count, |
||||
|
</if> |
||||
|
<if test="securitySwitchTime != null"> |
||||
|
security_switch_time, |
||||
|
</if> |
||||
|
<if test="securityPhs != null"> |
||||
|
security_phs, |
||||
|
</if> |
||||
|
<if test="mallSecurityTel != null"> |
||||
|
mall_security_tel, |
||||
|
</if> |
||||
|
<if test="facilitySideType != null"> |
||||
|
facility_side_type, |
||||
|
</if> |
||||
|
<if test="adDirectTel != null"> |
||||
|
ad_direct_tel, |
||||
|
</if> |
||||
|
<if test="alarmReceptionNote != null"> |
||||
|
alarm_reception_note, |
||||
|
</if> |
||||
|
<if test="escalationFlow != null"> |
||||
|
escalation_flow, |
||||
|
</if> |
||||
|
<if test="contractStartDate != null"> |
||||
|
contract_start_date, |
||||
|
</if> |
||||
|
<if test="openDate != null"> |
||||
|
open_date, |
||||
|
</if> |
||||
|
<if test="contractEndDate != null"> |
||||
|
contract_end_date, |
||||
|
</if> |
||||
|
<if test="legacyAddress != null"> |
||||
|
legacy_address, |
||||
|
</if> |
||||
|
<if test="legacyPropertyFlag != null"> |
||||
|
legacy_property_flag, |
||||
|
</if> |
||||
|
<if test="nameChangeHistory != null"> |
||||
|
name_change_history, |
||||
|
</if> |
||||
|
<if test="communicationInfo != null"> |
||||
|
communication_info, |
||||
|
</if> |
||||
|
<if test="napTime != null"> |
||||
|
nap_time, |
||||
|
</if> |
||||
|
<if test="noteUpdatedBy != null"> |
||||
|
note_updated_by, |
||||
|
</if> |
||||
|
<if test="flag != null"> |
||||
|
flag, |
||||
|
</if> |
||||
|
<if test="createTime != null"> |
||||
|
create_time, |
||||
|
</if> |
||||
|
<if test="creatorId != null"> |
||||
|
creator_id, |
||||
|
</if> |
||||
|
<if test="modifyTime != null"> |
||||
|
modify_time, |
||||
|
</if> |
||||
|
<if test="modifierId != null"> |
||||
|
modifier_id, |
||||
|
</if> |
||||
|
</trim> |
||||
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
|
<if test="facilityId != null"> |
||||
|
#{facilityId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="buildingId != null"> |
||||
|
#{buildingId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="companyId != null"> |
||||
|
#{companyId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="securityCompanyName != null"> |
||||
|
#{securityCompanyName,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="machineSecurityCompany != null"> |
||||
|
#{machineSecurityCompany,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="machineSecurityTel != null"> |
||||
|
#{machineSecurityTel,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="machineSecurityCustomerCode != null"> |
||||
|
#{machineSecurityCustomerCode,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="nightShiftType != null"> |
||||
|
#{nightShiftType,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="nightGuardCount != null"> |
||||
|
#{nightGuardCount,jdbcType=INTEGER}, |
||||
|
</if> |
||||
|
<if test="securitySwitchTime != null"> |
||||
|
#{securitySwitchTime,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="securityPhs != null"> |
||||
|
#{securityPhs,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="mallSecurityTel != null"> |
||||
|
#{mallSecurityTel,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="facilitySideType != null"> |
||||
|
#{facilitySideType,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="adDirectTel != null"> |
||||
|
#{adDirectTel,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="alarmReceptionNote != null"> |
||||
|
#{alarmReceptionNote,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="escalationFlow != null"> |
||||
|
#{escalationFlow,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="contractStartDate != null"> |
||||
|
#{contractStartDate,jdbcType=DATE}, |
||||
|
</if> |
||||
|
<if test="openDate != null"> |
||||
|
#{openDate,jdbcType=DATE}, |
||||
|
</if> |
||||
|
<if test="contractEndDate != null"> |
||||
|
#{contractEndDate,jdbcType=DATE}, |
||||
|
</if> |
||||
|
<if test="legacyAddress != null"> |
||||
|
#{legacyAddress,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="legacyPropertyFlag != null"> |
||||
|
#{legacyPropertyFlag,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="nameChangeHistory != null"> |
||||
|
#{nameChangeHistory,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="communicationInfo != null"> |
||||
|
#{communicationInfo,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="napTime != null"> |
||||
|
#{napTime,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="noteUpdatedBy != null"> |
||||
|
#{noteUpdatedBy,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="flag != null"> |
||||
|
#{flag,jdbcType=INTEGER}, |
||||
|
</if> |
||||
|
<if test="createTime != null"> |
||||
|
#{createTime,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="creatorId != null"> |
||||
|
#{creatorId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="modifyTime != null"> |
||||
|
#{modifyTime,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="modifierId != null"> |
||||
|
#{modifierId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
</trim> |
||||
|
</insert> |
||||
|
|
||||
|
<select id="countByExample" resultType="java.lang.Long"> |
||||
|
select count(*) from basic_facility |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</select> |
||||
|
|
||||
|
<update id="updateByExampleSelective"> |
||||
|
update basic_facility |
||||
|
<set> |
||||
|
<if test="record.facilityId != null"> |
||||
|
facility_id = #{record.facilityId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="record.buildingId != null"> |
||||
|
building_id = #{record.buildingId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="record.companyId != null"> |
||||
|
company_id = #{record.companyId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="record.securityCompanyName != null"> |
||||
|
security_company_name = #{record.securityCompanyName,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.machineSecurityCompany != null"> |
||||
|
machine_security_company = #{record.machineSecurityCompany,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.machineSecurityTel != null"> |
||||
|
machine_security_tel = #{record.machineSecurityTel,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.machineSecurityCustomerCode != null"> |
||||
|
machine_security_customer_code = #{record.machineSecurityCustomerCode,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.nightShiftType != null"> |
||||
|
night_shift_type = #{record.nightShiftType,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.nightGuardCount != null"> |
||||
|
night_guard_count = #{record.nightGuardCount,jdbcType=INTEGER}, |
||||
|
</if> |
||||
|
<if test="record.securitySwitchTime != null"> |
||||
|
security_switch_time = #{record.securitySwitchTime,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.securityPhs != null"> |
||||
|
security_phs = #{record.securityPhs,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.mallSecurityTel != null"> |
||||
|
mall_security_tel = #{record.mallSecurityTel,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.facilitySideType != null"> |
||||
|
facility_side_type = #{record.facilitySideType,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.adDirectTel != null"> |
||||
|
ad_direct_tel = #{record.adDirectTel,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.alarmReceptionNote != null"> |
||||
|
alarm_reception_note = #{record.alarmReceptionNote,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.escalationFlow != null"> |
||||
|
escalation_flow = #{record.escalationFlow,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.contractStartDate != null"> |
||||
|
contract_start_date = #{record.contractStartDate,jdbcType=DATE}, |
||||
|
</if> |
||||
|
<if test="record.openDate != null"> |
||||
|
open_date = #{record.openDate,jdbcType=DATE}, |
||||
|
</if> |
||||
|
<if test="record.contractEndDate != null"> |
||||
|
contract_end_date = #{record.contractEndDate,jdbcType=DATE}, |
||||
|
</if> |
||||
|
<if test="record.legacyAddress != null"> |
||||
|
legacy_address = #{record.legacyAddress,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.legacyPropertyFlag != null"> |
||||
|
legacy_property_flag = #{record.legacyPropertyFlag,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="record.nameChangeHistory != null"> |
||||
|
name_change_history = #{record.nameChangeHistory,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.communicationInfo != null"> |
||||
|
communication_info = #{record.communicationInfo,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.napTime != null"> |
||||
|
nap_time = #{record.napTime,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.noteUpdatedBy != null"> |
||||
|
note_updated_by = #{record.noteUpdatedBy,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.flag != null"> |
||||
|
flag = #{record.flag,jdbcType=INTEGER}, |
||||
|
</if> |
||||
|
<if test="record.createTime != null"> |
||||
|
create_time = #{record.createTime,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="record.creatorId != null"> |
||||
|
creator_id = #{record.creatorId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="record.modifyTime != null"> |
||||
|
modify_time = #{record.modifyTime,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="record.modifierId != null"> |
||||
|
modifier_id = #{record.modifierId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
</set> |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Update_By_Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</update> |
||||
|
|
||||
|
<update id="updateByExample"> |
||||
|
update basic_facility |
||||
|
set facility_id = #{record.facilityId,jdbcType=BIGINT}, |
||||
|
building_id = #{record.buildingId,jdbcType=BIGINT}, |
||||
|
company_id = #{record.companyId,jdbcType=BIGINT}, |
||||
|
security_company_name = #{record.securityCompanyName,jdbcType=VARCHAR}, |
||||
|
machine_security_company = #{record.machineSecurityCompany,jdbcType=VARCHAR}, |
||||
|
machine_security_tel = #{record.machineSecurityTel,jdbcType=VARCHAR}, |
||||
|
machine_security_customer_code = #{record.machineSecurityCustomerCode,jdbcType=VARCHAR}, |
||||
|
night_shift_type = #{record.nightShiftType,jdbcType=VARCHAR}, |
||||
|
night_guard_count = #{record.nightGuardCount,jdbcType=INTEGER}, |
||||
|
security_switch_time = #{record.securitySwitchTime,jdbcType=VARCHAR}, |
||||
|
security_phs = #{record.securityPhs,jdbcType=VARCHAR}, |
||||
|
mall_security_tel = #{record.mallSecurityTel,jdbcType=VARCHAR}, |
||||
|
facility_side_type = #{record.facilitySideType,jdbcType=VARCHAR}, |
||||
|
ad_direct_tel = #{record.adDirectTel,jdbcType=VARCHAR}, |
||||
|
alarm_reception_note = #{record.alarmReceptionNote,jdbcType=VARCHAR}, |
||||
|
escalation_flow = #{record.escalationFlow,jdbcType=VARCHAR}, |
||||
|
contract_start_date = #{record.contractStartDate,jdbcType=DATE}, |
||||
|
open_date = #{record.openDate,jdbcType=DATE}, |
||||
|
contract_end_date = #{record.contractEndDate,jdbcType=DATE}, |
||||
|
legacy_address = #{record.legacyAddress,jdbcType=VARCHAR}, |
||||
|
legacy_property_flag = #{record.legacyPropertyFlag,jdbcType=TINYINT}, |
||||
|
name_change_history = #{record.nameChangeHistory,jdbcType=VARCHAR}, |
||||
|
communication_info = #{record.communicationInfo,jdbcType=VARCHAR}, |
||||
|
nap_time = #{record.napTime,jdbcType=VARCHAR}, |
||||
|
note_updated_by = #{record.noteUpdatedBy,jdbcType=VARCHAR}, |
||||
|
flag = #{record.flag,jdbcType=INTEGER}, |
||||
|
create_time = #{record.createTime,jdbcType=BIGINT}, |
||||
|
creator_id = #{record.creatorId,jdbcType=BIGINT}, |
||||
|
modify_time = #{record.modifyTime,jdbcType=BIGINT}, |
||||
|
modifier_id = #{record.modifierId,jdbcType=BIGINT} |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Update_By_Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</update> |
||||
|
|
||||
|
<update id="updateByPrimaryKeySelective"> |
||||
|
update basic_facility |
||||
|
<set> |
||||
|
<if test="buildingId != null"> |
||||
|
building_id = #{buildingId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="companyId != null"> |
||||
|
company_id = #{companyId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="securityCompanyName != null"> |
||||
|
security_company_name = #{securityCompanyName,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="machineSecurityCompany != null"> |
||||
|
machine_security_company = #{machineSecurityCompany,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="machineSecurityTel != null"> |
||||
|
machine_security_tel = #{machineSecurityTel,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="machineSecurityCustomerCode != null"> |
||||
|
machine_security_customer_code = #{machineSecurityCustomerCode,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="nightShiftType != null"> |
||||
|
night_shift_type = #{nightShiftType,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="nightGuardCount != null"> |
||||
|
night_guard_count = #{nightGuardCount,jdbcType=INTEGER}, |
||||
|
</if> |
||||
|
<if test="securitySwitchTime != null"> |
||||
|
security_switch_time = #{securitySwitchTime,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="securityPhs != null"> |
||||
|
security_phs = #{securityPhs,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="mallSecurityTel != null"> |
||||
|
mall_security_tel = #{mallSecurityTel,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="facilitySideType != null"> |
||||
|
facility_side_type = #{facilitySideType,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="adDirectTel != null"> |
||||
|
ad_direct_tel = #{adDirectTel,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="alarmReceptionNote != null"> |
||||
|
alarm_reception_note = #{alarmReceptionNote,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="escalationFlow != null"> |
||||
|
escalation_flow = #{escalationFlow,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="contractStartDate != null"> |
||||
|
contract_start_date = #{contractStartDate,jdbcType=DATE}, |
||||
|
</if> |
||||
|
<if test="openDate != null"> |
||||
|
open_date = #{openDate,jdbcType=DATE}, |
||||
|
</if> |
||||
|
<if test="contractEndDate != null"> |
||||
|
contract_end_date = #{contractEndDate,jdbcType=DATE}, |
||||
|
</if> |
||||
|
<if test="legacyAddress != null"> |
||||
|
legacy_address = #{legacyAddress,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="legacyPropertyFlag != null"> |
||||
|
legacy_property_flag = #{legacyPropertyFlag,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="nameChangeHistory != null"> |
||||
|
name_change_history = #{nameChangeHistory,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="communicationInfo != null"> |
||||
|
communication_info = #{communicationInfo,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="napTime != null"> |
||||
|
nap_time = #{napTime,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="noteUpdatedBy != null"> |
||||
|
note_updated_by = #{noteUpdatedBy,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="flag != null"> |
||||
|
flag = #{flag,jdbcType=INTEGER}, |
||||
|
</if> |
||||
|
<if test="createTime != null"> |
||||
|
create_time = #{createTime,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="creatorId != null"> |
||||
|
creator_id = #{creatorId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="modifyTime != null"> |
||||
|
modify_time = #{modifyTime,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="modifierId != null"> |
||||
|
modifier_id = #{modifierId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
</set> |
||||
|
where facility_id = #{facilityId,jdbcType=BIGINT} |
||||
|
</update> |
||||
|
|
||||
|
<update id="updateByPrimaryKey"> |
||||
|
update basic_facility |
||||
|
set building_id = #{buildingId,jdbcType=BIGINT}, |
||||
|
company_id = #{companyId,jdbcType=BIGINT}, |
||||
|
security_company_name = #{securityCompanyName,jdbcType=VARCHAR}, |
||||
|
machine_security_company = #{machineSecurityCompany,jdbcType=VARCHAR}, |
||||
|
machine_security_tel = #{machineSecurityTel,jdbcType=VARCHAR}, |
||||
|
machine_security_customer_code = #{machineSecurityCustomerCode,jdbcType=VARCHAR}, |
||||
|
night_shift_type = #{nightShiftType,jdbcType=VARCHAR}, |
||||
|
night_guard_count = #{nightGuardCount,jdbcType=INTEGER}, |
||||
|
security_switch_time = #{securitySwitchTime,jdbcType=VARCHAR}, |
||||
|
security_phs = #{securityPhs,jdbcType=VARCHAR}, |
||||
|
mall_security_tel = #{mallSecurityTel,jdbcType=VARCHAR}, |
||||
|
facility_side_type = #{facilitySideType,jdbcType=VARCHAR}, |
||||
|
ad_direct_tel = #{adDirectTel,jdbcType=VARCHAR}, |
||||
|
alarm_reception_note = #{alarmReceptionNote,jdbcType=VARCHAR}, |
||||
|
escalation_flow = #{escalationFlow,jdbcType=VARCHAR}, |
||||
|
contract_start_date = #{contractStartDate,jdbcType=DATE}, |
||||
|
open_date = #{openDate,jdbcType=DATE}, |
||||
|
contract_end_date = #{contractEndDate,jdbcType=DATE}, |
||||
|
legacy_address = #{legacyAddress,jdbcType=VARCHAR}, |
||||
|
legacy_property_flag = #{legacyPropertyFlag,jdbcType=TINYINT}, |
||||
|
name_change_history = #{nameChangeHistory,jdbcType=VARCHAR}, |
||||
|
communication_info = #{communicationInfo,jdbcType=VARCHAR}, |
||||
|
nap_time = #{napTime,jdbcType=VARCHAR}, |
||||
|
note_updated_by = #{noteUpdatedBy,jdbcType=VARCHAR}, |
||||
|
flag = #{flag,jdbcType=INTEGER}, |
||||
|
create_time = #{createTime,jdbcType=BIGINT}, |
||||
|
creator_id = #{creatorId,jdbcType=BIGINT}, |
||||
|
modify_time = #{modifyTime,jdbcType=BIGINT}, |
||||
|
modifier_id = #{modifierId,jdbcType=BIGINT} |
||||
|
where facility_id = #{facilityId,jdbcType=BIGINT} |
||||
|
</update> |
||||
|
|
||||
|
</mapper> |
||||
@ -0,0 +1,54 @@ |
|||||
|
<?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.techsor.datacenter.business.dao.ex.BasicFacilityMapperExt"> |
||||
|
|
||||
|
<select id="getListPage" resultType="com.techsor.datacenter.business.vo.facility.FacilityPageVO"> |
||||
|
select |
||||
|
bf.facility_id as facilityId, |
||||
|
bf.building_id as buildingId, |
||||
|
bb.name as buildingName, |
||||
|
bf.company_id as companyId, |
||||
|
bf.security_company_name as securityCompanyName, |
||||
|
bf.machine_security_company as machineSecurityCompany, |
||||
|
bf.machine_security_tel as machineSecurityTel, |
||||
|
bf.machine_security_customer_code as machineSecurityCustomerCode, |
||||
|
bf.night_shift_type as nightShiftType, |
||||
|
bf.night_guard_count as nightGuardCount, |
||||
|
bf.security_switch_time as securitySwitchTime, |
||||
|
bf.security_phs as securityPhs, |
||||
|
bf.mall_security_tel as mallSecurityTel, |
||||
|
bf.facility_side_type as facilitySideType, |
||||
|
bf.ad_direct_tel as adDirectTel, |
||||
|
bf.alarm_reception_note as alarmReceptionNote, |
||||
|
bf.escalation_flow as escalationFlow, |
||||
|
bf.contract_start_date as contractStartDate, |
||||
|
bf.open_date as openDate, |
||||
|
bf.contract_end_date as contractEndDate, |
||||
|
bf.legacy_address as legacyAddress, |
||||
|
bf.legacy_property_flag as legacyPropertyFlag, |
||||
|
bf.name_change_history as nameChangeHistory, |
||||
|
bf.communication_info as communicationInfo, |
||||
|
bf.nap_time as napTime, |
||||
|
bf.note_updated_by as noteUpdatedBy |
||||
|
from |
||||
|
basic_facility bf |
||||
|
left join basic_building bb on bf.building_id = bb.building_id |
||||
|
<where> |
||||
|
<if test="param.buildingId != null"> |
||||
|
and bf.building_id = #{param.buildingId} |
||||
|
</if> |
||||
|
<if test="param.securityCompanyName != null and param.securityCompanyName != ''"> |
||||
|
and bf.security_company_name like CONCAT('%',#{param.securityCompanyName},'%') |
||||
|
</if> |
||||
|
<if test="param.machineSecurityCompany != null and param.machineSecurityCompany != ''"> |
||||
|
and bf.machine_security_company like CONCAT('%',#{param.machineSecurityCompany},'%') |
||||
|
</if> |
||||
|
and bf.flag = 0 |
||||
|
<if test="companyId != null"> |
||||
|
and bf.company_id = #{companyId} |
||||
|
</if> |
||||
|
</where> |
||||
|
order by bf.facility_id desc |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
||||
@ -0,0 +1,19 @@ |
|||||
|
package com.techsor.datacenter.business.dto.data; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Data |
||||
|
public class QueryDeviceDataParams { |
||||
|
|
||||
|
@Schema(description = "Device ID list", example = "[\"FFFF0001\",\"FFFF0002\"]", required = true) |
||||
|
private List<String> deviceIds; |
||||
|
|
||||
|
@Schema(description = "Start time, Unix milliseconds timestamp", example = "1709870240425", required = true) |
||||
|
private Long startTime; |
||||
|
|
||||
|
@Schema(description = "End time, Unix milliseconds timestamp", example = "1709889240425", required = true) |
||||
|
private Long endTime; |
||||
|
} |
||||
@ -0,0 +1,77 @@ |
|||||
|
package com.techsor.datacenter.business.dto.facility; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class FacilityAddParam { |
||||
|
|
||||
|
@Schema(description = "楼宇ID", example = "1", required = true) |
||||
|
private Long buildingId; |
||||
|
|
||||
|
@Schema(description = "常驻警备公司名称", example = "ABC Security") |
||||
|
private String securityCompanyName; |
||||
|
|
||||
|
@Schema(description = "机械警备公司名称", example = "XYZ Machine Security") |
||||
|
private String machineSecurityCompany; |
||||
|
|
||||
|
@Schema(description = "机械警备联系电话", example = "03-1234-5678") |
||||
|
private String machineSecurityTel; |
||||
|
|
||||
|
@Schema(description = "机械警备客户代码", example = "CUST001") |
||||
|
private String machineSecurityCustomerCode; |
||||
|
|
||||
|
@Schema(description = "夜间体制区分", example = "A") |
||||
|
private String nightShiftType; |
||||
|
|
||||
|
@Schema(description = "夜间常驻人数", example = "2") |
||||
|
private Integer nightGuardCount; |
||||
|
|
||||
|
@Schema(description = "常驻→机械 切换时间", example = "22:00") |
||||
|
private String securitySwitchTime; |
||||
|
|
||||
|
@Schema(description = "警备员PHS号码", example = "070-1234-5678") |
||||
|
private String securityPhs; |
||||
|
|
||||
|
@Schema(description = "商场侧警备电话", example = "03-8765-4321") |
||||
|
private String mallSecurityTel; |
||||
|
|
||||
|
@Schema(description = "商场/永旺侧区分", example = "Mall") |
||||
|
private String facilitySideType; |
||||
|
|
||||
|
@Schema(description = "AD直通电话", example = "03-1111-2222") |
||||
|
private String adDirectTel; |
||||
|
|
||||
|
@Schema(description = "警报接收特记", example = "注意事项...") |
||||
|
private String alarmReceptionNote; |
||||
|
|
||||
|
@Schema(description = "联络流程", example = "联络流程说明...") |
||||
|
private String escalationFlow; |
||||
|
|
||||
|
@Schema(description = "合同开始日", example = "2024-01-01") |
||||
|
private String contractStartDate; |
||||
|
|
||||
|
@Schema(description = "开业日", example = "2024-04-01") |
||||
|
private String openDate; |
||||
|
|
||||
|
@Schema(description = "解约日/闭店日", example = "2025-12-31") |
||||
|
private String contractEndDate; |
||||
|
|
||||
|
@Schema(description = "旧地址", example = "旧地址信息") |
||||
|
private String legacyAddress; |
||||
|
|
||||
|
@Schema(description = "旧物业标志 0:否 1:是", example = "0") |
||||
|
private Integer legacyPropertyFlag; |
||||
|
|
||||
|
@Schema(description = "名称变更履历", example = "变更履历...") |
||||
|
private String nameChangeHistory; |
||||
|
|
||||
|
@Schema(description = "SIM/通信线路", example = "通信线路信息") |
||||
|
private String communicationInfo; |
||||
|
|
||||
|
@Schema(description = "值班小睡时段", example = "23:00-06:00") |
||||
|
private String napTime; |
||||
|
|
||||
|
@Schema(description = "记载者/更新日", example = "张三") |
||||
|
private String noteUpdatedBy; |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
package com.techsor.datacenter.business.dto.facility; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class FacilityDeleteParam { |
||||
|
|
||||
|
@Schema(description = "设施ID, 逗号分隔", example = "1,2,3") |
||||
|
private String facilityIds; |
||||
|
} |
||||
@ -0,0 +1,80 @@ |
|||||
|
package com.techsor.datacenter.business.dto.facility; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class FacilityEditParam { |
||||
|
|
||||
|
@Schema(description = "设施ID", example = "1", required = true) |
||||
|
private Long facilityId; |
||||
|
|
||||
|
@Schema(description = "楼宇ID", example = "1") |
||||
|
private Long buildingId; |
||||
|
|
||||
|
@Schema(description = "常驻警备公司名称", example = "ABC Security") |
||||
|
private String securityCompanyName; |
||||
|
|
||||
|
@Schema(description = "机械警备公司名称", example = "XYZ Machine Security") |
||||
|
private String machineSecurityCompany; |
||||
|
|
||||
|
@Schema(description = "机械警备联系电话", example = "03-1234-5678") |
||||
|
private String machineSecurityTel; |
||||
|
|
||||
|
@Schema(description = "机械警备客户代码", example = "CUST001") |
||||
|
private String machineSecurityCustomerCode; |
||||
|
|
||||
|
@Schema(description = "夜间体制区分", example = "A") |
||||
|
private String nightShiftType; |
||||
|
|
||||
|
@Schema(description = "夜间常驻人数", example = "2") |
||||
|
private Integer nightGuardCount; |
||||
|
|
||||
|
@Schema(description = "常驻→机械 切换时间", example = "22:00") |
||||
|
private String securitySwitchTime; |
||||
|
|
||||
|
@Schema(description = "警备员PHS号码", example = "070-1234-5678") |
||||
|
private String securityPhs; |
||||
|
|
||||
|
@Schema(description = "商场侧警备电话", example = "03-8765-4321") |
||||
|
private String mallSecurityTel; |
||||
|
|
||||
|
@Schema(description = "商场/永旺侧区分", example = "Mall") |
||||
|
private String facilitySideType; |
||||
|
|
||||
|
@Schema(description = "AD直通电话", example = "03-1111-2222") |
||||
|
private String adDirectTel; |
||||
|
|
||||
|
@Schema(description = "警报接收特记", example = "注意事项...") |
||||
|
private String alarmReceptionNote; |
||||
|
|
||||
|
@Schema(description = "联络流程", example = "联络流程说明...") |
||||
|
private String escalationFlow; |
||||
|
|
||||
|
@Schema(description = "合同开始日", example = "2024-01-01") |
||||
|
private String contractStartDate; |
||||
|
|
||||
|
@Schema(description = "开业日", example = "2024-04-01") |
||||
|
private String openDate; |
||||
|
|
||||
|
@Schema(description = "解约日/闭店日", example = "2025-12-31") |
||||
|
private String contractEndDate; |
||||
|
|
||||
|
@Schema(description = "旧地址", example = "旧地址信息") |
||||
|
private String legacyAddress; |
||||
|
|
||||
|
@Schema(description = "旧物业标志 0:否 1:是", example = "0") |
||||
|
private Integer legacyPropertyFlag; |
||||
|
|
||||
|
@Schema(description = "名称变更履历", example = "变更履历...") |
||||
|
private String nameChangeHistory; |
||||
|
|
||||
|
@Schema(description = "SIM/通信线路", example = "通信线路信息") |
||||
|
private String communicationInfo; |
||||
|
|
||||
|
@Schema(description = "值班小睡时段", example = "23:00-06:00") |
||||
|
private String napTime; |
||||
|
|
||||
|
@Schema(description = "记载者/更新日", example = "张三") |
||||
|
private String noteUpdatedBy; |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
package com.techsor.datacenter.business.dto.facility; |
||||
|
|
||||
|
import com.techsor.datacenter.business.dto.BaseSearchParams; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class FacilityQueryParam extends BaseSearchParams { |
||||
|
|
||||
|
@Schema(description = "楼宇ID", example = "1") |
||||
|
private Long buildingId; |
||||
|
|
||||
|
@Schema(description = "常驻警备公司名称关键字", example = "ABC") |
||||
|
private String securityCompanyName; |
||||
|
|
||||
|
@Schema(description = "机械警备公司名称关键字", example = "XYZ") |
||||
|
private String machineSecurityCompany; |
||||
|
} |
||||
@ -0,0 +1,279 @@ |
|||||
|
package com.techsor.datacenter.business.model; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
public class BasicFacility implements Serializable { |
||||
|
private Long facilityId; |
||||
|
private Long buildingId; |
||||
|
private Long companyId; |
||||
|
private String securityCompanyName; |
||||
|
private String machineSecurityCompany; |
||||
|
private String machineSecurityTel; |
||||
|
private String machineSecurityCustomerCode; |
||||
|
private String nightShiftType; |
||||
|
private Integer nightGuardCount; |
||||
|
private String securitySwitchTime; |
||||
|
private String securityPhs; |
||||
|
private String mallSecurityTel; |
||||
|
private String facilitySideType; |
||||
|
private String adDirectTel; |
||||
|
private String alarmReceptionNote; |
||||
|
private String escalationFlow; |
||||
|
private Date contractStartDate; |
||||
|
private Date openDate; |
||||
|
private Date contractEndDate; |
||||
|
private String legacyAddress; |
||||
|
private Integer legacyPropertyFlag; |
||||
|
private String nameChangeHistory; |
||||
|
private String communicationInfo; |
||||
|
private String napTime; |
||||
|
private String noteUpdatedBy; |
||||
|
private Integer flag; |
||||
|
private Long createTime; |
||||
|
private Long creatorId; |
||||
|
private Long modifyTime; |
||||
|
private Long modifierId; |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
public Long getFacilityId() { |
||||
|
return facilityId; |
||||
|
} |
||||
|
|
||||
|
public void setFacilityId(Long facilityId) { |
||||
|
this.facilityId = facilityId; |
||||
|
} |
||||
|
|
||||
|
public Long getBuildingId() { |
||||
|
return buildingId; |
||||
|
} |
||||
|
|
||||
|
public void setBuildingId(Long buildingId) { |
||||
|
this.buildingId = buildingId; |
||||
|
} |
||||
|
|
||||
|
public Long getCompanyId() { |
||||
|
return companyId; |
||||
|
} |
||||
|
|
||||
|
public void setCompanyId(Long companyId) { |
||||
|
this.companyId = companyId; |
||||
|
} |
||||
|
|
||||
|
public String getSecurityCompanyName() { |
||||
|
return securityCompanyName; |
||||
|
} |
||||
|
|
||||
|
public void setSecurityCompanyName(String securityCompanyName) { |
||||
|
this.securityCompanyName = securityCompanyName; |
||||
|
} |
||||
|
|
||||
|
public String getMachineSecurityCompany() { |
||||
|
return machineSecurityCompany; |
||||
|
} |
||||
|
|
||||
|
public void setMachineSecurityCompany(String machineSecurityCompany) { |
||||
|
this.machineSecurityCompany = machineSecurityCompany; |
||||
|
} |
||||
|
|
||||
|
public String getMachineSecurityTel() { |
||||
|
return machineSecurityTel; |
||||
|
} |
||||
|
|
||||
|
public void setMachineSecurityTel(String machineSecurityTel) { |
||||
|
this.machineSecurityTel = machineSecurityTel; |
||||
|
} |
||||
|
|
||||
|
public String getMachineSecurityCustomerCode() { |
||||
|
return machineSecurityCustomerCode; |
||||
|
} |
||||
|
|
||||
|
public void setMachineSecurityCustomerCode(String machineSecurityCustomerCode) { |
||||
|
this.machineSecurityCustomerCode = machineSecurityCustomerCode; |
||||
|
} |
||||
|
|
||||
|
public String getNightShiftType() { |
||||
|
return nightShiftType; |
||||
|
} |
||||
|
|
||||
|
public void setNightShiftType(String nightShiftType) { |
||||
|
this.nightShiftType = nightShiftType; |
||||
|
} |
||||
|
|
||||
|
public Integer getNightGuardCount() { |
||||
|
return nightGuardCount; |
||||
|
} |
||||
|
|
||||
|
public void setNightGuardCount(Integer nightGuardCount) { |
||||
|
this.nightGuardCount = nightGuardCount; |
||||
|
} |
||||
|
|
||||
|
public String getSecuritySwitchTime() { |
||||
|
return securitySwitchTime; |
||||
|
} |
||||
|
|
||||
|
public void setSecuritySwitchTime(String securitySwitchTime) { |
||||
|
this.securitySwitchTime = securitySwitchTime; |
||||
|
} |
||||
|
|
||||
|
public String getSecurityPhs() { |
||||
|
return securityPhs; |
||||
|
} |
||||
|
|
||||
|
public void setSecurityPhs(String securityPhs) { |
||||
|
this.securityPhs = securityPhs; |
||||
|
} |
||||
|
|
||||
|
public String getMallSecurityTel() { |
||||
|
return mallSecurityTel; |
||||
|
} |
||||
|
|
||||
|
public void setMallSecurityTel(String mallSecurityTel) { |
||||
|
this.mallSecurityTel = mallSecurityTel; |
||||
|
} |
||||
|
|
||||
|
public String getFacilitySideType() { |
||||
|
return facilitySideType; |
||||
|
} |
||||
|
|
||||
|
public void setFacilitySideType(String facilitySideType) { |
||||
|
this.facilitySideType = facilitySideType; |
||||
|
} |
||||
|
|
||||
|
public String getAdDirectTel() { |
||||
|
return adDirectTel; |
||||
|
} |
||||
|
|
||||
|
public void setAdDirectTel(String adDirectTel) { |
||||
|
this.adDirectTel = adDirectTel; |
||||
|
} |
||||
|
|
||||
|
public String getAlarmReceptionNote() { |
||||
|
return alarmReceptionNote; |
||||
|
} |
||||
|
|
||||
|
public void setAlarmReceptionNote(String alarmReceptionNote) { |
||||
|
this.alarmReceptionNote = alarmReceptionNote; |
||||
|
} |
||||
|
|
||||
|
public String getEscalationFlow() { |
||||
|
return escalationFlow; |
||||
|
} |
||||
|
|
||||
|
public void setEscalationFlow(String escalationFlow) { |
||||
|
this.escalationFlow = escalationFlow; |
||||
|
} |
||||
|
|
||||
|
public Date getContractStartDate() { |
||||
|
return contractStartDate; |
||||
|
} |
||||
|
|
||||
|
public void setContractStartDate(Date contractStartDate) { |
||||
|
this.contractStartDate = contractStartDate; |
||||
|
} |
||||
|
|
||||
|
public Date getOpenDate() { |
||||
|
return openDate; |
||||
|
} |
||||
|
|
||||
|
public void setOpenDate(Date openDate) { |
||||
|
this.openDate = openDate; |
||||
|
} |
||||
|
|
||||
|
public Date getContractEndDate() { |
||||
|
return contractEndDate; |
||||
|
} |
||||
|
|
||||
|
public void setContractEndDate(Date contractEndDate) { |
||||
|
this.contractEndDate = contractEndDate; |
||||
|
} |
||||
|
|
||||
|
public String getLegacyAddress() { |
||||
|
return legacyAddress; |
||||
|
} |
||||
|
|
||||
|
public void setLegacyAddress(String legacyAddress) { |
||||
|
this.legacyAddress = legacyAddress; |
||||
|
} |
||||
|
|
||||
|
public Integer getLegacyPropertyFlag() { |
||||
|
return legacyPropertyFlag; |
||||
|
} |
||||
|
|
||||
|
public void setLegacyPropertyFlag(Integer legacyPropertyFlag) { |
||||
|
this.legacyPropertyFlag = legacyPropertyFlag; |
||||
|
} |
||||
|
|
||||
|
public String getNameChangeHistory() { |
||||
|
return nameChangeHistory; |
||||
|
} |
||||
|
|
||||
|
public void setNameChangeHistory(String nameChangeHistory) { |
||||
|
this.nameChangeHistory = nameChangeHistory; |
||||
|
} |
||||
|
|
||||
|
public String getCommunicationInfo() { |
||||
|
return communicationInfo; |
||||
|
} |
||||
|
|
||||
|
public void setCommunicationInfo(String communicationInfo) { |
||||
|
this.communicationInfo = communicationInfo; |
||||
|
} |
||||
|
|
||||
|
public String getNapTime() { |
||||
|
return napTime; |
||||
|
} |
||||
|
|
||||
|
public void setNapTime(String napTime) { |
||||
|
this.napTime = napTime; |
||||
|
} |
||||
|
|
||||
|
public String getNoteUpdatedBy() { |
||||
|
return noteUpdatedBy; |
||||
|
} |
||||
|
|
||||
|
public void setNoteUpdatedBy(String noteUpdatedBy) { |
||||
|
this.noteUpdatedBy = noteUpdatedBy; |
||||
|
} |
||||
|
|
||||
|
public Integer getFlag() { |
||||
|
return flag; |
||||
|
} |
||||
|
|
||||
|
public void setFlag(Integer flag) { |
||||
|
this.flag = flag; |
||||
|
} |
||||
|
|
||||
|
public Long getCreateTime() { |
||||
|
return createTime; |
||||
|
} |
||||
|
|
||||
|
public void setCreateTime(Long createTime) { |
||||
|
this.createTime = createTime; |
||||
|
} |
||||
|
|
||||
|
public Long getCreatorId() { |
||||
|
return creatorId; |
||||
|
} |
||||
|
|
||||
|
public void setCreatorId(Long creatorId) { |
||||
|
this.creatorId = creatorId; |
||||
|
} |
||||
|
|
||||
|
public Long getModifyTime() { |
||||
|
return modifyTime; |
||||
|
} |
||||
|
|
||||
|
public void setModifyTime(Long modifyTime) { |
||||
|
this.modifyTime = modifyTime; |
||||
|
} |
||||
|
|
||||
|
public Long getModifierId() { |
||||
|
return modifierId; |
||||
|
} |
||||
|
|
||||
|
public void setModifierId(Long modifierId) { |
||||
|
this.modifierId = modifierId; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,180 @@ |
|||||
|
package com.techsor.datacenter.business.model; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
public class BasicFacilityExample { |
||||
|
protected String orderByClause; |
||||
|
protected boolean distinct; |
||||
|
protected List<Criteria> oredCriteria; |
||||
|
|
||||
|
public BasicFacilityExample() { |
||||
|
oredCriteria = new ArrayList<>(); |
||||
|
} |
||||
|
|
||||
|
public void setOrderByClause(String orderByClause) { |
||||
|
this.orderByClause = orderByClause; |
||||
|
} |
||||
|
|
||||
|
public String getOrderByClause() { |
||||
|
return orderByClause; |
||||
|
} |
||||
|
|
||||
|
public void setDistinct(boolean distinct) { |
||||
|
this.distinct = distinct; |
||||
|
} |
||||
|
|
||||
|
public boolean isDistinct() { |
||||
|
return distinct; |
||||
|
} |
||||
|
|
||||
|
public List<Criteria> getOredCriteria() { |
||||
|
return oredCriteria; |
||||
|
} |
||||
|
|
||||
|
public void or(Criteria criteria) { |
||||
|
oredCriteria.add(criteria); |
||||
|
} |
||||
|
|
||||
|
public Criteria createCriteria() { |
||||
|
Criteria criteria = new Criteria(); |
||||
|
if (oredCriteria.size() == 0) { |
||||
|
oredCriteria.add(criteria); |
||||
|
} |
||||
|
return criteria; |
||||
|
} |
||||
|
|
||||
|
public void clear() { |
||||
|
oredCriteria.clear(); |
||||
|
orderByClause = null; |
||||
|
distinct = false; |
||||
|
} |
||||
|
|
||||
|
public static class Criteria { |
||||
|
protected List<Criterion> criteria; |
||||
|
|
||||
|
protected Criteria() { |
||||
|
criteria = new ArrayList<>(); |
||||
|
} |
||||
|
|
||||
|
public boolean isValid() { |
||||
|
return criteria.size() > 0; |
||||
|
} |
||||
|
|
||||
|
public List<Criterion> getCriteria() { |
||||
|
return criteria; |
||||
|
} |
||||
|
|
||||
|
protected void addCriterion(String condition) { |
||||
|
criteria.add(new Criterion(condition)); |
||||
|
} |
||||
|
|
||||
|
protected void addCriterion(String condition, Object value) { |
||||
|
criteria.add(new Criterion(condition, value)); |
||||
|
} |
||||
|
|
||||
|
protected void addCriterion(String condition, Object value1, Object value2) { |
||||
|
criteria.add(new Criterion(condition, value1, value2)); |
||||
|
} |
||||
|
|
||||
|
public Criteria andFacilityIdEqualTo(Long value) { |
||||
|
addCriterion("facility_id =", value); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andFacilityIdIn(List<Long> values) { |
||||
|
addCriterion("facility_id in", values); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andBuildingIdEqualTo(Long value) { |
||||
|
addCriterion("building_id =", value); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andBuildingIdIn(List<Long> values) { |
||||
|
addCriterion("building_id in", values); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCompanyIdEqualTo(Long value) { |
||||
|
addCriterion("company_id =", value); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andCompanyIdIn(List<Long> values) { |
||||
|
addCriterion("company_id in", values); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andFlagEqualTo(Integer value) { |
||||
|
addCriterion("flag =", value); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public Criteria andFlagNotEqualTo(Integer value) { |
||||
|
addCriterion("flag <>", value); |
||||
|
return this; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static class Criterion { |
||||
|
private String condition; |
||||
|
private Object value; |
||||
|
private Object secondValue; |
||||
|
private boolean noValue; |
||||
|
private boolean singleValue; |
||||
|
private boolean betweenValue; |
||||
|
private boolean listValue; |
||||
|
|
||||
|
protected Criterion(String condition) { |
||||
|
this.condition = condition; |
||||
|
this.noValue = true; |
||||
|
} |
||||
|
|
||||
|
protected Criterion(String condition, Object value) { |
||||
|
this.condition = condition; |
||||
|
this.value = value; |
||||
|
if (value instanceof List<?>) { |
||||
|
this.listValue = true; |
||||
|
} else { |
||||
|
this.singleValue = true; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
protected Criterion(String condition, Object value, Object secondValue) { |
||||
|
this.condition = condition; |
||||
|
this.value = value; |
||||
|
this.secondValue = secondValue; |
||||
|
this.betweenValue = true; |
||||
|
} |
||||
|
|
||||
|
public String getCondition() { |
||||
|
return condition; |
||||
|
} |
||||
|
|
||||
|
public Object getValue() { |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
public Object getSecondValue() { |
||||
|
return secondValue; |
||||
|
} |
||||
|
|
||||
|
public boolean isNoValue() { |
||||
|
return noValue; |
||||
|
} |
||||
|
|
||||
|
public boolean isSingleValue() { |
||||
|
return singleValue; |
||||
|
} |
||||
|
|
||||
|
public boolean isBetweenValue() { |
||||
|
return betweenValue; |
||||
|
} |
||||
|
|
||||
|
public boolean isListValue() { |
||||
|
return listValue; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,41 @@ |
|||||
|
package com.techsor.datacenter.business.vo.data; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class DeviceDataVO { |
||||
|
|
||||
|
@Schema(description = "Device ID", example = "FFFF0001") |
||||
|
private String deviceId; |
||||
|
|
||||
|
@Schema(description = "Device name", example = "温度传感器") |
||||
|
private String deviceName; |
||||
|
|
||||
|
@Schema(description = "Raw data JSON", example = "{\"temp\":25.5}") |
||||
|
private String rawData; |
||||
|
|
||||
|
@Schema(description = "Device data values, comma-separated", example = "25.5") |
||||
|
private String dataValue; |
||||
|
|
||||
|
@Schema(description = "Receive timestamp (milliseconds)", example = "1709870240425") |
||||
|
private Long receiveTs; |
||||
|
|
||||
|
@Schema(description = "Status", example = "UP") |
||||
|
private String status; |
||||
|
|
||||
|
@Schema(description = "Alert level", example = "1") |
||||
|
private String alertLevel; |
||||
|
|
||||
|
@Schema(description = "Alert content", example = "温度异常") |
||||
|
private String alertContent; |
||||
|
|
||||
|
@Schema(description = "Building info", example = "东京建物日本桥ビル") |
||||
|
private String buildingInfo; |
||||
|
|
||||
|
@Schema(description = "Floor info", example = "3F") |
||||
|
private String floorInfo; |
||||
|
|
||||
|
@Schema(description = "Space info", example = "会議室A") |
||||
|
private String spaceInfo; |
||||
|
} |
||||
@ -0,0 +1,86 @@ |
|||||
|
package com.techsor.datacenter.business.vo.facility; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class FacilityPageVO { |
||||
|
|
||||
|
@Schema(description = "设施ID") |
||||
|
private Long facilityId; |
||||
|
|
||||
|
@Schema(description = "楼宇ID") |
||||
|
private Long buildingId; |
||||
|
|
||||
|
@Schema(description = "楼宇名称") |
||||
|
private String buildingName; |
||||
|
|
||||
|
@Schema(description = "企业ID") |
||||
|
private Long companyId; |
||||
|
|
||||
|
@Schema(description = "常驻警备公司名称") |
||||
|
private String securityCompanyName; |
||||
|
|
||||
|
@Schema(description = "机械警备公司名称") |
||||
|
private String machineSecurityCompany; |
||||
|
|
||||
|
@Schema(description = "机械警备联系电话") |
||||
|
private String machineSecurityTel; |
||||
|
|
||||
|
@Schema(description = "机械警备客户代码") |
||||
|
private String machineSecurityCustomerCode; |
||||
|
|
||||
|
@Schema(description = "夜间体制区分") |
||||
|
private String nightShiftType; |
||||
|
|
||||
|
@Schema(description = "夜间常驻人数") |
||||
|
private Integer nightGuardCount; |
||||
|
|
||||
|
@Schema(description = "常驻→机械 切换时间") |
||||
|
private String securitySwitchTime; |
||||
|
|
||||
|
@Schema(description = "警备员PHS号码") |
||||
|
private String securityPhs; |
||||
|
|
||||
|
@Schema(description = "商场侧警备电话") |
||||
|
private String mallSecurityTel; |
||||
|
|
||||
|
@Schema(description = "商场/永旺侧区分") |
||||
|
private String facilitySideType; |
||||
|
|
||||
|
@Schema(description = "AD直通电话") |
||||
|
private String adDirectTel; |
||||
|
|
||||
|
@Schema(description = "警报接收特记") |
||||
|
private String alarmReceptionNote; |
||||
|
|
||||
|
@Schema(description = "联络流程") |
||||
|
private String escalationFlow; |
||||
|
|
||||
|
@Schema(description = "合同开始日") |
||||
|
private String contractStartDate; |
||||
|
|
||||
|
@Schema(description = "开业日") |
||||
|
private String openDate; |
||||
|
|
||||
|
@Schema(description = "解约日/闭店日") |
||||
|
private String contractEndDate; |
||||
|
|
||||
|
@Schema(description = "旧地址") |
||||
|
private String legacyAddress; |
||||
|
|
||||
|
@Schema(description = "旧物业标志 0:否 1:是") |
||||
|
private Integer legacyPropertyFlag; |
||||
|
|
||||
|
@Schema(description = "名称变更履历") |
||||
|
private String nameChangeHistory; |
||||
|
|
||||
|
@Schema(description = "SIM/通信线路") |
||||
|
private String communicationInfo; |
||||
|
|
||||
|
@Schema(description = "值班小睡时段") |
||||
|
private String napTime; |
||||
|
|
||||
|
@Schema(description = "记载者/更新日") |
||||
|
private String noteUpdatedBy; |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
package com.techsor.datacenter.business.service; |
||||
|
|
||||
|
import com.techsor.datacenter.business.common.response.PageInfo; |
||||
|
import com.techsor.datacenter.business.common.response.SimpleDataResponse; |
||||
|
import com.techsor.datacenter.business.dto.facility.FacilityAddParam; |
||||
|
import com.techsor.datacenter.business.dto.facility.FacilityDeleteParam; |
||||
|
import com.techsor.datacenter.business.dto.facility.FacilityEditParam; |
||||
|
import com.techsor.datacenter.business.dto.facility.FacilityQueryParam; |
||||
|
import com.techsor.datacenter.business.vo.facility.FacilityPageVO; |
||||
|
|
||||
|
public interface FacilityService { |
||||
|
|
||||
|
PageInfo<FacilityPageVO> query(FacilityQueryParam param, Long userId, Long companyId, Integer languageType); |
||||
|
|
||||
|
SimpleDataResponse add(FacilityAddParam param, Long userId, Long companyId, Integer languageType); |
||||
|
|
||||
|
SimpleDataResponse edit(FacilityEditParam param, Long userId, Long companyId, Integer languageType); |
||||
|
|
||||
|
SimpleDataResponse batchDelete(FacilityDeleteParam param, Long userId, Long companyId, Integer languageType); |
||||
|
} |
||||
@ -0,0 +1,243 @@ |
|||||
|
package com.techsor.datacenter.business.service.impl; |
||||
|
|
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import com.google.gson.Gson; |
||||
|
import com.techsor.datacenter.business.common.Constants; |
||||
|
import com.techsor.datacenter.business.common.language.msg.MsgLanguageChange; |
||||
|
import com.techsor.datacenter.business.common.response.PageInfo; |
||||
|
import com.techsor.datacenter.business.common.response.ResponseCode; |
||||
|
import com.techsor.datacenter.business.common.response.SimpleDataResponse; |
||||
|
import com.techsor.datacenter.business.dao.ex.BasicFacilityMapperExt; |
||||
|
import com.techsor.datacenter.business.dto.facility.FacilityAddParam; |
||||
|
import com.techsor.datacenter.business.dto.facility.FacilityDeleteParam; |
||||
|
import com.techsor.datacenter.business.dto.facility.FacilityEditParam; |
||||
|
import com.techsor.datacenter.business.dto.facility.FacilityQueryParam; |
||||
|
import com.techsor.datacenter.business.model.BasicFacility; |
||||
|
import com.techsor.datacenter.business.model.BasicFacilityExample; |
||||
|
import com.techsor.datacenter.business.service.FacilityService; |
||||
|
import com.techsor.datacenter.business.service.UserOperationLogsService; |
||||
|
import com.techsor.datacenter.business.vo.facility.FacilityPageVO; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
import org.springframework.transaction.interceptor.TransactionAspectSupport; |
||||
|
import org.springframework.util.ObjectUtils; |
||||
|
|
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
|
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class FacilityServiceImpl implements FacilityService { |
||||
|
|
||||
|
private static Logger logger = LoggerFactory.getLogger(FacilityServiceImpl.class); |
||||
|
|
||||
|
@Autowired |
||||
|
private MsgLanguageChange msgLanguageChange; |
||||
|
|
||||
|
@Autowired |
||||
|
private BasicFacilityMapperExt basicFacilityMapperExt; |
||||
|
|
||||
|
@Autowired |
||||
|
private UserOperationLogsService userOperationLogsService; |
||||
|
|
||||
|
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); |
||||
|
|
||||
|
@Override |
||||
|
public PageInfo<FacilityPageVO> query(FacilityQueryParam param, Long userId, Long companyId, Integer languageType) { |
||||
|
PageHelper.startPage(param.getPageNum() == null ? 1 : param.getPageNum(), param.getPageSize() == null ? 20 : param.getPageSize()); |
||||
|
List<FacilityPageVO> resultList = basicFacilityMapperExt.getListPage(param, companyId); |
||||
|
return new PageInfo<>(resultList); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional |
||||
|
public SimpleDataResponse add(FacilityAddParam param, Long userId, Long companyId, Integer languageType) { |
||||
|
try { |
||||
|
if (ObjectUtils.isEmpty(param.getBuildingId())) { |
||||
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, msgLanguageChange.getParameterMapByCode(languageType, "paramsFormatError")); |
||||
|
} |
||||
|
|
||||
|
BasicFacility insertObj = new BasicFacility(); |
||||
|
insertObj.setBuildingId(param.getBuildingId()); |
||||
|
insertObj.setCompanyId(companyId); |
||||
|
insertObj.setSecurityCompanyName(param.getSecurityCompanyName()); |
||||
|
insertObj.setMachineSecurityCompany(param.getMachineSecurityCompany()); |
||||
|
insertObj.setMachineSecurityTel(param.getMachineSecurityTel()); |
||||
|
insertObj.setMachineSecurityCustomerCode(param.getMachineSecurityCustomerCode()); |
||||
|
insertObj.setNightShiftType(param.getNightShiftType()); |
||||
|
insertObj.setNightGuardCount(param.getNightGuardCount()); |
||||
|
insertObj.setSecuritySwitchTime(param.getSecuritySwitchTime()); |
||||
|
insertObj.setSecurityPhs(param.getSecurityPhs()); |
||||
|
insertObj.setMallSecurityTel(param.getMallSecurityTel()); |
||||
|
insertObj.setFacilitySideType(param.getFacilitySideType()); |
||||
|
insertObj.setAdDirectTel(param.getAdDirectTel()); |
||||
|
insertObj.setAlarmReceptionNote(param.getAlarmReceptionNote()); |
||||
|
insertObj.setEscalationFlow(param.getEscalationFlow()); |
||||
|
if (StringUtils.isNotBlank(param.getContractStartDate())) { |
||||
|
try { |
||||
|
insertObj.setContractStartDate(DATE_FORMAT.parse(param.getContractStartDate())); |
||||
|
} catch (Exception e) { |
||||
|
log.warn("Invalid contractStartDate: {}", param.getContractStartDate()); |
||||
|
} |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(param.getOpenDate())) { |
||||
|
try { |
||||
|
insertObj.setOpenDate(DATE_FORMAT.parse(param.getOpenDate())); |
||||
|
} catch (Exception e) { |
||||
|
log.warn("Invalid openDate: {}", param.getOpenDate()); |
||||
|
} |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(param.getContractEndDate())) { |
||||
|
try { |
||||
|
insertObj.setContractEndDate(DATE_FORMAT.parse(param.getContractEndDate())); |
||||
|
} catch (Exception e) { |
||||
|
log.warn("Invalid contractEndDate: {}", param.getContractEndDate()); |
||||
|
} |
||||
|
} |
||||
|
insertObj.setLegacyAddress(param.getLegacyAddress()); |
||||
|
insertObj.setLegacyPropertyFlag(param.getLegacyPropertyFlag()); |
||||
|
insertObj.setNameChangeHistory(param.getNameChangeHistory()); |
||||
|
insertObj.setCommunicationInfo(param.getCommunicationInfo()); |
||||
|
insertObj.setNapTime(param.getNapTime()); |
||||
|
insertObj.setNoteUpdatedBy(param.getNoteUpdatedBy()); |
||||
|
insertObj.setFlag(0); |
||||
|
insertObj.setCreateTime(System.currentTimeMillis()); |
||||
|
insertObj.setCreatorId(userId); |
||||
|
|
||||
|
basicFacilityMapperExt.insertSelective(insertObj); |
||||
|
|
||||
|
userOperationLogsService.recordLog(companyId, userId, "添加设施信息:" + insertObj.getFacilityId(), |
||||
|
"Add Facility:" + insertObj.getFacilityId(), |
||||
|
"施設情報を追加:" + insertObj.getFacilityId(), |
||||
|
"Success", Constants.USER_OPERATION_LOG_TYPE_ASSET_LOG, |
||||
|
new Gson().toJson(insertObj)); |
||||
|
|
||||
|
return SimpleDataResponse.success(); |
||||
|
} catch (Exception e) { |
||||
|
logger.error("Error adding facility", e); |
||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
||||
|
return new SimpleDataResponse(ResponseCode.SERVER_ERROR, msgLanguageChange.getParameterMapByCode(languageType, "serviceError")); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional |
||||
|
public SimpleDataResponse edit(FacilityEditParam param, Long userId, Long companyId, Integer languageType) { |
||||
|
try { |
||||
|
if (ObjectUtils.isEmpty(param.getFacilityId())) { |
||||
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, msgLanguageChange.getParameterMapByCode(languageType, "paramsFormatError")); |
||||
|
} |
||||
|
|
||||
|
BasicFacilityExample example = new BasicFacilityExample(); |
||||
|
example.createCriteria().andFacilityIdEqualTo(param.getFacilityId()).andFlagEqualTo(0); |
||||
|
long cnt = basicFacilityMapperExt.countByExample(example); |
||||
|
if (cnt == 0) { |
||||
|
return new SimpleDataResponse(ResponseCode.MSG_ERROR, msgLanguageChange.getParameterMapByCode(languageType, "facilityNotExist")); |
||||
|
} |
||||
|
|
||||
|
BasicFacility updateObj = new BasicFacility(); |
||||
|
updateObj.setFacilityId(param.getFacilityId()); |
||||
|
if (param.getBuildingId() != null) { |
||||
|
updateObj.setBuildingId(param.getBuildingId()); |
||||
|
} |
||||
|
updateObj.setSecurityCompanyName(param.getSecurityCompanyName()); |
||||
|
updateObj.setMachineSecurityCompany(param.getMachineSecurityCompany()); |
||||
|
updateObj.setMachineSecurityTel(param.getMachineSecurityTel()); |
||||
|
updateObj.setMachineSecurityCustomerCode(param.getMachineSecurityCustomerCode()); |
||||
|
updateObj.setNightShiftType(param.getNightShiftType()); |
||||
|
updateObj.setNightGuardCount(param.getNightGuardCount()); |
||||
|
updateObj.setSecuritySwitchTime(param.getSecuritySwitchTime()); |
||||
|
updateObj.setSecurityPhs(param.getSecurityPhs()); |
||||
|
updateObj.setMallSecurityTel(param.getMallSecurityTel()); |
||||
|
updateObj.setFacilitySideType(param.getFacilitySideType()); |
||||
|
updateObj.setAdDirectTel(param.getAdDirectTel()); |
||||
|
updateObj.setAlarmReceptionNote(param.getAlarmReceptionNote()); |
||||
|
updateObj.setEscalationFlow(param.getEscalationFlow()); |
||||
|
if (StringUtils.isNotBlank(param.getContractStartDate())) { |
||||
|
try { |
||||
|
updateObj.setContractStartDate(DATE_FORMAT.parse(param.getContractStartDate())); |
||||
|
} catch (Exception e) { |
||||
|
log.warn("Invalid contractStartDate: {}", param.getContractStartDate()); |
||||
|
} |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(param.getOpenDate())) { |
||||
|
try { |
||||
|
updateObj.setOpenDate(DATE_FORMAT.parse(param.getOpenDate())); |
||||
|
} catch (Exception e) { |
||||
|
log.warn("Invalid openDate: {}", param.getOpenDate()); |
||||
|
} |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(param.getContractEndDate())) { |
||||
|
try { |
||||
|
updateObj.setContractEndDate(DATE_FORMAT.parse(param.getContractEndDate())); |
||||
|
} catch (Exception e) { |
||||
|
log.warn("Invalid contractEndDate: {}", param.getContractEndDate()); |
||||
|
} |
||||
|
} |
||||
|
updateObj.setLegacyAddress(param.getLegacyAddress()); |
||||
|
updateObj.setLegacyPropertyFlag(param.getLegacyPropertyFlag()); |
||||
|
updateObj.setNameChangeHistory(param.getNameChangeHistory()); |
||||
|
updateObj.setCommunicationInfo(param.getCommunicationInfo()); |
||||
|
updateObj.setNapTime(param.getNapTime()); |
||||
|
updateObj.setNoteUpdatedBy(param.getNoteUpdatedBy()); |
||||
|
updateObj.setModifyTime(System.currentTimeMillis()); |
||||
|
updateObj.setModifierId(userId); |
||||
|
|
||||
|
basicFacilityMapperExt.updateByPrimaryKeySelective(updateObj); |
||||
|
|
||||
|
userOperationLogsService.recordLog(companyId, userId, "编辑设施信息:" + updateObj.getFacilityId(), |
||||
|
"Edit Facility:" + updateObj.getFacilityId(), |
||||
|
"施設情報を編集:" + updateObj.getFacilityId(), |
||||
|
"Success", Constants.USER_OPERATION_LOG_TYPE_ASSET_LOG, |
||||
|
new Gson().toJson(updateObj)); |
||||
|
|
||||
|
return SimpleDataResponse.success(); |
||||
|
} catch (Exception e) { |
||||
|
logger.error("Error editing facility", e); |
||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
||||
|
return new SimpleDataResponse(ResponseCode.SERVER_ERROR, msgLanguageChange.getParameterMapByCode(languageType, "serviceError")); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional |
||||
|
public SimpleDataResponse batchDelete(FacilityDeleteParam param, Long userId, Long companyId, Integer languageType) { |
||||
|
try { |
||||
|
if (ObjectUtils.isEmpty(param.getFacilityIds())) { |
||||
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, msgLanguageChange.getParameterMapByCode(languageType, "paramsFormatError")); |
||||
|
} |
||||
|
|
||||
|
List<Long> idList = Arrays.stream(param.getFacilityIds().split(",")) |
||||
|
.map(String::trim) |
||||
|
.filter(s -> !s.isEmpty()) |
||||
|
.map(Long::parseLong) |
||||
|
.toList(); |
||||
|
|
||||
|
for (Long id : idList) { |
||||
|
BasicFacility updateObj = new BasicFacility(); |
||||
|
updateObj.setFacilityId(id); |
||||
|
updateObj.setModifyTime(System.currentTimeMillis()); |
||||
|
updateObj.setModifierId(userId); |
||||
|
updateObj.setFlag(1); |
||||
|
basicFacilityMapperExt.updateByPrimaryKeySelective(updateObj); |
||||
|
} |
||||
|
|
||||
|
userOperationLogsService.recordLog(companyId, userId, "删除设施信息:" + param.getFacilityIds(), |
||||
|
"Delete Facility:" + param.getFacilityIds(), |
||||
|
"施設情報を削除:" + param.getFacilityIds(), |
||||
|
"Success", Constants.USER_OPERATION_LOG_TYPE_ASSET_LOG, ""); |
||||
|
|
||||
|
return SimpleDataResponse.success(); |
||||
|
} catch (Exception e) { |
||||
|
logger.error("Error deleting facility", e); |
||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
||||
|
return new SimpleDataResponse(ResponseCode.SERVER_ERROR, msgLanguageChange.getParameterMapByCode(languageType, "serviceError")); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Binary file not shown.
File diff suppressed because it is too large
@ -0,0 +1,236 @@ |
|||||
|
{ |
||||
|
"openapi": "3.0.0", |
||||
|
"info": { |
||||
|
"title": "Device Data Query API", |
||||
|
"description": "通过设备ID列表和时间范围查询设备数据的接口文档", |
||||
|
"version": "1.0.0" |
||||
|
}, |
||||
|
"servers": [ |
||||
|
{ |
||||
|
"url": "https://api.example.com", |
||||
|
"description": "Production Server" |
||||
|
} |
||||
|
], |
||||
|
"paths": { |
||||
|
"/common/queryDeviceData": { |
||||
|
"post": { |
||||
|
"summary": "Query device data by device IDs and time range", |
||||
|
"description": "根据设备ID列表和时间范围查询Aurora中的设备原始数据,支持跨天查询但时间跨度不能超过7天", |
||||
|
"tags": ["CommonController"], |
||||
|
"parameters": [ |
||||
|
{ |
||||
|
"name": "Apikey", |
||||
|
"in": "header", |
||||
|
"required": true, |
||||
|
"schema": { |
||||
|
"type": "string" |
||||
|
}, |
||||
|
"description": "API key for authentication, provided by user" |
||||
|
}, |
||||
|
{ |
||||
|
"name": "Referer", |
||||
|
"in": "header", |
||||
|
"required": true, |
||||
|
"schema": { |
||||
|
"type": "string" |
||||
|
}, |
||||
|
"description": "Request source domain, must match server's accessControlAllowOrigin config (e.g. https://bilplartform-stg.ifmservice.jp)" |
||||
|
} |
||||
|
], |
||||
|
"requestBody": { |
||||
|
"description": "Query parameters including device IDs and time range", |
||||
|
"required": true, |
||||
|
"content": { |
||||
|
"application/json": { |
||||
|
"schema": { |
||||
|
"$ref": "#/components/schemas/QueryDeviceDataParams" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"responses": { |
||||
|
"200": { |
||||
|
"description": "Successful operation", |
||||
|
"content": { |
||||
|
"application/json": { |
||||
|
"schema": { |
||||
|
"$ref": "#/components/schemas/SimpleDataResponse_List_DeviceDataVO" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"400": { |
||||
|
"description": "Bad request - validation error", |
||||
|
"content": { |
||||
|
"application/json": { |
||||
|
"schema": { |
||||
|
"$ref": "#/components/schemas/SimpleDataResponse" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"401": { |
||||
|
"description": "Unauthorized - invalid API key", |
||||
|
"content": { |
||||
|
"application/json": { |
||||
|
"schema": { |
||||
|
"$ref": "#/components/schemas/SimpleDataResponse" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"500": { |
||||
|
"description": "Internal server error", |
||||
|
"content": { |
||||
|
"application/json": { |
||||
|
"schema": { |
||||
|
"$ref": "#/components/schemas/SimpleDataResponse" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"components": { |
||||
|
"schemas": { |
||||
|
"QueryDeviceDataParams": { |
||||
|
"type": "object", |
||||
|
"required": ["deviceIds", "startTime", "endTime"], |
||||
|
"properties": { |
||||
|
"deviceIds": { |
||||
|
"type": "array", |
||||
|
"items": { |
||||
|
"type": "string" |
||||
|
}, |
||||
|
"description": "Device ID list", |
||||
|
"example": ["FFFF0001", "FFFF0002"] |
||||
|
}, |
||||
|
"startTime": { |
||||
|
"type": "integer", |
||||
|
"format": "int64", |
||||
|
"description": "Start time, Unix milliseconds timestamp", |
||||
|
"example": 1709870240425 |
||||
|
}, |
||||
|
"endTime": { |
||||
|
"type": "integer", |
||||
|
"format": "int64", |
||||
|
"description": "End time, Unix milliseconds timestamp (must not exceed 7 days from startTime)", |
||||
|
"example": 1709889240425 |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"DeviceDataVO": { |
||||
|
"type": "object", |
||||
|
"properties": { |
||||
|
"deviceId": { |
||||
|
"type": "string", |
||||
|
"description": "Device ID", |
||||
|
"example": "FFFF0001" |
||||
|
}, |
||||
|
"deviceName": { |
||||
|
"type": "string", |
||||
|
"description": "Device name", |
||||
|
"example": "温度传感器" |
||||
|
}, |
||||
|
"rawData": { |
||||
|
"type": "string", |
||||
|
"description": "Raw data JSON", |
||||
|
"example": "{\"temp\":25.5}" |
||||
|
}, |
||||
|
"dataValue": { |
||||
|
"type": "string", |
||||
|
"description": "Device data values, comma-separated", |
||||
|
"example": "25.5" |
||||
|
}, |
||||
|
"receiveTs": { |
||||
|
"type": "integer", |
||||
|
"format": "int64", |
||||
|
"description": "Receive timestamp (milliseconds)", |
||||
|
"example": 1709870240425 |
||||
|
}, |
||||
|
"status": { |
||||
|
"type": "string", |
||||
|
"description": "Status", |
||||
|
"example": "UP" |
||||
|
}, |
||||
|
"alertLevel": { |
||||
|
"type": "string", |
||||
|
"description": "Alert level", |
||||
|
"example": "1" |
||||
|
}, |
||||
|
"alertContent": { |
||||
|
"type": "string", |
||||
|
"description": "Alert content", |
||||
|
"example": "温度异常" |
||||
|
}, |
||||
|
"buildingInfo": { |
||||
|
"type": "string", |
||||
|
"description": "Building info", |
||||
|
"example": "东京建物日本桥ビル" |
||||
|
}, |
||||
|
"floorInfo": { |
||||
|
"type": "string", |
||||
|
"description": "Floor info", |
||||
|
"example": "3F" |
||||
|
}, |
||||
|
"spaceInfo": { |
||||
|
"type": "string", |
||||
|
"description": "Space info", |
||||
|
"example": "会議室A" |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"SimpleDataResponse": { |
||||
|
"type": "object", |
||||
|
"properties": { |
||||
|
"code": { |
||||
|
"type": "integer", |
||||
|
"description": "Status code, 0 or 200 indicates success", |
||||
|
"example": 0 |
||||
|
}, |
||||
|
"msg": { |
||||
|
"type": "string", |
||||
|
"description": "Response message", |
||||
|
"example": "success" |
||||
|
}, |
||||
|
"data": { |
||||
|
"description": "Response data (null on error)" |
||||
|
}, |
||||
|
"errorMap": { |
||||
|
"type": "object", |
||||
|
"additionalProperties": { |
||||
|
"type": "string" |
||||
|
}, |
||||
|
"description": "Detailed error information", |
||||
|
"example": { |
||||
|
"deviceIds": "Device ID list is required" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"SimpleDataResponse_List_DeviceDataVO": { |
||||
|
"type": "object", |
||||
|
"properties": { |
||||
|
"code": { |
||||
|
"type": "integer", |
||||
|
"description": "Status code, 0 or 200 indicates success", |
||||
|
"example": 0 |
||||
|
}, |
||||
|
"msg": { |
||||
|
"type": "string", |
||||
|
"description": "Response message", |
||||
|
"example": "success" |
||||
|
}, |
||||
|
"data": { |
||||
|
"type": "array", |
||||
|
"items": { |
||||
|
"$ref": "#/components/schemas/DeviceDataVO" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,239 @@ |
|||||
|
--- |
||||
|
name: "query-device-data" |
||||
|
description: "Queries device raw data from Aurora by device IDs and time range via /common/queryDeviceData API. Invoke when user needs to retrieve device telemetry/historical data with device ID list and time range." |
||||
|
--- |
||||
|
|
||||
|
# Query Device Data |
||||
|
|
||||
|
通过设备ID列表和时间范围查询 Aurora 中的设备原始数据。 |
||||
|
|
||||
|
## 触发条件 |
||||
|
|
||||
|
当用户需要按设备ID列表和时间范围查询设备原始数据时调用此 skill。 |
||||
|
|
||||
|
用户可能用自然语言表达,例如: |
||||
|
- "查询设备A和设备B昨天的数据" |
||||
|
- "查一下FT0001最近3天的数据" |
||||
|
- "看看FFFF0001今天的数据" |
||||
|
- "获取设备A和C在2024年1月1日到1月5日的数据" |
||||
|
|
||||
|
## API 信息 |
||||
|
|
||||
|
| 项目 | 内容 | |
||||
|
|------|------| |
||||
|
| 接口路径 | `POST /common/queryDeviceData` | |
||||
|
| 认证方式 | Header 传入 `Apikey` | |
||||
|
| Referer 校验 | Header 需传入 `Referer`(值为服务端域名),否则被过滤器拦截返回 403 | |
||||
|
| 时间范围限制 | 最多7天 | |
||||
|
| 数据源 | Aurora 数据库 `rawData_yyyy_MM_dd` 分表 | |
||||
|
|
||||
|
## 自然语言转 API 参数 |
||||
|
|
||||
|
### 1. 时间范围解析 |
||||
|
|
||||
|
用户可能会用各种方式描述时间,需要根据当前时间(`Today's date`)计算出对应的毫秒时间戳。 |
||||
|
|
||||
|
| 自然语言表达 | 转换为 API 参数 | |
||||
|
|:-------------|:----------------| |
||||
|
| "最近 X 天 / 近 X 天 / 过去 X 天" | `startTime` = 当前日期往前推 X 天 的 00:00:00(时区 Asia/Tokyo),`endTime` = 当前时间的 23:59:59 | |
||||
|
| "昨天" | `startTime` = 昨天 00:00:00,`endTime` = 昨天 23:59:59 | |
||||
|
| "今天" | `startTime` = 今天 00:00:00,`endTime` = 当前时间 | |
||||
|
| "今天 x 点到 y 点" | `startTime` = 今天 x:00:00,`endTime` = 今天 y:59:59 | |
||||
|
| "2024年1月1日到2024年1月5日" | `startTime` = 2024-01-01 00:00:00,`endTime` = 2024-01-05 23:59:59 | |
||||
|
| "X月Y日到X月Y日" | 根据当前年份推算,`startTime` = X月Y日 00:00:00,`endTime` = X月Y日 23:59:59 | |
||||
|
| "上个月" | `startTime` = 上个月1号 00:00:00,`endTime` = 上个月最后一天 23:59:59 | |
||||
|
| "最近X小时" | `startTime` = 当前时间往前推X小时,`endTime` = 当前时间 | |
||||
|
|
||||
|
**注意**: |
||||
|
- 所有时间戳需要转换为 **毫秒**(13位数字) |
||||
|
- 时区统一使用 `Asia/Tokyo` |
||||
|
- `startTime` 和 `endTime` 之间的跨度不能超过 **7 天** |
||||
|
|
||||
|
### 2. 设备ID解析 |
||||
|
|
||||
|
请求参数要求传入 `deviceIds`(设备ID列表),用户可能会用不同方式描述设备: |
||||
|
|
||||
|
| 自然语言表达 | 转换方式 | |
||||
|
|:-------------|:---------| |
||||
|
| "设备A"、"设备B" | 如果用户提及设备名/编号,先根据上下文尝试确定是否为已知设备ID | |
||||
|
| "FFFF0001"、"FT0001" | 直接作为设备ID使用 | |
||||
|
| "所有设备"、"全部设备" | **不支持**,需要用户提供具体的设备ID列表 | |
||||
|
| "传感器A"、"温度计1" | 如果已知设备ID和名称的映射关系,转换为对应设备ID | |
||||
|
|
||||
|
如果用户只说了设备名称但没有提供具体ID,需要向用户确认具体的设备ID。 |
||||
|
|
||||
|
### 3. 请求头解析 |
||||
|
|
||||
|
- `Apikey` 由用户提供,**不设置默认值** |
||||
|
- 如果用户没有提供 Apikey,需要向用户询问具体的 Apikey 值 |
||||
|
|
||||
|
## 自然语言处理流程 |
||||
|
|
||||
|
当收到自然语言请求时,按以下步骤执行: |
||||
|
|
||||
|
``` |
||||
|
1. 提取时间描述 → 计算 startTime/endTime(毫秒时间戳) |
||||
|
2. 提取设备描述 → 构建设备ID列表 deviceIds |
||||
|
3. 检查参数完整性:如有缺漏,向用户询问补齐 |
||||
|
4. 检查 Apikey:如用户未提供,向用户询问 |
||||
|
5. 检查 Referer:如用户未提供,向用户询问 |
||||
|
6. 构建请求体 JSON 并设置请求头(Apikey、Referer) |
||||
|
7. 调用 POST /common/queryDeviceData |
||||
|
8. 返回结果给用户 |
||||
|
``` |
||||
|
|
||||
|
### 参数不完整时的处理 |
||||
|
|
||||
|
**所有参数不设默认值**,缺失时需向用户询问。 |
||||
|
|
||||
|
| 缺失参数 | 询问示例 | |
||||
|
|:---------|:---------| |
||||
|
| 未提供 `deviceIds` | "请问要查询哪些设备的ID?请提供设备ID列表。" | |
||||
|
| 未提供时间范围 | "请问要查询什么时间范围的数据?例如:最近3天、昨天、或指定日期区间。" | |
||||
|
| 仅提供开始/结束时间之一 | 补齐另一个时间点,例如:用户只说"从2024年1月1日开始",则询问"请问结束时间是什么时候?" | |
||||
|
| 未提供 `Apikey` | "请提供用于认证的 Apikey。" | |
||||
|
| 未提供 `Referer` | "请提供请求来源域名(Referer),例如服务的域名地址。" | |
||||
|
|
||||
|
### 处理后响应模板 |
||||
|
|
||||
|
调用接口后将结果以自然语言呈现给用户: |
||||
|
- 查询到数据时:告知用户共查询到多少条数据,以及设备的主要信息摘要 |
||||
|
- 未查询到数据时:告知用户在指定时间范围内没有找到对应设备的数据 |
||||
|
- 接口报错时:将错误信息展示给用户 |
||||
|
|
||||
|
## 请求参数 |
||||
|
|
||||
|
### Header |
||||
|
|
||||
|
| 参数名 | 必填 | 说明 | |
||||
|
|--------|:----:|------| |
||||
|
| `Apikey` | 是 | API key,用于认证,由用户提供 | |
||||
|
| `Referer` | 是 | 请求来源域名,需与服务端配置的 `accessControlAllowOrigin` 匹配(例如 `https://bilplartform-stg.ifmservice.jp`),否则返回 403 | |
||||
|
|
||||
|
### Request Body (JSON) |
||||
|
|
||||
|
| 字段 | 类型 | 必填 | 说明 | |
||||
|
|------|:----:|:----:|------| |
||||
|
| `deviceIds` | `List<String>` | 是 | 设备ID列表,由用户提供 | |
||||
|
| `startTime` | `Long` | 是 | 开始时间戳(毫秒,也支持秒级自动转换),由用户提供或根据用户描述计算 | |
||||
|
| `endTime` | `Long` | 是 | 结束时间戳(毫秒,也支持秒级自动转换),与 startTime 跨度不能超过7天,由用户提供或根据用户描述计算 | |
||||
|
|
||||
|
## 返回数据 |
||||
|
|
||||
|
返回 `SimpleDataResponse<List<DeviceDataVO>>`,其中 `data` 为设备数据列表: |
||||
|
|
||||
|
| 字段 | 类型 | 说明 | |
||||
|
|------|:----:|------| |
||||
|
| `deviceId` | String | 设备ID | |
||||
|
| `deviceName` | String | 设备名称 | |
||||
|
| `rawData` | String | 原始数据 JSON | |
||||
|
| `dataValue` | String | 从 rawData 解析出的数值,逗号拼接 | |
||||
|
| `receiveTs` | Long | 接收时间戳(毫秒) | |
||||
|
| `status` | String | 状态 | |
||||
|
| `alertLevel` | String | 告警级别 | |
||||
|
| `alertContent` | String | 告警内容 | |
||||
|
| `buildingInfo` | String | 楼宇信息 | |
||||
|
| `floorInfo` | String | 楼层信息 | |
||||
|
| `spaceInfo` | String | 空间信息 | |
||||
|
|
||||
|
## 调用示例 |
||||
|
|
||||
|
### 请求 |
||||
|
|
||||
|
``` |
||||
|
POST /common/queryDeviceData |
||||
|
Apikey: <用户提供的Apikey> |
||||
|
Referer: <服务端域名,例如 https://bilplartform-stg.ifmservice.jp> |
||||
|
``` |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"deviceIds": ["FFFF0001", "FFFF0002"], |
||||
|
"startTime": 1709870240425, |
||||
|
"endTime": 1709889240425 |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
### 成功响应 |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"code": 0, |
||||
|
"msg": "success", |
||||
|
"data": [ |
||||
|
{ |
||||
|
"deviceId": "FFFF0001", |
||||
|
"deviceName": "温度传感器", |
||||
|
"rawData": "{\"temp\":25.5}", |
||||
|
"dataValue": "25.5", |
||||
|
"receiveTs": 1709870240425, |
||||
|
"status": "UP", |
||||
|
"alertLevel": null, |
||||
|
"alertContent": null, |
||||
|
"buildingInfo": "东京建物日本桥ビル", |
||||
|
"floorInfo": "3F", |
||||
|
"spaceInfo": "会議室A" |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
### 错误响应示例 |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"code": 20001, |
||||
|
"msg": "[deviceIds] is required", |
||||
|
"data": null |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 自然语言用例映射 |
||||
|
|
||||
|
### 用例1:查询某设备最近N天的数据 |
||||
|
|
||||
|
> 用户说:**"查一下设备FFFF0001最近3天的数据"** |
||||
|
|
||||
|
``` |
||||
|
步骤: |
||||
|
1. 假设 Today's date = 2026-06-01 |
||||
|
2. 计算 startTime = 2026-05-30 00:00:00 JST → 毫秒时间戳 |
||||
|
3. 计算 endTime = 2026-06-01 23:59:59 JST → 毫秒时间戳 |
||||
|
4. deviceIds = ["FFFF0001"] |
||||
|
5. 调用接口 |
||||
|
``` |
||||
|
|
||||
|
### 用例2:查询多个设备特定日期的数据 |
||||
|
|
||||
|
> 用户说:**"查询FFFF0001和FT0002在2024年1月1日的数据"** |
||||
|
|
||||
|
``` |
||||
|
步骤: |
||||
|
1. 计算 startTime = 2024-01-01 00:00:00 JST → 毫秒时间戳 |
||||
|
2. 计算 endTime = 2024-01-01 23:59:59 JST → 毫秒时间戳 |
||||
|
3. deviceIds = ["FFFF0001", "FT0002"] |
||||
|
4. 调用接口 |
||||
|
``` |
||||
|
|
||||
|
### 用例3:查询设备今天的数据 |
||||
|
|
||||
|
> 用户说:**"看看FT0001今天的监测数据"** |
||||
|
|
||||
|
``` |
||||
|
步骤: |
||||
|
1. 假设 Today's date = 2026-06-01 |
||||
|
2. 计算 startTime = 2026-06-01 00:00:00 JST → 毫秒时间戳 |
||||
|
3. 计算 endTime = 当前时间 JST → 毫秒时间戳 |
||||
|
4. deviceIds = ["FT0001"] |
||||
|
5. 调用接口 |
||||
|
``` |
||||
|
|
||||
|
## 注意事项 |
||||
|
|
||||
|
1. `startTime` 和 `endTime` 支持毫秒和秒级时间戳(< 10000000000L 时自动按秒处理) |
||||
|
2. 时间跨度不能超过 **7 天**,否则接口会返回错误 |
||||
|
3. 跨天查询时自动查询多张 `rawData_yyyy_MM_dd` 分表并合并结果 |
||||
|
4. 使用 Apikey 认证,与 `/common/queryDeviceInfo` 相同的方式 |
||||
|
5. 所有时间计算都基于 `Asia/Tokyo` 时区 |
||||
|
6. Apikey 和所有请求参数均**不设置默认值**,缺失时需向用户询问补齐 |
||||
|
7. **Referer 头必传**:请求必须携带 `Referer` 头,否则被 `CrosXssFilter` 过滤器拦截返回 403。Referer 值需与服务端配置的 `accessControlAllowOrigin` 匹配(通常为服务域名本身,如 `https://bilplartform-stg.ifmservice.jp`) |
||||
Loading…
Reference in new issue