123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <?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.sb.SbModelSpareBomMapper">
- <sql id="Left_Column">
- bom.id, bom.period, bom.period_type, bom.num, bom.model_id, bom.sb_id, bom.sb_part_id,
- bom.check_date,
- bom.next_check_date,
- bom.change_num,
- bom.next_change_num,
- bom.spare_id, sbInfo.name, sbInfo.model, sbInfo.no, sbInfo.zbh, sbInfo.name_model, part.name as sbPartName
- </sql>
- <select id="selectExportList" parameterType="com.platform.dao.dto.sb.SbModelSpareBomDTO"
- resultType="com.platform.dao.vo.sb.SbModelSpareBomVO">
- select
- bom.id,
- bom.check_date,
- bom.next_check_date,
- bom.change_num,
- bom.next_change_num,bom.model_id, bom.sb_id, bom.sb_part_id, bom.spare_id,sbInfo.name,sbInfo.model, sbInfo.no, sbInfo.zbh, part.name as sbPartName
- from t_sb_model_spare_bom bom
- LEFT JOIN t_sb_info sbInfo ON bom.sb_id = sbInfo.id
- LEFT JOIN t_part_info part on bom.sb_part_id = part.id
- where
- bom.sb_id = sbInfo.id
- GROUP BY bom.spare_id
- </select>
- <select id="selectVOList" parameterType="com.platform.dao.dto.sb.SbModelSpareBomDTO"
- resultType="com.platform.dao.vo.sb.SbModelSpareBomVO">
- select
- partInfo.name as spareName,
- <include refid="Left_Column"/>
- from t_sb_model_spare_bom bom
- LEFT JOIN t_sb_info sbInfo ON bom.sb_id = sbInfo.id
- LEFT JOIN t_part_info part on bom.sb_part_id = part.id
- left join t_spare_part_info partInfo on bom.spare_id = partInfo.id
- <where>
- <if test="spareId != null">
- and bom.spare_id = #{spareId}
- </if>
- <if test="sbId != null">
- and bom.sb_id = #{sbId}
- </if>
- <if test="isSpecial != null">
- and partInfo.is_special = #{isSpecial}
- </if>
- <if test="keyword != null and keyword != ''">
- and (
- sbInfo.no like concat('%',#{keyword},'%')
- or sbInfo.name like concat('%',#{keyword},'%')
- or sbInfo.model like concat('%',#{keyword},'%')
- or sbInfo.zbh like concat('%',#{keyword},'%')
- )
- </if>
- </where>
- </select>
- <select id="selectLongYanVOList" parameterType="com.platform.dao.dto.store.SpareStoreDTO"
- resultType="com.platform.dao.vo.query.store.SpareStoreVO">
- select bom.id,
- bom.spare_name as spareName,bom.no as no,bom.ggxh as ggxh from t_sb_model_spare_bom bom
- <where>
- <if test="spareId != null">
- and bom.spare_id = #{spareId}
- </if>
- <if test="sbId != null">
- and bom.sb_id = #{sbId}
- </if>
- </where>
- </select>
- <update id="updateBatch" parameterType="java.util.List">
- <foreach collection="list" item="item" index="index" open="" close="" separator=";">
- update t_sb_model_spare_bom
- <set>
- spare_id = #{item.spareId}
- </set>
- where id = #{item.id}
- </foreach>
- </update>
- <update id="updateBatchAll" parameterType="java.util.List">
- <foreach collection="list" item="item" index="index" open="" close="" separator=";">
- update t_sb_model_spare_bom
- <set>
- period = #{item.period},
- period_type = #{item.periodType},
- num = #{item.num}
- </set>
- where id = #{item.id}
- </foreach>
- </update>
- <select id="selectVOList1" parameterType="com.platform.dao.dto.sb.SbModelSpareBomDTO"
- resultType="com.platform.dao.vo.sb.SbModelSpareBomVO">
- select
- partInfo.name as spareName,used.change_date,used.real_change_date,
- <include refid="Left_Column"/>
- from t_sb_model_spare_bom bom
- LEFT JOIN t_sb_info sbInfo ON bom.sb_id = sbInfo.id
- LEFT JOIN t_part_info part on bom.sb_part_id = part.id
- left join t_spare_part_info partInfo on bom.spare_id = partInfo.id
- left join t_spare_part_used used on used.spare_id=bom.spare_id
- <where>
- <if test="spareId != null">
- and bom.spare_id = #{spareId}
- </if>
- <if test="sbId != null">
- and bom.sb_id = #{sbId}
- </if>
- <if test="isSpecial != null">
- and partInfo.is_special = #{isSpecial}
- </if>
- <if test="keyword != null and keyword != ''">
- and (
- sbInfo.no like concat('%',#{keyword},'%')
- or sbInfo.name like concat('%',#{keyword},'%')
- or sbInfo.model like concat('%',#{keyword},'%')
- or sbInfo.zbh like concat('%',#{keyword},'%')
- )
- </if>
- </where>
- </select>
- </mapper>
|