<?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.steelrecord.mapper.SteelRecordMapper">
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
t.id as id,
|
t.brand as brand,
|
t.change_stock as changeStock,
|
t.check_time as checkTime,
|
t.create_time as createTime,
|
t.create_user as createUser,
|
t.factory_name as factoryName,
|
t.is_use as isUse,
|
t.line_code as lineCode,
|
t.pro_id as proId,
|
t.steel_id as steelId,
|
t.stock_type as stockType,
|
t.supplier_id as supplierId
|
</sql>
|
|
<sql id="condition_query">
|
<where>
|
<trim suffixOverrides=" AND ">
|
<if test="brand!=null and brand!=''">
|
t.brand = #{brand} AND
|
</if>
|
<if test="changeStock!=null">
|
t.change_stock = #{changeStock} AND
|
</if>
|
<if test="checkTime!=null">
|
t.check_time = #{checkTime} AND
|
</if>
|
<if test="createTime!=null">
|
t.create_time = #{createTime} AND
|
</if>
|
<if test="createUser!=null and createUser!=''">
|
t.create_user = #{createUser} AND
|
</if>
|
<if test="factoryName!=null and factoryName!=''">
|
t.factory_name = #{factoryName} AND
|
</if>
|
<if test="isUse!=null">
|
t.is_use = #{isUse} AND
|
</if>
|
<if test="lineCode!=null and lineCode!=''">
|
t.line_code = #{lineCode} AND
|
</if>
|
<if test="proId!=null and proId!=''">
|
t.pro_id = #{proId} AND
|
</if>
|
<if test="steelId!=null and steelId!=''">
|
t.steel_id = #{steelId} AND
|
</if>
|
<if test="stockType!=null">
|
t.stock_type = #{stockType} AND
|
</if>
|
<if test="supplierId!=null and supplierId!=''">
|
t.supplier_id = #{supplierId} AND
|
</if>
|
</trim>
|
</where>
|
</sql>
|
|
<select id="queryById" resultType="com.thhy.mobile.modules.biz.steelrecord.entity.SteelRecord">
|
select <include refid="Base_Column_List" />
|
from sys_steel_record t
|
where t.id=#{id}
|
</select>
|
|
<select id="queryVersionById" resultType="integer">
|
select version from sys_steel_record
|
where id=#{id}
|
</select>
|
|
<!--查询列表-->
|
<select id="findList" resultType="com.thhy.mobile.modules.biz.steelrecord.entity.SteelRecord">
|
SELECT
|
<include refid="Base_Column_List" />
|
from sys_steel_record t
|
<include refid="condition_query" />
|
</select>
|
|
<select id="findListByProduceNum" resultType="com.thhy.mobile.modules.biz.steelrecord.entity.SteelRecord">
|
SELECT
|
<include refid="Base_Column_List" />
|
from sys_steel_record t
|
where t.line_code = #{produceNum}
|
</select>
|
|
<delete id="deleteByProduceNum">
|
delete from sys_steel_record where line_code = #{produceNum}
|
</delete>
|
|
<!--查询列表-->
|
<select id="findAll" resultType="com.thhy.mobile.modules.biz.steelrecord.entity.SteelRecord">
|
SELECT
|
<include refid="Base_Column_List" />
|
from sys_steel_record t
|
</select>
|
|
<!--插入操作-->
|
<insert id="insert">
|
insert into sys_steel_record
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="brand != null">
|
brand,
|
</if>
|
<if test="changeStock != null">
|
change_stock,
|
</if>
|
<if test="checkTime != null">
|
check_time,
|
</if>
|
<if test="createTime != null">
|
create_time,
|
</if>
|
<if test="createUser != null">
|
create_user,
|
</if>
|
<if test="factoryName != null">
|
factory_name,
|
</if>
|
<if test="id != null">
|
id,
|
</if>
|
<if test="isUse != null">
|
is_use,
|
</if>
|
<if test="lineCode != null">
|
line_code,
|
</if>
|
<if test="proId != null">
|
pro_id,
|
</if>
|
<if test="steelId != null">
|
steel_id,
|
</if>
|
<if test="stockType != null">
|
stock_type,
|
</if>
|
<if test="supplierId != null">
|
supplier_id,
|
</if>
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="brand != null">
|
#{brand},
|
</if>
|
<if test="changeStock != null">
|
#{changeStock},
|
</if>
|
<if test="checkTime != null">
|
#{checkTime},
|
</if>
|
<if test="createTime != null">
|
#{createTime},
|
</if>
|
<if test="createUser != null">
|
#{createUser},
|
</if>
|
<if test="factoryName != null">
|
#{factoryName},
|
</if>
|
<if test="id != null">
|
#{id},
|
</if>
|
<if test="isUse != null">
|
#{isUse},
|
</if>
|
<if test="lineCode != null">
|
#{lineCode},
|
</if>
|
<if test="proId != null">
|
#{proId},
|
</if>
|
<if test="steelId != null">
|
#{steelId},
|
</if>
|
<if test="stockType != null">
|
#{stockType},
|
</if>
|
<if test="supplierId != null">
|
#{supplierId},
|
</if>
|
</trim>
|
</insert>
|
|
<!--插入操作-->
|
<insert id="insertCheckFile">
|
insert into t_steel_check_file
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="id != null">
|
id,
|
</if>
|
<if test="steelCheckId != null">
|
steel_check_id,
|
</if>
|
<if test="checkFile != null">
|
check_file,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="id != null">
|
#{id},
|
</if>
|
<if test="steelCheckId != null">
|
#{steelCheckId},
|
</if>
|
<if test="checkFile != null">
|
#{checkFile},
|
</if>
|
</trim>
|
</insert>
|
|
|
<!--更新操作-->
|
<update id="update">
|
update sys_steel_record
|
<set>
|
<if test="brand != null">
|
brand=#{brand},
|
</if>
|
<if test="changeStock != null">
|
change_stock=#{changeStock},
|
</if>
|
<if test="checkTime != null">
|
check_time=#{checkTime},
|
</if>
|
<if test="createTime != null">
|
create_time=#{createTime},
|
</if>
|
<if test="createUser != null">
|
create_user=#{createUser},
|
</if>
|
<if test="factoryName != null">
|
factory_name=#{factoryName},
|
</if>
|
<if test="isUse != null">
|
is_use=#{isUse},
|
</if>
|
<if test="lineCode != null">
|
line_code=#{lineCode},
|
</if>
|
<if test="proId != null">
|
pro_id=#{proId},
|
</if>
|
<if test="steelId != null">
|
steel_id=#{steelId},
|
</if>
|
<if test="stockType != null">
|
stock_type=#{stockType},
|
</if>
|
<if test="supplierId != null">
|
supplier_id=#{supplierId},
|
</if>
|
</set>
|
where id=#{id}
|
</update>
|
|
<!--逻辑删除-->
|
<update id="deletelogic">
|
update sys_steel_record
|
SET is_use = 0
|
where id=#{id}
|
</update>
|
|
<!--根据ID删除-->
|
<delete id="deleteById">
|
delete from sys_steel_record
|
where id=#{id}
|
</delete>
|
|
</mapper>
|