<?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.MouldCheckRecordMapper">
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
t.id as id,
|
t.create_user as createUser,
|
t.is_use as isUse,
|
t.match_result as matchResult,
|
t.match_time as matchTime,
|
t.mod_check_id as modCheckId,
|
t.steel_pro_num as steelProNum
|
</sql>
|
|
<sql id="condition_query">
|
<where>
|
<trim suffixOverrides=" AND ">
|
<if test="createUser!=null and createUser!=''">
|
t.create_user = #{createUser} AND
|
</if>
|
<if test="isUse!=null">
|
t.is_use = #{isUse} AND
|
</if>
|
<if test="matchResult!=null">
|
t.match_result = #{matchResult} AND
|
</if>
|
<if test="matchTime!=null">
|
t.match_time = #{matchTime} AND
|
</if>
|
<if test="modCheckId!=null and modCheckId!=''">
|
t.mod_check_id = #{modCheckId} AND
|
</if>
|
<if test="steelProNum!=null and steelProNum!=''">
|
t.steel_pro_num = #{steelProNum} AND
|
</if>
|
</trim>
|
</where>
|
</sql>
|
|
<select id="queryById" resultType="com.thhy.mobile.modules.biz.mouldcheck.entity.MouldCheckRecord">
|
select <include refid="Base_Column_List" />
|
from t_mould_check_record t
|
where t.id=#{id}
|
</select>
|
|
<select id="queryVersionById" resultType="integer">
|
select version from t_mould_check_record
|
where id=#{id}
|
</select>
|
|
<!--查询列表-->
|
<select id="findList" resultType="com.thhy.mobile.modules.biz.mouldcheck.entity.MouldCheckRecord">
|
SELECT
|
<include refid="Base_Column_List" />
|
from t_mould_check_record t
|
<include refid="condition_query" />
|
</select>
|
|
<!--查询列表-->
|
<select id="findAll" resultType="com.thhy.mobile.modules.biz.mouldcheck.entity.MouldCheckRecord">
|
SELECT
|
<include refid="Base_Column_List" />
|
from t_mould_check_record t
|
</select>
|
|
<!--插入操作-->
|
<insert id="insert">
|
insert into t_mould_check_record
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="createUser != null">
|
create_user,
|
</if>
|
<if test="id != null">
|
id,
|
</if>
|
<if test="isUse != null">
|
is_use,
|
</if>
|
<if test="matchResult != null">
|
match_result,
|
</if>
|
<if test="matchTime != null">
|
match_time,
|
</if>
|
<if test="modCheckId != null">
|
mod_check_id,
|
</if>
|
<if test="steelProNum != null">
|
steel_pro_num,
|
</if>
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="createUser != null">
|
#{createUser},
|
</if>
|
<if test="id != null">
|
#{id},
|
</if>
|
<if test="isUse != null">
|
#{isUse},
|
</if>
|
<if test="matchResult != null">
|
#{matchResult},
|
</if>
|
<if test="matchTime != null">
|
#{matchTime},
|
</if>
|
<if test="modCheckId != null">
|
#{modCheckId},
|
</if>
|
<if test="steelProNum != null">
|
#{steelProNum},
|
</if>
|
</trim>
|
</insert>
|
|
|
<!--更新操作-->
|
<update id="update">
|
update t_mould_check_record
|
<set>
|
<if test="createUser != null">
|
create_user=#{createUser},
|
</if>
|
<if test="isUse != null">
|
is_use=#{isUse},
|
</if>
|
<if test="matchResult != null">
|
match_result=#{matchResult},
|
</if>
|
<if test="matchTime != null">
|
match_time=#{matchTime},
|
</if>
|
<if test="modCheckId != null">
|
mod_check_id=#{modCheckId},
|
</if>
|
<if test="steelProNum != null">
|
steel_pro_num=#{steelProNum},
|
</if>
|
</set>
|
where id=#{id}
|
</update>
|
|
<!--逻辑删除-->
|
<update id="deletelogic">
|
update t_mould_check_record
|
SET is_use = 0
|
where id=#{id}
|
</update>
|
|
<!--根据ID删除-->
|
<delete id="deleteById">
|
delete from t_mould_check_record
|
where id=#{id}
|
</delete>
|
|
<select id="mouldCheckRecord" resultType="com.thhy.mobile.modules.biz.mouldcheck.entity.MouldCheckRecord">
|
select mod_check_id as modCheckId,steel_pro_num as steelProNum from t_mould_check_record
|
where mod_check_id =#{modCheckId}
|
order by match_time desc limit 1
|
</select>
|
|
<select id="steelCountByProNum" resultType="int">
|
select count(id) from t_mould_check_record where steel_pro_num = #{steelNum} and is_use = 1
|
</select>
|
|
<update id="deleteByCheckId">
|
update t_mould_check_record
|
SET is_use = 0
|
where mod_check_id=#{checkId}
|
</update>
|
|
</mapper>
|