You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
115 lines
5.0 KiB
115 lines
5.0 KiB
<?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.xujie.sys.modules.pms.mapper.PartSparePurchaseImportMapper">
|
|
|
|
<sql id="queryWhereClause">
|
|
<where>
|
|
a.is_deleted = '0'
|
|
and a.site in (select site from eam_access_site where username = #{query.username})
|
|
and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.username}))
|
|
<if test="query.site != null and query.site != ''">
|
|
and a.site = #{query.site}
|
|
</if>
|
|
<if test="query.buNo != null and query.buNo != ''">
|
|
and a.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test="query.supplierName != null and query.supplierName != ''">
|
|
and a.supplier_name like '%' + #{query.supplierName} + '%'
|
|
</if>
|
|
<if test="query.currencyType != null and query.currencyType != ''">
|
|
and a.currency_type = #{query.currencyType}
|
|
</if>
|
|
<if test="query.orderNo != null and query.orderNo != ''">
|
|
and a.order_no like '%' + #{query.orderNo} + '%'
|
|
</if>
|
|
<if test="query.itemCode != null and query.itemCode != ''">
|
|
and a.item_code like '%' + #{query.itemCode} + '%'
|
|
</if>
|
|
<if test="query.itemName != null and query.itemName != ''">
|
|
and a.item_name like '%' + #{query.itemName} + '%'
|
|
</if>
|
|
<if test="query.projectBu != null and query.projectBu != ''">
|
|
and a.project_bu like '%' + #{query.projectBu} + '%'
|
|
</if>
|
|
<if test="query.requestNo != null and query.requestNo != ''">
|
|
and a.request_no like '%' + #{query.requestNo} + '%'
|
|
</if>
|
|
<if test="query.requestBy != null and query.requestBy != ''">
|
|
and a.request_by like '%' + #{query.requestBy} + '%'
|
|
</if>
|
|
<if test="query.importBy != null and query.importBy != ''">
|
|
and a.import_by like '%' + #{query.importBy} + '%'
|
|
</if>
|
|
<if test="query.sourceFileName != null and query.sourceFileName != ''">
|
|
and a.source_file_name like '%' + #{query.sourceFileName} + '%'
|
|
</if>
|
|
<if test="query.orderDateStart != null">
|
|
and a.order_date >= #{query.orderDateStart}
|
|
</if>
|
|
<if test="query.orderDateEnd != null">
|
|
and a.order_date <= #{query.orderDateEnd}
|
|
</if>
|
|
<if test="query.importDateStart != null">
|
|
and a.import_date >= #{query.importDateStart}
|
|
</if>
|
|
<if test="query.importDateEnd != null">
|
|
and a.import_date <= #{query.importDateEnd}
|
|
</if>
|
|
<if test="query.qtyStart != null">
|
|
and a.qty >= #{query.qtyStart}
|
|
</if>
|
|
<if test="query.qtyEnd != null">
|
|
and a.qty <= #{query.qtyEnd}
|
|
</if>
|
|
<if test="query.localTotalAmountStart != null">
|
|
and a.local_total_amount >= #{query.localTotalAmountStart}
|
|
</if>
|
|
<if test="query.localTotalAmountEnd != null">
|
|
and a.local_total_amount <= #{query.localTotalAmountEnd}
|
|
</if>
|
|
</where>
|
|
</sql>
|
|
|
|
<select id="queryPage" resultType="com.xujie.sys.modules.pms.entity.PartSparePurchaseImportEntity">
|
|
select
|
|
a.id,
|
|
a.site,
|
|
a.bu_no as buNo,
|
|
a.order_date as orderDate,
|
|
a.supplier_name as supplierName,
|
|
a.currency_type as currencyType,
|
|
a.order_no as orderNo,
|
|
a.item_code as itemCode,
|
|
a.item_name as itemName,
|
|
a.qty,
|
|
a.local_unit_price as localUnitPrice,
|
|
a.local_amount as localAmount,
|
|
a.local_tax_amount as localTaxAmount,
|
|
a.local_total_amount as localTotalAmount,
|
|
a.unit_name as unitName,
|
|
a.project_bu as projectBu,
|
|
a.request_no as requestNo,
|
|
a.request_by as requestBy,
|
|
a.import_date as importDate,
|
|
a.import_by as importBy,
|
|
a.source_file_name as sourceFileName,
|
|
a.remark,
|
|
a.created_by as createdBy,
|
|
a.created_date as createdDate,
|
|
a.updated_by as updatedBy,
|
|
a.updated_date as updatedDate,
|
|
a.is_deleted as isDeleted
|
|
from part_spare_purchase_import a
|
|
<include refid="queryWhereClause"/>
|
|
order by a.import_date desc, a.id desc
|
|
</select>
|
|
|
|
<select id="querySummary" resultType="java.util.HashMap">
|
|
select
|
|
ISNULL(sum(a.qty), 0) as totalQty,
|
|
ISNULL(sum(a.local_total_amount), 0) as totalLocalTotalAmount
|
|
from part_spare_purchase_import a
|
|
<include refid="queryWhereClause"/>
|
|
</select>
|
|
|
|
</mapper>
|