123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- <?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.platform.dao.mapper.sqarepartmanage.SparePartInfoMapper">
- <resultMap id="BaseResultMap" type="com.platform.dao.entity.sqarepartmanage.SparePartInfo">
- <id column="id" jdbcType="VARCHAR" property="id"/>
- <result column="unite_no" jdbcType="VARCHAR" property="uniteNo"/>
- <result column="no" jdbcType="VARCHAR" property="no"/>
- <result column="init_no" jdbcType="VARCHAR" property="initNo"/>
- <result column="name_no" jdbcType="VARCHAR" property="nameNo"/>
- <result column="gg_no" jdbcType="VARCHAR" property="ggNo"/>
- <result column="name" jdbcType="VARCHAR" property="name"/>
- <result column="type_id" jdbcType="VARCHAR" property="typeId"/>
- <result column="parent_type_id" jdbcType="VARCHAR" property="parentTypeId"/>
- <result column="middle_type_id" jdbcType="VARCHAR" property="middleTypeId"/>
- <result column="child_type_id" jdbcType="VARCHAR" property="childTypeId"/>
- <result column="parent_no" jdbcType="VARCHAR" property="parentNo"/>
- <result column="middle_no" jdbcType="VARCHAR" property="middleNo"/>
- <result column="child_no" jdbcType="VARCHAR" property="childNo"/>
- <result column="image" jdbcType="VARCHAR" property="image"/>
- <result column="qr_code" jdbcType="VARCHAR" property="qrCode"/>
- <result column="level" jdbcType="SMALLINT" property="level"/>
- <result column="initial_value" jdbcType="DOUBLE" property="initialValue"/>
- <result column="producer_id" jdbcType="VARCHAR" property="producerId"/>
- <result column="supplier_id" jdbcType="VARCHAR" property="supplierId"/>
- <result column="unit" jdbcType="SMALLINT" property="unit"/>
- <result column="unit_bz" jdbcType="SMALLINT" property="unitBz"/>
- <result column="unit_rate" jdbcType="DOUBLE" property="unitRate"/>
- <result column="max_stock" jdbcType="DOUBLE" property="maxStock"/>
- <result column="min_stock" jdbcType="DOUBLE" property="minStock"/>
- <result column="init_stock" jdbcType="DOUBLE" property="initStock"/>
- <result column="zbh" jdbcType="VARCHAR" property="zbh"/>
- <result column="ggxh" jdbcType="VARCHAR" property="ggxh"/>
- <result column="english_name" jdbcType="VARCHAR" property="englishName"/>
- <result column="zjm" jdbcType="VARCHAR" property="zjm"/>
- <result column="cd" jdbcType="INTEGER" property="cd"/>
- <result column="yt" jdbcType="INTEGER" property="yt"/>
- <result column="purchase_period" jdbcType="DATE" property="purchasePeriod"/>
- <result column="use_period" jdbcType="DATE" property="usePeriod"/>
- <result column="remark" jdbcType="VARCHAR" property="remark"/>
- <result column="created_user_id" jdbcType="VARCHAR" property="createdUserId"/>
- <result column="update_user_id" jdbcType="VARCHAR" property="updateUserId"/>
- <result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
- <association column="type_id" javaType="string" property="typeName"
- select="com.platform.dao.mapper.sqarepartmanage.SpareTypeMapper.selectNameById"/>
- <association column="producer_id" javaType="string" property="producerName"
- select="com.platform.dao.mapper.firm.FirmProducerMapper.selectNameById"/>
- <association column="supplier_id" javaType="string" property="supplierName"
- select="com.platform.dao.mapper.purchase.SupplierMapper.selectNameById"/>
- </resultMap>
- <sql id="Base_Column_List">
- id, no, unite_no, gg_no, name_no, name, type_id, level, initial_value, producer_id,
- unit,
- purchase_period,
- use_period,
- unit_bz,
- unit_rate,
- image,
- qr_code,
- max_stock, min_stock,init_stock,supplier_id,
- remark, created_user_id, update_user_id, created_time, update_time,
- zbh,init_no,
- parent_type_id,
- child_type_id,
- middle_type_id,
- child_no,
- parent_no,
- middle_no,
- ggxh,
- english_name,
- zjm,
- cd,
- yt
- </sql>
- <select id="selectPageList" parameterType="com.platform.dao.dto.sqarepartmanage.SparePartInfoDTO"
- resultType="com.platform.dao.vo.query.sparepartmanage.SparePartInfoVO">
- select info.*
- from t_spare_part_info info
- <if test="storeId != null and storeId != ''">
- LEFT JOIN t_spare_store spare on spare.spare_id = info.id
- </if>
- <where>
- <if test="keyword != null and keyword != ''">
- AND ( info.name like concat('%',#{keyword},'%') or
- info.no like concat('%',#{keyword},'%'))
- </if>
- <if test="name != null and name != ''">
- AND info.name = #{name}
- </if>
- <if test="ggxh != null and ggxh != ''">
- AND info.ggxh like concat('%',#{ggxh},'%')
- </if>
- <if test="initNo != null and initNo != ''">
- AND info.init_no like concat('%',#{initNo},'%')
- </if>
- <if test="yt != null">
- AND info.yt=#{yt}
- </if>
- <if test="storeId != null and storeId != ''">
- AND spare.store_id=#{storeId}
- </if>
- <if test="level != null and level != ''">
- AND info.level=#{level}
- </if>
- <if test="typeIds != null and typeIds.size > 0">
- AND info.type_id in
- <foreach item="item" index="index" collection="typeIds" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="producerId != null and producerId != ''">
- AND info.producer_id=#{producerId}
- </if>
- <if test="supplierId != null and producerId != ''">
- AND info.supplier_id=#{supplierId}
- </if>
- <if test="parentTypeId != null and parentTypeId != ''">
- AND info.parent_type_id=#{parentTypeId}
- </if>
- <!-- <if test="typeId != null and typeId != ''">
- AND info.type_id=#{typeId}
- </if>-->
- <if test="parentNo != null and parentNo != ''">
- AND info.parent_no=#{parentNo}
- </if>
- <if test="childNo != null and childNo != ''">
- AND info.child_no=#{childNo}
- </if>
- </where>
- </select>
- <select id="selectById" parameterType="java.lang.Object" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List"/>
- from t_spare_part_info
- where id = #{value}
- </select>
- <select id="selectNameById" parameterType="java.lang.Object" resultType="java.lang.String">
- select name
- from t_spare_part_info
- where id = #{value}
- </select>
- <select id="selectSpareInfoList" resultType="com.platform.dao.vo.query.sparepartmanage.SparePartInfoVO">
- select spare.id as spareId, spare.no, spare.unite_no, spare.name, spare.type_id, spare.level,
- spare.initial_value, spare.producer_id,
- spare.unit,
- spare.unit_bz,
- spare.unit_rate,
- spare.image,
- spare.qr_code,
- spare.zbh,spare.init_no,
- spare.gg_no, spare.name_no,
- spare.ggxh,
- spare.english_name,
- spare.zjm,
- spare.cd,
- spare.yt,
- tcpsr.id as id,
- tcpsr.period,
- tcpsr.period_type as periodType,
- tcpsr.sb_id as sbId, tcpsr.num as num,
- part.name as sbPartName
- from t_spare_part_info spare
- left join t_sb_model_spare_bom tcpsr on tcpsr.spare_id=spare.id
- LEFT JOIN t_part_info part on tcpsr.sb_part_id = part.id
- where tcpsr.model_id = #{id}
- </select>
- <select id="selectSpareInfoListBySbId" resultType="com.platform.dao.vo.query.sparepartmanage.SparePartInfoVO">
- select spare.id as spareId, spare.no, spare.unite_no, spare.name, spare.type_id, spare.level,
- spare.initial_value, spare.producer_id,
- spare.unit,
- spare.unit_bz,
- spare.unit_rate,
- spare.image,
- spare.qr_code,
- spare.zbh,spare.init_no,
- spare.gg_no, spare.name_no,
- spare.ggxh,
- spare.english_name,
- spare.zjm,
- spare.cd,
- spare.yt,
- tcpsr.id as id,
- tcpsr.period,
- tcpsr.period_type as periodType,
- tcpsr.model_id as modelId, tcpsr.num as num,
- part.name as sbPartName
- from t_spare_part_info spare
- left join t_sb_model_spare_bom tcpsr on tcpsr.spare_id=spare.id
- LEFT JOIN t_part_info part on tcpsr.sb_part_id = part.id
- where tcpsr.sb_id = #{id}
- </select>
- <update id="updateBatch" parameterType="java.util.List">
- <foreach collection="list" item="item" index="index" open="" close="" separator=";">
- update t_spare_part_info
- <set>
- <if test="item.parentTypeId != null">
- parent_type_id = #{item.parentTypeId},
- </if>
- <if test="item.childTypeId != null">
- child_type_id = #{item.childTypeId},
- </if>
- <if test="item.middleTypeId != null">
- middle_type_id = #{item.middleTypeId},
- </if>
- <if test="item.parentTypeId == null">
- parent_type_id = null,
- </if>
- <if test="item.childTypeId == null">
- child_type_id = null,
- </if>
- <if test="item.middleTypeId == null">
- middle_type_id = null,
- </if>
- <if test="item.parentNo != null">
- parent_no = #{item.parentNo},
- </if>
- <if test="item.middleNo != null">
- middle_no = #{item.middleNo},
- </if>
- <if test="item.unit != null">
- child_no = #{item.childNo},
- </if>
- <if test="item.typeId != null">
- type_id = #{item.typeId},
- </if>
- <if test="item.ggxh != null">
- ggxh = #{item.ggxh},
- </if>
- <if test="item.name != null">
- name = #{item.name},
- </if>
- <if test="item.unit != null">
- unit = #{item.unit},
- </if>
- <if test="item.initNo != null">
- init_no = #{item.initNo},
- </if>
- <if test="item.initialValue != null">
- initial_value = #{item.initialValue}
- </if>
- </set>
- where id = #{item.id}
- </foreach>
- </update>
- </mapper>
|