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

170 lines
11 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.EmisBaseInvoiceChInfoMapper">
<resultMap type="EmisBaseInvoiceChInfo" id="EmisBaseInvoiceChInfoResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
<result property="id" column="id" />
<result property="chId" column="ch_id" />
<result property="chName" column="ch_name" />
<result property="companyName" column="company_name" />
<result property="companyTaxNo" column="company_tax_no" />
<result property="ecAccount" column="ec_account" />
<result property="ecName" column="ec_name" />
<result property="appKey" column="app_key" />
<result property="appSecret" column="app_secret" />
<result property="token" column="token" />
<result property="tokenExpireTime" column="token_expire_time" />
</resultMap>
<sql id="selectEmisBaseInvoiceChInfoVo">
select id, ch_id, ch_name, company_name, company_tax_no, ec_account, ec_name, app_key, app_secret, token, token_expire_time, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_base_invoice_ch_info
</sql>
<select id="selectEmisBaseInvoiceChInfoList" parameterType="EmisBaseInvoiceChInfo" resultMap="EmisBaseInvoiceChInfoResult">
<include refid="selectEmisBaseInvoiceChInfoVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="chId != null and chId != ''"> and ch_id like concat('%', #{chId}, '%')</if>
<if test="chName != null and chName != ''"> and ch_name like concat('%', #{chName}, '%')</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="ecAccount != null and ecAccount != ''"> and ec_account like concat('%', #{ecAccount}, '%')</if>
<if test="ecName != null and ecName != ''"> and ec_name like concat('%', #{ecName}, '%')</if>
<if test="appKey != null and appKey != ''"> and app_key like concat('%', #{appKey}, '%')</if>
<if test="appSecret != null and appSecret != ''"> and app_secret like concat('%', #{appSecret}, '%')</if>
<if test="token != null and token != ''"> and token like concat('%', #{token}, '%')</if>
<if test="tokenExpireTime != null "> and token_expire_time = #{tokenExpireTime}</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="EmisBaseInvoiceChInfo" resultType="int">
select count(1) from emis_base_invoice_ch_info
where del_flag='0'
and id = #{id}
and ch_id = #{chId}
and ch_name = #{chName}
and company_name = #{companyName}
and company_tax_no = #{companyTaxNo}
and ec_account = #{ecAccount}
and ec_name = #{ecName}
and app_key = #{appKey}
and app_secret = #{appSecret}
and token = #{token}
and token_expire_time = #{tokenExpireTime}
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="selectEmisBaseInvoiceChInfoById" parameterType="Long" resultMap="EmisBaseInvoiceChInfoResult">
select id, ch_id, ch_name, company_name, company_tax_no, ec_account, ec_name, app_key, app_secret, token, token_expire_time, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_base_invoice_ch_info a
where a.id = #{id}
</select>
<select id="selectEmisBaseInvoiceChInfoByTaxNo" parameterType="String" resultMap="EmisBaseInvoiceChInfoResult">
select id, ch_id, ch_name, company_name, company_tax_no, ec_account, ec_name, app_key, app_secret, token, token_expire_time, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_base_invoice_ch_info a
where a.company_tax_no = #{taxNo}
</select>
<insert id="insertEmisBaseInvoiceChInfo" parameterType="EmisBaseInvoiceChInfo" useGeneratedKeys="true" keyProperty="id">
insert into emis_base_invoice_ch_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="chId != null and chId != ''">ch_id,</if>
<if test="chName != null and chName != ''">ch_name,</if>
<if test="companyName != null and companyName != ''">company_name,</if>
<if test="companyTaxNo != null and companyTaxNo != ''">company_tax_no,</if>
<if test="ecAccount != null and ecAccount != ''">ec_account,</if>
<if test="ecName != null and ecName != ''">ec_name,</if>
<if test="appKey != null and appKey != ''">app_key,</if>
<if test="appSecret != null and appSecret != ''">app_secret,</if>
<if test="token != null and token != ''">token,</if>
<if test="tokenExpireTime != null">token_expire_time,</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="chId != null and chId != ''">#{chId},</if>
<if test="chName != null and chName != ''">#{chName},</if>
<if test="companyName != null and companyName != ''">#{companyName},</if>
<if test="companyTaxNo != null and companyTaxNo != ''">#{companyTaxNo},</if>
<if test="ecAccount != null and ecAccount != ''">#{ecAccount},</if>
<if test="ecName != null and ecName != ''">#{ecName},</if>
<if test="appKey != null and appKey != ''">#{appKey},</if>
<if test="appSecret != null and appSecret != ''">#{appSecret},</if>
<if test="token != null and token != ''">#{token},</if>
<if test="tokenExpireTime != null">#{tokenExpireTime},</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="updateEmisBaseInvoiceChInfo" parameterType="EmisBaseInvoiceChInfo">
update emis_base_invoice_ch_info
<trim prefix="SET" suffixOverrides=",">
<if test="chId != null and chId != ''">ch_id = #{chId},</if>
<if test="chName != null and chName != ''">ch_name = #{chName},</if>
<if test="companyName != null and companyName != ''">company_name = #{companyName},</if>
<if test="companyTaxNo != null and companyTaxNo != ''">company_tax_no = #{companyTaxNo},</if>
<if test="ecAccount != null and ecAccount != ''">ec_account = #{ecAccount},</if>
<if test="ecName != null and ecName != ''">ec_name = #{ecName},</if>
<if test="appKey != null and appKey != ''">app_key = #{appKey},</if>
<if test="appSecret != null and appSecret != ''">app_secret = #{appSecret},</if>
<if test="token != null and token != ''">token = #{token},</if>
<if test="tokenExpireTime != null">token_expire_time = #{tokenExpireTime},</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="deleteEmisBaseInvoiceChInfoById" parameterType="Long">
delete from emis_base_invoice_ch_info where id = #{id}
</delete>
<delete id="deleteEmisBaseInvoiceChInfoByIds" parameterType="String">
delete from emis_base_invoice_ch_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>