JNBusinessTest/ruoyi-system/target/classes/mapper/hainanOrder/HaiNanOrderMapper.xml

202 lines
5.9 KiB
XML
Raw Normal View History

2024-08-05 17:16:54 +08:00
<?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.ruoyi.hainanOrder.mapper.HaiNanOrderMapper">
<sql id="customerOrderColumns">
a.id AS "id",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.remarks AS "remarks",
a.del_flag AS "delFlag",
a.delivery_date AS "deliveryDate",
a.receiving_address AS "receivingAddress",
a.order_type AS "orderType",
a.total_price AS "totalPrice",
a.state AS "state",
a.customer_name AS "customerName",
a.contract_number AS "contractNumber",
a.zvbeln as "zvbeln",
a.kunnr as "kunnr",
a.kna1 as "kna1",
a.auart as "auart",
a.bezei as "bezei",
a.vkorg as "vkorg",
a.vkorgt as "vkorgt",
a.vtweg as "vtweg",
a.vtwegt as "vtwegt",
a.spart as "spart",
a.spartt as "spartt",
a.vdatu as "vdatu",
a.prsdt as "prsdt",
a.bstkd as "bstkd",
a.bstdk as "bstdk",
a.kunnr1 as "kunnr1",
a.kunnrgwds as "kunnrgwds",
a.zsdshdz as "zsdshdz",
a.zsdjdbz as "zsdjdbz",
a.zsdycjz as "zsdycjz",
a.kh_order_0 as "khOrder",
a.xm_name_0 as "xmName",
a.xm_id_0 as "xmId",
a.zsdsfdz as "zsdsfdz",
<!-- tuser.name AS "tuser.name",
tuser.salesapid AS "tuser.salesapid", -->
a.pzh as "pzh",
a.zsdywlxmb as "zsdywlxmb",
tuser2.name as "tjrname",
totalPrice2 as "totalPrice2",
totalPrice3 as "totalPrice3",
totalPrice4 as "totalPrice4",
a.ywydd as "ywydd",
a.ywytjsj as "ywytjsj",
a.orderid as "orderid",
a.randomOrderid as "randomOrderid",
a.sfdz as "sfdz",
s.sapname as "sapname",
<!--s1.sapname as "sapnametp",-->
sb.sapname as "sapnamegwds",
shr as "shr",
shrscb as "shrscb",
shrgdz as "shrgdz",
shrdcz as "shrdcz",
shrbjyx as "shrbjyx",
a.isprint as "isprint",
a.isypkdd as "isypkdd",
a.erpId as "erpId",
a.returnreason as "returnreason",
a.hasHt as "hasHt",
a.istp as "istp",
<!-- customer.name AS "customer.name",
customer.id AS "customer.id",
contract.name AS "contract.name",
contract.number AS "contract.number" -->
a.isMobileCreate as "isMobileCreate",
a.isCreateByHt as "isCreateByHt",
s.pianqu as "pianqu" ,
a.xsdq AS "xsdq",
a.province AS "province",
a.city AS "city",
a.village AS "village",
a.lxr AS "lxr",
a.lxrdh AS "lxrdh",
a.sfdcj AS "sfdcj",
a.sfxsywy AS "sfxsywy"
</sql>
<sql id="customerOrderJoins">
<!-- LEFT JOIN customer ON customer.id = a.customer_id
LEFT JOIN contract ON contract.number = a.contract_number -->
<!-- LEFT JOIN sys_user tuser ON tuser.salesapid = a.kunnr1
-->
LEFT JOIN sapuser s on s.sapid=a.kunnr1
<!--LEFT JOIN sapusertp s1 on s1.sapid=a.kunnr1 -->
LEFT JOIN sapuser sb on sb.sapid=a.kunnrgwds
LEFT JOIN sys_user tuser2 ON tuser2.user_name =a.create_by
</sql>
<sql id="customerOrderTpJoins">
<!-- LEFT JOIN customer ON customer.id = a.customer_id
LEFT JOIN contract ON contract.number = a.contract_number -->
<!-- LEFT JOIN sys_user tuser ON tuser.salesapid = a.kunnr1
-->
LEFT JOIN sapusertp s on s.sapid=a.kunnr1
LEFT JOIN sapusertp sb on sb.sapid=a.kunnrgwds
LEFT JOIN sys_user tuser2 ON tuser2.id =a.create_by
</sql>
<select id="orderList" resultType="HaiNanOrder" >
SELECT
<include refid="customerOrderColumns"/>
FROM customer_order a
<include refid="customerOrderJoins"/>
<where>
<!-- <if test="istp != null and istp != ''">-->
<!-- AND a.istp = '${istp}'-->
<!-- </if>-->
<if test="state != null and state != ''">
AND state='${state}'
</if>
<if test="orderid != null and orderid != ''">
AND a.orderid='${orderid}'
</if>
<if test="zsdshdz != null and zsdshdz != ''">
AND a.zsdshdz like '%${zsdshdz}%'
</if>
<!-- <if test="pianqu != null and pianqu != ''">
<if test="pianqu == '113' or pianqu == '112'">
AND (s.pianqu='113' or s1.pianqu='113' or s.pianqu='112' or s1.pianqu='112')
</if>
<if test="pianqu != '113' and pianqu != '112'">
AND (s.pianqu='${pianqu}' or s1.pianqu='${pianqu}')
</if>
</if> -->
<if test="pzh != null and pzh != ''">
AND a.pzh='${pzh}'
</if>
<if test="beginDate != null and beginDate!='' and endDate != null and endDate!=''">
AND a.create_date BETWEEN '${beginDate}' AND '${endDate}'
</if>
</where>
ORDER BY a.update_date DESC
</select>
<select id="customList" resultType="HNCustomer">
SELECT kunnr,name1 + isnull(name2,'') AS name1
from sdcus
<where>
kunnr not like '41%'
<if test="kunnr != null and kunnr != ''">
AND kunnr like '%${kunnr}%'
</if>
<if test="name1 != null and name1 != ''">
AND name1 like '%${name1}%'
</if>
</where>
GROUP BY kunnr,name1,name2
</select>
<select id="materialList" resultType="HNMaterial">
select wl.id,wl.matnr,wl.maktx,wl.meins kmein,wl.vtext,a.原型号 as yxh,case when A.当前厂价=0 then null else A.当前厂价 end as kbetr,wl.dwjz,wl.mrbs fdyq from material wl left join
Redbook.RedBook.dbo.sdmdm1 A
on A.matnr='0000000000'+wl.matnr
<where>
and wl.matnr like '3%' and wl.sfyx='0' and (wl.mstav is null or wl.mstav='')
<if test="matnr !=null and matnr!= ''" >
and wl.matnr like '%${matnr}%'
</if>
<if test="maktx !=null and maktx!= ''" >
and (wl.maktx like '%${maktx}%' or wl.yxh like '%${maktx}%')
</if>
<if test="maktx3 !=null and maktx3!= ''" >
and wl.maktx like '${maktx3}%'
</if>
<if test="maktx4 !=null and maktx4!= ''" >
and wl.maktx like '%${maktx4}%'
</if>
<if test="maktx5 !=null and maktx5!= ''" >
and wl.maktx like '%${maktx5}%'
</if>
<if test="diany !=null and diany!= ''" >
and wl.diany like '%${diany}%'
</if>
and wl.maktx not like '%删%'
</where>
</select>
</mapper>