Files
industry/industry-system/src/main/resources/mapper/work/IndustryMaterialMapper.xml
2025-08-11 14:24:20 +08:00

394 lines
18 KiB
XML

<?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.industry.work.mapper.IndustryMaterialMapper">
<resultMap type="IndustryMaterialVo" id="IndustryMaterialResult">
<result property="id" column="id"/>
<result property="specification" column="specification"/>
<result property="technology" column="technology"/>
<result property="operation" column="operation"/>
<result property="diameter" column="diameter"/>
<result property="batchId" column="batch_id"/>
<result property="sort" column="sort"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="delFlag" column="del_flag"/>
<result property="state" column="state"/>
<result property="stepSize" column="step_size"/>
<result property="finalWidth" column="final_width"/>
<result property="finalDiameter" column="final_diameter"/>
<result property="weight" column="weight"/>
<result property="width" column="width"/>
<collection property="industryStepVo" javaType="IndustryStepVo">
<id property="id" column="ist_id"/>
<result property="operation" column="ist_operation"/>
<result property="state" column="ist_state"/>
</collection>
</resultMap>
<sql id="selectIndustryMaterialVo">
select id,
step_size,
specification,
technology,
operation,
diameter,
batch_id,
sort,
create_time,
create_by,
update_time,
update_by,
del_flag,
state,
final_width,
final_diameter,
weight,
width
from industry_material
</sql>
<select id="selectIndustryMaterialList" parameterType="IndustryMaterial" resultMap="IndustryMaterialResult">
<include refid="selectIndustryMaterialVo"/>
<where>
<if test="specification != null">and specification = #{specification}</if>
<if test="technology != null">and technology = #{technology}</if>
<if test="operation != null ">and operation = #{operation}</if>
<if test="diameter != null ">and diameter = #{diameter}</if>
<if test="batchId != null ">and batch_id = #{batchId}</if>
<if test="sort != null ">and sort = #{sort}</if>
<if test="state != null ">and (state = #{state} or state=3)</if>
<if test="stepSize != null ">and step_size = #{stepSize}</if>
<if test="finalWidth != null and finalWidth != ''">and final_width = #{finalWidth}</if>
<if test="finalDiameter != null and finalDiameter != ''">and final_diameter = #{finalDiameter}</if>
<if test="weight != null and weight != ''">and weight = #{weight}</if>
<if test="width != null and width != ''">and width = #{width}</if>
<if test="delFlag != null">and del_flag = #{delFlag}</if>
</where>
order by sort
</select>
<select id="selectIndustryListRecord" parameterType="IndustryMaterial" resultMap="IndustryMaterialResult">
<include refid="selectIndustryMaterialVo"/>
<where>
<if test="specification != null and specification != ''">and specification = #{specification}</if>
<if test="technology != null and technology != ''">and technology = #{technology}</if>
<if test="operation != null ">and operation = #{operation}</if>
<if test="diameter != null ">and diameter = #{diameter}</if>
<if test="batchId != null ">and batch_id = #{batchId}</if>
<if test="sort != null ">and sort = #{sort}</if>
<if test="state != null ">and state = #{state}</if>
<if test="stepSize != null ">and step_size = #{stepSize}</if>
<if test="finalWidth != null and finalWidth != ''">and final_width = #{finalWidth}</if>
<if test="finalDiameter != null and finalDiameter != ''">and final_diameter = #{finalDiameter}</if>
<if test="weight != null and weight != ''">and weight = #{weight}</if>
<if test="width != null and width != ''">and width = #{width}</if>
</where>
order by sort,create_time desc
</select>
<select id="selectIndustryMaterialList1" parameterType="IndustryMaterial" resultMap="IndustryMaterialResult">
<include refid="selectIndustryMaterialVo"/>
<where>
<if test="specification != null and specification != ''">and specification = #{specification}</if>
<if test="technology != null and technology != ''">and technology = #{technology}</if>
<if test="operation != null ">and operation = #{operation}</if>
<if test="diameter != null ">and diameter = #{diameter}</if>
<if test="batchId != null ">and batch_id = #{batchId}</if>
<if test="sort != null ">and sort = #{sort}</if>
<if test="state != null ">and state = #{state}</if>
<if test="stepSize != null ">and step_size = #{stepSize}</if>
<if test="finalWidth != null and finalWidth != ''">and final_width = #{finalWidth}</if>
<if test="finalDiameter != null and finalDiameter != ''">and final_diameter = #{finalDiameter}</if>
<if test="weight != null and weight != ''">and weight = #{weight}</if>
<if test="width != null and width != ''">and width = #{width}</if>
</where>
order by sort
</select>
<select id="selectIndustryMaterialList2" parameterType="IndustryMaterial" resultMap="IndustryMaterialResult">
<include refid="selectIndustryMaterialVo"/>
<where>
<if test="specification != null and specification != ''">and specification = #{specification}</if>
<if test="technology != null and technology != ''">and technology = #{technology}</if>
<if test="operation != null ">and operation = #{operation}</if>
<if test="diameter != null ">and diameter = #{diameter}</if>
<if test="batchId != null ">and batch_id = #{batchId}</if>
<if test="sort != null ">and sort = #{sort}</if>
<if test="state != null ">and (state = #{state} or state = 5 or state =3 or state = 4 ) </if>
<if test="stepSize != null ">and step_size = #{stepSize}</if>
<if test="finalWidth != null and finalWidth != ''">and final_width = #{finalWidth}</if>
<if test="finalDiameter != null and finalDiameter != ''">and final_diameter = #{finalDiameter}</if>
<if test="weight != null and weight != ''">and weight = #{weight}</if>
<if test="width != null and width != ''">and width = #{width}</if>
</where>
order by sort
</select>
<select id="selectIndustryMaterialById" parameterType="String" resultMap="IndustryMaterialResult">
<include refid="selectIndustryMaterialVo"/>
where id = #{id}
</select>
<select id="selectIndustryMaterialByBatchId" parameterType="Long" resultMap="IndustryMaterialResult">
select id,
step_size,
specification,
technology,
operation,
diameter,
batch_id,
sort,
create_time,
create_by,
update_time,
update_by,
del_flag,
state,
final_width,
final_diameter,
weight,
width
from industry_material
where batch_id = #{batchId}
and state != 3 and state!=4 and state != 5 and state!=6
</select>
<select id="selectIndustryMaterialErrorByBatchId" parameterType="Long" resultMap="IndustryMaterialResult">
select id,
step_size,
specification,
technology,
operation,
diameter,
batch_id,
sort,
create_time,
create_by,
update_time,
update_by,
del_flag,
state,
final_width,
final_diameter,
weight,
width
from industry_material
where batch_id = #{batchId}
and state != 3 and state!=4 and state != 5 and state!=6
</select>
<select id="selectAbnormalList" resultMap="IndustryMaterialResult">
<include refid="selectIndustryMaterialVo"/>
<where>
<if test="specification != null and specification != ''">and specification = #{specification}</if>
<if test="technology != null and technology != ''">and technology = #{technology}</if>
<if test="operation != null ">and operation = #{operation}</if>
<if test="diameter != null ">and diameter = #{diameter}</if>
<if test="batchId != null ">and batch_id = #{batchId}</if>
<if test="sort != null ">and sort = #{sort}</if>
<if test="state != null ">and state = #{state}</if>
<if test="stepSize != null ">and step_size = #{stepSize}</if>
<if test="finalWidth != null and finalWidth != ''">and final_width = #{finalWidth}</if>
<if test="finalDiameter != null and finalDiameter != ''">and final_diameter = #{finalDiameter}</if>
<if test="weight != null and weight != ''">and weight = #{weight}</if>
<if test="width != null and width != ''">and width = #{width}</if>
<if test="delFlag != null and delFlag != ''">and del_flag = #{delFlag}</if>
</where>
order by sort
</select>
<select id="selectIndustryAbnormalMaterialByBatchId" parameterType="Long" resultMap="IndustryMaterialResult">
select id,
step_size,
specification,
technology,
operation,
diameter,
batch_id,
sort,
create_time,
create_by,
update_time,
update_by,
del_flag,
state,
final_width,
final_diameter,
weight,
width
from industry_material
where batch_id = #{batchId}
and state = 5
</select>
<select id="selectIndustryMaterialAndStepList" resultMap="IndustryMaterialResult">
select im.id,
step_size,
specification,
technology,
im.operation,
diameter,
im.batch_id,
sort,
im.create_time,
im.create_by,
im.update_time,
im.update_by,
im.del_flag,
im.state,
final_width,
final_diameter,
weight,
width,
ist.id as ist_id,
ist.operation as ist_operation,
ist.state as ist_state
from industry_material im left join industry_step ist on im.id = ist.material_id
<where>
ist.operation=1
<if test="specification != null and specification != ''">and specification = #{specification}</if>
<if test="technology != null and technology != ''">and technology = #{technology}</if>
<if test="operation != null ">and im.operation = #{operation}</if>
<if test="diameter != null ">and diameter = #{diameter}</if>
<if test="batchId != null ">and im.batch_id = #{batchId}</if>
<if test="sort != null ">and sort = #{sort}</if>
<if test="state != null ">and im.state = #{state}</if>
<if test="stepSize != null ">and step_size = #{stepSize}</if>
<if test="finalWidth != null and finalWidth != ''">and final_width = #{finalWidth}</if>
<if test="finalDiameter != null and finalDiameter != ''">and final_diameter = #{finalDiameter}</if>
<if test="weight != null and weight != ''">and weight = #{weight}</if>
<if test="width != null and width != ''">and width = #{width}</if>
<if test="delFlag != null and delFlag != ''">and im.del_flag = #{delFlag}</if>
</where>
order by sort
</select>
<select id="selectIndustryMaterialListAndNotFinish"
resultMap="IndustryMaterialResult">
select * from industry_material where state!=0 and state!=1 and state!=3 and state!=4 and state!=5
</select>
<insert id="insertIndustryMaterial" parameterType="IndustryMaterial">
insert into industry_material
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="specification != null">specification,</if>
<if test="technology != null">technology,</if>
<if test="operation != null">operation,</if>
<if test="diameter != null">diameter,</if>
<if test="batchId != null">batch_id,</if>
<if test="sort != null">sort,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="state != null">state,</if>
<if test="delFlag != null">del_flag,</if>
<if test="stepSize != null">step_size,</if>
<if test="finalWidth != null">final_width,</if>
<if test="finalWidth2 != null">final_width2,</if>
<if test="finalDiameter != null">final_diameter,</if>
<if test="finalDiameter2 != null">final_diameter2,</if>
<if test="weight != null">weight,</if>
<if test="width != null">width,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="specification != null">#{specification},</if>
<if test="technology != null">#{technology},</if>
<if test="operation != null">#{operation},</if>
<if test="diameter != null">#{diameter},</if>
<if test="batchId != null">#{batchId},</if>
<if test="sort != null">#{sort},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="state != null">#{state},</if>
<if test="stepSize != null">#{stepSize},</if>
<if test="finalWidth != null">#{finalWidth},</if>
<if test="finalWidth2 != null">#{finalWidth2},</if>
<if test="finalDiameter != null">#{finalDiameter},</if>
<if test="finalDiameter2 != null">#{finalDiameter2},</if>
<if test="weight != null">#{weight},</if>
<if test="width != null">#{width},</if>
</trim>
</insert>
<update id="updateIndustryMaterial" parameterType="IndustryMaterial">
update industry_material
<trim prefix="SET" suffixOverrides=",">
<if test="specification != null">specification = #{specification},</if>
<if test="technology != null">technology = #{technology},</if>
<if test="operation != null">operation = #{operation},</if>
<if test="diameter != null">diameter = #{diameter},</if>
<if test="batchId != null">batch_id = #{batchId},</if>
<if test="sort != null">sort = #{sort},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="state != null">state = #{state},</if>
<if test="stepSize != null">step_size = #{stepSize},</if>
<if test="finalWidth != null">final_width = #{finalWidth},</if>
<if test="finalWidth2 != null">final_width2 = #{finalWidth2},</if>
<if test="finalDiameter != null">final_diameter = #{finalDiameter},</if>
<if test="finalDiameter2 != null">final_diameter2 = #{finalDiameter2},</if>
<if test="weight != null">weight = #{weight},</if>
<if test="width != null">width = #{width},</if>
</trim>
where id = #{id}
</update>
<update id="submitMaterial" parameterType="IndustryMaterial">
update industry_material
<trim prefix="SET" suffixOverrides=",">
<if test="state == 0">state =1,</if>
<if test="state == 1">state =2,</if>
<if test="state == 3">state =4,</if>
<if test="state == 4 and delFlag ==1">state =5,</if>
<if test="state == 5">state =6,</if>
</trim>
where id = #{id}
</update>
<update id="deleteIndustryMaterialById" parameterType="String">
update industry_material
set del_flag=1
where id = #{id}
</update>
<update id="refreshMaterialStateById">
update industry_material
set state=#{state}
where id = #{materialId}
</update>
<delete id="deleteIndustryMaterialByIds" parameterType="String">
delete from industry_material where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteMaterialById" parameterType="String">
delete
from industry_material
where id = #{id}
</delete>
<delete id="deleteIndustryMaterialByState" parameterType="Long">
delete from industry_material where state = #{state}
</delete>
</mapper>