Files
nanguangszwlback/mhd_wms/src/main/resources/mapper/materialBaseInfo/MaterialBaseInfoMapper.xml
T

226 lines
12 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.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper">
<resultMap type="com.mhd.wms.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="shipperCode" column="shipper_code" />
<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="unitNumber" column="unit_number" />
<result property="common" column="common" />
</resultMap>
<sql id="selectMaterialBaseInfoPo">
select material_base_info_id, organization_id, organization_name, top_organization_id, shipper_id, shipper_code, 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,sku_code, unit_price, currency, origin_country, hs_code, declaration_unit, statutory_unit, statutory_second_unit,specification_Model from material_base_info
</sql>
<sql id="JoinMaterialBaseInfoPo">
,b.shipper_id, b.shipper_code, b.shipper_name, b.material_code, b.material_name, b.bar_code, b.material_classify_code, b.material_classify_name,
b.material_type, b.material_type_name, b.common
</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="shipperCode != null and shipperCode != ''">
and shipper_code like concat('%', #{shipperCode}, '%')
</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="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>
<if test="compoundOrQuery != null and compoundOrQuery != ''">
and ( instr(material_name, #{compoundOrQuery}) > 0
or
instr(material_code, #{compoundOrQuery}) > 0
or
instr(bar_code, #{compoundOrQuery}) > 0
)
</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>
<sql id="JoinMaterialBaseInfoPoWhere">
<if test="shipperId != null ">
and shipper_id = #{shipperId}
</if>
<if test="shipperCode != null and shipperCode != ''">
and shipper_code like concat('%', #{shipperCode}, '%')
</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="shipperInfo != null and shipperInfo != ''">
and (shipper_code like concat('%', #{shipperInfo}, '%') or shipper_name like concat('%', #{shipperInfo}, '%'))
</if>
<if test="materialInfo != null and materialInfo != ''">
and (material_code = #{materialInfo} or material_name like concat('%', #{materialInfo}, '%') or bar_code = #{materialInfo})
</if>
</sql>
<select id="queryList" parameterType="com.mhd.wms.domain.materialBaseInfo.repository.todo.MaterialBaseInfoDO" resultMap="MaterialBaseInfoResult">
<include refid="selectMaterialBaseInfoPo"/>
<include refid="selectMaterialBaseInfoPo1"/>
</select>
<select id="selectOneByID" parameterType="java.lang.Long" resultMap="MaterialBaseInfoResult">
select material_code, material_name, pack_id, pack_code, pack_name, unit_code, unit_name, shipper_id, shipper_name, shipper_code, bar_code, unit_number from material_base_info
where material_base_info_id = #{materialBaseInfoId}
</select>
</mapper>