<?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.mobile.modules.biz.pipeinfo.mapper.PipeInfoMapper">
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
t.pipe_id as pipeId,
|
t.block_num as blockNum,
|
t.check_result as checkResult,
|
t.check_time as checkTime,
|
t.grouting_holes as groutingHoles,
|
t.into_mod_time as intoModTime,
|
t.into_mod_user as intoModUser,
|
t.mod_id as modId,
|
t.pipe_num as pipeNum,
|
t.pouring_time as pouringTime,
|
t.pro_id as proId,
|
t.reinforcement as reinforcement,
|
t.ring_num as ringNum,
|
t.turn as turn,
|
t.go_in as goIn,
|
t.size,
|
t.in_repo_time as inRepoTime,
|
t.out_repo_time as outRepoTime,
|
t.produce_number as produceNumber,
|
t.out_mod as outMod
|
</sql>
|
|
<sql id="condition_query">
|
<where>
|
<trim suffixOverrides=" AND ">
|
<if test="blockNum!=null and blockNum!=''">
|
t.block_num = #{blockNum} AND
|
</if>
|
<if test="checkResult!=null">
|
t.check_result = #{checkResult} AND
|
</if>
|
<if test="checkTime!=null">
|
t.check_time = #{checkTime} AND
|
</if>
|
<if test="groutingHoles!=null and groutingHoles!=''">
|
t.grouting_holes = #{groutingHoles} AND
|
</if>
|
<if test="intoModTime!=null">
|
t.into_mod_time = #{intoModTime} AND
|
</if>
|
<if test="intoModUser!=null and intoModUser!=''">
|
t.into_mod_user = #{intoModUser} AND
|
</if>
|
<if test="modId!=null and modId!=''">
|
t.mod_id = #{modId} AND
|
</if>
|
<if test="pipeNum!=null and pipeNum!=''">
|
t.pipe_num = #{pipeNum} AND
|
</if>
|
<if test="pouringTime!=null">
|
t.pouring_time = #{pouringTime} AND
|
</if>
|
<if test="proId!=null and proId!=''">
|
t.pro_id = #{proId} AND
|
</if>
|
<if test="reinforcement!=null and reinforcement!=''">
|
t.reinforcement = #{reinforcement} AND
|
</if>
|
<if test="ringNum!=null and ringNum!=''">
|
t.ring_num = #{ringNum} AND
|
</if>
|
<if test="turn!=null and turn!=''">
|
t.turn = #{turn} AND
|
</if>
|
</trim>
|
</where>
|
</sql>
|
|
<select id="queryById" resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.PipeInfo">
|
select <include refid="Base_Column_List" />
|
from t_pipe_info t
|
where t.pipe_id=#{pipeId}
|
</select>
|
|
<select id="queryByPipeNum" resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.PipeInfo">
|
select <include refid="Base_Column_List" />
|
from t_pipe_info t
|
where t.pipe_num=#{pipeNum}
|
</select>
|
|
<select id="countByPipeInfo" resultType="int">
|
select count(pipe_id) from t_pipe_info where pro_id = #{proId}
|
</select>
|
|
<select id="queryMaxPipeNumByProId" resultType="int">
|
select case when b.maxNum is null then 0 else b.maxNum end as maxNum from
|
(select max(a.num) as maxNum from (
|
select CONVERT(SUBSTR(pipe_num from LENGTH(pipe_num)-4 for LENGTH(pipe_num)),SIGNED) as num from t_pipe_info where pro_id = #{proId}
|
) a ) b
|
</select>
|
|
<select id="queryVersionById" resultType="integer">
|
select version from t_pipe_info
|
where pipe_id=#{pipeId}
|
</select>
|
|
<!--查询列表-->
|
<select id="findList" resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.PipeInfo">
|
SELECT
|
<include refid="Base_Column_List" />
|
from t_pipe_info t
|
<include refid="condition_query" />
|
</select>
|
|
<select id="screenFindList" resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.PipeInfo">
|
SELECT
|
<include refid="Base_Column_List" />
|
from t_pipe_info t
|
<include refid="condition_query" />
|
order by t.into_mod_time desc limit 1
|
</select>
|
|
<select id="pipelist" resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.PipeListVo">
|
select a.* from (select tpi.pipe_id as pipeId,tpi.ring_num as ringNum,tpi.pipe_num as pipeNum,sd1.dict_name as
|
turnName,sd2.dict_name as reinforcementName,
|
sd3.dict_name as groutingHolesName,sd4.dict_name as blockNumName,sd5.dict_name as sizeName,sm.mould_num as mouldNum,
|
tpi.into_mod_time as intoModTime, su.real_name AS intoModUser,
|
tpi.pouring_time as pouringTime,tpi.check_time as checkTime,su1.real_name AS checkName,
|
sp.pro_name as proName,tpi.check_result as checkResult,
|
(select GROUP_CONCAT(sg.group_name) from sys_group_user sgu left join sys_group sg on sg.group_id =
|
sgu.group_id
|
where sgu.user_id = spu.user_id group by sgu.user_id) as groupName,
|
(select GROUP_CONCAT(sg.group_id) from sys_group_user sgu left join sys_group sg on sg.group_id = sgu.group_id
|
where sgu.user_id = spu.user_id group by sgu.user_id) as groupIds
|
from t_pipe_info tpi
|
left join sys_dict sd1 on sd1.dict_id = tpi.turn
|
left join sys_dict sd2 on sd2.dict_id = tpi.reinforcement
|
left join sys_dict sd3 on sd3.dict_id = tpi.grouting_holes
|
left join sys_dict sd4 on sd4.dict_id = tpi.block_num
|
left join sys_dict sd5 on sd5.dict_id = tpi.size
|
left join sys_mould sm on sm.mould_id = tpi.mod_id
|
left join sys_project sp on sp.pro_id = tpi.pro_id
|
left join sys_users su on su.user_id = tpi.into_mod_user
|
LEFT JOIN sys_users su1 ON su1.user_id = tpi.check_user
|
left join sys_plat_user spu on spu.user_id = su.plat_id
|
<where>
|
<trim suffixOverrides=" AND ">
|
|
<if test="companyId!=null and companyId!=''">
|
sp.company_id = #{companyId} AND
|
</if>
|
<if test="ringNum!=null and ringNum!=''">
|
tpi.ring_num LIKE concat('%',#{ringNum},'%') AND
|
</if>
|
<if test="checkResult!=null">
|
tpi.check_result = #{checkResult} AND
|
</if>
|
<if test="proId!=null and proId!=''">
|
tpi.pro_id = #{proId} AND
|
</if>
|
<if test="reinforcement !=null and reinforcement !=''">
|
tpi.reinforcement = #{reinforcement} AND
|
</if>
|
|
<if test="groutingHoles !=null and groutingHoles !=''">
|
tpi.grouting_holes = #{groutingHoles} AND
|
</if>
|
|
<if test="blockNum!=null and blockNum!=''">
|
tpi.block_num = #{blockNum} AND
|
</if>
|
|
<if test="inModStartTime!=null">
|
tpi.into_mod_time >= #{inModStartTime} AND
|
</if>
|
|
<if test="inModEndTime!=null">
|
tpi.into_mod_time <= #{inModEndTime} AND
|
</if>
|
|
<if test="pouringStartTime!=null">
|
tpi.pouring_time > #{pouringStartTime} AND
|
</if>
|
|
<if test="pouringEndTime!=null">
|
tpi.pouring_time < #{pouringEndTime} AND
|
</if>
|
|
<if test="checkStartTime!=null">
|
tpi.check_time > #{checkStartTime} AND
|
</if>
|
|
<if test="checkEndTime!=null">
|
tpi.check_time < #{checkEndTime} AND
|
</if>
|
<if test="num!=null">
|
tpi.pipe_num = #{num} AND
|
</if>
|
<if test="segmentId!=null">
|
tpi.segment_id = #{segmentId} AND
|
</if>
|
<if test="yearMonth!=null">
|
tpi.out_mod_time like CONCAT(#{yearMonth},'%') AND
|
</if>
|
<if test="goIn!=null">
|
tpi.go_in = 2 AND
|
</if>
|
</trim>
|
</where>
|
order by tpi.check_time desc
|
) a
|
<if test="groupId != null and groupId !=''">
|
where #{groupId} in (a.groupIds)
|
</if>
|
</select>
|
<select id="pipeThingJsInfo" resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.PipeListVo">
|
select a.* from (select tpi.pipe_id as pipeId,tpi.ring_num as ringNum,tpi.pipe_num as pipeNum,sd1.dict_name as
|
turnName,sd2.dict_name as reinforcementName,tpi.mod_id AS modId,
|
tpi.produce_number AS produceNumber,
|
sd3.dict_name as groutingHolesName,sd4.dict_name as blockNumName,sd5.dict_name as sizeName,sm.mould_num as mouldNum,
|
tpi.into_mod_time as intoModTime, su.real_name AS intoModUser,
|
tpi.pouring_time as pouringTime,tpi.check_time as checkTime,su1.real_name AS checkName,
|
sp.pro_name as proName,tpi.check_result as checkResult,
|
(select GROUP_CONCAT(sg.group_name) from sys_group_user sgu left join sys_group sg on sg.group_id =
|
sgu.group_id
|
where sgu.user_id = spu.user_id group by sgu.user_id) as groupName,
|
(select GROUP_CONCAT(sg.group_id) from sys_group_user sgu left join sys_group sg on sg.group_id = sgu.group_id
|
where sgu.user_id = spu.user_id group by sgu.user_id) as groupIds
|
from t_pipe_info tpi
|
left join sys_dict sd1 on sd1.dict_id = tpi.turn
|
left join sys_dict sd2 on sd2.dict_id = tpi.reinforcement
|
left join sys_dict sd3 on sd3.dict_id = tpi.grouting_holes
|
left join sys_dict sd4 on sd4.dict_id = tpi.block_num
|
left join sys_dict sd5 on sd5.dict_id = tpi.size
|
left join sys_mould sm on sm.mould_id = tpi.mod_id
|
left join sys_project sp on sp.pro_id = tpi.pro_id
|
left join sys_users su on su.user_id = tpi.into_mod_user
|
LEFT JOIN sys_users su1 ON su1.user_id = tpi.check_user
|
left join sys_plat_user spu on spu.user_id = su.plat_id
|
<where>
|
<trim suffixOverrides=" AND ">
|
tpi.check_result != 0 AND
|
<if test="companyId!=null and companyId!=''">
|
sp.company_id = #{companyId} AND
|
</if>
|
</trim>
|
</where>
|
order by tpi.into_mod_time desc limit 0,1
|
) a
|
</select>
|
|
<select id="queryPipeInfoByPipeId" resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.PipeInfoVo">
|
select
|
tsp.produce_number as produceNumber,
|
sp.pro_name as proName,
|
spu.real_name as createUserName,
|
su2.real_name as steelCheckUserName,
|
tsp.quality_time as steelCheckTime,
|
tsp.is_qualified as steelCheckResult,
|
tsp.print_time as printTime,
|
sm.mould_num as mouldNum,sm.current_cycle_time as currentCycleTime,sm.max_cycle_time as maxCycleTime,sm.mould_code as mouldCode,
|
tpi.ring_num as ringNum,tpi.pipe_num as pipeNum,tpi.into_mod_time as intoModTime,
|
tpi.check_user as checkUser,su.real_name as pipeCheckUserName,tpi.check_time as pipeCheckTime,
|
sd1.dict_name as turnName,
|
sd2.dict_name as reinforcementName,
|
sd3.dict_name as groutingHolesName,
|
sd4.dict_name as blockNumName,
|
sd5.dict_name as sizeName,
|
sd6.dict_name as mouldTypeName
|
|
from t_pipe_info tpi
|
left join sys_dict sd1 on sd1.dict_id = tpi.turn
|
left join sys_dict sd2 on sd2.dict_id = tpi.reinforcement
|
left join sys_dict sd3 on sd3.dict_id = tpi.grouting_holes
|
left join sys_dict sd4 on sd4.dict_id = tpi.block_num
|
left join sys_dict sd5 on sd5.dict_id = tpi.size
|
left join sys_mould sm on sm.mould_id = tpi.mod_id
|
left join sys_dict sd6 on sd6.dict_id = sm.mould_type
|
left join t_steel_produce tsp on tsp.produce_number = tpi.produce_number
|
left join sys_project sp on sp.pro_id = tpi.pro_id
|
left join sys_users su on su.user_id = tpi.check_user
|
left join sys_users su1 on su1.user_id = tsp.create_user
|
left join sys_users su2 on su2.user_id = tsp.quality_user
|
left join t_steel_print stp on stp.steel_print_id = tsp.steel_print_id
|
left join sys_plat_user spu on spu.user_id = stp.plat_user_id
|
where 1=1
|
<if test="pipeId != null">
|
and tpi.pipe_id = #{pipeId}
|
</if>
|
<if test="num != null">
|
and tpi.pipe_num = #{num}
|
</if>
|
</select>
|
|
<select id="queryByRingNum" resultType="com.thhy.mobile.modules.biz.cultivated.entity.PipeIntoListVo">
|
select t.ring_num as ringNum,t.pipe_num as pipeNum,t.check_time as checkTime,sd.dict_name as blockNum
|
from t_pipe_info t
|
left join sys_dict sd on sd.dict_id = t.block_num
|
where t.ring_num = #{ringNum}
|
</select>
|
|
<!--查询列表-->
|
<select id="findAll" resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.PipeInfo">
|
SELECT
|
<include refid="Base_Column_List" />
|
from t_pipe_info t
|
</select>
|
|
<!--插入操作-->
|
<insert id="insert">
|
insert into t_pipe_info
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="blockNum != null">
|
block_num,
|
</if>
|
<if test="checkResult != null">
|
check_result,
|
</if>
|
<if test="checkTime != null">
|
check_time,
|
</if>
|
<if test="groutingHoles != null">
|
grouting_holes,
|
</if>
|
<if test="intoModTime != null">
|
into_mod_time,
|
</if>
|
<if test="intoModUser != null">
|
into_mod_user,
|
</if>
|
<if test="modId != null">
|
mod_id,
|
</if>
|
<if test="pipeId != null">
|
pipe_id,
|
</if>
|
<if test="pipeNum != null">
|
pipe_num,
|
</if>
|
<if test="pouringTime != null">
|
pouring_time,
|
</if>
|
<if test="proId != null">
|
pro_id,
|
</if>
|
<if test="reinforcement != null">
|
reinforcement,
|
</if>
|
<if test="ringNum != null">
|
ring_num,
|
</if>
|
<if test="turn != null">
|
turn,
|
</if>
|
<if test="size != null">
|
`size`,
|
</if>
|
<if test="produceNumber != null and produceNumber!=''">
|
produce_number,
|
</if>
|
|
<if test="outMod != null">
|
out_mod,
|
</if>
|
<if test="createFlag != null">
|
create_flag,
|
</if>
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="blockNum != null">
|
#{blockNum},
|
</if>
|
<if test="checkResult != null">
|
#{checkResult},
|
</if>
|
<if test="checkTime != null">
|
#{checkTime},
|
</if>
|
<if test="groutingHoles != null">
|
#{groutingHoles},
|
</if>
|
<if test="intoModTime != null">
|
#{intoModTime},
|
</if>
|
<if test="intoModUser != null">
|
#{intoModUser},
|
</if>
|
<if test="modId != null">
|
#{modId},
|
</if>
|
<if test="pipeId != null">
|
#{pipeId},
|
</if>
|
<if test="pipeNum != null">
|
#{pipeNum},
|
</if>
|
<if test="pouringTime != null">
|
#{pouringTime},
|
</if>
|
<if test="proId != null">
|
#{proId},
|
</if>
|
<if test="reinforcement != null">
|
#{reinforcement},
|
</if>
|
<if test="ringNum != null">
|
#{ringNum},
|
</if>
|
<if test="turn != null">
|
#{turn},
|
</if>
|
<if test="size != null">
|
#{size},
|
</if>
|
<if test="produceNumber != null">
|
#{produceNumber},
|
</if>
|
<if test="outMod != null">
|
#{outMod},
|
</if>
|
<if test="createFlag != null">
|
#{createFlag},
|
</if>
|
</trim>
|
</insert>
|
|
|
<!--更新操作-->
|
<update id="update">
|
update t_pipe_info
|
<set>
|
<if test="blockNum != null">
|
block_num=#{blockNum},
|
</if>
|
<if test="checkResult != null">
|
check_result=#{checkResult},
|
</if>
|
<if test="checkTime != null">
|
check_time=#{checkTime},
|
</if>
|
<if test="groutingHoles != null">
|
grouting_holes=#{groutingHoles},
|
</if>
|
<if test="intoModTime != null">
|
into_mod_time=#{intoModTime},
|
</if>
|
<if test="intoModUser != null">
|
into_mod_user=#{intoModUser},
|
</if>
|
<if test="modId != null">
|
mod_id=#{modId},
|
</if>
|
<if test="pipeNum != null">
|
pipe_num=#{pipeNum},
|
</if>
|
<if test="pouringTime != null">
|
pouring_time=#{pouringTime},
|
</if>
|
<if test="proId != null">
|
pro_id=#{proId},
|
</if>
|
<if test="reinforcement != null">
|
reinforcement=#{reinforcement},
|
</if>
|
<if test="ringNum != null">
|
ring_num=#{ringNum},
|
</if>
|
<if test="turn != null">
|
turn=#{turn},
|
</if>
|
</set>
|
where pipe_id=#{pipeId}
|
</update>
|
|
<!--逻辑删除-->
|
<update id="deletelogic">
|
update t_pipe_info
|
SET is_use = 0
|
where pipe_id=#{pipeId}
|
</update>
|
|
<!--根据ID删除-->
|
<delete id="deleteById">
|
delete from t_pipe_info
|
where pipe_id=#{pipeId}
|
</delete>
|
|
<select id="queryRingComplete" resultType="com.thhy.mobile.modules.biz.mouldcheck.entity.RingCompleteCheck">
|
select * from (SELECT a.ringnum,a.pipecount,(select count(pipe_id) from t_pipe_info where ring_num = a.ringnum and block_num = #{blockNum}) as isExist from
|
(select ring_num as ringnum,count(block_num) as pipecount from t_pipe_info
|
where create_flag = 1 and pro_id=#{proId}
|
and size=#{size} and reinforcement=#{reinforcement} GROUP BY ring_num) a
|
)c where c.isExist = 0 order by c.ringnum limit 1
|
</select>
|
|
<select id="queryMaxRingNum" resultType="int">
|
select case when a.maxRingNum is null then 1 else a.maxRingNum end as maxRingNum
|
from
|
(
|
SELECT ( max(tpi.ring_num + 0 )) AS maxRingNum FROM t_pipe_info tpi left join sys_project sp on sp.pro_id = tpi.pro_id where sp.company_id = #{companyId}
|
) a
|
</select>
|
|
<update id="updateCheckResult">
|
update t_pipe_info set check_result = #{checkResult},check_user = #{checkUser},check_time = sysdate() where pipe_id=#{pipeId}
|
</update>
|
|
<select id="pipeMonthData" resultType="com.thhy.mobile.modules.biz.steelproduce.entity.ProduceMonthVo">
|
select DATE_FORMAT(a.`month`,'%Y-%m') as `month`, case when b.count is NULL then 0 else b.count end as count from
|
(SELECT @s := DATE_ADD(@s,INTERVAL 1 MONTH) as `month` FROM mysql.help_topic,(SELECT @s := DATE_ADD(#{startTime},INTERVAL -2 MONTH)) temp WHERE @s < #{endTime}) a
|
left join
|
(select DATE_FORMAT(tpi.check_time,'%Y-%m') as `month`,count(tpi.pipe_id) as count from t_pipe_info tpi
|
left join sys_project sp on sp.pro_id = tpi.pro_id
|
where tpi.check_result = 1 and sp.company_id = #{companyId} group by DATE_FORMAT(check_time,'%Y-%m')
|
) b on DATE_FORMAT(a.`month`,'%Y-%m') = b.`month`
|
</select>
|
|
<select id="pipeCompare" resultType="com.thhy.mobile.modules.biz.steelproduce.entity.ProduceMonthVo">
|
select DATE_FORMAT(a.`month`,'%Y-%m') as `month`, case when b.count is NULL then 0 else b.count end as count,c.plan_product as planProduct from
|
(SELECT @s := DATE_ADD(@s,INTERVAL 1 MONTH) as `month` FROM mysql.help_topic,(SELECT @s := DATE_ADD(#{startTime},INTERVAL -2 MONTH)) temp WHERE @s < #{endTime}) a
|
left join
|
(select DATE_FORMAT(tpi.check_time,'%Y-%m') as `month`,count(tpi.pipe_id) as count from t_pipe_info tpi
|
left join sys_project sp1 on sp1.pro_id = tpi.pro_id
|
where tpi.check_result = 1 and sp1.company_id = #{companyId} group by DATE_FORMAT(tpi.check_time,'%Y-%m')
|
|
) b on DATE_FORMAT(a.`month`,'%Y-%m') = b.`month`
|
left join
|
(select DATE_FORMAT(DATE(CONCAT(pp.plan_year,'-',ppm.`month`,'-01')),'%Y-%m') as `month`,sum(ppm.plan_product) as plan_product
|
from t_pipe_plan_month ppm
|
left join t_pipe_plan pp on ppm.pipe_plan_id = pp.plan_id
|
left join sys_project sp on sp.pro_id = pp.pro_id
|
where sp.company_id = #{companyId} AND (DATE(CONCAT(pp.plan_year,'-',ppm.`month`,'-01')) between #{startTime} and #{endTime}) group by DATE_FORMAT(DATE(CONCAT(pp.plan_year,'-',ppm.`month`,'-01')),'%Y-%m')) c on DATE_FORMAT(a.`month`,'%Y-%m') = c.`month`
|
</select>
|
|
<select id="pipeCompareByPro" resultType="com.thhy.mobile.modules.biz.steelproduce.entity.ProduceMonthVo">
|
select DATE_FORMAT(a.`month`,'%Y-%m') as `month`, case when b.count is NULL then 0 else b.count end as count,
|
case when c.plan_product is NULL then 0 else c.plan_product end as planProduct from
|
(SELECT @s := DATE_ADD(@s,INTERVAL 1 MONTH) as `month` FROM mysql.help_topic,(SELECT @s := DATE_ADD(#{startTime},INTERVAL -2 MONTH)) temp WHERE @s < #{endTime}) a
|
left join
|
(select DATE_FORMAT(tpi.check_time,'%Y-%m') as `month`,count(tpi.pipe_id) as count from t_pipe_info tpi
|
left join sys_project sp1 on sp1.pro_id = tpi.pro_id
|
where tpi.check_result = 1 and sp1.company_id = #{companyId} and sp1.pro_id = #{proId} group by DATE_FORMAT(tpi.check_time,'%Y-%m')
|
|
) b on DATE_FORMAT(a.`month`,'%Y-%m') = b.`month`
|
left join
|
(select DATE_FORMAT(DATE(CONCAT(pp.plan_year,'-',ppm.`month`,'-01')),'%Y-%m') as `month`,sum(ppm.plan_product) as plan_product
|
from t_pipe_plan_month ppm
|
left join t_pipe_plan pp on ppm.pipe_plan_id = pp.plan_id
|
left join sys_project sp on sp.pro_id = pp.pro_id
|
where sp.company_id = #{companyId} AND sp.pro_id = #{proId} AND (DATE(CONCAT(pp.plan_year,'-',ppm.`month`,'-01')) between #{startTime} and #{endTime}) group by DATE_FORMAT(DATE(CONCAT(pp.plan_year,'-',ppm.`month`,'-01')),'%Y-%m')) c on DATE_FORMAT(a.`month`,'%Y-%m') = c.`month`
|
</select>
|
|
<select id="checkHistoryList" resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.PipeCheckHistoryListVo">
|
select tpi.ring_num as ringNum,sp.pro_name as proName,tpi.pipe_num as pipeNum,sd1.dict_name as turnName,sd2.dict_name as sizeName,sd3.dict_name as blockNumName,
|
sd4.dict_name as reinforcementName,sd5.dict_name as groutingHolesName,sm.mould_num as mouldNum,tpi.into_mod_time as intoModTime,
|
tpi.check_time as checkTime
|
from t_pipe_info tpi
|
left join sys_project sp on sp.pro_id = tpi.pro_id
|
left join sys_mould sm on sm.mould_id = tpi.mod_id
|
left join sys_dict sd1 on sd1.dict_id = tpi.turn
|
left join sys_dict sd2 on sd2.dict_id = tpi.size
|
left join sys_dict sd3 on sd3.dict_id = tpi.block_num
|
left join sys_dict sd4 on sd4.dict_id = tpi.reinforcement
|
left join sys_dict sd5 on sd5.dict_id = tpi.grouting_holes
|
<where>
|
<trim suffixOverrides=" AND ">
|
tpi.ring_num = #{ringNum}
|
</trim>
|
</where>
|
</select>
|
|
<delete id="deleteBySteelProNum">
|
delete from t_pipe_info where produce_number = #{produceNumber}
|
</delete>
|
|
<select id="queryIsCheckBySteelNum" resultType="int">
|
select check_result from t_pipe_info where produce_number = #{produceNumber}
|
</select>
|
|
<select id="hisSteelInfo" resultType="com.thhy.mobile.modules.biz.checkhistory.entity.SteelInfoVo">
|
select tsp.produce_number as produceNumber,sd2.dict_name as sizeName,sd3.dict_name as blockNumName,
|
sd4.dict_name as reinforcementName,tsp.print_time as printTime,tsp.quality_time as qualityTime
|
from t_steel_produce tsp
|
left join sys_dict sd2 on sd2.dict_id = tsp.size_id
|
left join sys_dict sd3 on sd3.dict_id = tsp.block_num
|
left join sys_dict sd4 on sd4.dict_id = tsp.reinforcement_id
|
where tsp.produce_number = #{produceNumber}
|
</select>
|
|
<select id="leastMixStation" resultType="com.thhy.mobile.modules.biz.checkhistory.entity.MixStation">
|
select sd.dict_name as materialName,mmi.material_value as materialValue
|
from t_mix_material_info mmi
|
left join t_mix_material mm on mmi.mix_material_id = mm.id
|
left join sys_dict sd on sd.dict_id = mmi.material_name
|
where mm.id = (select id from t_mix_material order by create_time desc limit 1)
|
</select>
|
|
<select id="queryWaterByRingNum" resultType="com.thhy.mobile.modules.biz.checkhistory.entity.WaterCulInfoVo">
|
select wc.water_cultivated_name as waterCultivatedName,tpc.create_time as createTime,case when out_water = 1 then TIMESTAMPDIFF(MINUTE,tpc.create_time,SYSDATE()) else TIMESTAMPDIFF(MINUTE,tpc.create_time,tpc.out_time) end as times,tpc.out_time as outTime
|
from t_pipe_cultivated tpc
|
left join t_water_cultivated wc on wc.water_cultivated_id = tpc.water_cultivated_id
|
where tpc.ring_num = #{ringNum}
|
</select>
|
|
<update id="updatePipeOutMod">
|
update t_pipe_info set out_mod = 2,out_mod_time = sysdate() where pipe_num = #{pipeNum}
|
</update>
|
|
<update id="updatePipeInRepo">
|
update t_pipe_info set go_in = 1,in_repo_time = sysdate() where pipe_num = #{pipeNum}
|
</update>
|
|
<update id="updateModCheck">
|
update t_mould_check set status = 2 where mod_id = #{modId} and match_status = 2 and is_use = 1
|
</update>
|
|
<update id="updateSysMouldFree">
|
update sys_mould set free = #{free} where mould_id = #{modId}
|
</update>
|
|
<select id="RepoRecordCountByPipeNum" resultType="int">
|
select count(id) from t_repo_record_pipe where pipe_num = #{pipeNum}
|
</select>
|
|
|
|
<select id="RepoRecordByPipeNum" resultType="com.thhy.mobile.modules.biz.checkhistory.entity.RepoInfoVo">
|
select r.repo_name as repoName,tru.unit_name as unitName,rrp.create_time as createTime,rrp.out_repo as outRepo,rrp.out_repo_time as outRepoTime
|
from t_repo_record_pipe rrp
|
left join t_repo_record trr on trr.record_id = rrp.record_id
|
left join t_repo r on r.repo_id = trr.repo_id
|
left join t_repo_unit tru on trr.repo_unit_id = tru.unit_id
|
where rrp.pipe_num = #{pipeNum}
|
</select>
|
|
<select id="PipeOutInfo" resultType="com.thhy.mobile.modules.biz.checkhistory.entity.OutInfoVo">
|
select su.real_name as sendUserName,sc.car_brand as carBrand,sc.car_driver as carDriver,sr.reciver_name as reciverName,po.str_time as startTime,po.end_time as endTime
|
from t_pipe_out_pipe pop
|
left join t_pipe_out po on po.pipe_out_id = pop.pipe_out_id
|
left join sys_users su on su.user_id = po.out_user_id
|
left join sys_car sc on sc.car_id = po.car_id
|
left join sys_reciver sr on sr.id = po.in_user_id
|
where pop.pipe_id = #{pipeId}
|
</select>
|
|
<select id="ringCompleteByRingNum" resultType="int">
|
select count(a.ring_num) as ringCount from
|
(
|
select tpi.ring_num,GROUP_CONCAT(sd.dict_name order by sd.dict_value) as blockName,
|
(select GROUP_CONCAT(sd1.dict_name order by sd1.dict_value) from sys_pro_blok spb left join sys_dict sd1 on sd1.dict_id = spb.block_num where spb.pro_id = max(tpi.pro_id) group by spb.pro_id) as proBlock
|
from t_pipe_info tpi
|
left join sys_dict sd on sd.dict_id = tpi.block_num
|
where tpi.check_result = 1 and tpi.ring_num = #{ringNum}
|
group by tpi.ring_num
|
) a where a.blockName = a.proBlock
|
</select>
|
|
<select id="problemInfo" resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.ProblemInfoVo">
|
select pipe_check_id as pipeCheckId,check_result as checkResult,check_reason as existProblem,exe_pro_result as exeProResult,remark,exe_pro_note as exeProNote
|
from t_pipe_check_record where pipe_id = #{pipeId}
|
order by check_time desc limit 1
|
</select>
|
|
<select id="checkfiles" resultType="string">
|
select check_file from t_pipe_check_file
|
where pipe_check_id = #{pipeCheckId}
|
</select>
|
|
<select id="queryReasons" resultType="string">
|
select GROUP_CONCAT(reason_name) as reasonName from t_check_reason
|
<where>
|
<foreach collection="idList" item="id" index="index" open="id in (" separator="," close=")" nullable="false">
|
#{id}
|
</foreach>
|
</where>
|
GROUP BY reason_type
|
</select>
|
|
<update id="updateProblem">
|
update t_pipe_check_record
|
<set>
|
<trim suffixOverrides=",">
|
exec_finish = 1,
|
<if test="exeProResult !=null and exeProResult!=''">
|
exe_pro_result = #{exeProResult},
|
</if>
|
<if test="exeProNote !=null and exeProNote!=''">
|
exe_pro_note = #{exeProNote},
|
</if>
|
</trim>
|
</set>
|
where pipe_check_id = #{pipeCheckId}
|
</update>
|
|
<select id="querySteelByPRSB" resultType="com.thhy.mobile.modules.biz.checkhistory.entity.SteelVo">
|
select sn.steel_id as steelId,ste.steel_name as steelName,sc.create_time as createTime,ste.steel_model as steelModel
|
from t_steel_need sn
|
left join t_steel_consumption sc on sn.consumption_id = sc.consumption_id
|
left join sys_steel ste on ste.steel_id = sn.steel_id
|
where sc.pro_id = #{proId} and sc.size_id = #{size} and sc.reinforcement_id = #{reinforcement} and sc.block_id = #{blockNum} and sc.is_use = 1
|
</select>
|
<select id="modIdlThing" parameterType="java.lang.String" resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.ModIdlThing">
|
SELECT
|
sm.mould_id AS mouldId,
|
sm.mould_num AS mouldNum,
|
sm.mould_code AS mouldCode,
|
sd.dict_name AS mouldType,
|
sd1.dict_name AS mouldSize,
|
sd2.dict_name AS mouldTurn,
|
sm.mould_mn AS mouldMn,
|
sm.current_cycle_time AS currentCycleTime
|
FROM
|
sys_mould sm
|
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
|
where sm.mould_id=#{modId}
|
</select>
|
<select id="steelProduceThing" parameterType="java.lang.String"
|
resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.SteelProduceThing">
|
SELECT tsp.steel_produce_id AS steelProduceId,
|
tsp.produce_number AS produceNumber,
|
sp.pro_id AS proId,
|
sp.pro_name AS proName,
|
sd.dict_name AS sizeName,
|
sd1.dict_name AS reinforcementName,
|
sd2.dict_name AS blockName,
|
su.real_name AS realName,
|
sg.group_name AS groupName,
|
su1.real_name AS qualityUserName,
|
tsp.quality_time AS qualityTime,
|
tsp.is_qualified AS isQualified,
|
tsp.is_model AS isModel,
|
tsp.print_time AS printTime
|
FROM t_steel_produce tsp
|
LEFT JOIN sys_project sp ON tsp.pro_id = sp.pro_id
|
LEFT JOIN sys_dict sd ON tsp.size_id = sd.dict_id
|
LEFT JOIN sys_dict sd1 ON tsp.reinforcement_id = sd1.dict_id
|
LEFT JOIN sys_dict sd2 ON tsp.block_num = sd2.dict_id
|
LEFT JOIN sys_users su ON tsp.create_user = su.user_id
|
LEFT JOIN sys_group_user sgu ON su.plat_id = sgu.user_id
|
LEFT JOIN sys_group sg ON sgu.group_id = sg.group_id
|
LEFT JOIN sys_users su1 ON tsp.quality_user = su1.user_id
|
WHERE tsp.is_use = 1
|
AND tsp.produce_number = #{produceNumber}
|
</select>
|
|
<update id="pipeIdOutUpdate">
|
update t_pipe_info
|
set placing_type=2,
|
placing_out_time=sysdate()
|
where pipe_id=#{pipeId}
|
</update>
|
|
<select id="queryAllProject" resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.ScreenPipeCompare">
|
select pro_id as proId,pro_name as proName from sys_project where is_use = 1
|
</select>
|
|
|
<select id="queryPipeDeplete" resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.MaterialInfo">
|
SELECT rm.material_name as materialName,sd.dict_name as materialCName,rm.material_value as materialValue
|
from t_rsb_materials rm
|
left join t_rsb_material_plan rmp on rm.rsb_id = rmp.id
|
left join sys_dict sd on sd.dict_id = rm.material_name
|
where rmp.pro_id = #{proId} and rmp.block_num = #{blockNum} and rmp.reinforcement = #{reinforcement} and rmp.size = #{size}
|
|
</select>
|
|
<select id="queryMaterStock" resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.MaterialInfo">
|
select material_name as materialName,material_value as materialValue from t_material_stock where material_name = #{materialName} and company_id = #{companyId}
|
</select>
|
|
<update id="updateMaterStock">
|
update t_material_stock set material_value = #{materialValue} where material_name = #{materialName} and company_id = #{companyId}
|
</update>
|
|
<insert id="updateMaterStockRecord">
|
insert into t_material_stock_record (id,type,op_type,material_name,material_value,before_stock,after_stock,company_id,pipe_id,pipe_num)
|
values (REPLACE(UUID(),'-',''),#{type},#{opType},#{materialName},#{materialValue},#{beforeStock},#{afterStock},#{companyId},#{pipeId},#{pipeNum})
|
</insert>
|
|
<select id="materialTotalStock" resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.MaterialInfo">
|
select ms.material_name as materialName,sd.dict_name as materialCName,ms.material_value as materialValue
|
from t_material_stock ms
|
left join sys_dict sd on sd.dict_id = ms.material_name
|
where ms.company_id = #{companyId}
|
</select>
|
|
<select id="TableHeader" resultType="java.util.HashMap">
|
select dict_name as headName,dict_id as dictId
|
from sys_dict sd
|
where sd.dict_type='pipe_materials' and sd.is_use = 1 order by sd.dict_value
|
</select>
|
|
<select id="queryMaterias" resultType="hashmap">
|
select msr.create_date as createDate,GROUP_CONCAT(CONCAT(msr.material_name,':',msr.material_value)) as namevalue
|
from t_material_stock_record msr
|
where msr.company_id = #{companyId} and msr.type = 2 and DATE_FORMAT(sysdate(),'%Y-%m-%d') = DATE_FORMAT(msr.create_date,'%Y-%m-%d')
|
group by msr.create_date
|
order by msr.create_date desc
|
</select>
|
|
<select id="queryDeviceBySn" resultType="com.thhy.mobile.modules.biz.temdevice.entity.DeviceInfo">
|
select device_id as deviceId,produce_order as produceOrder,device_status as deviceStatus,node from sys_device where sn_code = #{snCode}
|
</select>
|
|
<update id="updateDeviceStatus">
|
update sys_device set device_status = #{deviceStatus} where sn_code = #{snCode}
|
</update>
|
|
<insert id="insertRestData">
|
insert into t_rest_data (id,device_id,tem,hum,check_time) values (REPLACE(UUID(),'-',''),#{deviceId},#{tem},#{hum},#{checkTime})
|
</insert>
|
|
<insert id="insertWaterData">
|
insert into t_water_cultivated_device_data (id,device_id,temperature,ph_value,release_time) values (REPLACE(UUID(),'-',''),#{deviceId},#{tem},#{phValue},#{checkTime})
|
</insert>
|
|
<update id="updateRingNum">
|
update t_pipe_info set ring_num = #{newRingNum} where ring_num = #{ringNum}
|
</update>
|
|
<select id="queryBlockByPro" resultType="string">
|
select block_num from sys_pro_blok where pro_id = #{proId}
|
</select>
|
|
<select id="queryMouldTypeByPro" resultType="com.thhy.mobile.modules.biz.mouldcheck.entity.Mould">
|
select m.mould_type as mouldType,max(mould_id) as mouldId from sys_mould m
|
where m.pro_id = #{proId}
|
group by m.mould_type
|
</select>
|
|
<select id="queryMaxNumBySteelProduce" resultType="int">
|
select
|
max(a.number)
|
FROM
|
(
|
select produce_number,SUBSTR(produce_number from LENGTH(produce_number)-4 for 5) as number
|
FROM t_steel_produce
|
) a
|
</select>
|
|
<select id="countByRingNum" resultType="int">
|
select count(pipe_id) from t_pipe_info where ring_num = #{ringNum}
|
</select>
|
|
<select id="compelteByRingNumAndPro" resultType="boolean">
|
select (a.pipeBlock=b.proBlock) as result from
|
(
|
select GROUP_CONCAT(block_num order by sd.dict_value) as pipeBlock,tpi.pro_id
|
from t_pipe_info tpi
|
left join sys_dict sd on sd.dict_id = tpi.block_num
|
where tpi.ring_num = #{ringNum} and tpi.pro_id = #{proId} and tpi.check_result = 1
|
group by tpi.ring_num,tpi.pro_id
|
) a
|
left join
|
(
|
select GROUP_CONCAT(block_num order by sd1.dict_value) as proBlock,spb.pro_id
|
from sys_pro_blok spb
|
left join sys_dict sd1 on sd1.dict_id = spb.block_num
|
where spb.pro_id = #{proId}
|
group by spb.pro_id
|
) b on a.pro_id = b.pro_id
|
</select>
|
|
<select id="queryByRingNumAndPro" resultType="com.thhy.mobile.modules.biz.cultivated.entity.PipeIntoListVo">
|
select t.ring_num as ringNum,t.pipe_num as pipeNum,t.check_time as checkTime,sd.dict_name as blockNum,sp.pro_name as proName
|
from t_pipe_info t
|
left join sys_dict sd on sd.dict_id = t.block_num
|
left join sys_project sp on sp.pro_id = t.pro_id
|
where t.ring_num = #{ringNum} and t.pro_id = #{proId}
|
order by t.pipe_num
|
</select>
|
|
<select id="queryWaterTimeByPipeNum" resultType="com.thhy.mobile.modules.biz.cultivated.entity.PipeCultivated">
|
select pc.id,pc.ring_num as ringNum,pc.create_time as createTime,pc.out_time as outTime,pc.out_water as outWater
|
from t_pipe_cultivated_pi pcp
|
left join t_pipe_cultivated pc on pcp.cultivated_id = pc.id
|
where pipe_num = #{pipeNum}
|
</select>
|
|
<select id="queryRepoDate" resultType="com.thhy.mobile.modules.biz.repo.entity.RepoRecord">
|
select rr.create_time as createTime,rr.record_id as recordId,rrp.out_repo as outRepo,rrp.out_repo_time as outRepoTime
|
from t_repo_record_pipe rrp
|
left join t_repo_record rr on rrp.record_id = rr.record_id
|
where rrp.pipe_num = #{pipeNum}
|
</select>
|
|
<update id="updatePipeDateByNum">
|
update t_pipe_info
|
<set>
|
<if test="checkTime != null">
|
check_time=#{checkTime},
|
</if>
|
<if test="inModTime != null">
|
into_mod_time=#{inModTime},
|
</if>
|
<if test="outModTime != null">
|
out_mod_time=#{outModTime},
|
</if>
|
<if test="pouringTime != null">
|
pouring_time=#{pouringTime},
|
</if>
|
<if test="placingInTime != null">
|
placing_in_time=#{placingInTime},
|
</if>
|
<if test="placingOutTime != null">
|
placing_out_time=#{placingOutTime},
|
</if>
|
<if test="inRepoTime != null">
|
in_repo_time = #{inRepoTime},
|
</if>
|
</set>
|
where pipe_num=#{pipeNum}
|
</update>
|
|
<update id="updateInWaterTime">
|
update t_pipe_cultivated set create_time = #{createTime} where id =#{id}
|
</update>
|
|
<update id="updateOutWaterTime">
|
update t_pipe_cultivated set out_time = #{outTime} where id =#{id}
|
</update>
|
|
<update id="updateInRepoTime">
|
update t_repo_record set create_time = #{createTime} where record_id =#{recordId}
|
</update>
|
</mapper>
|