zhaoxianglong
10 months ago
6 changed files with 110 additions and 75 deletions
@ -1,44 +0,0 @@ |
|||
package com.zc.business.entity; |
|||
|
|||
import com.zc.business.domain.DcDevice; |
|||
import com.zc.business.domain.DcStakeMark; |
|||
import io.swagger.annotations.ApiModel; |
|||
import lombok.Data; |
|||
|
|||
|
|||
@Data |
|||
@ApiModel(value = "EntityDcDevice", description = "设备返回参数") |
|||
public class EntityDcDevice extends DcDevice { |
|||
|
|||
private String longitude; |
|||
private String latitude; |
|||
|
|||
public EntityDcDevice EstablishEntityDcDevice(DcDevice device, DcStakeMark dcStakeMark) { |
|||
EntityDcDevice entityDcDevice = new EntityDcDevice(); |
|||
|
|||
entityDcDevice.setId(device.getId()); |
|||
entityDcDevice.setIotDeviceId(device.getIotDeviceId()); |
|||
entityDcDevice.setGroupId(device.getGroupId()); |
|||
entityDcDevice.setProductId(device.getProductId()); |
|||
entityDcDevice.setStakeMarkId(device.getStakeMarkId()); |
|||
entityDcDevice.setDirection(device.getDirection()); |
|||
entityDcDevice.setDeviceCode(device.getDeviceCode()); |
|||
entityDcDevice.setDeviceName(device.getDeviceName()); |
|||
entityDcDevice.setDeviceType(device.getDeviceType()); |
|||
entityDcDevice.setInstallationDate(device.getInstallationDate()); |
|||
entityDcDevice.setProductionDate(device.getProductionDate()); |
|||
entityDcDevice.setDurableYears(device.getDurableYears()); |
|||
entityDcDevice.setInstallationSite(device.getInstallationSite()); |
|||
entityDcDevice.setUseState(device.getUseState()); |
|||
entityDcDevice.setOtherConfig(device.getOtherConfig()); |
|||
entityDcDevice.setRemark(device.getRemark()); |
|||
entityDcDevice.setCreateTime(device.getCreateTime()); |
|||
entityDcDevice.setUpdateTime(device.getUpdateTime()); |
|||
if (dcStakeMark != null) { |
|||
entityDcDevice.setLongitude(dcStakeMark.getLongitude()); |
|||
entityDcDevice.setLatitude(dcStakeMark.getLatitude()); |
|||
} |
|||
return entityDcDevice; |
|||
|
|||
} |
|||
} |
@ -0,0 +1,89 @@ |
|||
<?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.zc.business.mapper.DcDeviceMapper"> |
|||
|
|||
<resultMap type="DcDevice" id="DcDevice"> |
|||
|
|||
<result property="id" column="id"/> |
|||
<result property="iotDeviceId" column="iot_device_id"/> |
|||
<result property="groupId" column="group_id"/> |
|||
<result property="productId" column="product_id"/> |
|||
<result property="stakeMarkId" column="stake_mark_id"/> |
|||
<result property="direction" column="direction"/> |
|||
<result property="deviceName" column="device_name"/> |
|||
<result property="deviceCode" column="device_code"/> |
|||
<result property="deviceType" column="device_type"/> |
|||
<result property="installationDate" column="installation_Date"/> |
|||
<result property="productionDate" column="production_date"/> |
|||
<result property="durableYears" column="durable_years"/> |
|||
<result property="installationSite" column="installation_site"/> |
|||
<result property="useState" column="use_state"/> |
|||
<result property="otherConfig" column="other_config"/> |
|||
<result property="remark" column="remark"/> |
|||
<result property="createTime" column="create_time"/> |
|||
<result property="updateTime" column="update_time"/> |
|||
<result property="longitude" column="longitude"/> |
|||
<result property="latitude" column="latitude"/> |
|||
</resultMap> |
|||
|
|||
<resultMap id="dcStakeMarkResult" type="dcStakeMark"> |
|||
<result property="longitude" column="longitude"/> |
|||
<result property="latitude" column="latitude"/> |
|||
|
|||
</resultMap> |
|||
|
|||
<sql id="selectDcDeviceVo"> |
|||
select id, |
|||
iot_device_id, |
|||
group_id, |
|||
product_id, |
|||
stake_mark_id, |
|||
direction, |
|||
device_name, |
|||
device_code, |
|||
device_type, |
|||
installation_Date, |
|||
production_date, |
|||
durable_years, |
|||
installation_site, |
|||
use_state, |
|||
other_config, |
|||
remark, |
|||
create_time, |
|||
update_time |
|||
from dc_device |
|||
</sql> |
|||
|
|||
|
|||
<select id="selectDcDeviceList" parameterType="dcDevice" resultMap="DcDevice"> |
|||
select t1.id, t1.iot_device_id, t1.group_id, t1.product_id, t1.stake_mark_id, t1.direction, t1.device_name, t1.device_code, t1.device_type, |
|||
t1.installation_Date,t1.production_date,t1.durable_years,t1.installation_site,t1.use_state,t1.other_config,t1.remark,t1.create_time,t1.update_time, |
|||
t2.longitude,t2.latitude |
|||
from dc_device t1 |
|||
left join dc_stake_mark t2 on t1.stake_mark_id = t2.id and t1.direction = t2.direction |
|||
<where> |
|||
<if test="id != null and id != ''">and t1.id = #{id}</if> |
|||
<if test="iotDeviceId != null and iotDeviceId != ''">and t1.iot_device_id = #{iotDeviceId}</if> |
|||
<if test="groupId != null and groupId != ''">and t1.group_id = #{groupId}</if> |
|||
<if test="productId != null and productId != ''">and t1.product_id = #{productId}</if> |
|||
<if test="stakeMarkId != null and stakeMarkId != ''">and t1.stake_mark_id = #{stakeMarkId}</if> |
|||
<if test="direction != null and direction != ''">and t1.direction = #{direction}</if> |
|||
<if test="deviceName != null and deviceName != ''">and t1.device_name like concat('%', #{deviceName}, '%')</if> |
|||
<if test="deviceCode != null and deviceCode != ''">and t1.device_code = #{deviceCode}</if> |
|||
<if test="deviceType != null and deviceType != ''">and t1.device_type = #{deviceType}</if> |
|||
<if test="installationDate != null and installationDate != ''">and t1.installation_Date = #{installationDate}</if> |
|||
<if test="productionDate != null and productionDate != ''">and t1.production_date = #{productionDate}</if> |
|||
<if test="durableYears != null and durableYears != ''">and t1.durable_years = #{durableYears}</if> |
|||
<if test="installationSite != null and installationSite != ''">and t1.installation_site = #{installationSite}</if> |
|||
<if test="useState != null and useState != ''">and t1.use_state = #{useState}</if> |
|||
<if test="otherConfig != null and otherConfig != ''">and t1.other_config = #{otherConfig}</if> |
|||
<if test="remark != null and remark != ''">and t1.remark = #{remark}</if> |
|||
<if test="createTime != null and createTime != ''">and t1.create_time = #{createTime}</if> |
|||
<if test="updateTime != null and updateTime != ''">and t1.update_time = #{updateTime}</if> |
|||
</where> |
|||
|
|||
</select> |
|||
|
|||
</mapper> |
Loading…
Reference in new issue