<?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.thhy.engineering.modules.biz.device.mapper.SysDeviceMapper">
|
<resultMap id="BaseResultMap" type="com.thhy.engineering.modules.biz.device.entity.SysDevice">
|
<!--
|
WARNING - @mbg.generated
|
This element is automatically generated by MyBatis Generator, do not modify.
|
This element was generated on Thu May 11 13:19:52 CST 2023.
|
-->
|
<id column="device_id" jdbcType="VARCHAR" property="deviceId" />
|
<result column="device_name" jdbcType="VARCHAR" property="deviceName" />
|
<result column="sn_code" jdbcType="VARCHAR" property="snCode" />
|
<result column="produce_order" jdbcType="VARCHAR" property="produceOrder" />
|
<result column="company_id" jdbcType="VARCHAR" property="companyId" />
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
|
</resultMap>
|
|
|
<select id="deviceNameOrSNByOne" resultType="com.thhy.engineering.modules.biz.device.entity.SysDevice">
|
select device_id as deviceId,
|
device_name as deviceName,
|
sn_code as snCode
|
from sys_device where is_use=1 and
|
company_id=#{companyId} and
|
(device_name=#{deviceName} or sn_code=#{snCode})
|
</select>
|
|
<insert id="deviceInsert">
|
insert into sys_device
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="deviceId != null">
|
device_id,
|
</if>
|
<if test="deviceName != null">
|
device_name,
|
</if>
|
<if test="snCode != null">
|
sn_code,
|
</if>
|
<if test="produceOrder != null">
|
produce_order,
|
</if>
|
<if test="companyId != null">
|
company_id,
|
</if>
|
<if test="createTime != null">
|
create_time,
|
</if>
|
<if test="createUser != null">
|
create_user,
|
</if>
|
<if test="deviceType != null">
|
device_type,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="deviceId != null">
|
#{deviceId,jdbcType=VARCHAR},
|
</if>
|
<if test="deviceName != null">
|
#{deviceName,jdbcType=VARCHAR},
|
</if>
|
<if test="snCode != null">
|
#{snCode,jdbcType=VARCHAR},
|
</if>
|
<if test="produceOrder != null">
|
#{produceOrder,jdbcType=VARCHAR},
|
</if>
|
<if test="companyId != null">
|
#{companyId,jdbcType=VARCHAR},
|
</if>
|
<if test="createTime != null">
|
#{createTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="createUser != null">
|
#{createUser,jdbcType=VARCHAR},
|
</if>
|
<if test="deviceType != null">
|
#{deviceType,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
|
<select id="deviceList" resultType="com.thhy.engineering.modules.biz.device.entity.SysDevice">
|
select
|
sd.device_id as deviceId,
|
sd.device_name as deviceName,
|
sd.sn_code as snCode,
|
sd.produce_order as produceOrder,
|
sd.device_type as deviceType,
|
sd2.dict_name as deviceTypeName
|
from sys_device sd
|
left join sys_dict sd2 on sd.device_type=sd2.dict_id
|
where sd.is_use=1
|
<if test="deviceName!=null and deviceName!='' ">
|
and sd.device_name like concat('%',#{deviceName},'%')
|
</if>
|
<if test="companyId!=null and companyId!='' ">
|
and sd.company_id=#{companyId}
|
</if>
|
order by sd.create_time desc
|
</select>
|
<select id="deviceInfo" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.device.entity.SysDevice">
|
select
|
sd.device_id as deviceId,
|
sd.device_name as deviceName,
|
sd.sn_code as snCode,
|
sd.produce_order as produceOrder,
|
sd.device_type as deviceType,
|
sd2.dict_name as deviceTypeName
|
from sys_device sd
|
left join sys_dict sd2 on sd.device_type=sd2.dict_id
|
where sd.is_use=1
|
and sd.device_id=#{deviceId}
|
</select>
|
|
<update id="deviceUpdate">
|
update sys_device
|
<set>
|
<if test="deviceName != null">
|
device_name = #{deviceName,jdbcType=VARCHAR},
|
</if>
|
<if test="snCode != null">
|
sn_code = #{snCode,jdbcType=VARCHAR},
|
</if>
|
<if test="produceOrder != null">
|
produce_order = #{produceOrder,jdbcType=VARCHAR},
|
</if>
|
<if test="companyId != null">
|
company_id = #{companyId,jdbcType=VARCHAR},
|
</if>
|
<if test="createTime != null">
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="createUser != null">
|
create_user = #{createUser,jdbcType=VARCHAR},
|
</if>
|
<if test="deviceType != null">
|
device_type = #{deviceType,jdbcType=VARCHAR},
|
</if>
|
</set>
|
where device_id = #{deviceId,jdbcType=VARCHAR}
|
</update>
|
<update id="deviceDel" parameterType="java.lang.String" >
|
update sys_device
|
set
|
is_use=2
|
where device_id=#{deviceId}
|
</update>
|
|
<select id="selectBySteamIds" parameterType="java.lang.String" resultType="java.lang.String">
|
select steam_id from t_steam where device_id=#{deviceId}
|
</select>
|
<select id="steamList" resultType="com.thhy.engineering.modules.biz.device.entity.TSteam">
|
select
|
ts.steam_id as steamId,
|
ts.device_id as deviceId,
|
ts.temperature as temperature,
|
ts.humidity as humidity,
|
ts.gather_time as gatherTime,
|
sd.device_name as deviceName
|
from t_steam ts left join
|
sys_device sd on ts.device_id=sd.device_id
|
where 1=1
|
<if test="companyId!=null and companyId!='' ">
|
and sd.company_id=#{companyId}
|
</if>
|
<if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
|
and ts.gather_time between #{strTime} and #{endTime}
|
</if>
|
order by ts.gather_time desc
|
</select>
|
|
<select id="devicePull" resultType="com.thhy.engineering.modules.biz.device.entity.SysDevice">
|
select device_id as deviceId,
|
device_name as deviceName
|
from sys_device where is_use=1
|
and device_type=#{deviceType}
|
<if test="companyId!=null and companyId!='' ">
|
and company_id=#{companyId}
|
</if>
|
</select>
|
<select id="mouldList" resultType="com.thhy.engineering.modules.biz.device.entity.TMouldRecord">
|
SELECT
|
tmr.mould_record_id as mouldRecordId,
|
tmr.mould_id as mouldId,
|
tmr.scan_num as scanNum,
|
tmr.create_time as createTime,
|
tmr.length_time as lengthTime,
|
sm.mould_num as mouldNum,
|
sm.mould_code as mouldCode,
|
sd.dict_name AS mouldTypes,
|
sd1.dict_name AS sizeName,
|
sd2.dict_name AS turn,
|
sd3.dict_name AS holes
|
FROM
|
t_mould_record tmr
|
LEFT JOIN sys_mould sm ON tmr.mould_id = sm.mould_id
|
LEFT JOIN sys_dict sd ON sm.mould_type = sd.dict_id
|
LEFT JOIN sys_dict sd1 ON sm.mould_size = sd1.dict_id
|
LEFT JOIN sys_dict sd2 ON sm.mould_turn = sd2.dict_id
|
LEFT JOIN sys_dict sd3 ON sm.grouting_holes = sd3.dict_id
|
where 1=1
|
<if test="companyId!=null and companyId!='' ">
|
and tmr.company_id=#{companyId}
|
</if>
|
<if test="mouldNum!=null and mouldNum!='' ">
|
and sm.mould_num like concat('%',#{mouldNum},'%')
|
</if>
|
<if test="mouldCode!=null and mouldCode!='' ">
|
and sm.mould_code=#{mouldCode}
|
</if>
|
order by tmr.create_time desc
|
</select>
|
<insert id="moldDataInsert">
|
insert into t_mold_data
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="dataId != null">
|
data_id,
|
</if>
|
<if test="dataTime != null">
|
data_time,
|
</if>
|
<if test="worksId != null">
|
works_id,
|
</if>
|
<if test="types != null">
|
types,
|
</if>
|
<if test="moldId != null">
|
mold_id,
|
</if>
|
<if test="createTime != null">
|
create_time,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="dataId != null">
|
#{dataId,jdbcType=VARCHAR},
|
</if>
|
<if test="dataTime != null">
|
#{dataTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="worksId != null">
|
#{worksId,jdbcType=VARCHAR},
|
</if>
|
<if test="types != null">
|
#{types,jdbcType=VARCHAR},
|
</if>
|
<if test="moldId != null">
|
#{moldId,jdbcType=VARCHAR},
|
</if>
|
<if test="createTime != null">
|
#{createTime,jdbcType=TIMESTAMP},
|
</if>
|
</trim>
|
</insert>
|
<insert id="moldUseInsert">
|
insert into t_mold_use
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="useId != null">
|
use_id,
|
</if>
|
<if test="moldId != null">
|
mold_id,
|
</if>
|
<if test="seconds != null">
|
seconds,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="useId != null">
|
#{useId,jdbcType=VARCHAR},
|
</if>
|
<if test="moldId != null">
|
#{moldId,jdbcType=VARCHAR},
|
</if>
|
<if test="seconds != null">
|
#{seconds,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
|
|
<select id="moldIdSelectPipeId" parameterType="java.lang.String" resultType="java.lang.String">
|
select tpi.pipe_id from t_pipe_info tpi left join
|
sys_mould sm on sm.mould_id=tpi.mod_id
|
where sm.mould_mn=#{rfid}
|
order by tpi.into_mod_time desc
|
limit 0,1
|
</select>
|
|
<update id="pipeInfoUpdate" >
|
update t_pipe_info
|
set out_mod=#{outMod},
|
out_mod_time=#{outModTime}
|
where pipe_id=#{pipeId}
|
</update>
|
<update id="pipeIdUpdate" >
|
update t_pipe_info
|
set placing_type=#{placingType},
|
placing_in_time=#{placingInTime}
|
where pipe_id=#{pipeId}
|
</update>
|
<select id="mouldMouldMn" parameterType="java.lang.String" resultType="java.lang.Integer">
|
select current_cycle_time from sys_mould where mould_mn=#{rfid}
|
</select>
|
|
<update id="mouldUpdate" >
|
update sys_mould set
|
current_cycle_time=#{nums}
|
where mould_mn=#{rfid}
|
</update>
|
|
<update id="pipeIdOutUpdate">
|
update t_pipe_info
|
set placing_type=#{placingType},
|
placing_out_time=#{placingOutTime}
|
where pipe_id=#{pipeId}
|
</update>
|
|
<update id="mouldFreeUpdate" >
|
update sys_mould set free=1
|
where mould_mn=#{rfid}
|
</update>
|
|
<select id="dataInTime" parameterType="java.lang.String" resultType="java.lang.String">
|
select data_time from t_mold_data where mold_id=#{rfid} and types='upper'
|
order by data_time desc limit 0,1
|
</select>
|
<select id="selectMouldId" parameterType="java.lang.String" resultType="java.lang.String">
|
select mould_id from sys_mould where mould_mn=#{rfid}
|
</select>
|
<select id="selectMouldCheck" parameterType="java.lang.String" resultType="java.lang.String">
|
select mod_check_id from t_mould_check where mod_id=#{modId} order by check_time desc limit 0,1
|
</select>
|
<update id="updateMouldCheck" >
|
update t_mould_check set status=2
|
where mod_check_id=#{modCheckId}
|
</update>
|
</mapper>
|