123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <?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.store.InStoreDetailMapper">
- <sql id="Base_Column_List">
- instoredetail.id,
- instoredetail.in_id, instoredetail.type,
- instoredetail.in_no,
- instoredetail.store_id,
- instoredetail.spare_id,
- instoredetail.num,
- instoredetail.purchase_num,
- instoredetail.price,
- instoredetail.total_price,
- instoredetail.purchase_price,
- instoredetail.purchase_total_price,
- instoredetail.created_user_id,
- instoredetail.update_user_id,
- instoredetail.created_time,
- instoredetail.purchase_detail_id,
- instoredetail.update_time
- </sql>
- <sql id="Ref_Column_List">
- instoredetail.in_id,
- instoredetail.in_no,instoredetail.type,
- instoredetail.purchase_detail_id,
- instoredetail.store_id,
- instoredetail.spare_id,
- instoredetail.num,
- instoredetail.purchase_num,
- instoredetail.price,
- instoredetail.total_price,
- instoredetail.purchase_price,
- instoredetail.purchase_total_price, </sql>
- <sql id="List_Condition">
- <if test="id != null and id != ''">
- and instoredetail.id = #{id}
- </if>
- <if test="type != null and type != ''">
- and instoredetail.type = #{type}
- </if>
- <if test="purchaseDetailId != null and purchaseDetailId != ''">
- and instoredetail.purchase_detail_id = #{purchaseDetailId}
- </if>
- <if test="inId != null and inId != ''">
- and instoredetail.in_id = #{inId}
- </if>
- <if test="inNo != null and inNo != ''">
- and instoredetail.in_no = #{inNo}
- </if>
- <if test="storeId != null and storeId != ''">
- and instoredetail.store_id = #{storeId}
- </if>
- <if test="spareId != null and spareId != ''">
- and instoredetail.spare_id = #{spareId}
- </if>
- <if test="num != null">
- and instoredetail.num = #{num}
- </if>
- <if test="price != null">
- and instoredetail.price = #{price}
- </if>
- <if test="totalPrice != null">
- and instoredetail.total_price = #{totalPrice}
- </if>
- <if test="createdUserId != null and createdUserId != ''">
- and instoredetail.created_user_id = #{createdUserId}
- </if>
- <if test="updateUserId != null and updateUserId != ''">
- and instoredetail.update_user_id = #{updateUserId}
- </if>
- <if test="createdTimeStart != null">
- and instoredetail.created_time <![CDATA[>=]]>; #{createdTimeStart}
- </if>
- <if test="createdTimeEnd != null">
- and instoredetail.created_time <![CDATA[<=]]> #{createdTimeEnd}
- </if>
- <if test="createdTime != null">
- and instoredetail.created_time = #{createdTime}
- </if>
- <if test="updateTimeStart != null">
- and instoredetail.update_time <![CDATA[>=]]>; #{updateTimeStart}
- </if>
- <if test="updateTimeEnd != null">
- and instoredetail.update_time <![CDATA[<=]]> #{updateTimeEnd}
- </if>
- <if test="updateTime != null">
- and instoredetail.update_time = #{updateTime}
- </if>
- <if test="keyword != null and keyword != ''">
- and instoredetail.id like concat('%',#{keyword},'%')
- </if>
- <if test="searchStartTime != null">
- and instoredetail.created_time <![CDATA[ >= ]]> #{searchStartTime}
- </if>
- <if test="searchEndTime != null">
- and instoredetail.created_time <![CDATA[ <= ]]> #{searchEndTime}
- </if>
- </sql>
- <select id="selectList" parameterType="com.platform.dao.dto.store.InStoreDetailDTO"
- resultType="com.platform.dao.vo.query.store.InStoreDetailVO">
- select instoredetail.*, store.name storeName, spareinfo.name spareName, spareinfo.no spareNo
- from t_in_store_detail as instoredetail
- left join t_store store on store.id = instoredetail.store_id
- left join t_spare_part_info spareinfo on spareinfo.id = instoredetail.spare_id
- <where>
- <include refid="List_Condition"/>
- <if test="useCompany != null and useCompany != ''">
- and store.use_company = #{useCompany}
- </if>
- <if test="useProject != null and useProject != ''">
- and store.use_project = #{useProject}
- </if>
- <if test="userId != null and userId != ''">
- and store.user_id = #{userId}
- </if>
- <if test="spareNo != null and spareNo != ''">
- and spareinfo.no = #{spareNo}
- </if>
- </where>
- </select>
- <select id="selectReportList" parameterType="com.platform.dao.dto.store.InStoreDetailDTO"
- resultType="com.platform.dao.vo.query.store.InStoreDetailVO">
- select
- sum(instoredetail.num) as totalNum,
- sum(instoredetail.total_price) as totalPrice,
- spareinfo.name spareName,
- store.name storeName,
- store.id storeId,
- spareinfo.id spareId,
- sparetype.name typeName
- from t_in_store_detail instoredetail,t_spare_part_info spareinfo ,t_spare_type sparetype,t_store store
- <where>
- spareinfo.id = instoredetail.spare_id
- and spareinfo.type_id = sparetype.id
- and store.id = instoredetail.store_id
- <include refid="List_Condition"/>
- </where>
- GROUP BY
- spareinfo.id
- </select>
- <update id="updateBatch" parameterType="java.util.List">
- <foreach collection="list" item="item" index="index" open="" close="" separator=";">
- update t_in_store_detail
- <set>
- num=#{item.num},
- total_price = #{item.totalPrice}
- </set>
- where id = #{item.id}
- </foreach>
- </update>
- <select id="selectReportByInStoreFormVO" parameterType="com.platform.dao.vo.query.store.InStoreFormVO"
- resultType="com.platform.dao.vo.query.store.InStoreDetailVO">
- </select>
- <select id="getCurrentlyList" parameterType="com.platform.dao.vo.query.store.InStoreFormVO"
- resultType="com.platform.dao.vo.query.store.InStoreDetailVO">
- select * from t_in_store_detail left join
- t_in_store_form
- on t_in_store_form.id = t_in_store_detail.in_id
- left join
- t_store
- on t_in_store_form.store_id=t_store.id
- <where>
- <if test="userId!=null">
- and user_id=#{userId}
- </if>
- <if test="searchStartTime != null">
- and t_in_store_detail.created_time <![CDATA[ > ]]> #{searchStartTime}
- </if>
- <if test="searchEndTime != null">
- and t_in_store_detail.created_time <![CDATA[ < ]]> #{searchEndTime}
- </if>
- <if test="status != null">
- and status = #{status}
- </if>
- </where>
- </select>
- </mapper>
|