@ -3,48 +3,60 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace= "com.ruoyi.system.mapper.SysSupplierMapper" >
<resultMap type= "SysSupplier" id= "SysSupplierResult" >
<result property= "supplierId" column= "supplier_id" />
<result property= "useStatus" column= "use_status" />
<result property= "auditStatus" column= "audit_status" />
<result property= "supplierQualification" column= "supplier_qualification" />
<result property= "purchaseBuyer" column= "purchase_buyer" />
<result property= "supplierType" column= "supplier_type" />
<result property= "supplierCode" column= "supplier_code" />
<result property= "supplierName" column= "supplier_name" />
<result property= "exportSales" column= "export_sales" />
<result property= "enterpriseName" column= "enterprise_name" />
<result property= "enterpriseNature" column= "enterprise_nature" />
<result property= "customerAddress" column= "customer_address" />
<result property= "manufacturerCategory" column= "manufacturer_category" />
<result property= "postalCode" column= "postal_code" />
<result property= "businessScope" column= "business_scope" />
<result property= "customerCountry" column= "customer_country" />
<result property= "establishedTime" column= "established_time" />
<result property= "legalRepresentative" column= "legal_representative" />
<result property= "customerContact" column= "customer_contact" />
<result property= "contactNumber" column= "contact_number" />
<result property= "customerFax" column= "customer_fax" />
<result property= "customerEmail" column= "customer_email" />
<result property= "website" column= "website" />
<result property= "paymentTerms" column= "payment_terms" />
<result property= "supplierDays" column= "supplier_days" />
<result property= "actualPaymentDays" column= "actual_payment_days" />
<result property= "settlementBank" column= "settlement_bank" />
<result property= "exchangeSettlementAccount" column= "exchange_settlement_account" />
<result property= "depositBank" column= "deposit_bank" />
<result property= "bankAccount" column= "bank_account" />
<result property= "rmbRegisteredCapital" column= "rmb_registered_capital" />
<result property= "industryCode" column= "Industry_code" />
<result property= "merchandiser" column= "merchandiser" />
<result property= "merchandiserTelephone" column= "merchandiser_telephone" />
<result property= "financialContact" column= "financial_contact" />
<result property= "confirmTax" column= "confirm_tax" />
<result property= "taxRate" column= "tax_rate" />
<result property= "firstAddTime" column= "first_add_time" />
<result property= "updateInfoTime" column= "update_info_time" />
<result property= "photoAttachId" column= "photo_attach_id" />
<result property= "photoUrl" column= "photo_url" />
<resultMap type= "SysSupplierVo" id= "SysSupplierResult" >
<result property= "supplierId" column= "supplier_id" />
<result property= "useStatus" column= "use_status" />
<result property= "auditStatus" column= "audit_status" />
<result property= "supplierQualification" column= "supplier_qualification" />
<result property= "purchaseBuyer" column= "purchase_buyer" />
<result property= "supplierType" column= "supplier_type" />
<result property= "supplierCode" column= "supplier_code" />
<result property= "supplierName" column= "supplier_name" />
<result property= "exportSales" column= "export_sales" />
<result property= "enterpriseName" column= "enterprise_name" />
<result property= "enterpriseNature" column= "enterprise_nature" />
<result property= "customerAddress" column= "customer_address" />
<result property= "manufacturerCategory" column= "manufacturer_category" />
<result property= "postalCode" column= "postal_code" />
<result property= "businessScope" column= "business_scope" />
<result property= "customerCountry" column= "customer_country" />
<result property= "establishedTime" column= "established_time" />
<result property= "legalRepresentative" column= "legal_representative" />
<result property= "customerContact" column= "customer_contact" />
<result property= "contactNumber" column= "contact_number" />
<result property= "customerFax" column= "customer_fax" />
<result property= "customerEmail" column= "customer_email" />
<result property= "website" column= "website" />
<result property= "paymentTerms" column= "payment_terms" />
<result property= "supplierDays" column= "supplier_days" />
<result property= "actualPaymentDays" column= "actual_payment_days" />
<result property= "settlementBank" column= "settlement_bank" />
<result property= "exchangeSettlementAccount" column= "exchange_settlement_account" />
<result property= "depositBank" column= "deposit_bank" />
<result property= "bankAccount" column= "bank_account" />
<result property= "rmbRegisteredCapital" column= "rmb_registered_capital" />
<result property= "industryCode" column= "Industry_code" />
<result property= "merchandiser" column= "merchandiser" />
<result property= "merchandiserTelephone" column= "merchandiser_telephone" />
<result property= "financialContact" column= "financial_contact" />
<result property= "confirmTax" column= "confirm_tax" />
<result property= "taxRate" column= "tax_rate" />
<result property= "photoAttachId" column= "photo_attach_id" />
<result property= "photoUrl" column= "photo_url" />
<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= "remark" column= "remark" />
<result property= "instanceType" column= "instance_type" />
<result property= "instanceId" column= "instance_id" />
<result property= "restoreInstanceId" column= "restore_instance_id" />
<result property= "cancelInstanceId" column= "cancel_instance_id" />
<result property= "submitInstanceId" column= "submit_instance_id" />
<result property= "applyTitle" column= "apply_title" />
<result property= "applyUser" column= "apply_user" />
<result property= "applyTime" column= "apply_time" />
<result property= "delFlag" column= "del_flag" />
</resultMap>
<sql id= "selectSysSupplierVo" >
@ -56,7 +68,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
customer_email, website, payment_terms, supplier_days, actual_payment_days,
settlement_bank, exchange_settlement_account, deposit_bank, bank_account,
rmb_registered_capital, Industry_code, merchandiser, merchandiser_telephone,
financial_contact, confirm_tax, tax_rate, first_add_time, update_info_time
financial_contact, confirm_tax, tax_rate, photo_attach_id, photo_url, create_by,
create_time, update_by, update_time, remark,
instance_type, instance_id, restore_instance_id, cancel_instance_id, submit_instance_id,
apply_title, apply_user, apply_time,del_flag
from sys_supplier
</sql>
@ -69,34 +84,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sup.customer_email, sup.website, sup.payment_terms, sup.supplier_days, sup.actual_payment_days,
sup.settlement_bank, sup.exchange_settlement_account, sup.deposit_bank, sup.bank_account,
sup.rmb_registered_capital, sup.Industry_code, sup.merchandiser, sup.merchandiser_telephone,
sup.financial_contact, sup.confirm_tax, sup.tax_rate, sup.first_add_time, sup.update_info_time
sup.financial_contact, sup.confirm_tax, sup.tax_rate, sup.first_add_time, sup.update_info_time,
sup.photo_attach_id, sup.create_by, sup.create_time, sup.update_by, sup.update_time, sup.remark,sup.del_flag,
sup.instance_type, sup.instance_id, sup.restore_instance_id, sup.cancel_instance_id, sup.submit_instance_id,
sup.apply_title, sup.apply_user, sup.apply_time,p.dict_value as instance_type_name,file.url as photo_url
from sys_supplier as sup
left join(
select dict_value,dict_label from sys_dict_data
where dict_type = 'processType'
) as p on sup.instance_type = p.dict_value
left join (
select
att.rel_id
,file.url
,min(file.create_time) as create_time
from sys_attach as att
left join sys_attach_file as file
on att.id = file.attach_id
where att.source_type = 'supplier' and att.source_sub_type = 'photo'
group by att.rel_id
)file
on sup.supplier_id = file.rel_id
<where >
select att.rel_id,file.url,min(file.create_time) as create_time
from sys_attach as att left join sys_attach_file as file on att.id = file.attach_id
where att.source_type = 'supplier' and att.source_sub_type = 'photo'
group by att.rel_id
) as file on sup.supplier_id = file.rel_id
<where >
<if test= "supplierCode != null and supplierCode != ''" > and sup.supplier_code like concat('%', #{supplierCode}, '%')</if>
<if test= "supplierName != null and supplierName != ''" > and sup.supplier_name like concat('%', #{supplierName}, '%')</if>
<if test= "supplierType != null and supplierType != ''" > and sup.supplier_type = #{supplierType}</if>
<if test= "useStatus != null and useStatus != ''" > and sup.use_status = #{useStatus}</if>
<if test= "auditStatus != null and auditStatus != ''" > and sup.audit_status = #{auditStatus}</if>
<if test= "purchaseBuyer != null and purchaseBuyer != ''" > and sup.purchase_buyer = #{purchaseBuyer}</if>
<if test= "supplierType != null and supplierType != ''" > and sup.supplier_type = #{supplierType}</if>
<if test= "useStatus != null and useStatus != ''" > and sup.use_status = #{useStatus}</if>
<if test= "auditStatus != null and auditStatus != ''" > and sup.audit_status = #{auditStatus}</if>
<if test= "purchaseBuyer != null and purchaseBuyer != ''" > and sup.purchase_buyer = #{purchaseBuyer}</if>
<if test= "exportSales != null and exportSales != ''" > and sup.export_sales = #{exportSales}</if>
<if test= "enterpriseName != null and enterpriseName != ''" > and sup.enterprise_name like concat('%', #{enterpriseName}, '%')</if>
<if test= "customerContact != null and customerContact != ''" > and sup.customer_contact like concat('%', #{customerContact}, '%')</if>
<if test= "merchandiser != null and merchandiser != ''" > and sup.merchandiser like concat('%', #{merchandiser}, '%')</if>
<if test= "instanceId != null and instanceId != ''" > and sup.instance_id = #{instanceId}</if>
<if test= "instanceType != null and instanceType != ''" > and sup.instance_type = #{instanceType}</if>
<if test= "submitInstanceId != null and submitInstanceId != ''" > and sup.submit_instance_id = #{submitInstanceId}</if>
<if test= "cancelInstanceId != null and cancelInstanceId != ''" > and sup.cancel_instance_id = #{cancelInstanceId}</if>
<if test= "restoreInstanceId != null and restoreInstanceId != ''" > and sup.restore_instance_id = #{restoreInstanceId}</if>
<if test= "applyTitle != null and applyTitle != ''" > and sup.apply_title = #{applyTitle}</if>
<if test= "applyUser != null and applyUser != ''" > and sup.apply_user = #{applyUser}</if>
<if test= "applyTime != null " > and sup.apply_time = #{applyTime}</if>
<if test= "params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''" >
and sup.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
<if test= "keyword != null and keyword != ''" > and ((sup.supplierCode like concat('%',#{keyword},'%') or sup.suppplierName like concat('%',#{keyword},'%'))</if>
</where>
order by sup.create_time,sup.supplier_id desc
</select>
<select id= "selectSysSupplierById" parameterType= "Long" resultMap= "SysSupplierResult" >
select sup.supplier_id, sup.supplier_code, sup.supplier_name, sup.export_sales,
sup.supplier_type, sup.use_status, sup.audit_status, sup.supplier_qualification, sup.purchase_buyer,
@ -106,24 +134,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sup.customer_email, sup.website, sup.payment_terms, sup.supplier_days, sup.actual_payment_days,
sup.settlement_bank, sup.exchange_settlement_account, sup.deposit_bank, sup.bank_account,
sup.rmb_registered_capital, sup.Industry_code, sup.merchandiser, sup.merchandiser_telephone,
sup.financial_contact, sup.confirm_tax, sup.tax_rate, sup.first_add_time, sup.update_info_time
sup.financial_contact, sup.confirm_tax, sup.tax_rate, sup.first_add_time, sup.update_info_time,
sup.photo_attach_id, sup.create_by, sup.create_time, sup.update_by, sup.update_time, sup.remark,sup.del_flag,
sup.instance_type, sup.instance_id, sup.restore_instance_id, sup.cancel_instance_id, sup.submit_instance_id,
sup.apply_title, sup.apply_user, sup.apply_time,p.dict_value as instance_type_name,file.url as photo_url
from sys_supplier as sup
left join (
select
att.rel_id
,file.url
,min(file.create_time) as create_time
left join(
select dict_value,dict_label from sys_dict_data
where dict_type = 'processType'
) as p on sup.instance_type = p.dict_value
left join (
select att.rel_id,file.url,min(file.create_time) as create_time
from sys_attach as att
left join sys_attach_file as file
on att.id = file.attach_id
where att.source_type = 'supplier' and att.source_sub_type = 'photo'
left join sys_attach_file as file on att.id = file.attach_id
where att.source_type = 'supplier' and att.source_sub_type = 'photo'
group by att.rel_id
)file
on sup.supplier_id = file.rel_id
where sup.supplier_id = #{supplierId}
) as file on sup.supplier_id = file.rel_id where sup.supplier_id = #{supplierId}
</select>
<select id= "selectSysSupplierBycode" resultMap= "SysSupplierResult" >
select supplier_id,supplier_code,supplier_name from sys_supplier where audit_status = 1
<include refid= "selectSysSupplierVo" />
where audit_status = 1 and use_status = 1
</select>
<select id= "selectSysSupplierWithMaterial" resultMap= "SysSupplierResult" >
@ -178,7 +208,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test= "financialContact != null" > financial_contact,</if>
<if test= "confirmTax != null" > confirm_tax,</if>
<if test= "taxRate != null" > tax_rate,</if>
audit_status,use_status,first_add_time,
<if test= "instanceId != null" > instance_id,</if>
<if test= "instanceType != null" > instance_type,</if>
<if test= "submitInstanceId != null" > submit_instance_id,</if>
<if test= "cancelInstanceId != null" > cancel_instance_id,</if>
<if test= "restoreInstanceId != null" > restore_instance_id,</if>
<if test= "applyTitle != null" > apply_title,</if>
<if test= "applyUser != null" > apply_user,</if>
<if test= "applyTime != null" > apply_time,</if>
<if test= "useStatus != null" > use_status,</if>
<if test= "auditStatus != null" > audit_status,</if>
<if test= "createBy != null and createBy != ''" > create_by,</if>
<if test= "createTime != null" > create_time,</if>
<if test= "remark != null and remark != ''" > remark,</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
@ -218,7 +260,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test= "financialContact != null" > #{financialContact},</if>
<if test= "confirmTax != null" > #{confirmTax},</if>
<if test= "taxRate != null" > #{taxRate},</if>
'1','1',CONCAT_WS(',',NOW(),update_info_time),
<if test= "instanceId != null" > #{instanceId},</if>
<if test= "instanceType != null" > #{instanceType},</if>
<if test= "submitInstanceId != null" > #{submitInstanceId},</if>
<if test= "cancelInstanceId != null" > #{cancelInstanceId},</if>
<if test= "restoreInstanceId != null" > #{restoreInstanceId},</if>
<if test= "applyTitle != null" > #{applyTitle},</if>
<if test= "applyUser != null" > #{applyUser},</if>
<if test= "applyTime != null" > #{applyTime},</if>
<if test= "useStatus != null" > #{useStatus},</if>
<if test= "auditStatus != null and auditStatus != ''" > #{auditStatus},</if>
<if test= "createBy != null and createBy != ''" > #{createBy},</if>
<if test= "createTime != null" > #{createTime},</if>
<if test= "remark != null and remark != ''" > #{remark},</if>
</trim>
</insert>
@ -261,7 +315,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test= "financialContact != null" > financial_contact = #{financialContact},</if>
<if test= "confirmTax != null" > confirm_tax = #{confirmTax},</if>
<if test= "taxRate != null" > tax_rate = #{taxRate},</if>
update_info_time = CONCAT_WS(',',NOW(),update_info_time),
<if test= "instanceId != null" > instance_id = #{instanceId},</if>
<if test= "instanceType != null" > instance_type = #{instanceType},</if>
<if test= "submitInstanceId != null" > submit_instance_id = #{submitInstanceId},</if>
<if test= "cancelInstanceId != null" > cancel_instance_id = #{cancelInstanceId},</if>
<if test= "restoreInstanceId != null" > restore_instance_id = #{restoreInstanceId},</if>
<if test= "applyTitle != null" > apply_title = #{applyTitle},</if>
<if test= "applyUser != null" > apply_user = #{applyUser},</if>
<if test= "applyTime != null" > apply_time = #{applyTime},</if>
<if test= "useStatus != null and useStatus != ''" > use_status = #{useStatus},</if>
<if test= "auditStatus != null and auditStatus != ''" > audit_status = #{auditStatus},</if>
<if test= "remark != null and remark != ''" > remark = #{remark},</if>
<if test= "updateBy != null and updateBy != ''" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
</trim>
where supplier_id = #{supplierId}
</update>
@ -270,6 +336,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from sys_supplier where supplier_id = #{supplierId}
</delete>
<delete id= "deleteSysSupplierBySupplierCode" parameterType= "Long" >
delete from sys_supplier where supplier_code = #{supplierCode}
</delete>
<delete id= "deleteSysSupplierByIds" parameterType= "String" >
delete from sys_supplier where supplier_id in
<foreach item= "supplierId" collection= "array" open= "(" separator= "," close= ")" >
@ -277,4 +346,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<delete id= "deleteSysSupplierBySupplierCodes" parameterType= "String" >
delete from sys_supplier where supplier_id in
<foreach item= "supplierCode" collection= "array" open= "(" separator= "," close= ")" >
#{supplierCode}
</foreach>
</delete>
<update id= "updateSysSupplierBySupplierCode" parameterType= "String" >
update sys_supplier set del_falg = #{delFlag} where supplier_code = #{supplierCode}
</update>
<update id= "updateSysSupplierBySupplierCodes" parameterType= "String" >
update sys_supplier set del_falg = #{delFlag} where supplier_code in
<foreach item= "supplierCode" collection= "array" open= "(" separator= "," close= ")" >
#{supplierCode}
</foreach>
</update>
</mapper>