You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

322 lines
12 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="org.dromara.oa.crm.mapper.CrmSupplierInfoMapper">
<resultMap type="org.dromara.oa.crm.domain.vo.CrmSupplierInfoVo" id="CrmSupplierInfoResult">
</resultMap>
<select id="selectCustomCrmSupplierInfoVoList" resultMap="CrmSupplierInfoResult">
select t.supplier_id, t.tenant_id, t.supplier_name, t.mnemonic_name, t.supplier_type,
t.registered_capital, t.establishment_date, t.business_scope, t.main_industry,
t.legal_representative, t.business_license_number, t.tax_number, t.bank_account_opening,
t.bank_number, t.registered_address, t.business_address, t.contact_person, t.contact_phone, t.contact_mobile,
t.contact_email, t.contact_fax, t.website, t.owner_id, t.detailed_address, t.oss_id, t.remark, t.active_flag, t.del_flag, t.create_dept,
u1.nick_name as ownerName,
u2.nick_name as createName,
t.create_by, t.create_time, t.update_by, t.update_time
from crm_supplier_info t
left join sys_user u1 on u1.user_id = t.owner_id
left join sys_user u2 on u2.user_id = t.create_by
${ew.getCustomSqlSegment}
</select>
<!-- 根据ID查询详情 -->
<select id="selectCustomCrmSupplierInfoVoById" resultMap="CrmSupplierInfoResult">
select t.supplier_id, t.tenant_id, t.supplier_name, t.mnemonic_name, t.supplier_type, t.registered_capital, t.establishment_date, t.business_scope, t.main_industry, t.legal_representative, t.business_license_number, t.tax_number, t.bank_account_opening, t.bank_number, t.registered_address, t.business_address, t.contact_person, t.contact_phone, t.contact_mobile, t.contact_email, t.contact_fax, t.website, t.owner_id, t.detailed_address, t.oss_id, t.remark, t.active_flag, t.del_flag, t.create_dept, t.create_by, t.create_time, t.update_by, t.update_time
from crm_supplier_info t
where t.supplier_id = #{supplierId}
</select>
<!-- 批量查询 - 根据ID列表 -->
<select id="selectCustomCrmSupplierInfoVoByIds" resultMap="CrmSupplierInfoResult">
select t.supplier_id, t.tenant_id, t.supplier_name, t.mnemonic_name, t.supplier_type, t.registered_capital, t.establishment_date, t.business_scope, t.main_industry, t.legal_representative, t.business_license_number, t.tax_number, t.bank_account_opening, t.bank_number, t.registered_address, t.business_address, t.contact_person, t.contact_phone, t.contact_mobile, t.contact_email, t.contact_fax, t.website, t.owner_id, t.detailed_address, t.oss_id, t.remark, t.active_flag, t.del_flag, t.create_dept, t.create_by, t.create_time, t.update_by, t.update_time
from crm_supplier_info t
where t.supplier_id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<!-- 统计查询 -->
<select id="countCustomCrmSupplierInfo" resultType="java.lang.Long">
select count(1) from crm_supplier_info t
${ew.getCustomSqlSegment}
</select>
<!-- 分页查询(带自定义条件) -->
<select id="selectCustomCrmSupplierInfoVoPage" resultMap="CrmSupplierInfoResult">
select t.supplier_id, t.tenant_id, t.supplier_name, t.mnemonic_name, t.supplier_type, t.registered_capital, t.establishment_date, t.business_scope, t.main_industry, t.legal_representative, t.business_license_number, t.tax_number, t.bank_account_opening, t.bank_number, t.registered_address, t.business_address, t.contact_person, t.contact_phone, t.contact_mobile, t.contact_email, t.contact_fax, t.website, t.owner_id, t.detailed_address, t.oss_id, t.remark, t.active_flag, t.del_flag, t.create_dept, t.create_by, t.create_time, t.update_by, t.update_time
from crm_supplier_info t
${ew.getCustomSqlSegment}
</select>
<!-- 批量插入 -->
<insert id="batchInsertCrmSupplierInfo">
insert into crm_supplier_info(
tenant_id,
supplier_name,
mnemonic_name,
supplier_type,
registered_capital,
establishment_date,
business_scope,
main_industry,
legal_representative,
business_license_number,
tax_number,
bank_account_opening,
bank_number,
registered_address,
business_address,
contact_person,
contact_phone,
contact_mobile,
contact_email,
contact_fax,
website,
owner_id,
detailed_address,
oss_id,
remark,
active_flag,
del_flag,
create_dept,
create_by,
create_time,
update_by,
update_time
)
values
<foreach collection="list" item="item" separator=",">
(
#{item.tenantId},
#{item.supplierName},
#{item.mnemonicName},
#{item.supplierType},
#{item.registeredCapital},
#{item.establishmentDate},
#{item.businessScope},
#{item.mainIndustry},
#{item.legalRepresentative},
#{item.businessLicenseNumber},
#{item.taxNumber},
#{item.bankAccountOpening},
#{item.bankNumber},
#{item.registeredAddress},
#{item.businessAddress},
#{item.contactPerson},
#{item.contactPhone},
#{item.contactMobile},
#{item.contactEmail},
#{item.contactFax},
#{item.website},
#{item.ownerId},
#{item.detailedAddress},
#{item.ossId},
#{item.remark},
#{item.activeFlag},
#{item.delFlag},
#{item.createDept},
#{item.createBy},
#{item.createTime},
#{item.updateBy},
#{item.updateTime}
)
</foreach>
</insert>
<!-- 批量更新 -->
<update id="batchUpdateCrmSupplierInfo">
<foreach collection="list" item="item" separator=";">
update crm_supplier_info
<set>
<if test="item.tenantId != null and item.tenantId != ''">
tenant_id = #{item.tenantId},
</if>
<if test="item.supplierName != null and item.supplierName != ''">
supplier_name = #{item.supplierName},
</if>
<if test="item.mnemonicName != null and item.mnemonicName != ''">
mnemonic_name = #{item.mnemonicName},
</if>
<if test="item.supplierType != null and item.supplierType != ''">
supplier_type = #{item.supplierType},
</if>
<if test="item.registeredCapital != null">
registered_capital = #{item.registeredCapital},
</if>
<if test="item.establishmentDate != null">
establishment_date = #{item.establishmentDate},
</if>
<if test="item.businessScope != null and item.businessScope != ''">
business_scope = #{item.businessScope},
</if>
<if test="item.mainIndustry != null and item.mainIndustry != ''">
main_industry = #{item.mainIndustry},
</if>
<if test="item.legalRepresentative != null and item.legalRepresentative != ''">
legal_representative = #{item.legalRepresentative},
</if>
<if test="item.businessLicenseNumber != null and item.businessLicenseNumber != ''">
business_license_number = #{item.businessLicenseNumber},
</if>
<if test="item.taxNumber != null and item.taxNumber != ''">
tax_number = #{item.taxNumber},
</if>
<if test="item.bankAccountOpening != null and item.bankAccountOpening != ''">
bank_account_opening = #{item.bankAccountOpening},
</if>
<if test="item.bankNumber != null and item.bankNumber != ''">
bank_number = #{item.bankNumber},
</if>
<if test="item.registeredAddress != null and item.registeredAddress != ''">
registered_address = #{item.registeredAddress},
</if>
<if test="item.businessAddress != null and item.businessAddress != ''">
business_address = #{item.businessAddress},
</if>
<if test="item.contactPerson != null and item.contactPerson != ''">
contact_person = #{item.contactPerson},
</if>
<if test="item.contactPhone != null and item.contactPhone != ''">
contact_phone = #{item.contactPhone},
</if>
<if test="item.contactMobile != null and item.contactMobile != ''">
contact_mobile = #{item.contactMobile},
</if>
<if test="item.contactEmail != null and item.contactEmail != ''">
contact_email = #{item.contactEmail},
</if>
<if test="item.contactFax != null and item.contactFax != ''">
contact_fax = #{item.contactFax},
</if>
<if test="item.website != null and item.website != ''">
website = #{item.website},
</if>
<if test="item.ownerId != null">
owner_id = #{item.ownerId},
</if>
<if test="item.detailedAddress != null and item.detailedAddress != ''">
detailed_address = #{item.detailedAddress},
</if>
<if test="item.ossId != null and item.ossId != ''">
oss_id = #{item.ossId},
</if>
<if test="item.remark != null and item.remark != ''">
remark = #{item.remark},
</if>
<if test="item.activeFlag != null and item.activeFlag != ''">
active_flag = #{item.activeFlag},
</if>
<if test="item.delFlag != null and item.delFlag != ''">
del_flag = #{item.delFlag},
</if>
<if test="item.createDept != null">
create_dept = #{item.createDept},
</if>
<if test="item.createBy != null">
create_by = #{item.createBy},
</if>
<if test="item.createTime != null">
create_time = #{item.createTime},
</if>
<if test="item.updateBy != null">
update_by = #{item.updateBy},
</if>
<if test="item.updateTime != null">
update_time = #{item.updateTime}
</if>
</set>
where supplier_id = #{item.supplierId}
</foreach>
</update>
<!-- 根据自定义条件删除 -->
<delete id="deleteCustomCrmSupplierInfo">
delete from crm_supplier_info
${ew.getCustomSqlSegment}
</delete>
<!-- 根据ID列表批量删除 -->
<delete id="deleteCustomCrmSupplierInfoByIds">
delete from crm_supplier_info
where supplier_id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!-- 检查是否存在 -->
<select id="existsCrmSupplierInfo" resultType="java.lang.Boolean">
select count(1) > 0 from crm_supplier_info t
${ew.getCustomSqlSegment}
</select>
</mapper>