emis-service/emis-biz/src/main/resources/mapper/EmisCustomerInvoiceInfoMapper.xml
2024-07-25 20:20:10 +08:00

182 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="com.xdadan.erp.emis.mapper.EmisCustomerInvoiceInfoMapper">
<resultMap type="EmisCustomerInvoiceInfo" id="EmisCustomerInvoiceInfoResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
<result property="id" column="id" />
<result property="companyName" column="company_name" />
<result property="companyTaxNo" column="company_tax_no" />
<result property="companyTel" column="company_tel" />
<result property="companyAddress" column="company_address" />
<result property="bankName" column="bank_name" />
<result property="bankAccNo" column="bank_acc_no" />
<result property="invoiceType" column="invoice_type" />
<result property="customerCode" column="customer_code" />
<result property="customerName" column="customer_name" />
<result property="contact" column="contact" />
<result property="phone" column="phone" />
<result property="recieveAddress" column="recieve_address" />
<result property="email" column="email" />
</resultMap>
<sql id="selectEmisCustomerInvoiceInfoVo">
select id, company_name, company_tax_no, company_tel, company_address, bank_name, bank_acc_no, invoice_type, customer_code, customer_name, contact, phone, recieve_address, email, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_customer_invoice_info
</sql>
<select id="selectEmisCustomerInvoiceInfoList" parameterType="EmisCustomerInvoiceInfo" resultMap="EmisCustomerInvoiceInfoResult">
<include refid="selectEmisCustomerInvoiceInfoVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
<if test="companyTaxNo != null and companyTaxNo != ''"> and company_tax_no like concat('%', #{companyTaxNo}, '%')</if>
<if test="companyTel != null and companyTel != ''"> and company_tel like concat('%', #{companyTel}, '%')</if>
<if test="companyAddress != null and companyAddress != ''"> and company_address like concat('%', #{companyAddress}, '%')</if>
<if test="bankName != null and bankName != ''"> and bank_name like concat('%', #{bankName}, '%')</if>
<if test="bankAccNo != null and bankAccNo != ''"> and bank_acc_no like concat('%', #{bankAccNo}, '%')</if>
<if test="invoiceType != null and invoiceType != ''"> and invoice_type like concat('%', #{invoiceType}, '%')</if>
<if test="customerCode != null and customerCode != ''"> and customer_code like concat('%', #{customerCode}, '%')</if>
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
<if test="contact != null and contact != ''"> and contact like concat('%', #{contact}, '%')</if>
<if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if>
<if test="recieveAddress != null and recieveAddress != ''"> and recieve_address like concat('%', #{recieveAddress}, '%')</if>
<if test="email != null and email != ''"> and email like concat('%', #{email}, '%')</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
</where>
order by create_time desc
</select>
<select id="checkUnique" parameterType="EmisCustomerInvoiceInfo" resultType="int">
select count(1) from emis_customer_invoice_info
where del_flag='0'
and id = #{id}
and company_name = #{companyName}
and company_tax_no = #{companyTaxNo}
and company_tel = #{companyTel}
and company_address = #{companyAddress}
and bank_name = #{bankName}
and bank_acc_no = #{bankAccNo}
and invoice_type = #{invoiceType}
and customer_code = #{customerCode}
and customer_name = #{customerName}
and contact = #{contact}
and phone = #{phone}
and recieve_address = #{recieveAddress}
and email = #{email}
and remark = #{remark}
and del_flag = #{delFlag}
and create_by = #{createBy}
and create_time = #{createTime}
and update_by = #{updateBy}
and update_time = #{updateTime}
and create_site = #{createSite}
and update_site = #{updateSite}
limit 1
</select>
<select id="selectEmisCustomerInvoiceInfoById" parameterType="Long" resultMap="EmisCustomerInvoiceInfoResult">
select id, company_name, company_tax_no, company_tel, company_address, bank_name, bank_acc_no, invoice_type, customer_code, customer_name, contact, phone, recieve_address, email, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_customer_invoice_info a
where a.id = #{id}
</select>
<insert id="insertEmisCustomerInvoiceInfo" parameterType="EmisCustomerInvoiceInfo" useGeneratedKeys="true" keyProperty="id">
insert into emis_customer_invoice_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="companyName != null and companyName != ''">company_name,</if>
<if test="companyTaxNo != null and companyTaxNo != ''">company_tax_no,</if>
<if test="companyTel != null and companyTel != ''">company_tel,</if>
<if test="companyAddress != null and companyAddress != ''">company_address,</if>
<if test="bankName != null and bankName != ''">bank_name,</if>
<if test="bankAccNo != null and bankAccNo != ''">bank_acc_no,</if>
<if test="invoiceType != null and invoiceType != ''">invoice_type,</if>
<if test="customerCode != null and customerCode != ''">customer_code,</if>
<if test="customerName != null and customerName != ''">customer_name,</if>
<if test="contact != null and contact != ''">contact,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="recieveAddress != null and recieveAddress != ''">recieve_address,</if>
<if test="email != null and email != ''">email,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="createSite != null and createSite != ''">create_site,</if>
<if test="updateSite != null and updateSite != ''">update_site,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="companyName != null and companyName != ''">#{companyName},</if>
<if test="companyTaxNo != null and companyTaxNo != ''">#{companyTaxNo},</if>
<if test="companyTel != null and companyTel != ''">#{companyTel},</if>
<if test="companyAddress != null and companyAddress != ''">#{companyAddress},</if>
<if test="bankName != null and bankName != ''">#{bankName},</if>
<if test="bankAccNo != null and bankAccNo != ''">#{bankAccNo},</if>
<if test="invoiceType != null and invoiceType != ''">#{invoiceType},</if>
<if test="customerCode != null and customerCode != ''">#{customerCode},</if>
<if test="customerName != null and customerName != ''">#{customerName},</if>
<if test="contact != null and contact != ''">#{contact},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="recieveAddress != null and recieveAddress != ''">#{recieveAddress},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createSite != null and createSite != ''">#{createSite},</if>
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
</trim>
</insert>
<update id="updateEmisCustomerInvoiceInfo" parameterType="EmisCustomerInvoiceInfo">
update emis_customer_invoice_info
<trim prefix="SET" suffixOverrides=",">
<if test="companyName != null and companyName != ''">company_name = #{companyName},</if>
<if test="companyTaxNo != null and companyTaxNo != ''">company_tax_no = #{companyTaxNo},</if>
<if test="companyTel != null and companyTel != ''">company_tel = #{companyTel},</if>
<if test="companyAddress != null and companyAddress != ''">company_address = #{companyAddress},</if>
<if test="bankName != null and bankName != ''">bank_name = #{bankName},</if>
<if test="bankAccNo != null and bankAccNo != ''">bank_acc_no = #{bankAccNo},</if>
<if test="invoiceType != null and invoiceType != ''">invoice_type = #{invoiceType},</if>
<if test="customerCode != null and customerCode != ''">customer_code = #{customerCode},</if>
<if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
<if test="contact != null and contact != ''">contact = #{contact},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="recieveAddress != null and recieveAddress != ''">recieve_address = #{recieveAddress},</if>
<if test="email != null and email != ''">email = #{email},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEmisCustomerInvoiceInfoById" parameterType="Long">
delete from emis_customer_invoice_info where id = #{id}
</delete>
<delete id="deleteEmisCustomerInvoiceInfoByIds" parameterType="String">
delete from emis_customer_invoice_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>