emis-service/emis-biz/src/main/resources/mapper/EmisBaseInvoiceInfoMapper.xml

164 lines
10 KiB
XML
Raw Normal View History

2024-07-21 13:34:34 +00: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.xdadan.erp.emis.mapper.EmisBaseInvoiceInfoMapper">
<resultMap type="EmisBaseInvoiceInfo" id="EmisBaseInvoiceInfoResult">
<result property="id" column="id" />
<result property="comCode" column="com_code" />
<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="invoiceType" column="invoice_type" />
<result property="contact" column="contact" />
<result property="phone" column="phone" />
<result property="recieveAddress" column="recieve_address" />
<result property="email" column="email" />
</resultMap>
<sql id="selectEmisBaseInvoiceInfoVo">
select id, com_code, company_name, company_tax_no, company_tel, company_address, invoice_type, contact, phone, recieve_address, email, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_base_invoice_info
</sql>
<select id="selectEmisBaseInvoiceInfoList" parameterType="EmisBaseInvoiceInfo" resultMap="EmisBaseInvoiceInfoResult">
<include refid="selectEmisBaseInvoiceInfoVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="comCode != null and comCode != ''"> and com_code = #{comCode}</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="invoiceType != null and invoiceType != ''"> and invoice_type like concat('%', #{invoiceType}, '%')</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="EmisBaseInvoiceInfo" resultType="int">
select count(1) from emis_base_invoice_info
where del_flag='0'
and id = #{id}
and com_code = #{comCode}
and company_name = #{companyName}
and company_tax_no = #{companyTaxNo}
and company_tel = #{companyTel}
and company_address = #{companyAddress}
and invoice_type = #{invoiceType}
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="selectEmisBaseInvoiceInfoById" parameterType="Long" resultMap="EmisBaseInvoiceInfoResult">
select id, com_code, company_name, company_tax_no, company_tel, company_address, invoice_type, contact, phone, recieve_address, email, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_base_invoice_info a
where a.id = #{id}
</select>
<insert id="insertEmisBaseInvoiceInfo" parameterType="EmisBaseInvoiceInfo" useGeneratedKeys="true" keyProperty="id">
insert into emis_base_invoice_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="comCode != null and comCode != ''">com_code,</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="invoiceType != null and invoiceType != ''">invoice_type,</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="comCode != null and comCode != ''">#{comCode},</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="invoiceType != null and invoiceType != ''">#{invoiceType},</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="updateEmisBaseInvoiceInfo" parameterType="EmisBaseInvoiceInfo">
update emis_base_invoice_info
<trim prefix="SET" suffixOverrides=",">
<if test="comCode != null and comCode != ''">com_code = #{comCode},</if>
<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="invoiceType != null and invoiceType != ''">invoice_type = #{invoiceType},</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="deleteEmisBaseInvoiceInfoById" parameterType="Long">
delete from emis_base_invoice_info where id = #{id}
</delete>
<delete id="deleteEmisBaseInvoiceInfoByIds" parameterType="String">
delete from emis_base_invoice_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>