叶松
2023-12-01 5efd01db698683e95a63053da43aaa08fa35a185
hd/pipe/materialsManage/src/main/resources/mapping/WeighMapper.xml
@@ -579,5 +579,448 @@
        where by_id=#{byId}
    </update>
    <select id="weighbridgeList" resultType="com.thhy.materials.modules.biz.weigh.entity.TWeighbridge">
        select
        weighbridge_id as weighbridgeId,
        id,
        code,
        orgName,
        supplyOrgName,
        carNumber,
        driverName,
        matName,
        matModel,
        mPoundTime,
        mPoundWeight,
        mPoundName,
        pPoundTime,
        pPoundWeight,
        pPoundName,
        jPoundWeight,
        buckleWeight,
        mWeight,
        pWeight,
        jWeight,
        wareName,
        fileImage,
        types
         from  t_weighbridge where
        1=1
        <if test="carNumber!=null and carNumber!='' ">
            and carNumber like concat('%',#{carNumber},'%')
        </if>
        <if test="matName!=null and matName!='' ">
            and matName like concat('%',#{matName},'%')
        </if>
        order by weighbridge_id desc
    </select>
    <select id="weighbridgeListType" resultType="com.thhy.materials.modules.biz.weigh.entity.TWeighbridge">
        select
        weighbridge_id as weighbridgeId,
        id,
        code,
        orgName,
        supplyOrgName,
        carNumber,
        driverName,
        matName,
        matModel,
        mPoundTime,
        mPoundWeight,
        mPoundName,
        pPoundTime,
        pPoundWeight,
        pPoundName,
        jPoundWeight,
        buckleWeight,
        mWeight,
        pWeight,
        jWeight,
        wareName,
        fileImage,
        types
         from  t_weighbridge where
        types=1
    </select>
    <select id="materialStockValue" resultType="java.lang.Double">
        select material_value as materialValue
        from  t_material_stock where  material_name=#{dictId}
    </select>
    <insert id="materialStockRecordIns" >
        insert into t_material_stock_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            id,
            <if test="createDate != null">
                create_date,
            </if>
            <if test="type != null">
                type,
            </if>
            <if test="opType != null">
                op_type,
            </if>
            <if test="materialName != null">
                material_name,
            </if>
            <if test="materialValue != null">
                material_value,
            </if>
            <if test="beforeStock != null">
                before_stock,
            </if>
            <if test="afterStock != null">
                after_stock,
            </if>
            <if test="companyId != null">
                company_id,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            REPLACE(UUID(),'-',''),
            <if test="createDate != null">
                #{createDate,jdbcType=TIMESTAMP},
            </if>
            <if test="type != null">
                #{type,jdbcType=INTEGER},
            </if>
            <if test="opType != null">
                #{opType,jdbcType=INTEGER},
            </if>
            <if test="materialName != null">
                #{materialName,jdbcType=VARCHAR},
            </if>
            <if test="materialValue != null">
                #{materialValue,jdbcType=DOUBLE},
            </if>
            <if test="beforeStock != null">
                #{beforeStock,jdbcType=DOUBLE},
            </if>
            <if test="afterStock != null">
                #{afterStock,jdbcType=DOUBLE},
            </if>
            <if test="companyId != null">
                #{companyId},
            </if>
        </trim>
    </insert>
    <update id="weighbridgeUpdateType" >
        update t_weighbridge set
        types=2
        where weighbridge_id=#{weighbridgeId}
    </update>
    <select id="materialStockInventory" resultType="com.thhy.materials.modules.biz.weigh.entity.dto.MaterialStockRecordDto">
    SELECT
   s.dict_name AS materialName,
   t.material_value AS materialValue
FROM
   t_material_stock t
   LEFT JOIN sys_dict s ON t.material_name = s.dict_id
    </select>
    <select id="steelInventory" resultType="com.thhy.materials.modules.biz.weigh.entity.dto.SteelDto">
        select
         steel_name as steelName,
         steel_model as steelModel,
         stock as stock
         from sys_steel
    </select>
    <select id="assistGoodInventory" resultType="com.thhy.materials.modules.biz.weigh.entity.dto.AssistGoodDto">
        select s.assist_name as s.assistName,
        d.dict_name as assistType,
        s.stock as stock
         from  sys_assist_good s left join sys_dict d on  s.assist_type=d.dict_id
    </select>
    <select id="mouldInventory" resultType="com.thhy.materials.modules.biz.weigh.entity.dto.MouldDto">
        select
         mould_num as mouldNum,
         free as free,
         current_cycle_time as currentCycleTime
         from sys_mould
    </select>
    <select id="steelType" resultType="com.thhy.materials.modules.biz.concret.entity.SysSteel">
        select
         steel_id as steelId,
         steel_name as steelName,
         steel_model as steelModel,
         stock as stock
         from
            sys_steel
    </select>
    <insert id="steelRecordIn" >
        insert into sys_steel_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="steelId != null">
                steel_id,
            </if>
            <if test="stockType != null">
                stock_type,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="changeStock != null">
                change_stock,
            </if>
            <if test="supplierId != null">
                supplier_id,
            </if>
            <if test="factoryName != null">
                factory_name,
            </if>
            <if test="brand != null">
                brand,
            </if>
            <if test="lineCode != null">
                line_code,
            </if>
            <if test="proId != null">
                pro_id,
            </if>
            <if test="createUser != null">
                create_user,
            </if>
            <if test="companyId != null">
                company_id,
            </if>
            <if test="carName != null">
                car_name,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=VARCHAR},
            </if>
            <if test="steelId != null">
                #{steelId,jdbcType=VARCHAR},
            </if>
            <if test="stockType != null">
                #{stockType,jdbcType=INTEGER},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="changeStock != null">
                #{changeStock,jdbcType=DOUBLE},
            </if>
            <if test="supplierId != null">
                #{supplierId,jdbcType=VARCHAR},
            </if>
            <if test="factoryName != null">
                #{factoryName,jdbcType=VARCHAR},
            </if>
            <if test="brand != null">
                #{brand,jdbcType=VARCHAR},
            </if>
            <if test="lineCode != null">
                #{lineCode,jdbcType=VARCHAR},
            </if>
            <if test="proId != null">
                #{proId,jdbcType=VARCHAR},
            </if>
            <if test="createUser != null">
                #{createUser,jdbcType=VARCHAR},
            </if>
            <if test="companyId != null">
                #{companyId,jdbcType=VARCHAR},
            </if>
            <if test="carName != null">
                #{carName,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>
    <update id="steelUp" >
        update sys_steel set
        stock=#{doubleValue}
        where steel_id=#{steelId}
    </update>
    <select id="materialWarehouseRecordList" resultType="com.thhy.materials.modules.biz.weigh.entity.TSuMaterialWarehouseRecord">
        select
        id,
        table_num as tableNum,
        name_of_origin as nameOfOrigin,
        material_name as materialName,
        incoming_quantity as incomingQuantity,
        in_time as inTime,
        status as status,
        inspection_date as inspectionDate,
        report_number as reportNumber,
        create_time as createTime,
        `type`
         from t_su_material_warehouse_record
        where 1=1
        <if test="tableNum!=null and tableNum!='' ">
            and table_num=#{tableNum}
        </if>
        <if test="type!=null and type!='' ">
            and `type`=#{type}
        </if>
        <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
            and create_time between #{strTime} and #{endTime}
        </if>
        order by create_time desc
    </select>
    <insert id="materialWarehouseRecordInsert" >
        insert into t_su_material_warehouse_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="tableNum != null">
                table_num,
            </if>
            <if test="nameOfOrigin != null">
                name_of_origin,
            </if>
            <if test="materialName != null">
                material_name,
            </if>
            <if test="incomingQuantity != null">
                incoming_quantity,
            </if>
            <if test="inTime != null">
                in_time,
            </if>
            <if test="status != null">
                status,
            </if>
            <if test="inspectionDate != null">
                inspection_date,
            </if>
            <if test="reportNumber != null">
                report_number,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="createUser != null">
                create_user,
            </if>
            <if test="updateTime != null">
                update_time,
            </if>
            <if test="updateUser != null">
                update_user,
            </if>
            <if test="isUse != null">
                is_use,
            </if>
            <if test="companyId != null">
                company_id,
            </if>
            <if test="type != null">
                type,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=VARCHAR},
            </if>
            <if test="tableNum != null">
                #{tableNum,jdbcType=INTEGER},
            </if>
            <if test="nameOfOrigin != null">
                #{nameOfOrigin,jdbcType=VARCHAR},
            </if>
            <if test="materialName != null">
                #{materialName,jdbcType=VARCHAR},
            </if>
            <if test="incomingQuantity != null">
                #{incomingQuantity,jdbcType=DOUBLE},
            </if>
            <if test="inTime != null">
                #{inTime,jdbcType=TIMESTAMP},
            </if>
            <if test="status != null">
                #{status,jdbcType=INTEGER},
            </if>
            <if test="inspectionDate != null">
                #{inspectionDate,jdbcType=TIMESTAMP},
            </if>
            <if test="reportNumber != null">
                #{reportNumber,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="createUser != null">
                #{createUser,jdbcType=VARCHAR},
            </if>
            <if test="updateTime != null">
                #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateUser != null">
                #{updateUser,jdbcType=VARCHAR},
            </if>
            <if test="isUse != null">
                #{isUse,jdbcType=INTEGER},
            </if>
            <if test="companyId != null">
                #{companyId,jdbcType=VARCHAR},
            </if>
            <if test="type != null">
                #{type,jdbcType=INTEGER},
            </if>
        </trim>
    </insert>
    <update id="materialWarehouseRecordUpdate" >
        update t_su_material_warehouse_record
        <set>
            <if test="tableNum != null">
                table_num = #{tableNum,jdbcType=INTEGER},
            </if>
            <if test="nameOfOrigin != null">
                name_of_origin = #{nameOfOrigin,jdbcType=VARCHAR},
            </if>
            <if test="materialName != null">
                material_name = #{materialName,jdbcType=VARCHAR},
            </if>
            <if test="incomingQuantity != null">
                incoming_quantity = #{incomingQuantity,jdbcType=DOUBLE},
            </if>
            <if test="inTime != null">
                in_time = #{inTime,jdbcType=TIMESTAMP},
            </if>
            <if test="status != null">
                status = #{status,jdbcType=INTEGER},
            </if>
            <if test="inspectionDate != null">
                inspection_date = #{inspectionDate,jdbcType=TIMESTAMP},
            </if>
            <if test="reportNumber != null">
                report_number = #{reportNumber,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="createUser != null">
                create_user = #{createUser,jdbcType=VARCHAR},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateUser != null">
                update_user = #{updateUser,jdbcType=VARCHAR},
            </if>
            <if test="isUse != null">
                is_use = #{isUse,jdbcType=INTEGER},
            </if>
            <if test="companyId != null">
                company_id = #{companyId,jdbcType=VARCHAR},
            </if>
            <if test="type != null">
                type = #{type,jdbcType=INTEGER},
            </if>
        </set>
        where id = #{id,jdbcType=VARCHAR}
    </update>
    <delete id="materialWarehouseRecordDel" parameterType="java.lang.String">
        delete from t_su_material_warehouse_record where id=#{id}
    </delete>
</mapper>