193 lines
8.8 KiB
XML
193 lines
8.8 KiB
XML
<?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.xdadan.erp.emis.mapper.EmisBaseMapper">
|
|
|
|
<resultMap type="BaseEntity" id="EmisBaseResult">
|
|
|
|
<result property="remark" column="remark" />
|
|
<result property="tenantId" column="tenant_id" />
|
|
<result property="delFlag" column="del_flag" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="createSite" column="create_site" />
|
|
<result property="updateSite" column="update_site" />
|
|
|
|
<association property="createByName" column="create_by" select="selectEmpNameByUserId" fetchType="lazy"/>
|
|
<association property="updateByName" column="update_by" select="selectEmpNameByUserId" fetchType="lazy"/>
|
|
<association property="createSiteName" column="create_site" select="selectSiteNameByCode" fetchType="lazy"/>
|
|
<association property="updateSiteName" column="update_site" select="selectSiteNameByCode" fetchType="lazy"/>
|
|
|
|
</resultMap>
|
|
|
|
<!-- 查询区域名称 -->
|
|
<select id="selectAreaNameById" parameterType="Long" resultType="string">
|
|
select a.name from emis_country_area a where a.id = #{id} limit 1
|
|
</select>
|
|
|
|
<!-- 查询国家名称 -->
|
|
<select id="selectCountryNameByCode" parameterType="String" resultType="string">
|
|
select a.name from emis_country a where a.code = #{code} limit 1
|
|
</select>
|
|
|
|
<!-- 查询国家名称(多个) -->
|
|
<select id="selectGroupCountryNameByCode" parameterType="String" resultType="string">
|
|
select GROUP_CONCAT(name) from emis_country where FIND_IN_SET(`code`,#{code})
|
|
</select>
|
|
|
|
<!-- 查询区域名称 -->
|
|
<select id="selectRegionNameByCode" parameterType="String" resultType="string">
|
|
select a.region_name from emis_region a where a.region_code = #{code} limit 1
|
|
</select>
|
|
|
|
<!-- 查询站点名称 -->
|
|
<select id="selectSiteNameByCode" parameterType="String" resultType="string">
|
|
select a.site_name from emis_site a where a.site_code = #{code} limit 1
|
|
</select>
|
|
|
|
<!-- 查询多个站点名称 -->
|
|
<select id="selectGroupSiteNameByCode" parameterType="String" resultType="string">
|
|
select group_concat(a.site_name) as site_name from emis_site a where a.del_flag='0' and FIND_IN_SET(a.site_code, #{code}) limit 1
|
|
</select>
|
|
|
|
|
|
<!-- 查询国家区域名称 -->
|
|
<select id="selectCountryAreaNameById" parameterType="long" resultType="string">
|
|
select a.name from emis_country_area a where a.id = #{id} limit 1
|
|
</select>
|
|
|
|
<!-- 查询线路名称 -->
|
|
<select id="selectLineNameByCode" parameterType="String" resultType="string">
|
|
select a.line_name from emis_trans_line a where a.line_code = #{code} limit 1
|
|
</select>
|
|
|
|
<select id="selectMutiLineNameByCode" parameterType="String" resultType="string">
|
|
select group_concat(a.line_name) from emis_trans_line a where FIND_IN_SET(a.line_code, #{code}) limit 1
|
|
</select>
|
|
|
|
<!-- 查询多个产品名称 -->
|
|
<select id="selectProdNameByCode" parameterType="String" resultType="string">
|
|
select group_concat(a.prod_name) from emis_trans_product a where FIND_IN_SET(a.prod_code, #{code}) limit 1
|
|
</select>
|
|
|
|
<!-- 根据产品查线路名称 -->
|
|
<select id="selectLineNameByProdCode" parameterType="String" resultType="string">
|
|
select a.line_name from emis_trans_line a,emis_trans_product b where a.line_code=b.trans_line_code and b.prod_code = #{code} limit 1
|
|
</select>
|
|
|
|
<!-- 根据产品查线路编号 -->
|
|
<select id="selectLineProdByProdCode" parameterType="string" resultType="string">
|
|
select trans_line_code from emis_trans_product a where del_flag='0' and prod_code=#{code} limit 1
|
|
</select>
|
|
|
|
<!-- 根据线路获取出发国家名称-->
|
|
<select id="selectFromCountryNameByLineCode" parameterType="String" resultType="string">
|
|
select a.name from emis_country a,emis_trans_line b where a.del_flag='0' and b.del_flag='0' and a.code=b.from_country and b.line_code = #{code} limit 1
|
|
</select>
|
|
|
|
<!-- 根据线路获取目的国家名称 -->
|
|
<select id="selectDestCountryNameByLineCode" parameterType="String" resultType="string">
|
|
select a.name from emis_country a,emis_trans_line b where a.del_flag='0' and b.del_flag='0' and a.code=b.country and b.line_code = #{code} limit 1
|
|
</select>
|
|
|
|
<!--目的地名称-->
|
|
<select id="selectDestNameByCode" parameterType="String" resultType="string">
|
|
select a.dest_name from emis_destination a where a.dest_code = #{code} and a.del_flag='0' limit 1
|
|
</select>
|
|
|
|
<!-- 查询客户名称(code) -->
|
|
<select id="selectCustomerNameByCode" parameterType="String" resultType="string">
|
|
select a.customer_name from emis_customer_user a where a.customer_code = #{code} limit 1
|
|
</select>
|
|
|
|
<!-- 查询月结客户名称(月结编码) -->
|
|
<select id="selectCustNameByCustNo" parameterType="String" resultType="string">
|
|
select a.customer_name from emis_customer_user a where a.monthly_pay_code = #{code} limit 1
|
|
</select>
|
|
|
|
<!-- 查询员工(emp_code) -->
|
|
<select id="selectEmpNameByCode" parameterType="String" resultType="string">
|
|
select a.emp_name from sys_user a where a.emp_code = #{code} limit 1
|
|
</select>
|
|
|
|
<!-- 查询员工部门(dept_name) -->
|
|
<select id="selectDeptNameByEmpCode" parameterType="String" resultType="string">
|
|
select b.dept_name from sys_user a,sys_dept b where a.dept_id=b.dept_id and a.emp_code = #{code} limit 1
|
|
</select>
|
|
|
|
<!-- 查询员工(user_id) -->
|
|
<select id="selectEmpNameByUserId" parameterType="String" resultType="string">
|
|
select a.emp_name from sys_user a where a.user_id = #{id} limit 1
|
|
</select>
|
|
|
|
<!-- 查询品牌名称-->
|
|
<select id="selectBrandNameByCode" parameterType="String" resultType="string">
|
|
select a.name from emis_brand a where a.code = #{code} limit 1
|
|
</select>
|
|
|
|
<!-- 查询问题件类型原型 -->
|
|
<select id="selectProblemTypeNameById" parameterType="int" resultType="string">
|
|
select a.type_name from emis_problem_type a where a.id = #{id} limit 1
|
|
</select>
|
|
|
|
<!-- 查询费用结算类型 -->
|
|
<select id="selectSettleTypeNameByCode" parameterType="string" resultType="string">
|
|
select a.settle_name from emis_settle_type a where a.settle_type = #{settleType} limit 1
|
|
</select>
|
|
|
|
<!-- 查询运单调整类型 -->
|
|
<select id="selectAjustTypeNameByCode" parameterType="string" resultType="string">
|
|
select group_concat(a.type_name) as type_name from emis_waybill_ajust_type a where a.del_flag='0' and FIND_IN_SET(a.type_code, #{typeCode}) limit 1
|
|
</select>
|
|
|
|
|
|
<select id="selectBillMonthByApplySeqNo" parameterType="string" resultType="string">
|
|
SELECT group_concat( CONCAT(x2.settle_bill_name,'(账单月:',x2.bill_month,')') ) AS billMonth
|
|
FROM emis_settle_invoice_record x1,emis_settle_bill x2
|
|
WHERE x1.del_flag = '0'
|
|
AND x2.del_flag = '0'
|
|
AND FIND_IN_SET( x2.settle_bill_no, x1.settle_bill_no )
|
|
and x1.apply_seq_no=#{applySeqNo}
|
|
</select>
|
|
|
|
<select id="selectBillCodeByApplySeqNo" parameterType="string" resultType="string">
|
|
SELECT group_concat( x2.bill_no) AS billCode
|
|
FROM emis_settle_invoice_record x1,emis_settle_sub_bill x2
|
|
WHERE x1.del_flag = '0'
|
|
AND x2.del_flag = '0'
|
|
AND FIND_IN_SET( x2.settle_bill_no, x1.settle_bill_no )
|
|
and x1.apply_seq_no=#{applySeqNo}
|
|
</select>
|
|
|
|
<select id="selectSalesmenByApplySeqNo" parameterType="string" resultType="string">
|
|
SELECT group_concat(DISTINCT x2.salesmen) AS salesmen
|
|
FROM emis_settle_invoice_record x1,emis_settle_bill x2
|
|
WHERE x1.del_flag = '0'
|
|
AND x2.del_flag = '0'
|
|
AND FIND_IN_SET( x2.settle_bill_no, x1.settle_bill_no )
|
|
and x1.apply_seq_no=#{applySeqNo}
|
|
</select>
|
|
|
|
|
|
<select id="selectApplyManNameByApplySeqNo" parameterType="string" resultType="string">
|
|
SELECT x2.emp_name AS ApplyManName
|
|
FROM emis_settle_invoice_record x1,sys_user x2
|
|
WHERE x1.del_flag = '0'
|
|
AND x2.del_flag = '0'
|
|
AND x1.create_by=x2.user_id
|
|
and x1.apply_seq_no=#{applySeqNo}
|
|
</select>
|
|
|
|
<select id="selectApplyRemarkByApplySeqNo" parameterType="string" resultType="string">
|
|
SELECT x1.remark AS applyRemark
|
|
FROM emis_settle_invoice_record x1
|
|
WHERE x1.del_flag = '0'
|
|
and x1.apply_seq_no=#{applySeqNo}
|
|
</select>
|
|
|
|
|
|
|
|
</mapper> |