质检:质检resources文件提交
master
xins 9 months ago
parent 2d52984ba3
commit 13fa8ee782

@ -0,0 +1,187 @@
<?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.hw.qms.mapper.MesBaseBarcodeInfoMapper">
<resultMap type="MesBaseBarcodeInfo" id="MesBaseBarcodeInfoResult">
<result property="barcodeId" column="barcode_id" />
<result property="printTime" column="print_time" />
<result property="printPerson" column="print_person" />
<result property="batchFlag" column="batch_flag" />
<result property="barcodeType" column="barcode_type" />
<result property="barcodeInfo" column="barcode_info" />
<result property="batchCode" column="batch_code" />
<result property="palletInfoCode" column="pallet_info_code" />
<result property="materialId" column="material_id" />
<result property="manufacturerId" column="manufacturer_id" />
<result property="amount" column="amount" />
<result property="machineName" column="machine_name" />
<result property="poNo" column="po_no" />
<result property="productionDate" column="production_date" />
<result property="acceptedDate" column="accepted_date" />
<result property="lastOutstockDate" column="last_outstock_date" />
<result property="planCode" column="plan_code" />
<result property="planDetailCode" column="plan_detail_code" />
<result property="saleorderCode" column="saleorder_code" />
<result property="projectNo" column="project_no" />
<result property="serialNumber" column="serial_number" />
<result property="remark" column="remark" />
<result property="bindStatus" column="bind_status" />
<result property="bindBy" column="bind_by" />
<result property="bindTime" column="bind_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectMesBaseBarcodeInfoVo">
select barcode_id, print_time, print_person, batch_flag, barcode_type, barcode_info, batch_code, pallet_info_code, material_id, manufacturer_id, amount, machine_name, po_no, production_date, accepted_date, last_outstock_date, plan_code, plan_detail_code, saleorder_code, project_no, serial_number, remark, bind_status, bind_by, bind_time, update_by, update_time from mes_base_barcode_info
</sql>
<select id="selectMesBaseBarcodeInfoList" parameterType="MesBaseBarcodeInfo" resultMap="MesBaseBarcodeInfoResult">
<include refid="selectMesBaseBarcodeInfoVo"/>
<where>
<if test="printTime != null "> and print_time = #{printTime}</if>
<if test="printPerson != null and printPerson != ''"> and print_person = #{printPerson}</if>
<if test="batchFlag != null and batchFlag != ''"> and batch_flag = #{batchFlag}</if>
<if test="barcodeType != null and barcodeType != ''"> and barcode_type = #{barcodeType}</if>
<if test="barcodeInfo != null and barcodeInfo != ''"> and barcode_info = #{barcodeInfo}</if>
<if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if>
<if test="palletInfoCode != null and palletInfoCode != ''"> and pallet_info_code = #{palletInfoCode}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="manufacturerId != null "> and manufacturer_id = #{manufacturerId}</if>
<if test="amount != null "> and amount = #{amount}</if>
<if test="machineName != null and machineName != ''"> and machine_name like concat('%', #{machineName}, '%')</if>
<if test="poNo != null and poNo != ''"> and po_no = #{poNo}</if>
<if test="productionDate != null "> and production_date = #{productionDate}</if>
<if test="acceptedDate != null "> and accepted_date = #{acceptedDate}</if>
<if test="lastOutstockDate != null "> and last_outstock_date = #{lastOutstockDate}</if>
<if test="planCode != null and planCode != ''"> and plan_code = #{planCode}</if>
<if test="planDetailCode != null and planDetailCode != ''"> and plan_detail_code = #{planDetailCode}</if>
<if test="saleorderCode != null and saleorderCode != ''"> and saleorder_code = #{saleorderCode}</if>
<if test="projectNo != null and projectNo != ''"> and project_no = #{projectNo}</if>
<if test="serialNumber != null and serialNumber != ''"> and serial_number = #{serialNumber}</if>
<if test="bindStatus != null and bindStatus != ''"> and bind_status = #{bindStatus}</if>
<if test="bindBy != null and bindBy != ''"> and bind_by = #{bindBy}</if>
<if test="bindTime != null "> and bind_time = #{bindTime}</if>
</where>
</select>
<select id="selectMesBaseBarcodeInfoByBarcodeId" parameterType="Long" resultMap="MesBaseBarcodeInfoResult">
<include refid="selectMesBaseBarcodeInfoVo"/>
where barcode_id = #{barcodeId}
</select>
<insert id="insertMesBaseBarcodeInfo" parameterType="MesBaseBarcodeInfo" useGeneratedKeys="true" keyProperty="barcodeId">
insert into mes_base_barcode_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="printTime != null">print_time,</if>
<if test="printPerson != null">print_person,</if>
<if test="batchFlag != null and batchFlag != ''">batch_flag,</if>
<if test="barcodeType != null and barcodeType != ''">barcode_type,</if>
<if test="barcodeInfo != null and barcodeInfo != ''">barcode_info,</if>
<if test="batchCode != null and batchCode != ''">batch_code,</if>
<if test="palletInfoCode != null">pallet_info_code,</if>
<if test="materialId != null">material_id,</if>
<if test="manufacturerId != null">manufacturer_id,</if>
<if test="amount != null">amount,</if>
<if test="machineName != null">machine_name,</if>
<if test="poNo != null">po_no,</if>
<if test="productionDate != null">production_date,</if>
<if test="acceptedDate != null">accepted_date,</if>
<if test="lastOutstockDate != null">last_outstock_date,</if>
<if test="planCode != null">plan_code,</if>
<if test="planDetailCode != null">plan_detail_code,</if>
<if test="saleorderCode != null">saleorder_code,</if>
<if test="projectNo != null">project_no,</if>
<if test="serialNumber != null">serial_number,</if>
<if test="remark != null">remark,</if>
<if test="bindStatus != null">bind_status,</if>
<if test="bindBy != null">bind_by,</if>
<if test="bindTime != null">bind_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="printTime != null">#{printTime},</if>
<if test="printPerson != null">#{printPerson},</if>
<if test="batchFlag != null and batchFlag != ''">#{batchFlag},</if>
<if test="barcodeType != null and barcodeType != ''">#{barcodeType},</if>
<if test="barcodeInfo != null and barcodeInfo != ''">#{barcodeInfo},</if>
<if test="batchCode != null and batchCode != ''">#{batchCode},</if>
<if test="palletInfoCode != null">#{palletInfoCode},</if>
<if test="materialId != null">#{materialId},</if>
<if test="manufacturerId != null">#{manufacturerId},</if>
<if test="amount != null">#{amount},</if>
<if test="machineName != null">#{machineName},</if>
<if test="poNo != null">#{poNo},</if>
<if test="productionDate != null">#{productionDate},</if>
<if test="acceptedDate != null">#{acceptedDate},</if>
<if test="lastOutstockDate != null">#{lastOutstockDate},</if>
<if test="planCode != null">#{planCode},</if>
<if test="planDetailCode != null">#{planDetailCode},</if>
<if test="saleorderCode != null">#{saleorderCode},</if>
<if test="projectNo != null">#{projectNo},</if>
<if test="serialNumber != null">#{serialNumber},</if>
<if test="remark != null">#{remark},</if>
<if test="bindStatus != null">#{bindStatus},</if>
<if test="bindBy != null">#{bindBy},</if>
<if test="bindTime != null">#{bindTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateMesBaseBarcodeInfo" parameterType="MesBaseBarcodeInfo">
update mes_base_barcode_info
<trim prefix="SET" suffixOverrides=",">
<if test="printTime != null">print_time = #{printTime},</if>
<if test="printPerson != null">print_person = #{printPerson},</if>
<if test="batchFlag != null and batchFlag != ''">batch_flag = #{batchFlag},</if>
<if test="barcodeType != null and barcodeType != ''">barcode_type = #{barcodeType},</if>
<if test="barcodeInfo != null and barcodeInfo != ''">barcode_info = #{barcodeInfo},</if>
<if test="batchCode != null and batchCode != ''">batch_code = #{batchCode},</if>
<if test="palletInfoCode != null">pallet_info_code = #{palletInfoCode},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="manufacturerId != null">manufacturer_id = #{manufacturerId},</if>
<if test="amount != null">amount = #{amount},</if>
<if test="machineName != null">machine_name = #{machineName},</if>
<if test="poNo != null">po_no = #{poNo},</if>
<if test="productionDate != null">production_date = #{productionDate},</if>
<if test="acceptedDate != null">accepted_date = #{acceptedDate},</if>
<if test="lastOutstockDate != null">last_outstock_date = #{lastOutstockDate},</if>
<if test="planCode != null">plan_code = #{planCode},</if>
<if test="planDetailCode != null">plan_detail_code = #{planDetailCode},</if>
<if test="saleorderCode != null">saleorder_code = #{saleorderCode},</if>
<if test="projectNo != null">project_no = #{projectNo},</if>
<if test="serialNumber != null">serial_number = #{serialNumber},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="bindStatus != null">bind_status = #{bindStatus},</if>
<if test="bindBy != null">bind_by = #{bindBy},</if>
<if test="bindTime != null">bind_time = #{bindTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where barcode_id = #{barcodeId}
</update>
<delete id="deleteMesBaseBarcodeInfoByBarcodeId" parameterType="Long">
delete from mes_base_barcode_info where barcode_id = #{barcodeId}
</delete>
<delete id="deleteMesBaseBarcodeInfoByBarcodeIds" parameterType="String">
delete from mes_base_barcode_info where barcode_id in
<foreach item="barcodeId" collection="array" open="(" separator="," close=")">
#{barcodeId}
</foreach>
</delete>
<select id="selectMesBaseBarcodeInfoByBarcodeInfo" parameterType="String" resultMap="MesBaseBarcodeInfoResult">
<include refid="selectMesBaseBarcodeInfoVo"/>
where barcode_info = #{barcodeInfo} limit 1
</select>
</mapper>

@ -0,0 +1,300 @@
<?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.hw.qms.mapper.MesBaseMaterialInfoMapper">
<resultMap type="MesBaseMaterialInfo" id="MesBaseMaterialInfoResult">
<result property="materialId" column="material_id"/>
<result property="erpId" column="erp_id"/>
<result property="materialCode" column="material_code"/>
<result property="oldMaterialCode" column="old_material_code"/>
<result property="materialName" column="material_name"/>
<result property="materialCategories" column="material_categories"/>
<result property="materialSubclass" column="material_subclass"/>
<result property="materialTypeId" column="material_type_id"/>
<result property="batchFlag" column="batch_flag"/>
<result property="materialUnitId" column="material_unit_id"/>
<result property="materialUnit" column="material_unit"/>
<result property="materialMatkl" column="material_matkl"/>
<result property="materialSpec" column="material_spec"/>
<result property="netWeight" column="net_weight"/>
<result property="grossWeight" column="gross_weight"/>
<result property="factoryId" column="factory_id"/>
<result property="createOrgId" column="create_org_id"/>
<result property="useOrgId" column="use_org_id"/>
<result property="prodlineId" column="prodline_id"/>
<result property="activeFlag" column="active_flag"/>
<result property="deletedFlag" column="deleted_flag"/>
<result property="remark" column="remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="approveDate" column="approve_date"/>
<result property="erpModifyDate" column="erp_modify_date"/>
<result property="warehouseId" column="warehouse_id"/>
<result property="checkRuleId" column="check_rule_id"/>
</resultMap>
<sql id="selectMesBaseMaterialInfoVo">
select material_id,
erp_id,
material_code,
old_material_code,
material_name,
material_categories,
material_subclass,
material_type_id,
batch_flag,
material_unit_id,
material_unit,
material_matkl,
material_spec,
net_weight,
gross_weight,
factory_id,
create_org_id,
use_org_id,
prodline_id,
active_flag,
deleted_flag,
remark,
create_by,
create_time,
update_by,
update_time,
approve_date,
erp_modify_date
from mes_base_material_info
</sql>
<select id="selectMesBaseMaterialInfoList" parameterType="MesBaseMaterialInfo"
resultMap="MesBaseMaterialInfoResult">
<include refid="selectMesBaseMaterialInfoVo"/>
<where>
<if test="erpId != null ">and erp_id = #{erpId}</if>
<if test="materialCode != null and materialCode != ''">and material_code = #{materialCode}</if>
<if test="oldMaterialCode != null and oldMaterialCode != ''">and old_material_code = #{oldMaterialCode}
</if>
<if test="materialName != null and materialName != ''">and material_name like concat('%', #{materialName},
'%')
</if>
<if test="materialCategories != null and materialCategories != ''">and material_categories =
#{materialCategories}
</if>
<if test="materialSubclass != null and materialSubclass != ''">and material_subclass =
#{materialSubclass}
</if>
<if test="materialTypeId != null ">and material_type_id = #{materialTypeId}</if>
<if test="batchFlag != null and batchFlag != ''">and batch_flag = #{batchFlag}</if>
<if test="materialUnitId != null ">and material_unit_id = #{materialUnitId}</if>
<if test="materialUnit != null and materialUnit != ''">and material_unit = #{materialUnit}</if>
<if test="materialMatkl != null and materialMatkl != ''">and material_matkl = #{materialMatkl}</if>
<if test="materialSpec != null and materialSpec != ''">and material_spec = #{materialSpec}</if>
<if test="netWeight != null ">and net_weight = #{netWeight}</if>
<if test="grossWeight != null ">and gross_weight = #{grossWeight}</if>
<if test="factoryId != null ">and factory_id = #{factoryId}</if>
<if test="createOrgId != null ">and create_org_id = #{createOrgId}</if>
<if test="useOrgId != null ">and use_org_id = #{useOrgId}</if>
<if test="prodlineId != null and prodlineId != ''">and prodline_id = #{prodlineId}</if>
<if test="activeFlag != null and activeFlag != ''">and active_flag = #{activeFlag}</if>
<if test="deletedFlag != null and deletedFlag != ''">and deleted_flag = #{deletedFlag}</if>
<if test="approveDate != null ">and approve_date = #{approveDate}</if>
<if test="erpModifyDate != null ">and erp_modify_date = #{erpModifyDate}</if>
</where>
</select>
<select id="selectMesBaseMaterialInfoByMaterialId" parameterType="Long" resultMap="MesBaseMaterialInfoResult">
<include refid="selectMesBaseMaterialInfoVo"/>
where material_id = #{materialId}
</select>
<insert id="insertMesBaseMaterialInfo" parameterType="MesBaseMaterialInfo" useGeneratedKeys="true"
keyProperty="materialId">
insert into mes_base_material_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="erpId != null">erp_id,</if>
<if test="materialCode != null and materialCode != ''">material_code,</if>
<if test="oldMaterialCode != null">old_material_code,</if>
<if test="materialName != null and materialName != ''">material_name,</if>
<if test="materialCategories != null and materialCategories != ''">material_categories,</if>
<if test="materialSubclass != null">material_subclass,</if>
<if test="materialTypeId != null">material_type_id,</if>
<if test="batchFlag != null">batch_flag,</if>
<if test="materialUnitId != null">material_unit_id,</if>
<if test="materialUnit != null">material_unit,</if>
<if test="materialMatkl != null">material_matkl,</if>
<if test="materialSpec != null">material_spec,</if>
<if test="netWeight != null">net_weight,</if>
<if test="grossWeight != null">gross_weight,</if>
<if test="factoryId != null">factory_id,</if>
<if test="createOrgId != null">create_org_id,</if>
<if test="useOrgId != null">use_org_id,</if>
<if test="prodlineId != null">prodline_id,</if>
<if test="activeFlag != null">active_flag,</if>
<if test="deletedFlag != null">deleted_flag,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="approveDate != null">approve_date,</if>
<if test="erpModifyDate != null">erp_modify_date,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="erpId != null">#{erpId},</if>
<if test="materialCode != null and materialCode != ''">#{materialCode},</if>
<if test="oldMaterialCode != null">#{oldMaterialCode},</if>
<if test="materialName != null and materialName != ''">#{materialName},</if>
<if test="materialCategories != null and materialCategories != ''">#{materialCategories},</if>
<if test="materialSubclass != null">#{materialSubclass},</if>
<if test="materialTypeId != null">#{materialTypeId},</if>
<if test="batchFlag != null">#{batchFlag},</if>
<if test="materialUnitId != null">#{materialUnitId},</if>
<if test="materialUnit != null">#{materialUnit},</if>
<if test="materialMatkl != null">#{materialMatkl},</if>
<if test="materialSpec != null">#{materialSpec},</if>
<if test="netWeight != null">#{netWeight},</if>
<if test="grossWeight != null">#{grossWeight},</if>
<if test="factoryId != null">#{factoryId},</if>
<if test="createOrgId != null">#{createOrgId},</if>
<if test="useOrgId != null">#{useOrgId},</if>
<if test="prodlineId != null">#{prodlineId},</if>
<if test="activeFlag != null">#{activeFlag},</if>
<if test="deletedFlag != null">#{deletedFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="approveDate != null">#{approveDate},</if>
<if test="erpModifyDate != null">#{erpModifyDate},</if>
</trim>
</insert>
<update id="updateMesBaseMaterialInfo" parameterType="MesBaseMaterialInfo">
update mes_base_material_info
<trim prefix="SET" suffixOverrides=",">
<if test="erpId != null">erp_id = #{erpId},</if>
<if test="materialCode != null and materialCode != ''">material_code = #{materialCode},</if>
<if test="oldMaterialCode != null">old_material_code = #{oldMaterialCode},</if>
<if test="materialName != null and materialName != ''">material_name = #{materialName},</if>
<if test="materialCategories != null and materialCategories != ''">material_categories =
#{materialCategories},
</if>
<if test="materialSubclass != null">material_subclass = #{materialSubclass},</if>
<if test="materialTypeId != null">material_type_id = #{materialTypeId},</if>
<if test="batchFlag != null">batch_flag = #{batchFlag},</if>
<if test="materialUnitId != null">material_unit_id = #{materialUnitId},</if>
<if test="materialUnit != null">material_unit = #{materialUnit},</if>
<if test="materialMatkl != null">material_matkl = #{materialMatkl},</if>
<if test="materialSpec != null">material_spec = #{materialSpec},</if>
<if test="netWeight != null">net_weight = #{netWeight},</if>
<if test="grossWeight != null">gross_weight = #{grossWeight},</if>
<if test="factoryId != null">factory_id = #{factoryId},</if>
<if test="createOrgId != null">create_org_id = #{createOrgId},</if>
<if test="useOrgId != null">use_org_id = #{useOrgId},</if>
<if test="prodlineId != null">prodline_id = #{prodlineId},</if>
<if test="activeFlag != null">active_flag = #{activeFlag},</if>
<if test="deletedFlag != null">deleted_flag = #{deletedFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="approveDate != null">approve_date = #{approveDate},</if>
<if test="erpModifyDate != null">erp_modify_date = #{erpModifyDate},</if>
</trim>
where material_id = #{materialId}
</update>
<delete id="deleteMesBaseMaterialInfoByMaterialId" parameterType="Long">
delete
from mes_base_material_info
where material_id = #{materialId}
</delete>
<delete id="deleteMesBaseMaterialInfoByMaterialIds" parameterType="String">
delete from mes_base_material_info where material_id in
<foreach item="materialId" collection="array" open="(" separator="," close=")">
#{materialId}
</foreach>
</delete>
<!--新增以下-->
<select id="selectMesBaseMaterialInfoListByMaterialIds" parameterType="String"
resultMap="MesBaseMaterialInfoResult">
<include refid="selectMesBaseMaterialInfoVo"/>
where material_id in
<foreach item="materialId" collection="array" open="(" separator="," close=")">
#{materialId}
</foreach>
</select>
<select id="selectMaterialInfos4AllocateCheckRule" parameterType="MesBaseMaterialInfo"
resultMap="MesBaseMaterialInfoResult">
select material_id,
erp_id,
material_code,
old_material_code,
material_name,
material_categories,
material_subclass,
material_type_id,
batch_flag,
material_unit_id,
material_unit,
material_matkl,
material_spec,
net_weight,
gross_weight,
factory_id
from mes_base_material_info mbmi
<where>
and not exists (select 1 from qms_check_rule_detail qcrd where mbmi.material_id = qcrd.target_id and qcrd.target_type='1' and qcrd.check_rule_id=#{checkRuleId})
<if test="erpId != null ">and erp_id = #{erpId}</if>
<if test="materialCode != null and materialCode != ''">and material_code = #{materialCode}</if>
<if test="oldMaterialCode != null and oldMaterialCode != ''">and old_material_code = #{oldMaterialCode}
</if>
<if test="materialName != null and materialName != ''">and material_name like concat('%', #{materialName},
'%')
</if>
<if test="materialCategories != null and materialCategories != ''">and material_categories =
#{materialCategories}
</if>
<if test="materialSubclass != null and materialSubclass != ''">and material_subclass =
#{materialSubclass}
</if>
<if test="materialTypeId != null ">and material_type_id = #{materialTypeId}</if>
<if test="batchFlag != null and batchFlag != ''">and batch_flag = #{batchFlag}</if>
<if test="materialUnitId != null ">and material_unit_id = #{materialUnitId}</if>
<if test="materialUnit != null and materialUnit != ''">and material_unit = #{materialUnit}</if>
<if test="materialMatkl != null and materialMatkl != ''">and material_matkl = #{materialMatkl}</if>
<if test="materialSpec != null and materialSpec != ''">and material_spec = #{materialSpec}</if>
<if test="netWeight != null ">and net_weight = #{netWeight}</if>
<if test="grossWeight != null ">and gross_weight = #{grossWeight}</if>
<if test="factoryId != null ">and factory_id = #{factoryId}</if>
<if test="createOrgId != null ">and create_org_id = #{createOrgId}</if>
<if test="useOrgId != null ">and use_org_id = #{useOrgId}</if>
<if test="prodlineId != null and prodlineId != ''">and prodline_id = #{prodlineId}</if>
<if test="activeFlag != null and activeFlag != ''">and active_flag = #{activeFlag}</if>
<if test="deletedFlag != null and deletedFlag != ''">and deleted_flag = #{deletedFlag}</if>
<if test="approveDate != null ">and approve_date = #{approveDate}</if>
<if test="erpModifyDate != null ">and erp_modify_date = #{erpModifyDate}</if>
</where>
</select>
</mapper>

@ -0,0 +1,154 @@
<?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.hw.qms.mapper.QmsCheckProjectMapper">
<resultMap type="QmsCheckProject" id="QmsCheckProjectResult">
<result property="checkProjectId" column="check_project_id" />
<result property="checkProjectName" column="check_project_name" />
<result property="checkProjectStatus" column="check_project_status" />
<result property="checkProjectProperty" column="check_project_property" />
<result property="checkMode" column="check_mode" />
<result property="checkSample" column="check_sample" />
<result property="checkTool" column="check_tool" />
<result property="unitCode" column="unit_code" />
<result property="standardValue" column="standard_value" />
<result property="upperDiff" column="upper_diff" />
<result property="downDiff" column="down_diff" />
<result property="defectSeverity" column="defect_severity" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectQmsCheckProjectVo">
select check_project_id, check_project_name, check_project_status, check_project_property, check_mode, check_sample, check_tool, unit_code, standard_value, upper_diff, down_diff, defect_severity, remark, create_by, create_time, update_by, update_time from qms_check_project
</sql>
<select id="selectQmsCheckProjectList" parameterType="QmsCheckProject" resultMap="QmsCheckProjectResult">
<include refid="selectQmsCheckProjectVo"/>
<where>
<if test="checkProjectName != null and checkProjectName != ''"> and check_project_name like concat('%', #{checkProjectName}, '%')</if>
<if test="checkProjectStatus != null and checkProjectStatus != ''"> and check_project_status = #{checkProjectStatus}</if>
<if test="checkProjectProperty != null and checkProjectProperty != ''"> and check_project_property = #{checkProjectProperty}</if>
<if test="checkMode != null and checkMode != ''"> and check_mode = #{checkMode}</if>
<if test="checkSample != null "> and check_sample = #{checkSample}</if>
<if test="checkTool != null and checkTool != ''"> and check_tool = #{checkTool}</if>
<if test="unitCode != null and unitCode != ''"> and unit_code = #{unitCode}</if>
<if test="standardValue != null "> and standard_value = #{standardValue}</if>
<if test="upperDiff != null "> and upper_diff = #{upperDiff}</if>
<if test="downDiff != null "> and down_diff = #{downDiff}</if>
<if test="defectSeverity != null and defectSeverity != ''"> and defect_severity = #{defectSeverity}</if>
</where>
</select>
<select id="selectQmsCheckProjectByCheckProjectId" parameterType="Long" resultMap="QmsCheckProjectResult">
<include refid="selectQmsCheckProjectVo"/>
where check_project_id = #{checkProjectId}
</select>
<insert id="insertQmsCheckProject" parameterType="QmsCheckProject" useGeneratedKeys="true" keyProperty="checkProjectId">
insert into qms_check_project
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="checkProjectName != null and checkProjectName != ''">check_project_name,</if>
<if test="checkProjectStatus != null and checkProjectStatus != ''">check_project_status,</if>
<if test="checkProjectProperty != null and checkProjectProperty != ''">check_project_property,</if>
<if test="checkMode != null and checkMode != ''">check_mode,</if>
<if test="checkSample != null">check_sample,</if>
<if test="checkTool != null">check_tool,</if>
<if test="unitCode != null">unit_code,</if>
<if test="standardValue != null">standard_value,</if>
<if test="upperDiff != null">upper_diff,</if>
<if test="downDiff != null">down_diff,</if>
<if test="defectSeverity != null">defect_severity,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="checkProjectName != null and checkProjectName != ''">#{checkProjectName},</if>
<if test="checkProjectStatus != null and checkProjectStatus != ''">#{checkProjectStatus},</if>
<if test="checkProjectProperty != null and checkProjectProperty != ''">#{checkProjectProperty},</if>
<if test="checkMode != null and checkMode != ''">#{checkMode},</if>
<if test="checkSample != null">#{checkSample},</if>
<if test="checkTool != null">#{checkTool},</if>
<if test="unitCode != null">#{unitCode},</if>
<if test="standardValue != null">#{standardValue},</if>
<if test="upperDiff != null">#{upperDiff},</if>
<if test="downDiff != null">#{downDiff},</if>
<if test="defectSeverity != null">#{defectSeverity},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateQmsCheckProject" parameterType="QmsCheckProject">
update qms_check_project
<trim prefix="SET" suffixOverrides=",">
<if test="checkProjectName != null and checkProjectName != ''">check_project_name = #{checkProjectName},</if>
<if test="checkProjectStatus != null and checkProjectStatus != ''">check_project_status = #{checkProjectStatus},</if>
<if test="checkProjectProperty != null and checkProjectProperty != ''">check_project_property = #{checkProjectProperty},</if>
<if test="checkMode != null and checkMode != ''">check_mode = #{checkMode},</if>
<if test="checkSample != null">check_sample = #{checkSample},</if>
<if test="checkTool != null">check_tool = #{checkTool},</if>
<if test="unitCode != null">unit_code = #{unitCode},</if>
standard_value = #{standardValue},
upper_diff = #{upperDiff},
down_diff = #{downDiff},
<if test="defectSeverity != null">defect_severity = #{defectSeverity},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where check_project_id = #{checkProjectId}
</update>
<delete id="deleteQmsCheckProjectByCheckProjectId" parameterType="Long">
delete from qms_check_project where check_project_id = #{checkProjectId}
</delete>
<delete id="deleteQmsCheckProjectByCheckProjectIds" parameterType="String">
delete from qms_check_project where check_project_id in
<foreach item="checkProjectId" collection="array" open="(" separator="," close=")">
#{checkProjectId}
</foreach>
</delete>
<select id="selectQmsCheckProjects4AllocateCheckRule" parameterType="QmsCheckProject" resultMap="QmsCheckProjectResult">
select qcp.check_project_id, qcp.check_project_name from qms_check_project qcp
<where>
and not exists (select 1 from qms_check_rule_project qcrp where qcrp.check_project_id = qcp.check_project_id and qcrp.check_rule_id=#{checkRuleId})
<if test="checkProjectName != null and checkProjectName != ''"> and check_project_name like concat('%', #{checkProjectName}, '%')</if>
<if test="checkProjectStatus != null and checkProjectStatus != ''"> and check_project_status = #{checkProjectStatus}</if>
<if test="checkProjectProperty != null and checkProjectProperty != ''"> and check_project_property = #{checkProjectProperty}</if>
<if test="checkMode != null and checkMode != ''"> and check_mode = #{checkMode}</if>
<if test="checkSample != null "> and check_sample = #{checkSample}</if>
<if test="checkTool != null and checkTool != ''"> and check_tool = #{checkTool}</if>
<if test="unitCode != null and unitCode != ''"> and unit_code = #{unitCode}</if>
<if test="standardValue != null "> and standard_value = #{standardValue}</if>
<if test="upperDiff != null "> and upper_diff = #{upperDiff}</if>
<if test="downDiff != null "> and down_diff = #{downDiff}</if>
<if test="defectSeverity != null and defectSeverity != ''"> and defect_severity = #{defectSeverity}</if>
</where>
</select>
</mapper>

@ -0,0 +1,139 @@
<?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.hw.qms.mapper.QmsCheckResultDetailMapper">
<resultMap type="QmsCheckResultDetail" id="QmsCheckResultDetailResult">
<result property="checkResultDetailId" column="check_result_detail_id" />
<result property="checkResultId" column="check_result_id" />
<result property="materialBarcode" column="material_barcode" />
<result property="checkStatus" column="check_status" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<resultMap id="QmsCheckResultDetailQmsCheckResultDetailProjectResult" type="QmsCheckResultDetail" extends="QmsCheckResultDetailResult">
<collection property="qmsCheckResultDetailProjectList" notNullColumn="sub_result_detail_project_id" javaType="java.util.List" resultMap="QmsCheckResultDetailProjectResult" />
</resultMap>
<resultMap type="QmsCheckResultDetailProject" id="QmsCheckResultDetailProjectResult">
<result property="resultDetailProjectId" column="sub_result_detail_project_id" />
<result property="checkResultDetailId" column="sub_check_result_detail_id" />
<result property="checkProjectId" column="sub_check_project_id" />
<result property="checkProjectStatus" column="sub_check_project_status" />
<result property="checkProjectResult" column="sub_check_project_result" />
<result property="standardValue" column="sub_standard_value" />
<result property="upperDiff" column="sub_upper_diff" />
<result property="downDiff" column="sub_down_diff" />
<result property="createBy" column="sub_create_by" />
<result property="createTime" column="sub_create_time" />
<result property="updateBy" column="sub_update_by" />
<result property="updateTime" column="sub_update_time" />
</resultMap>
<sql id="selectQmsCheckResultDetailVo">
select check_result_detail_id, check_result_id, material_barcode, check_status, remark, create_by, create_time, update_by, update_time from qms_check_result_detail
</sql>
<select id="selectQmsCheckResultDetailList" parameterType="QmsCheckResultDetail" resultMap="QmsCheckResultDetailResult">
<include refid="selectQmsCheckResultDetailVo"/>
<where>
<if test="checkResultId != null "> and check_result_id = #{checkResultId}</if>
<if test="materialBarcode != null and materialBarcode != ''"> and material_barcode = #{materialBarcode}</if>
<if test="checkStatus != null and checkStatus != ''"> and check_status = #{checkStatus}</if>
</where>
</select>
<select id="selectQmsCheckResultDetailByCheckResultDetailId" parameterType="Long" resultMap="QmsCheckResultDetailQmsCheckResultDetailProjectResult">
select a.check_result_detail_id, a.check_result_id, a.material_barcode, a.check_status, a.remark, a.create_by, a.create_time, a.update_by, a.update_time,
b.result_detail_project_id as sub_result_detail_project_id, b.check_result_detail_id as sub_check_result_detail_id, b.check_project_id as sub_check_project_id, b.check_project_status as sub_check_project_status, b.check_project_result as sub_check_project_result, b.standard_value as sub_standard_value, b.upper_diff as sub_upper_diff, b.down_diff as sub_down_diff, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time
from qms_check_result_detail a
left join qms_check_result_detail_project b on b.check_result_detail_id = a.check_result_detail_id
where a.check_result_detail_id = #{checkResultDetailId}
</select>
<insert id="insertQmsCheckResultDetail" parameterType="QmsCheckResultDetail" useGeneratedKeys="true" keyProperty="checkResultDetailId">
insert into qms_check_result_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="checkResultId != null">check_result_id,</if>
<if test="materialBarcode != null and materialBarcode != ''">material_barcode,</if>
<if test="checkStatus != null and checkStatus != ''">check_status,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="checkResultId != null">#{checkResultId},</if>
<if test="materialBarcode != null and materialBarcode != ''">#{materialBarcode},</if>
<if test="checkStatus != null and checkStatus != ''">#{checkStatus},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateQmsCheckResultDetail" parameterType="QmsCheckResultDetail">
update qms_check_result_detail
<trim prefix="SET" suffixOverrides=",">
<if test="checkResultId != null">check_result_id = #{checkResultId},</if>
<if test="materialBarcode != null and materialBarcode != ''">material_barcode = #{materialBarcode},</if>
<if test="checkStatus != null and checkStatus != ''">check_status = #{checkStatus},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where check_result_detail_id = #{checkResultDetailId}
</update>
<delete id="deleteQmsCheckResultDetailByCheckResultDetailId" parameterType="Long">
delete from qms_check_result_detail where check_result_detail_id = #{checkResultDetailId}
</delete>
<delete id="deleteQmsCheckResultDetailByCheckResultDetailIds" parameterType="String">
delete from qms_check_result_detail where check_result_detail_id in
<foreach item="checkResultDetailId" collection="array" open="(" separator="," close=")">
#{checkResultDetailId}
</foreach>
</delete>
<delete id="deleteQmsCheckResultDetailProjectByCheckResultDetailIds" parameterType="String">
delete from qms_check_result_detail_project where check_result_detail_id in
<foreach item="checkResultDetailId" collection="array" open="(" separator="," close=")">
#{checkResultDetailId}
</foreach>
</delete>
<delete id="deleteQmsCheckResultDetailProjectByCheckResultDetailId" parameterType="Long">
delete from qms_check_result_detail_project where check_result_detail_id = #{checkResultDetailId}
</delete>
<insert id="batchQmsCheckResultDetailProject">
insert into qms_check_result_detail_project( result_detail_project_id, check_result_detail_id, check_project_id, check_project_status, check_project_result, standard_value, upper_diff, down_diff, create_by, create_time, update_by, update_time) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.resultDetailProjectId}, #{item.checkResultDetailId}, #{item.checkProjectId}, #{item.checkProjectStatus}, #{item.checkProjectResult}, #{item.standardValue}, #{item.upperDiff}, #{item.downDiff}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
</foreach>
</insert>
<select id="selectQmsCheckResultDetailByMaterialBarcode" parameterType="String" resultMap="QmsCheckResultDetailQmsCheckResultDetailProjectResult">
select a.check_result_detail_id, a.check_result_id, a.material_barcode, a.check_status, a.remark, a.create_by, a.create_time, a.update_by, a.update_time,
b.result_detail_project_id as sub_result_detail_project_id, b.check_result_detail_id as sub_check_result_detail_id, b.check_project_id as sub_check_project_id, b.check_project_status as sub_check_project_status, b.check_project_result as sub_check_project_result, b.standard_value as sub_standard_value, b.upper_diff as sub_upper_diff, b.down_diff as sub_down_diff, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time
from qms_check_result_detail a
left join qms_check_result_detail_project b on b.check_result_detail_id = a.check_result_detail_id
where a.material_barcode = #{materialBarcode} limit 1
</select>
</mapper>

@ -0,0 +1,173 @@
<?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.hw.qms.mapper.QmsCheckResultMapper">
<resultMap type="QmsCheckResult" id="QmsCheckResultResult">
<result property="checkResultId" column="check_result_id" />
<result property="materialType" column="material_type" />
<result property="materialId" column="material_id" />
<result property="materialBatch" column="material_batch" />
<result property="checkMode" column="check_mode" />
<result property="checkSample" column="check_sample" />
<result property="planCode" column="plan_code" />
<result property="planDetailCode" column="plan_detail_code" />
<result property="saleorderCode" column="saleorder_code" />
<result property="poNo" column="po_no" />
<result property="poLine" column="po_line" />
<result property="projectNo" column="project_no" />
<result property="checkStatus" column="check_status" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="attr1" column="attr1" />
</resultMap>
<resultMap id="QmsCheckResultQmsCheckResultDetailResult" type="QmsCheckResult" extends="QmsCheckResultResult">
<collection property="qmsCheckResultDetailList" notNullColumn="sub_check_result_detail_id" javaType="java.util.List" resultMap="QmsCheckResultDetailResult" />
</resultMap>
<resultMap type="QmsCheckResultDetail" id="QmsCheckResultDetailResult">
<result property="checkResultDetailId" column="sub_check_result_detail_id" />
<result property="checkResultId" column="sub_check_result_id" />
<result property="materialBarcode" column="sub_material_barcode" />
<result property="checkStatus" column="sub_check_status" />
<result property="remark" column="sub_remark" />
<result property="createBy" column="sub_create_by" />
<result property="createTime" column="sub_create_time" />
<result property="updateBy" column="sub_update_by" />
<result property="updateTime" column="sub_update_time" />
</resultMap>
<sql id="selectQmsCheckResultVo">
select check_result_id, material_type, material_id, material_batch, check_mode, check_sample, plan_code, plan_detail_code, saleorder_code, po_no, po_line, project_no, check_status, remark, create_by, create_time, update_by, update_time, attr1 from qms_check_result
</sql>
<select id="selectQmsCheckResultList" parameterType="QmsCheckResult" resultMap="QmsCheckResultResult">
<include refid="selectQmsCheckResultVo"/>
<where>
<if test="materialType != null and materialType != ''"> and material_type = #{materialType}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="materialBatch != null and materialBatch != ''"> and material_batch = #{materialBatch}</if>
<if test="checkMode != null and checkMode != ''"> and check_mode = #{checkMode}</if>
<if test="checkSample != null "> and check_sample = #{checkSample}</if>
<if test="planCode != null and planCode != ''"> and plan_code = #{planCode}</if>
<if test="planDetailCode != null and planDetailCode != ''"> and plan_detail_code = #{planDetailCode}</if>
<if test="saleorderCode != null and saleorderCode != ''"> and saleorder_code = #{saleorderCode}</if>
<if test="poNo != null and poNo != ''"> and po_no = #{poNo}</if>
<if test="poLine != null and poLine != ''"> and po_line = #{poLine}</if>
<if test="projectNo != null and projectNo != ''"> and project_no = #{projectNo}</if>
<if test="checkStatus != null and checkStatus != ''"> and check_status = #{checkStatus}</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
</where>
</select>
<select id="selectQmsCheckResultByCheckResultId" parameterType="Long" resultMap="QmsCheckResultQmsCheckResultDetailResult">
select a.check_result_id, a.material_type, a.material_id, a.material_batch, a.check_mode, a.check_sample, a.plan_code, a.plan_detail_code, a.saleorder_code, a.po_no, a.po_line, a.project_no, a.check_status, a.remark, a.create_by, a.create_time, a.update_by, a.update_time, a.attr1,
b.check_result_detail_id as sub_check_result_detail_id, b.check_result_id as sub_check_result_id, b.material_barcode as sub_material_barcode, b.check_status as sub_check_status, b.remark as sub_remark, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time
from qms_check_result a
left join qms_check_result_detail b on b.check_result_id = a.check_result_id
where a.check_result_id = #{checkResultId}
</select>
<insert id="insertQmsCheckResult" parameterType="QmsCheckResult" useGeneratedKeys="true" keyProperty="checkResultId">
insert into qms_check_result
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="materialType != null">material_type,</if>
<if test="materialId != null">material_id,</if>
<if test="materialBatch != null and materialBatch != ''">material_batch,</if>
<if test="checkMode != null">check_mode,</if>
<if test="checkSample != null">check_sample,</if>
<if test="planCode != null">plan_code,</if>
<if test="planDetailCode != null">plan_detail_code,</if>
<if test="saleorderCode != null">saleorder_code,</if>
<if test="poNo != null">po_no,</if>
<if test="poLine != null">po_line,</if>
<if test="projectNo != null">project_no,</if>
<if test="checkStatus != null and checkStatus != ''">check_status,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="attr1 != null">attr1,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="materialType != null">#{materialType},</if>
<if test="materialId != null">#{materialId},</if>
<if test="materialBatch != null and materialBatch != ''">#{materialBatch},</if>
<if test="checkMode != null">#{checkMode},</if>
<if test="checkSample != null">#{checkSample},</if>
<if test="planCode != null">#{planCode},</if>
<if test="planDetailCode != null">#{planDetailCode},</if>
<if test="saleorderCode != null">#{saleorderCode},</if>
<if test="poNo != null">#{poNo},</if>
<if test="poLine != null">#{poLine},</if>
<if test="projectNo != null">#{projectNo},</if>
<if test="checkStatus != null and checkStatus != ''">#{checkStatus},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="attr1 != null">#{attr1},</if>
</trim>
</insert>
<update id="updateQmsCheckResult" parameterType="QmsCheckResult">
update qms_check_result
<trim prefix="SET" suffixOverrides=",">
<if test="materialType != null">material_type = #{materialType},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="materialBatch != null and materialBatch != ''">material_batch = #{materialBatch},</if>
<if test="checkMode != null">check_mode = #{checkMode},</if>
<if test="checkSample != null">check_sample = #{checkSample},</if>
<if test="planCode != null">plan_code = #{planCode},</if>
<if test="planDetailCode != null">plan_detail_code = #{planDetailCode},</if>
<if test="saleorderCode != null">saleorder_code = #{saleorderCode},</if>
<if test="poNo != null">po_no = #{poNo},</if>
<if test="poLine != null">po_line = #{poLine},</if>
<if test="projectNo != null">project_no = #{projectNo},</if>
<if test="checkStatus != null and checkStatus != ''">check_status = #{checkStatus},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
</trim>
where check_result_id = #{checkResultId}
</update>
<delete id="deleteQmsCheckResultByCheckResultId" parameterType="Long">
delete from qms_check_result where check_result_id = #{checkResultId}
</delete>
<delete id="deleteQmsCheckResultByCheckResultIds" parameterType="String">
delete from qms_check_result where check_result_id in
<foreach item="checkResultId" collection="array" open="(" separator="," close=")">
#{checkResultId}
</foreach>
</delete>
<delete id="deleteQmsCheckResultDetailByCheckResultIds" parameterType="String">
delete from qms_check_result_detail where check_result_id in
<foreach item="checkResultId" collection="array" open="(" separator="," close=")">
#{checkResultId}
</foreach>
</delete>
<delete id="deleteQmsCheckResultDetailByCheckResultId" parameterType="Long">
delete from qms_check_result_detail where check_result_id = #{checkResultId}
</delete>
<insert id="batchQmsCheckResultDetail">
insert into qms_check_result_detail( check_result_detail_id, check_result_id, material_barcode, check_status, remark, create_by, create_time, update_by, update_time) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.checkResultDetailId}, #{item.checkResultId}, #{item.materialBarcode}, #{item.checkStatus}, #{item.remark}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
</foreach>
</insert>
</mapper>

@ -0,0 +1,105 @@
<?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.hw.qms.mapper.QmsCheckRuleDetailMapper">
<resultMap type="QmsCheckRuleDetail" id="QmsCheckRuleDetailResult">
<result property="checkRuleId" column="check_rule_id" />
<result property="targetType" column="target_type" />
<result property="targetId" column="target_id" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
</resultMap>
<sql id="selectQmsCheckRuleDetailVo">
select check_rule_id, target_type, target_id from qms_check_rule_detail
</sql>
<select id="selectQmsCheckRuleDetailList" parameterType="QmsCheckRuleDetail" resultMap="QmsCheckRuleDetailResult">
<include refid="selectQmsCheckRuleDetailVo"/>
<where>
<if test="checkRuleId != null "> and check_rule_id = #{checkRuleId}</if>
<if test="targetType != null and targetType != ''"> and target_type = #{targetType}</if>
<if test="targetId != null "> and target_id = #{targetId}</if>
</where>
</select>
<select id="selectQmsCheckRuleDetailByCheckRuleId" parameterType="Long" resultMap="QmsCheckRuleDetailResult">
<include refid="selectQmsCheckRuleDetailVo"/>
where check_rule_id = #{checkRuleId}
</select>
<insert id="insertQmsCheckRuleDetail" parameterType="QmsCheckRuleDetail">
insert into qms_check_rule_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="checkRuleId != null">check_rule_id,</if>
<if test="targetType != null and targetType != ''">target_type,</if>
<if test="targetId != null">target_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="checkRuleId != null">#{checkRuleId},</if>
<if test="targetType != null and targetType != ''">#{targetType},</if>
<if test="targetId != null">#{targetId},</if>
</trim>
</insert>
<update id="updateQmsCheckRuleDetail" parameterType="QmsCheckRuleDetail">
update qms_check_rule_detail
<trim prefix="SET" suffixOverrides=",">
<if test="targetType != null and targetType != ''">target_type = #{targetType},</if>
<if test="targetId != null">target_id = #{targetId},</if>
</trim>
where check_rule_id = #{checkRuleId}
</update>
<delete id="deleteQmsCheckRuleDetailByCheckRuleId" parameterType="Long">
delete from qms_check_rule_detail where check_rule_id = #{checkRuleId}
</delete>
<delete id="deleteQmsCheckRuleDetailByCheckRuleIds" parameterType="String">
delete from qms_check_rule_detail where check_rule_id in
<foreach item="checkRuleId" collection="array" open="(" separator="," close=")">
#{checkRuleId}
</foreach>
</delete>
<select id="selectQmsCheckRuleDetailJoinList" parameterType="QmsCheckRuleDetail" resultMap="QmsCheckRuleDetailResult">
select qcrd.check_rule_id, qcrd.target_type, qcrd.target_id,
mbmi.material_code,mbmi.material_name
from qms_check_rule_detail qcrd
left join mes_base_material_info mbmi on qcrd.target_id=mbmi.material_id and qcrd.target_type='1'
<where>
<if test="checkRuleId != null "> and check_rule_id = #{checkRuleId}</if>
<if test="targetType != null and targetType != ''"> and target_type = #{targetType}</if>
<if test="targetId != null "> and target_id = #{targetId}</if>
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
</where>
</select>
<delete id="deleteQmsCheckRuleDetails">
delete from qms_check_rule_detail where
<foreach item="item" index="index" collection="list" separator="or">
( check_rule_id = #{item.checkRuleId} and target_id = #{item.targetId} and target_type=#{item.targetType})
</foreach>
</delete>
</mapper>

@ -0,0 +1,140 @@
<?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.hw.qms.mapper.QmsCheckRuleMapper">
<resultMap type="QmsCheckRule" id="QmsCheckRuleResult">
<result property="checkRuleId" column="check_rule_id" />
<result property="checkRuleName" column="check_rule_name" />
<result property="checkRuleType" column="check_rule_type" />
<result property="checkMode" column="check_mode" />
<result property="checkSample" column="check_sample" />
<result property="checkRuleStatus" column="check_rule_status" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<resultMap id="QmsCheckRuleQmsCheckRuleProjectResult" type="QmsCheckRule" extends="QmsCheckRuleResult">
<collection property="qmsCheckRuleProjectList" notNullColumn="sub_check_rule_id" javaType="java.util.List" resultMap="QmsCheckRuleProjectResult" />
</resultMap>
<resultMap type="QmsCheckRuleProject" id="QmsCheckRuleProjectResult">
<result property="checkRuleId" column="sub_check_rule_id" />
<result property="checkProjectId" column="sub_check_project_id" />
<result property="projectStepOrder" column="sub_project_step_order" />
</resultMap>
<sql id="selectQmsCheckRuleVo">
select check_rule_id, check_rule_name, check_rule_type, check_mode, check_sample, check_rule_status, remark, create_by, create_time, update_by, update_time from qms_check_rule
</sql>
<select id="selectQmsCheckRuleList" parameterType="QmsCheckRule" resultMap="QmsCheckRuleResult">
<include refid="selectQmsCheckRuleVo"/>
<where>
<if test="checkRuleName != null and checkRuleName != ''"> and check_rule_name like concat('%', #{checkRuleName}, '%')</if>
<if test="checkRuleType != null and checkRuleType != ''"> and check_rule_type = #{checkRuleType}</if>
<if test="checkMode != null and checkMode != ''"> and check_mode = #{checkMode}</if>
<if test="checkSample != null "> and check_sample = #{checkSample}</if>
<if test="checkRuleStatus != null and checkRuleStatus != ''"> and check_rule_status = #{checkRuleStatus}</if>
</where>
</select>
<select id="selectQmsCheckRuleByCheckRuleId" parameterType="Long" resultMap="QmsCheckRuleQmsCheckRuleProjectResult">
select a.check_rule_id, a.check_rule_name, a.check_rule_type, a.check_mode, a.check_sample, a.check_rule_status, a.remark, a.create_by, a.create_time, a.update_by, a.update_time,
b.check_rule_id as sub_check_rule_id, b.check_project_id as sub_check_project_id, b.project_step_order as sub_project_step_order
from qms_check_rule a
left join qms_check_rule_project b on b.check_rule_id = a.check_rule_id
where a.check_rule_id = #{checkRuleId} order by b.project_step_order
</select>
<insert id="insertQmsCheckRule" parameterType="QmsCheckRule" useGeneratedKeys="true" keyProperty="checkRuleId">
insert into qms_check_rule
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="checkRuleName != null and checkRuleName != ''">check_rule_name,</if>
<if test="checkRuleType != null and checkRuleType != ''">check_rule_type,</if>
<if test="checkMode != null">check_mode,</if>
<if test="checkSample != null">check_sample,</if>
<if test="checkRuleStatus != null and checkRuleStatus != ''">check_rule_status,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="checkRuleName != null and checkRuleName != ''">#{checkRuleName},</if>
<if test="checkRuleType != null and checkRuleType != ''">#{checkRuleType},</if>
<if test="checkMode != null">#{checkMode},</if>
<if test="checkSample != null">#{checkSample},</if>
<if test="checkRuleStatus != null and checkRuleStatus != ''">#{checkRuleStatus},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateQmsCheckRule" parameterType="QmsCheckRule">
update qms_check_rule
<trim prefix="SET" suffixOverrides=",">
<if test="checkRuleName != null and checkRuleName != ''">check_rule_name = #{checkRuleName},</if>
<if test="checkRuleType != null and checkRuleType != ''">check_rule_type = #{checkRuleType},</if>
<if test="checkMode != null">check_mode = #{checkMode},</if>
check_sample = #{checkSample},
<if test="checkRuleStatus != null and checkRuleStatus != ''">check_rule_status = #{checkRuleStatus},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where check_rule_id = #{checkRuleId}
</update>
<delete id="deleteQmsCheckRuleByCheckRuleId" parameterType="Long">
delete from qms_check_rule where check_rule_id = #{checkRuleId}
</delete>
<delete id="deleteQmsCheckRuleByCheckRuleIds" parameterType="String">
delete from qms_check_rule where check_rule_id in
<foreach item="checkRuleId" collection="array" open="(" separator="," close=")">
#{checkRuleId}
</foreach>
</delete>
<delete id="deleteQmsCheckRuleProjectByCheckRuleIds" parameterType="String">
delete from qms_check_rule_project where check_rule_id in
<foreach item="checkRuleId" collection="array" open="(" separator="," close=")">
#{checkRuleId}
</foreach>
</delete>
<delete id="deleteQmsCheckRuleProjectByCheckRuleId" parameterType="Long">
delete from qms_check_rule_project where check_rule_id = #{checkRuleId}
</delete>
<insert id="batchQmsCheckRuleDetail">
insert into qms_check_rule_detail( check_rule_id, target_type, target_id) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.checkRuleId}, #{item.targetType}, #{item.targetId})
</foreach>
</insert>
<insert id="batchQmsCheckRuleProject">
insert into qms_check_rule_project( check_rule_id, check_project_id, project_step_order) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.checkRuleId}, #{item.checkProjectId}, #{item.projectStepOrder})
</foreach>
</insert>
</mapper>

@ -0,0 +1,116 @@
<?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.hw.qms.mapper.QmsCheckRuleProjectMapper">
<resultMap type="QmsCheckRuleProject" id="QmsCheckRuleProjectResult">
<result property="checkRuleId" column="check_rule_id" />
<result property="checkProjectId" column="check_project_id" />
<result property="projectStepOrder" column="project_step_order" />
<association property="CheckProject" javaType="QmsCheckProject" resultMap="CheckProjectResult" />
</resultMap>
<resultMap id="CheckProjectResult" type="QmsCheckProject">
<id property="checkProjectId" column="check_project_id" />
<result property="checkProjectName" column="check_project_name" />
<result property="checkProjectStatus" column="check_project_status" />
<result property="checkProjectProperty" column="check_project_property" />
<result property="checkMode" column="check_mode" />
<result property="checkSample" column="check_sample" />
<result property="checkTool" column="check_tool" />
<result property="unitCode" column="unit_code" />
<result property="standardValue" column="standard_value" />
<result property="upperDiff" column="upper_diff" />
<result property="downDiff" column="down_diff" />
<result property="defectSeverity" column="defect_severity" />
</resultMap>
<sql id="selectQmsCheckRuleProjectVo">
select check_rule_id, check_project_id, project_step_order from qms_check_rule_project
</sql>
<select id="selectQmsCheckRuleProjectList" parameterType="QmsCheckRuleProject" resultMap="QmsCheckRuleProjectResult">
<include refid="selectQmsCheckRuleProjectVo"/>
<where>
<if test="projectStepOrder != null "> and project_step_order = #{projectStepOrder}</if>
</where>
</select>
<select id="selectQmsCheckRuleProjectByCheckRuleId" parameterType="Long" resultMap="QmsCheckRuleProjectResult">
<include refid="selectQmsCheckRuleProjectVo"/>
where check_rule_id = #{checkRuleId}
</select>
<insert id="insertQmsCheckRuleProject" parameterType="QmsCheckRuleProject">
insert into qms_check_rule_project
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="checkRuleId != null">check_rule_id,</if>
<if test="checkProjectId != null">check_project_id,</if>
<if test="projectStepOrder != null">project_step_order,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="checkRuleId != null">#{checkRuleId},</if>
<if test="checkProjectId != null">#{checkProjectId},</if>
<if test="projectStepOrder != null">#{projectStepOrder},</if>
</trim>
</insert>
<update id="updateQmsCheckRuleProject" parameterType="QmsCheckRuleProject">
update qms_check_rule_project
<trim prefix="SET" suffixOverrides=",">
<if test="checkProjectId != null">check_project_id = #{checkProjectId},</if>
<if test="projectStepOrder != null">project_step_order = #{projectStepOrder},</if>
</trim>
where check_rule_id = #{checkRuleId}
</update>
<delete id="deleteQmsCheckRuleProjectByCheckRuleId" parameterType="Long">
delete from qms_check_rule_project where check_rule_id = #{checkRuleId}
</delete>
<delete id="deleteQmsCheckRuleProjectByCheckRuleIds" parameterType="String">
delete from qms_check_rule_project where check_rule_id in
<foreach item="checkRuleId" collection="array" open="(" separator="," close=")">
#{checkRuleId}
</foreach>
</delete>
<select id="selectQmsCheckRuleProjectListByTarget" parameterType="QmsCheckRuleProject" resultMap="QmsCheckRuleProjectResult">
select qcrp.check_rule_id, qcrp.check_project_id, qcrp.project_step_order,
qcp.check_project_name,qcp.check_project_property,qcp.standard_value,qcp.upper_diff,qcp.down_diff
from qms_check_rule_project qcrp left join qms_check_project qcp on qcrp.check_project_id = qcp.check_project_id
<where>
<if test="projectStepOrder != null "> and project_step_order = #{projectStepOrder}</if>
<if test="targetId != null and targetType!=null and targetType!=''"> and exists (select 1 from qms_check_rule_detail qcrd where
qcrd.check_rule_id=qcrd.check_rule_id and qcrd.target_type=#{targetType} and qcrd.target_id=#{targetId})</if>
</where>
</select>
<delete id="deleteQmsCheckRuleProjects">
delete from qms_check_rule_project where
<foreach item="item" index="index" collection="list" separator="or">
( check_rule_id = #{item.checkRuleId} and check_project_id = #{item.checkProjectId})
</foreach>
</delete>
<select id="selectQmsCheckRuleProjectJoinList" parameterType="QmsCheckRuleProject" resultMap="QmsCheckRuleProjectResult">
select qcrp.check_rule_id, qcrp.check_project_id, qcrp.project_step_order,qcp.check_project_name
from qms_check_rule_project qcrp left join qms_check_project qcp on qcrp.check_project_id = qcp.check_project_id
<where>
<if test="projectStepOrder != null "> and project_step_order = #{projectStepOrder}</if>
<if test="checkProjectName != null "> and check_project_name like concat('%', #{checkProjectName},
'%')</if>
</where>
</select>
</mapper>
Loading…
Cancel
Save