<?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.glxp.mipsdl.dao.basic.BasicUdirelDao">
    <resultMap id="BaseResultMap" type="com.glxp.mipsdl.entity.basic.BasicUdirelEntity">
        <!--@mbg.generated-->
        <!--@Table basic_udirel-->
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="uuid" jdbcType="VARCHAR" property="uuid"/>
        <result column="mainId" jdbcType="VARCHAR" property="mainId"/>
        <result column="thirdId" jdbcType="VARCHAR" property="thirdId"/>
        <result column="thirdId1" jdbcType="VARCHAR" property="thirdId1"/>
        <result column="thirdId2" jdbcType="VARCHAR" property="thirdId2"/>
        <result column="thirdId3" jdbcType="VARCHAR" property="thirdId3"/>
        <result column="thirdId4" jdbcType="VARCHAR" property="thirdId4"/>
        <result column="udplatCode" jdbcType="VARCHAR" property="udplatCode"/>
        <result column="isUseDy" jdbcType="TINYINT" property="isUseDy"/>
        <result column="isDisable" jdbcType="TINYINT" property="isDisable"/>
        <result column="isLock" jdbcType="TINYINT" property="isLock"/>
        <result column="lockStatus" jdbcType="INTEGER" property="lockStatus"/>
        <result column="isAdavence" jdbcType="TINYINT" property="isAdavence"/>
        <result column="useMuti" jdbcType="TINYINT" property="useMuti"/>
        <result column="useNum" jdbcType="INTEGER" property="useNum"/>
        <result column="supName" jdbcType="VARCHAR" property="supName"/>
        <result column="createTime" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="updateTime" jdbcType="VARCHAR" property="updateTime"/>
        <result column="modifyTime" jdbcType="TIMESTAMP" property="modifyTime"/>
        <result column="createUser" jdbcType="VARCHAR" property="createUser"/>
        <result column="updateUser" jdbcType="VARCHAR" property="updateUser"/>
        <result column="remark" jdbcType="VARCHAR" property="remark"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        id, uuid, mainId, thirdId, thirdId1, thirdId2, thirdId3, thirdId4, udplatCode, isUseDy,
        isDisable, isLock, lockStatus, isAdavence, useMuti, useNum, supName, createTime,
        updateTime, modifyTime, `createUser`, updateUser, remark
    </sql>

    <select id="selectByNameCode" resultType="com.glxp.mipsdl.entity.basic.BasicUdirelEntity">
        select basic_udirel.*
        from basic_udirel
                     inner join basic_products on basic_udirel.uuid = basic_products.uuid
        where basic_products.nameCode = #{nameCode}
        limit 1
    </select>

    <select id="selectOneUdi" parameterType="com.glxp.mipsdl.entity.basic.BasicUdirelEntity" resultType="com.glxp.mipsdl.res.udiwms.UdiRelevanceResponse">
        select bu.*,
        bp.originUuid,
        bp.nameCode,
        bp.deviceRecordKey,
        bp.packRatio,
        bp.packUnit,
        bp.packLevel,
        bp.bhxjsl,
        bp.bhzxxsbzsl,
        bp.zxxsbzbhsydysl,
        bp.bhxjcpbm,
        bp.bzcj,
        bp.cpmctymc,
        bp.cplb,
        bp.flbm,
        bp.ggxh,
        bp.qxlb,
        bp.tyshxydm,
        bp.ylqxzcrbarmc,
        bp.zczbhhzbapzbh,
        bp.ylqxzcrbarywmc,
        bp.sydycpbs,
        bp.sjcpbm,
        bp.versionNumber,
        bp.diType,
        bp.ybbm,
        bp.sptm,
        bp.manufactory,
        bp.measname,
        bp.productType,
        bp.scbssfbhph,
        bp.scbssfbhxlh,
        bp.scbssfbhscrq,
        bp.scbssfbhsxrq,
        bp.cpms,
        bp.allowNoBatch,
        bp.allowNoExpire,
        bp.allowNoProduct,
        bp.allowNoSerial,
        bp.spmc,
        bp.cplx,
        bp.hchzsb,
        bp.cpdls,
        bp.basicPrductRemak1,
        bp.basicPrductRemak2,
        bp.basicPrductRemak3,
        bp.basicPrductRemak4,
        bp.basicPrductRemak5,
        bp.basicPrductRemak6,
        bp.basicPrductRemak7,
        bp.basicPrductRemak8,
        bp.sfwblztlcp,
        bp.cgzmraqxgxx,
        bp.sfbjwycxsy,
        bp.zdcfsycs,
        bp.sfwwjbz,
        bp.syqsfxyjxmj,
        bp.mjfs,
        bp.categoryName
        from basic_udirel bu
        inner JOIN basic_products bp ON bp.uuid = bu.uuid
        <where>
            <if test="id != null ">
                AND bu.id = #{id}
            </if>
            <if test="mainId != '' and mainId != null">
                AND bu.mainId = #{mainId}
            </if>
        </where>
        limit 1
    </select>
</mapper>
