<?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.pipecheckrecord.mapper.PipeCheckRecordMapper">
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
t.pipe_check_id as pipeCheckId,
|
t.check_reason as checkReason,
|
t.check_result as checkResult,
|
t.check_time as checkTime,
|
t.check_user as checkUser,
|
t.pipe_id as pipeId,
|
t.remark as remark
|
</sql>
|
|
<sql id="condition_query">
|
<where>
|
<trim suffixOverrides=" AND ">
|
<if test="checkReason!=null and checkReason!=''">
|
t.check_reason = #{checkReason} AND
|
</if>
|
<if test="checkResult!=null">
|
t.check_result = #{checkResult} AND
|
</if>
|
<if test="checkTime!=null">
|
t.check_time = #{checkTime} AND
|
</if>
|
<if test="checkUser!=null and checkUser!=''">
|
t.check_user = #{checkUser} AND
|
</if>
|
<if test="pipeId!=null and pipeId!=''">
|
t.pipe_id = #{pipeId} AND
|
</if>
|
<if test="remark!=null and remark!=''">
|
t.remark = #{remark} AND
|
</if>
|
</trim>
|
</where>
|
</sql>
|
|
<select id="queryById" resultType="com.thhy.mobile.modules.biz.pipecheckrecord.entity.PipeCheckRecord">
|
select <include refid="Base_Column_List" />
|
from t_pipe_check_record t
|
where t.pipe_check_id=#{pipeCheckId}
|
</select>
|
|
<select id="queryVersionById" resultType="integer">
|
select version from t_pipe_check_record
|
where pipe_check_id=#{pipeCheckId}
|
</select>
|
|
<!--查询列表-->
|
<select id="findList" resultType="com.thhy.mobile.modules.biz.pipecheckrecord.entity.PipeCheckRecord">
|
SELECT
|
<include refid="Base_Column_List" />
|
from t_pipe_check_record t
|
<include refid="condition_query" />
|
</select>
|
|
<select id="pipeCheckList" resultType="com.thhy.mobile.modules.biz.pipecheckrecord.entity.PipeCheckListVo">
|
select pi.pipe_id as pipeId,pi.check_result as checkResult,
|
sp.pro_name as proName,pi.ring_num as ringNum,pi.pipe_num as pipeNum,sd.dict_name as sizeName,sd4.dict_name as groutingHolesName,sd1.dict_name as reinforcementName,
|
sd2.dict_name as turnName,sd3.dict_name as blockNumName,sm.mould_num as mouldNum,pi.into_mod_time as intoModTime,pi.pouring_time as pouringTime,su.real_name as checkUserName,pi.check_time as checkTime,pi.produce_number as produceNumber
|
from t_pipe_info pi
|
-- left join t_pipe_check_record pcr on pcr.pipe_id = pi.pipe_id
|
left join sys_project sp on pi.pro_id = sp.pro_id
|
left join sys_dict sd on sd.dict_id = pi.size
|
left join sys_dict sd1 on sd1.dict_id = pi.reinforcement
|
left join sys_dict sd2 on sd2.dict_id = pi.turn
|
left join sys_dict sd3 on sd3.dict_id = pi.block_num
|
left join sys_dict sd4 on sd4.dict_id = pi.grouting_holes
|
left join sys_mould sm on sm.mould_id = pi.mod_id
|
left join sys_users su on su.user_id = pi.check_user
|
<where>
|
<trim suffixOverrides=" AND ">
|
pi.check_result != 0 AND sp.company_id = #{companyId} AND
|
<if test="checkResult!=null">
|
pi.check_result = #{checkResult} AND
|
</if>
|
<if test="pipeNum!=null and pipeNum!=''">
|
pi.pipe_num LIKE CONCAT('%',#{pipeNum},'%') AND
|
</if>
|
</trim>
|
</where>
|
order by pi.check_time desc
|
</select>
|
|
<!--查询列表-->
|
<select id="findAll" resultType="com.thhy.mobile.modules.biz.pipecheckrecord.entity.PipeCheckRecord">
|
SELECT
|
<include refid="Base_Column_List" />
|
from t_pipe_check_record t
|
</select>
|
|
<!--插入操作-->
|
<insert id="insert">
|
insert into t_pipe_check_record
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="checkReason != null">
|
check_reason,
|
</if>
|
<if test="checkResult != null">
|
check_result,
|
</if>
|
<if test="checkTime != null">
|
check_time,
|
</if>
|
<if test="checkUser != null">
|
check_user,
|
</if>
|
<if test="pipeCheckId != null">
|
pipe_check_id,
|
</if>
|
<if test="pipeId != null">
|
pipe_id,
|
</if>
|
<if test="remark != null">
|
remark,
|
</if>
|
<if test="existProblem != null">
|
exist_problem,
|
</if>
|
<if test="exeProResult != null">
|
exe_pro_result,
|
</if>
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="checkReason != null">
|
#{checkReason},
|
</if>
|
<if test="checkResult != null">
|
#{checkResult},
|
</if>
|
<if test="checkTime != null">
|
#{checkTime},
|
</if>
|
<if test="checkUser != null">
|
#{checkUser},
|
</if>
|
<if test="pipeCheckId != null">
|
#{pipeCheckId},
|
</if>
|
<if test="pipeId != null">
|
#{pipeId},
|
</if>
|
<if test="remark != null">
|
#{remark},
|
</if>
|
<if test="existProblem != null">
|
#{existProblem},
|
</if>
|
<if test="exeProResult != null">
|
#{exeProResult},
|
</if>
|
</trim>
|
</insert>
|
|
<insert id="insertCheckFile">
|
insert into t_pipe_check_record
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="id != null">
|
id,
|
</if>
|
<if test="pipeCheckId != null">
|
pipe_check_id,
|
</if>
|
<if test="checkFile != null">
|
check_file,
|
</if>
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="id != null">
|
#{id},
|
</if>
|
<if test="pipeCheckId != null">
|
#{pipeCheckId},
|
</if>
|
<if test="checkFile != null">
|
#{checkFile},
|
</if>
|
</trim>
|
</insert>
|
|
|
<!--更新操作-->
|
<update id="update">
|
update t_pipe_check_record
|
<set>
|
<if test="checkReason != null">
|
check_reason=#{checkReason},
|
</if>
|
<if test="checkResult != null">
|
check_result=#{checkResult},
|
</if>
|
<if test="checkTime != null">
|
check_time=#{checkTime},
|
</if>
|
<if test="checkUser != null">
|
check_user=#{checkUser},
|
</if>
|
<if test="pipeId != null">
|
pipe_id=#{pipeId},
|
</if>
|
<if test="remark != null">
|
remark=#{remark},
|
</if>
|
</set>
|
where pipe_check_id=#{pipeCheckId}
|
</update>
|
|
<!--逻辑删除-->
|
<update id="deletelogic">
|
update t_pipe_check_record
|
SET is_use = 0
|
where pipe_check_id=#{pipeCheckId}
|
</update>
|
|
<!--根据ID删除-->
|
<delete id="deleteById">
|
delete from t_pipe_check_record
|
where pipe_check_id=#{pipeCheckId}
|
</delete>
|
|
</mapper>
|