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

119 lines
7.0 KiB

2 years ago
<?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.ruoyi.system.mapper.SysContactsMapper">
<resultMap type="SysContacts" id="SysContactsResult">
<result property="contactid" column="contactid" />
<result property="enterpriseCode" column="enterprise_code" />
<result property="enterpriseName" column="enterprise_name" />
<result property="customerName" column="customer_name" />
<result property="customerPosition" column="customer_position" />
<result property="customerBirthday" column="customer_birthday" />
<result property="officeTelephone" column="office_telephone" />
<result property="homePhone" column="home_phone" />
<result property="cellPhone" column="cell_phone" />
<result property="customerFax" column="customer_fax" />
<result property="standbyTelephoneOne" column="standby_telephone_one" />
<result property="standbyTelephoneTwo" column="standby_telephone_two" />
<result property="commonEmail" column="common_email" />
<result property="alternateEmail" column="alternate_email" />
<result property="customerRemarks" column="customer_remarks" />
<result property="customerRemarks" column="customer_remarks" />
<result property="customerRemarks" column="customer_remarks" />
<result property="firstAddTime" column="first_add_time" />
<result property="updateInfoTime" column="update_info_time" />
</resultMap>
<sql id="selectSysContactsVo">
select contactid, enterprise_code, enterprise_name, customer_name, customer_position, customer_birthday, office_telephone, home_phone, cell_phone, customer_fax, standby_telephone_one, standby_telephone_two, common_email, alternate_email, customer_remarks, first_add_time, update_info_time from sys_contacts
</sql>
<select id="selectSysContactsList" parameterType="SysContacts" resultMap="SysContactsResult">
<include refid="selectSysContactsVo"/>
<where>
<if test="enterpriseCode != null and enterpriseCode != ''"> and enterprise_code like concat('%', #{enterpriseCode}, '%')</if>
<if test="enterpriseName != null and enterpriseName != ''"> and enterprise_name like concat('%', #{enterpriseName}, '%')</if>
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
<if test="customerFax != null and customerFax != ''"> and customer_fax = #{customerFax}</if>
</where>
</select>
<select id="selectSysContactsById" parameterType="Long" resultMap="SysContactsResult">
<include refid="selectSysContactsVo"/>
where contactid = #{contactid}
</select>
<insert id="insertSysContacts" parameterType="SysContacts" useGeneratedKeys="true" keyProperty="contactid">
insert into sys_contacts
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="enterpriseCode != null">enterprise_code,</if>
<if test="enterpriseName != null">enterprise_name,</if>
<if test="customerName != null">customer_name,</if>
<if test="customerPosition != null">customer_position,</if>
<if test="customerBirthday != null">customer_birthday,</if>
<if test="officeTelephone != null">office_telephone,</if>
<if test="homePhone != null">home_phone,</if>
<if test="cellPhone != null">cell_phone,</if>
<if test="customerFax != null">customer_fax,</if>
<if test="standbyTelephoneOne != null">standby_telephone_one,</if>
<if test="standbyTelephoneTwo != null">standby_telephone_two,</if>
<if test="commonEmail != null">common_email,</if>
<if test="alternateEmail != null">alternate_email,</if>
<if test="customerRemarks != null">customer_remarks,</if>
first_add_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="enterpriseCode != null">#{enterpriseCode},</if>
<if test="enterpriseName != null">#{enterpriseName},</if>
<if test="customerName != null">#{customerName},</if>
<if test="customerPosition != null">#{customerPosition},</if>
<if test="customerBirthday != null">#{customerBirthday},</if>
<if test="officeTelephone != null">#{officeTelephone},</if>
<if test="homePhone != null">#{homePhone},</if>
<if test="cellPhone != null">#{cellPhone},</if>
<if test="customerFax != null">#{customerFax},</if>
<if test="standbyTelephoneOne != null">#{standbyTelephoneOne},</if>
<if test="standbyTelephoneTwo != null">#{standbyTelephoneTwo},</if>
<if test="commonEmail != null">#{commonEmail},</if>
<if test="alternateEmail != null">#{alternateEmail},</if>
<if test="customerRemarks != null">#{customerRemarks},</if>
NOW(),
</trim>
</insert>
<update id="updateSysContacts" parameterType="SysContacts">
update sys_contacts
<trim prefix="SET" suffixOverrides=",">
<if test="enterpriseCode != null">enterprise_code = #{enterpriseCode},</if>
<if test="enterpriseName != null">enterprise_name = #{enterpriseName},</if>
<if test="customerName != null">customer_name = #{customerName},</if>
<if test="customerPosition != null">customer_position = #{customerPosition},</if>
<if test="customerBirthday != null">customer_birthday = #{customerBirthday},</if>
<if test="officeTelephone != null">office_telephone = #{officeTelephone},</if>
<if test="homePhone != null">home_phone = #{homePhone},</if>
<if test="cellPhone != null">cell_phone = #{cellPhone},</if>
<if test="customerFax != null">customer_fax = #{customerFax},</if>
<if test="standbyTelephoneOne != null">standby_telephone_one = #{standbyTelephoneOne},</if>
<if test="standbyTelephoneTwo != null">standby_telephone_two = #{standbyTelephoneTwo},</if>
<if test="commonEmail != null">common_email = #{commonEmail},</if>
<if test="alternateEmail != null">alternate_email = #{alternateEmail},</if>
<if test="customerRemarks != null">customer_remarks = #{customerRemarks},</if>
update_info_time = CONCAT_WS(',',NOW(),update_info_time),
</trim>
where contactid = #{contactid}
</update>
<delete id="deleteSysContactsById" parameterType="Long">
delete from sys_contacts where contactid = #{contactid}
</delete>
<delete id="deleteSysContactsByIds" parameterType="String">
delete from sys_contacts where contactid in
<foreach item="contactid" collection="array" open="(" separator="," close=")">
#{contactid}
</foreach>
</delete>
</mapper>