Files
nanguangszwlback/mhd-modules/mhd-system/src/main/resources/mapper/basic/materialBaseInfo/MaterialBaseInfoMapper.xml
T

296 lines
14 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.mhd.basic.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper">
<resultMap type="com.mhd.basic.domain.materialBaseInfo.repository.po.MaterialBaseInfoPO" id="MaterialBaseInfoResult">
<result property="materialBaseInfoId" column="material_base_info_id" />
<result property="organizationId" column="organization_id" />
<result property="organizationName" column="organization_name" />
<result property="topOrganizationId" column="top_organization_id" />
<result property="shipperId" column="shipper_id" />
<result property="shipperName" column="shipper_name" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="barCode" column="bar_code" />
<result property="materialClassifyCode" column="material_classify_code" typeHandler="com.mhd.common.core.handler.ListTypeHandler" />
<result property="materialClassifyName" column="material_classify_name" typeHandler="com.mhd.common.core.handler.ListTypeHandler" />
<result property="materialType" column="material_type" />
<result property="materialTypeName" column="material_type_name" />
<result property="packId" column="pack_id" />
<result property="packCode" column="pack_code" />
<result property="packName" column="pack_name" />
<result property="brandId" column="brand_id" />
<result property="brandCode" column="brand_code" />
<result property="brandName" column="brand_name" />
<result property="shelfLife" column="shelf_life" />
<result property="weightLimit" column="weight_limit" />
<result property="volumeLimit" column="volume_limit" />
<result property="materialShape" column="material_shape" />
<result property="materialShapeName" column="material_shape_name" />
<result property="materialSize" column="material_size" />
<result property="materialLength" column="material_length" />
<result property="materialWidth" column="material_width" />
<result property="materialHeight" column="material_height" />
<result property="remark" column="remark" />
<result property="nullify" column="nullify" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="createByName" column="create_by_name" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="updateByName" column="update_by_name" />
<result property="delFlag" column="del_flag" />
<result property="common" column="common" />
<result property="unitName" column="unit_name" />
<result column="material_model" property="materialModel" jdbcType="VARCHAR"/>
<result column="material_unit" property="materialUnit" jdbcType="VARCHAR"/>
<result column="machine_code" property="machineCode" jdbcType="VARCHAR"/>
</resultMap>
<sql id="selectMaterialBaseInfoPo">
select material_base_info_id, organization_id, organization_name, top_organization_id, shipper_id, shipper_name, material_code, material_name, bar_code, material_classify_code,
material_classify_name, material_type, material_type_name, pack_id, pack_code, pack_name, unit_code, unit_name, brand_id, brand_code, brand_name, shelf_life, weight_limit,
volume_limit, material_shape, material_shape_name, material_size, material_length, material_width, material_height, remark, nullify, create_time, create_by, create_by_name,
update_time, update_by, update_by_name, del_flag, common,material_model,material_unit,machine_code
from material_base_info
</sql>
<sql id="selectMaterialBaseInfoPo1">
<where>
<if test="organizationId != null ">
and organization_id = #{organizationId}
</if>
<if test="organizationName != null and organizationName != ''">
and organization_name like concat('%', #{organizationName}, '%')
</if>
<if test="topOrganizationId != null ">
and top_organization_id = #{topOrganizationId}
</if>
<if test="shipperId != null ">
and shipper_id = #{shipperId}
</if>
<if test="shipperName != null and shipperName != ''">
and shipper_name like concat('%', #{shipperName}, '%')
</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>
<if test="barCode != null and barCode != ''">
and bar_code = #{barCode}
</if>
<if test="materialClassifyCode != null and materialClassifyCode != ''">
and material_classify_code = #{materialClassifyCode}
</if>
<if test="materialClassifyName != null and materialClassifyName != ''">
and material_classify_name like concat('%', #{materialClassifyName}, '%')
</if>
<if test="materialType != null and materialType != ''">
and material_type = #{materialType}
</if>
<if test="materialTypeName != null and materialTypeName != ''">
and material_type_name like concat('%', #{materialTypeName}, '%')
</if>
<if test="unitCode != null and unitCode != ''">
and unit_code = #{unitCode}
</if>
<if test="unitName != null and unitName != ''">
and unit_name like concat('%', #{unitName}, '%')
</if>
<if test="packId != null ">
and pack_id = #{packId}
</if>
<if test="packCode != null and packCode != ''">
and pack_code = #{packCode}
</if>
<if test="packName != null and packName != ''">
and pack_name like concat('%', #{packName}, '%')
</if>
<if test="brandId != null ">
and brand_id = #{brandId}
</if>
<if test="brandCode != null and brandCode != ''">
and brand_code = #{brandCode}
</if>
<if test="brandName != null and brandName != ''">
and brand_name like concat('%', #{brandName}, '%')
</if>
<if test="shelfLife != null ">
and shelf_life = #{shelfLife}
</if>
<if test="weightLimit != null ">
and weight_limit = #{weightLimit}
</if>
<if test="volumeLimit != null ">
and volume_limit = #{volumeLimit}
</if>
<if test="materialShape != null and materialShape != ''">
and material_shape = #{materialShape}
</if>
<if test="materialShapeName != null and materialShapeName != ''">
and material_shape_name like concat('%', #{materialShapeName}, '%')
</if>
<if test="materialSize != null and materialSize != ''">
and material_size = #{materialSize}
</if>
<if test="materialLength != null ">
and material_length = #{materialLength}
</if>
<if test="materialWidth != null ">
and material_width = #{materialWidth}
</if>
<if test="materialHeight != null ">
and material_height = #{materialHeight}
</if>
<if test="nullify != null ">
and nullify = #{nullify}
</if>
<if test="createByName != null and createByName != ''">
and create_by_name like concat('%', #{createByName}, '%')
</if>
<if test="updateByName != null and updateByName != ''">
and update_by_name like concat('%', #{updateByName}, '%')
</if>
<!-- 传 1:只查公共 , 2:只查自己的 ,3:公共的和自己的 -->
<choose>
<when test="common != null and (common == 1 or common == 2) "> and common = #{common} </when>
<otherwise> and (
1 = 1
or common = 1 )</otherwise>
</choose>
<choose>
<when test="delFlag != null"> and del_flag = #{delFlag} </when>
<otherwise> and del_flag = 1 </otherwise>
</choose>
</where>
and material_base_info_id in (SELECT
DISTINCT material_base_info_id
FROM ngwl_test_wms.material_inventory
WHERE
allocation_quantity > 0
AND del_flag = 1)
</sql>
<select id="queryList" parameterType="com.mhd.basic.domain.materialBaseInfo.repository.todo.MaterialBaseInfoDO" resultMap="MaterialBaseInfoResult">
<include refid="selectMaterialBaseInfoPo"/>
<include refid="selectMaterialBaseInfoPo2"/>
</select>
<sql id="selectMaterialBaseInfoPo2">
<where>
<if test="organizationId != null ">
and organization_id = #{organizationId}
</if>
<if test="organizationName != null and organizationName != ''">
and organization_name like concat('%', #{organizationName}, '%')
</if>
<if test="topOrganizationId != null ">
and top_organization_id = #{topOrganizationId}
</if>
<if test="shipperId != null ">
and shipper_id = #{shipperId}
</if>
<if test="shipperName != null and shipperName != ''">
and shipper_name like concat('%', #{shipperName}, '%')
</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>
<if test="barCode != null and barCode != ''">
and bar_code = #{barCode}
</if>
<if test="materialClassifyCode != null and materialClassifyCode != ''">
and material_classify_code = #{materialClassifyCode}
</if>
<if test="materialClassifyName != null and materialClassifyName != ''">
and material_classify_name like concat('%', #{materialClassifyName}, '%')
</if>
<if test="materialType != null and materialType != ''">
and material_type = #{materialType}
</if>
<if test="materialTypeName != null and materialTypeName != ''">
and material_type_name like concat('%', #{materialTypeName}, '%')
</if>
<if test="unitCode != null and unitCode != ''">
and unit_code = #{unitCode}
</if>
<if test="unitName != null and unitName != ''">
and unit_name like concat('%', #{unitName}, '%')
</if>
<if test="packId != null ">
and pack_id = #{packId}
</if>
<if test="packCode != null and packCode != ''">
and pack_code = #{packCode}
</if>
<if test="packName != null and packName != ''">
and pack_name like concat('%', #{packName}, '%')
</if>
<if test="brandId != null ">
and brand_id = #{brandId}
</if>
<if test="brandCode != null and brandCode != ''">
and brand_code = #{brandCode}
</if>
<if test="brandName != null and brandName != ''">
and brand_name like concat('%', #{brandName}, '%')
</if>
<if test="shelfLife != null ">
and shelf_life = #{shelfLife}
</if>
<if test="weightLimit != null ">
and weight_limit = #{weightLimit}
</if>
<if test="volumeLimit != null ">
and volume_limit = #{volumeLimit}
</if>
<if test="materialShape != null and materialShape != ''">
and material_shape = #{materialShape}
</if>
<if test="materialShapeName != null and materialShapeName != ''">
and material_shape_name like concat('%', #{materialShapeName}, '%')
</if>
<if test="materialSize != null and materialSize != ''">
and material_size = #{materialSize}
</if>
<if test="materialLength != null ">
and material_length = #{materialLength}
</if>
<if test="materialWidth != null ">
and material_width = #{materialWidth}
</if>
<if test="materialHeight != null ">
and material_height = #{materialHeight}
</if>
<if test="nullify != null ">
and nullify = #{nullify}
</if>
<if test="createByName != null and createByName != ''">
and create_by_name like concat('%', #{createByName}, '%')
</if>
<if test="updateByName != null and updateByName != ''">
and update_by_name like concat('%', #{updateByName}, '%')
</if>
<!-- 传 1:只查公共 , 2:只查自己的 ,3:公共的和自己的 -->
<choose>
<when test="common != null and (common == 1 or common == 2) "> and common = #{common} </when>
<otherwise> and (
1 = 1
or common = 1 )</otherwise>
</choose>
<choose>
<when test="delFlag != null"> and del_flag = #{delFlag} </when>
<otherwise> and del_flag = 1 </otherwise>
</choose>
</where>
</sql>
</mapper>