<?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.ld.igds.phone.mapper.PhoneCommonMapper">
|
|
<!-- 根据用户名获取用户信息 -->
|
<select id="phoneGetUser" parameterType="java.lang.String" resultType="com.bstek.bdf2.core.model.DefaultUser">
|
select
|
USERNAME_ as username,
|
COMPANY_ID_ as companyId,
|
PASSWORD_ as password,
|
SALT_ as salt,
|
CNAME_ as cname,
|
MALE_ as male,
|
ENABLED_ as enabled,
|
ADMINISTRATOR_ as administrator,
|
BIRTHDAY_ as birthday,
|
MOBILE_ as mobile,
|
EMAIL_ as email,
|
CREATE_DATE_ as createDate
|
from BDF2_USER
|
where USERNAME_ = #{param}
|
</select>
|
|
<!-- 根据用户名修改用户信息 -->
|
<update id="phoneUpdateUser" parameterType="com.ld.igds.phone.param.ParamUser">
|
update BDF2_USER
|
<set>
|
PASSWORD_ = #{param.password},
|
SALT_ = #{param.salt},
|
<if test="param.newCname != null and param.newCname != ''">CNAME_ = #{param.newCname},</if>
|
<if test="param.newMobile != null and param.newMobile != ''">MOBILE_ = #{param.newMobile},</if>
|
</set>
|
where USERNAME_ = #{param.username}
|
and COMPANY_ID_ = #{param.companyId}
|
</update>
|
|
<select id="phoneListWeather" parameterType="java.lang.String" resultType="com.ld.igds.phone.dto.DtoWeather">
|
select
|
ID_ as id,
|
COMPANY_ID_ as companyId,
|
TEMP_ as temp,
|
HUMIDITY_ as humidity,
|
WIND_SPEED_ as windSpeed,
|
WIND_DIRECTION_ as windDirection,
|
WEATHER_ as weather,
|
RAINFALL_ as rainfall,
|
UPDATE_TIME_ as updateTime
|
from D_WEATHER_INFO
|
where COMPANY_ID_ = #{param}
|
order by UPDATE_TIME_ DESC
|
limit 10
|
</select>
|
|
<!-- 获取警告列表信息 -->
|
<select id="phoneListWarn" parameterType="com.ld.igds.phone.param.ParamWarn" resultType="com.ld.igds.phone.dto.Dto5003">
|
select
|
ID_ as id,
|
COMPANY_ID_ as companyId,
|
DEPT_ID_ as deptId,
|
DEPOT_ID_ as depotId,
|
SER_ID_ as serId,
|
NAME_ as name,
|
BIZ_TYPE_ as bizType,
|
TYPE_ as type,
|
LEVEL_ as level,
|
STATUS_ as status,
|
INFO_ as info,
|
TIME_ as time,
|
COMPLETE_USER_ as completeUser,
|
COMPLETE_TIME_ as completeTime,
|
REMARK_ as remark
|
from D_M_WARN_INFO
|
<where>
|
<if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
|
<if test="param.deptId != null and param.deptId != '' ">AND DEPT_ID_ = #{param.deptId}</if>
|
<if test="param.start != null">AND
|
TIME_ <![CDATA[ > ]]>#{param.start,jdbcType=TIMESTAMP}
|
</if>
|
<if test="param.end != null">AND
|
TIME_ <![CDATA[ < ]]>#{param.end,jdbcType=TIMESTAMP}
|
</if>
|
</where>
|
order by TIME_
|
</select>
|
|
<update id="updateWarn" parameterType="com.ld.igds.phone.param.ParamWarn">
|
update D_M_WARN_INFO
|
<set>
|
COMPLETE_TIME_ = #{param.completeTime},
|
<if test="param.completeUser != null and param.completeUser != ''">COMPLETE_USER_ = #{param.completeUser},</if>
|
<if test="param.status != null and param.status != ''">STATUS_ = #{param.status},</if>
|
</set>
|
where ID_ = #{param.id}
|
</update>
|
|
<!-- 获取仓库信息 -->
|
<select id="phoneListDepot" parameterType="java.lang.String" resultType="com.ld.igds.phone.dto.DtoDepot">
|
select
|
ID_ as depotId,
|
COMPANY_ID_ as companyId,
|
NAME_ as depotName,
|
DEPOT_TYPE_ as depotType,
|
DEPOT_STATUS_ as depotStatus,
|
STORAGE_MAX_ as storageMax,
|
STORAGE_REAL_ as storageReal,
|
FOOD_TYPE_ as foodType,
|
FOOD_VARIETY_ as foodVariety,
|
FOOD_LEVEL_ as foodLevel,
|
FOOD_LOCATION_ as foodLocation,
|
PER_WET_ as perWet,
|
PER_IMPURITY_ as perImpurity,
|
STORE_KEEPER_ as storeKeeper,
|
STORE_KEEPER_NAME_ as storeKeeperName,
|
STORE_DATE_ as storeDate,
|
FOOD_YEAR_ as foodYear,
|
REMARK_ as remark
|
from D_DEPOT
|
where COMPANY_ID_ = #{companyId}
|
and DEPT_ID_ = #{deptId}
|
</select>
|
|
|
<!-- 获取出入库记录信息 -->
|
<select id="phoneListInoutRecord" parameterType="com.ld.igds.phone.param.ParamInoutRecord"
|
resultType="com.ld.igds.phone.dto.DtoInoutRecord">
|
select
|
ID_ as id,
|
COMPANY_ID_ as companyId,
|
INTEL_CARD_ as intelCard,
|
PLATE_NUM_ as plateNum,
|
DEPOT_ID_ as depotId,
|
TYPE_ as type,
|
CUSTOMER_ID_ as customerId,
|
CUSTOMER_NAME_ as customerName,
|
FOOD_VARIETY_ as foodVariety,
|
SETTLE_WEIGHT_ as settleWeight,
|
COMPLETE_TIME_ as completeTime
|
from D_INOUT_RECORD
|
<where>
|
<if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
|
<if test="param.deptId != null and param.deptId != '' ">AND DEPT_ID_ = #{param.deptId}</if>
|
<if test="param.type != null and param.type != '' ">AND TYPE_ = #{param.type}</if>
|
<if test="param.date != null">AND
|
COMPLETE_TIME_ <![CDATA[ > ]]>#{param.date,jdbcType=TIMESTAMP}
|
</if>
|
<if test="param.end != null">AND
|
COMPLETE_TIME_ <![CDATA[ < ]]>#{param.end,jdbcType=TIMESTAMP}
|
</if>
|
AND PROGRESS_ = 'RECORD'
|
AND RECORD_STATUS_ != 'ERROR'
|
AND RECORD_STATUS_ != 'DEL'
|
ORDER BY ID_
|
</where>
|
</select>
|
|
<!--根据车牌获取个数 -->
|
<select id="validateByPlateNum" parameterType="com.ld.igds.phone.param.ParamInout"
|
resultType="java.lang.Integer">
|
select count(1) from D_INOUT_RECORD
|
<where>
|
<if test="param.companyId != null and param.companyId != '' ">
|
AND COMPANY_ID_ = #{param.companyId}
|
</if>
|
<if test="param.plateNum != null and param.plateNum != '' ">
|
AND PLATE_NUM_ = #{param.plateNum}
|
</if>
|
and PROGRESS_ <> 'RECORD' and RECORD_STATUS_ != 'DEL' and RECORD_STATUS_ != 'ERROR'
|
</where>
|
</select>
|
|
<!--根据一卡通和车牌获取个数 -->
|
<select id="validateByInterCard" parameterType="com.ld.igds.phone.param.ParamInout"
|
resultType="java.lang.Integer">
|
select count(1) from D_INOUT_RECORD
|
<where>
|
<if test="param.companyId != null">AND COMPANY_ID_ = #{param.companyId}</if>
|
<if test="param.intelCard != null and param.plateNum != null">
|
AND ( INTEL_CARD_ = #{param.intelCard} OR PLATE_NUM_ = #{param.plateNum} )
|
</if>
|
and PROGRESS_ <> 'RECORD' and RECORD_STATUS_ != 'DEL' and RECORD_STATUS_ != 'ERROR'
|
</where>
|
</select>
|
|
<!-- 根据组织编码、仓库号、设备类型查询设备 -->
|
<select id="phoneListDevice" parameterType="com.ld.igds.phone.param.ParamDevice"
|
resultType="com.ld.igds.phone.dto.DtoDevice">
|
select
|
ID_ as id,
|
COMPANY_ID_ as companyId,
|
DEPOT_ID_ as depotId,
|
NAME_ as name,
|
PASS_CODE_ as passCode,
|
SER_ID_ as serId,
|
TYPE_ as type,
|
STATUS_ as status
|
from D_DEVICE
|
<where>
|
<if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
|
<if test="param.depotId != null and param.depotId != '' ">AND DEPOT_ID_ = #{param.depotId}</if>
|
AND
|
(
|
<if test="param.type != null and param.type != '' ">TYPE_ = #{param.type}</if>
|
<if test="param.type1 != null and param.type1 != '' ">OR TYPE_ = #{param.type1}</if>
|
<if test="param.type2 != null and param.type2 != '' ">OR TYPE_ = #{param.type2}</if>
|
<if test="param.type3 != null and param.type3 != '' ">OR TYPE_ = #{param.type3}</if>
|
)
|
</where>
|
ORDER BY NAME_
|
</select>
|
|
<select id="phoneListCamera" parameterType="java.lang.String" resultType="com.ld.igds.phone.dto.DtoCamera">
|
select
|
TYPE_ as type,
|
NAME_ as name,
|
LOGIN_ID_ as loginId,
|
PWD_ as pwd,
|
IP_IN_ as ipIn,
|
PORT_IN_C_ as portInC,
|
PORT_IN_V_ as portInV,
|
MEDIA_ADDR_ as mediaAddr
|
from
|
D_SEC_CAMERA
|
<where>
|
<if test="companyId != null and companyId != '' ">AND COMPANY_ID_ = #{companyId}</if>
|
</where>
|
ORDER BY NAME_
|
</select>
|
|
<!-- 远程抄表-->
|
<select id="getEnergyMeter" parameterType="com.ld.igds.phone.param.ParamEnergyMeter"
|
resultType="com.ld.igds.phone.dto.DtoEnergyMeter">
|
select
|
ID_ as id,
|
COMPANY_ID_ as companyId,
|
DEPOT_ID_ as depotId,
|
UPDATE_TIME_ as updateTime,
|
TYPE_ as type,
|
UA_ as ua,
|
UB_ as ub,
|
UC_ as uc,
|
IA_ as ia,
|
IB_ as ib,
|
IC_ as ic,
|
-- PA_ as pa,
|
-- PB_ as pb,
|
-- PC_ as pc,
|
-- PFA_ as pfa,
|
-- PFB_ as pfb,
|
-- PFC_ as pfc,
|
F_ as f,
|
EP_ as ep,
|
EP_INC_ as epInc,
|
EQ_ as eq,
|
EQ_INC_ as eqInc,
|
ES_ as es,
|
ES_INC_ as esInc
|
from
|
D_ENERGY
|
<where>
|
<if test="param.companyId != null and param.companyId != '' ">
|
AND COMPANY_ID_ = #{param.companyId}
|
</if>
|
<if test="param.start != null">AND
|
UPDATE_TIME_ <![CDATA[ > ]]>#{param.start,jdbcType=TIMESTAMP}
|
</if>
|
<if test="param.end != null">AND
|
UPDATE_TIME_ <![CDATA[ < ]]>#{param.end,jdbcType=TIMESTAMP}
|
</if>
|
</where>
|
ORDER BY UPDATE_TIME_ desc
|
</select>
|
|
|
<select id="getDeptList" resultType="com.ld.igds.phone.dto.DtoDept" parameterType="java.lang.String">
|
select
|
ID_ as id,
|
NAME_ as name,
|
COMPANY_ID_ as companyId,
|
PARENT_ID_ as parentId
|
from
|
BDF2_DEPT
|
where COMPANY_ID_ = #{companyId}
|
and PARENT_ID_ like #{parentId}
|
|
</select>
|
|
<select id="getDicList" resultType="com.ld.igds.phone.dto.DtoDic" parameterType="java.lang.String">
|
select
|
CODE_ as code,
|
NAME_ as name,
|
COMPANY_ID_ as companyId,
|
PARENT_CODE as parentCode
|
from
|
D_DIC_TRIGGER
|
where COMPANY_ID_ = #{companyId}
|
and PARENT_CODE = #{parentCode}
|
</select>
|
|
|
<!-- 获取巡更记录信息 -->
|
<select id="phoneListPatrolRecord" parameterType="com.ld.igds.phone.param.ParamPatrolRecord"
|
resultType="com.ld.igds.phone.dto.DtoPatrolRecord">
|
select
|
ID_ as id,
|
COMPANY_ID_ as companyId,
|
DEPT_ID_ as deptId,
|
DEVICE_ID_ as deviceId,
|
USER_NAME_ as userName,
|
POINT_ID_ as pointId,
|
POINT_NAME_ as pointName,
|
CREATE_TIME_ as createTime,
|
LONGITUDE_ as longitude,
|
LATITUDE_ as latitude,
|
IMG_NAME_ as imgName
|
from D_SEC_PATROL_RECORD
|
<where>
|
<if test="param.id != null and param.id != '' ">AND ID_ = #{param.id}</if>
|
<if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
|
<if test="param.deptId != null and param.deptId != '' ">AND DEPT_ID_ = #{param.deptId}</if>
|
<if test="param.userName != null and param.userName != '' ">AND USER_NAME_ = #{param.userName}</if>
|
<if test="param.date != null">AND
|
CREATE_TIME_ <![CDATA[ >= ]]>#{param.date,jdbcType=TIMESTAMP}
|
</if>
|
<if test="param.end != null">AND
|
CREATE_TIME_ <![CDATA[ <= ]]>#{param.end,jdbcType=TIMESTAMP}
|
</if>
|
ORDER BY CREATE_TIME_ DESC
|
</where>
|
</select>
|
|
</mapper>
|