<?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.mouldcheck.mapper.MouldCheckMapper">
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
t.mod_check_id as modCheckId,
|
t.check_time as checkTime,
|
t.check_user as checkUser,
|
t.is_use as isUse,
|
t.mod_id as modId,
|
t.match_status as matchStatus,
|
t.status as status
|
</sql>
|
|
<sql id="condition_query">
|
<where>
|
<trim suffixOverrides=" AND ">
|
<if test="checkTime!=null">
|
t.check_time = #{checkTime} AND
|
</if>
|
<if test="checkUser!=null and checkUser!=''">
|
t.check_user = #{checkUser} AND
|
</if>
|
<if test="isUse!=null">
|
t.is_use = #{isUse} AND
|
</if>
|
<if test="modId!=null and modId!=''">
|
t.mod_id = #{modId} AND
|
</if>
|
<if test="status!=null">
|
t.status = #{status} AND
|
</if>
|
</trim>
|
</where>
|
</sql>
|
|
<select id="queryById" resultType="com.thhy.mobile.modules.biz.mouldcheck.entity.MouldCheck">
|
select <include refid="Base_Column_List" />
|
from t_mould_check t
|
where t.mod_check_id=#{modCheckId}
|
</select>
|
|
<select id="countByMouldNum" resultType="int">
|
select count(mod_check_id) from t_mould_check where mod_id = #{modId} and status = 1 and is_use = 1
|
</select>
|
|
<select id="queryVersionById" resultType="integer">
|
select version from t_mould_check
|
where mod_check_id=#{modCheckId}
|
</select>
|
|
<!--查询列表-->
|
<select id="findList" resultType="com.thhy.mobile.modules.biz.mouldcheck.entity.MouldCheck">
|
SELECT
|
<include refid="Base_Column_List" />
|
from t_mould_check t
|
<include refid="condition_query" />
|
</select>
|
|
<!--查询列表-->
|
<select id="findAll" resultType="com.thhy.mobile.modules.biz.mouldcheck.entity.MouldCheck">
|
SELECT
|
<include refid="Base_Column_List" />
|
from t_mould_check t
|
</select>
|
|
<!--插入操作-->
|
<insert id="insert" useGeneratedKeys="true" keyProperty="modCheckId">
|
insert into t_mould_check
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="checkTime != null">
|
check_time,
|
</if>
|
<if test="checkUser != null">
|
check_user,
|
</if>
|
<if test="isUse != null">
|
is_use,
|
</if>
|
<if test="modCheckId != null">
|
mod_check_id,
|
</if>
|
<if test="modId != null">
|
mod_id,
|
</if>
|
<if test="status != null">
|
status,
|
</if>
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="checkTime != null">
|
#{checkTime},
|
</if>
|
<if test="checkUser != null">
|
#{checkUser},
|
</if>
|
<if test="isUse != null">
|
#{isUse},
|
</if>
|
<if test="modCheckId != null">
|
#{modCheckId},
|
</if>
|
<if test="modId != null">
|
#{modId},
|
</if>
|
<if test="status != null">
|
#{status},
|
</if>
|
</trim>
|
</insert>
|
|
|
<!--更新操作-->
|
<update id="update">
|
update t_mould_check
|
<set>
|
<if test="checkTime != null">
|
check_time=#{checkTime},
|
</if>
|
<if test="checkUser != null">
|
check_user=#{checkUser},
|
</if>
|
<if test="isUse != null">
|
is_use=#{isUse},
|
</if>
|
<if test="modId != null">
|
mod_id=#{modId},
|
</if>
|
<if test="status != null">
|
status=#{status},
|
</if>
|
</set>
|
where mod_check_id=#{modCheckId}
|
</update>
|
|
<update id="updateMatchStatus">
|
update t_mould_check
|
<set>
|
<if test="matchStatus != null">
|
match_status=#{matchStatus},
|
</if>
|
</set>
|
where mod_check_id=#{modCheckId}
|
</update>
|
|
<!--逻辑删除-->
|
<update id="deletelogic">
|
update t_mould_check
|
SET is_use = 0
|
where mod_check_id=#{modCheckId}
|
</update>
|
|
<!--根据ID删除-->
|
<delete id="deleteById">
|
delete from t_mould_check
|
where mod_check_id=#{modCheckId}
|
</delete>
|
|
<select id="ModCheckList" resultType="com.thhy.mobile.modules.biz.mouldcheck.entity.MouldCheckListVo">
|
select mc.mod_check_id as modCheckId,mc.mod_id as modId,
|
sm.mould_num as mouldNum,sm.mould_code as mouldCode,sd.dict_name as mouldSizeName,sd1.dict_name as mouldBlockName,sd2.dict_name as mouldTurnName,mc.match_status as matchStatus,
|
mcr.steel_pro_num as produceNumber,spr.pro_name as proName,
|
sd3.dict_name as steelSizeName,sd4.dict_name as steelReinforcementName,sd5.dict_name as steelBlockName
|
from t_mould_check mc
|
left join sys_mould sm on sm.mould_id = mc.mod_id
|
left join sys_dict sd on sd.dict_id = sm.mould_size
|
left join sys_dict sd1 on sd1.dict_id = sm.mould_type
|
left join sys_dict sd2 on sd2.dict_id = sm.mould_turn
|
left join t_mould_check_record mcr on mcr.mod_check_id = mc.mod_check_id
|
left join t_steel_produce sp on sp.produce_number = mcr.steel_pro_num
|
left join sys_project spr on spr.pro_id = sm.pro_id
|
|
left join sys_dict sd3 on sd3.dict_id = sp.size_id
|
left join sys_dict sd4 on sd4.dict_id = sp.reinforcement_id
|
left join sys_dict sd5 on sd5.dict_id = sp.block_num
|
<where>
|
<trim suffixOverrides=" AND ">
|
mc.is_use = 1 AND spr.company_id = #{companyId} AND
|
<if test="mouldNum!=null and mouldNum!=''">
|
sm.mould_num LIKE CONCAT('%',#{mouldNum},'%') AND
|
</if>
|
<if test="matchStatus!=null">
|
mc.match_status = #{matchStatus} AND
|
</if>
|
</trim>
|
</where>
|
order by mc.check_time desc
|
</select>
|
|
</mapper>
|