<?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.materials.modules.biz.concret.mapper.SysSteelMapper">
|
<resultMap id="BaseResultMap" type="com.thhy.materials.modules.biz.concret.entity.SysSteel">
|
<id column="steel_id" jdbcType="VARCHAR" property="steelId" />
|
<result column="steel_name" jdbcType="VARCHAR" property="steelName" />
|
<result column="steel_model" jdbcType="VARCHAR" property="steelModel" />
|
<result column="unit" jdbcType="VARCHAR" property="unit" />
|
<result column="stock" jdbcType="DOUBLE" property="stock" />
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
|
<result column="is_use" jdbcType="INTEGER" property="isUse" />
|
<result column="alarm_count" jdbcType="DOUBLE" property="alarmCount" />
|
</resultMap>
|
|
<select id="steelNameAndModelByOne" resultType="java.lang.String">
|
select steel_id from sys_steel where is_use=1
|
and steel_name=#{steelName} and steel_model=#{steelModel} and company_id=#{companyId}
|
</select>
|
|
<insert id="steelInsert" >
|
insert into sys_steel
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="steelId != null">
|
steel_id,
|
</if>
|
<if test="steelName != null">
|
steel_name,
|
</if>
|
<if test="steelModel != null">
|
steel_model,
|
</if>
|
<if test="unit != null">
|
unit,
|
</if>
|
<if test="stock != null">
|
stock,
|
</if>
|
<if test="createTime != null">
|
create_time,
|
</if>
|
<if test="createUser != null">
|
create_user,
|
</if>
|
<if test="isUse != null">
|
is_use,
|
</if>
|
<if test="companyId != null">
|
company_id,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="steelId != null">
|
#{steelId,jdbcType=VARCHAR},
|
</if>
|
<if test="steelName != null">
|
#{steelName,jdbcType=VARCHAR},
|
</if>
|
<if test="steelModel != null">
|
#{steelModel,jdbcType=VARCHAR},
|
</if>
|
<if test="unit != null">
|
#{unit,jdbcType=VARCHAR},
|
</if>
|
<if test="stock != null">
|
#{stock,jdbcType=DOUBLE},
|
</if>
|
<if test="createTime != null">
|
#{createTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="createUser != null">
|
#{createUser,jdbcType=VARCHAR},
|
</if>
|
<if test="isUse != null">
|
#{isUse,jdbcType=INTEGER},
|
</if>
|
<if test="companyId != null">
|
#{companyId,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
<select id="steelList" resultType="com.thhy.materials.modules.biz.concret.entity.SysSteel">
|
select
|
steel_id as steelId,
|
steel_name as steelName,
|
steel_model as steelModel,
|
unit as unit,
|
stock as stock,
|
create_time as createTime,
|
create_user as createUser,
|
is_use as isUse,
|
alarm_count as alarmCount
|
from sys_steel where is_use=1
|
<if test="steelName!=null and steelName!='' ">
|
and steel_name like concat('%',#{steelName},'%')
|
</if>
|
<if test="steelModel!=null and steelModel!='' ">
|
and steel_model like concat('%',#{steelModel},'%')
|
</if>
|
<if test="companyId!=null and companyId!='' ">
|
and company_id=#{companyId}
|
</if>
|
order by create_time desc
|
</select>
|
<select id="steelThingJsList" resultType="com.thhy.materials.modules.biz.concret.entity.SysSteel">
|
select
|
steel_id as steelId,
|
steel_name as steelName,
|
steel_model as steelModel,
|
unit as unit,
|
stock as stock,
|
create_time as createTime,
|
create_user as createUser,
|
is_use as isUse
|
from sys_steel where is_use=1
|
<if test="companyId!=null and companyId!='' ">
|
and company_id=#{companyId}
|
</if>
|
order by create_time desc
|
</select>
|
<update id="steelDel">
|
update sys_steel set
|
is_use=2
|
where steel_id=#{steelId}
|
</update>
|
|
<select id="steelInfo" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.concret.entity.SysSteel">
|
select
|
steel_id as steelId,
|
steel_name as steelName,
|
steel_model as steelModel,
|
unit as unit,
|
stock as stock,
|
create_time as createTime,
|
create_user as createUser,
|
is_use as isUse
|
from sys_steel where is_use=1 and steel_id=#{steelId}
|
</select>
|
|
<update id="steelUpdate">
|
update sys_steel
|
<set>
|
<if test="steelName != null">
|
steel_name = #{steelName,jdbcType=VARCHAR},
|
</if>
|
<if test="steelModel != null">
|
steel_model = #{steelModel,jdbcType=VARCHAR},
|
</if>
|
<if test="unit != null">
|
unit = #{unit,jdbcType=VARCHAR},
|
</if>
|
<if test="stock != null">
|
stock = #{stock,jdbcType=DOUBLE},
|
</if>
|
<if test="createTime != null">
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="createUser != null">
|
create_user = #{createUser,jdbcType=VARCHAR},
|
</if>
|
<if test="isUse != null">
|
is_use = #{isUse,jdbcType=INTEGER},
|
</if>
|
</set>
|
where steel_id = #{steelId,jdbcType=VARCHAR}
|
</update>
|
<update id="steelStockUp" >
|
update sys_steel set
|
stock=#{correctionAfter}
|
where steel_id=#{steelId}
|
</update>
|
|
<insert id="steelCheckInsert" >
|
insert into sys_steel_correction
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="ids != null">
|
id,
|
</if>
|
<if test="steelId != null">
|
steel_id,
|
</if>
|
<if test="correctionBefore != null">
|
correction_before,
|
</if>
|
<if test="correctionNum != null">
|
correction_num,
|
</if>
|
<if test="correctionAfter != null">
|
correction_after,
|
</if>
|
<if test="remark != null">
|
remark,
|
</if>
|
<if test="createTime != null">
|
create_time,
|
</if>
|
<if test="createUser != null">
|
create_user,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="ids != null">
|
#{ids,jdbcType=VARCHAR},
|
</if>
|
<if test="steelId != null">
|
#{steelId,jdbcType=VARCHAR},
|
</if>
|
<if test="correctionBefore != null">
|
#{correctionBefore,jdbcType=VARCHAR},
|
</if>
|
<if test="correctionNum != null">
|
#{correctionNum,jdbcType=VARCHAR},
|
</if>
|
<if test="correctionAfter != null">
|
#{correctionAfter,jdbcType=VARCHAR},
|
</if>
|
<if test="remark != null">
|
#{remark,jdbcType=VARCHAR},
|
</if>
|
<if test="createTime != null">
|
#{createTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="createUser != null">
|
#{createUser,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
<select id="steelCheckList" resultType="com.thhy.materials.modules.biz.concret.entity.SysSteelCorrection">
|
select
|
ssc.id,
|
ssc.steel_id as steelId,
|
ssc.correction_before as correctionBefore,
|
ssc.correction_num as correctionNum,
|
ssc.correction_after as correctionAfter,
|
ssc.remark as remark,
|
ssc.create_time as createTime,
|
ss.steel_name as steelName,
|
ss.steel_model as steelModel,
|
su.real_name as realName,
|
ss.unit from sys_steel_correction ssc
|
left join sys_steel ss on ssc.steel_id=ss.steel_id
|
left join sys_users su on ssc.create_user=su.user_id
|
where 1=1
|
<if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
|
and ssc.create_time between #{strTime} and #{endTime}
|
</if>
|
<if test="steelName!=null and steelName!='' ">
|
and ss.steel_name like concat('%',#{steelName},'%')
|
</if>
|
<if test="steelModel!=null and steelModel!='' ">
|
and ss.steel_model like concat('%',#{steelModel},'%')
|
</if>
|
<if test="steelId!=null and steelId!='' ">
|
and ssc.steel_id=#{steelId}
|
</if>
|
<if test="companyId!=null and companyId!='' ">
|
and ss.company_id=#{companyId}
|
</if>
|
order by ssc.create_time desc
|
</select>
|
<select id="steelPull" resultType="com.thhy.materials.modules.biz.concret.entity.SysSteel">
|
select steel_id as steelId,steel_name as steelName,
|
steel_model as steelModel,unit
|
from sys_steel where is_use=1
|
<if test="companyId!=null and companyId!='' ">
|
and company_id=#{companyId}
|
</if>
|
</select>
|
<select id="steelCorrection" parameterType="java.lang.String" resultType="java.lang.String">
|
select id from sys_steel_record where steel_id=#{steelId} and is_use=1
|
</select>
|
|
<update id="steelAlertSettings">
|
update sys_steel set
|
alarm_count=#{alarmCount}
|
where steel_id=#{steelId}
|
</update>
|
|
<select id="selectsteelAlert" resultType="com.thhy.materials.modules.biz.concret.entity.SysSteel">
|
SELECT
|
concat(steel_name,'-',steel_model) steelName
|
FROM sys_steel WHERE alarm_count > stock
|
</select>
|
|
<select id="restDataByOne" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.concret.entity.dto.RestDataByOneDto">
|
select
|
id,
|
device_id as deviceId,
|
tem,
|
hum,
|
check_time as checkTime
|
from t_rest_data where
|
device_id=#{deviceId}
|
order by check_time desc
|
</select>
|
|
</mapper>
|