Files
wuhan-saga/server/target/classes/mapper/ContactMapper.xml

40 lines
2.1 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.wuhansaga.server.mapper.ContactMapper">
<select id="selectById" resultType="com.wuhansaga.server.entity.Contact">
SELECT * FROM f_contact WHERE contact_id = #{id} AND del_flag = 0
</select>
<select id="selectPublished" resultType="com.wuhansaga.server.entity.Contact">
SELECT * FROM f_contact WHERE del_flag = 0 ORDER BY contact_id DESC LIMIT 1
</select>
<insert id="insert" useGeneratedKeys="true" keyProperty="contactId">
INSERT INTO f_contact (company_info_id, phone, fax, email, address_zh, address_en,
zip_code, map_coordinates, business_hours_zh, business_hours_en, create_by, remark)
VALUES (#{companyInfoId}, #{phone}, #{fax}, #{email}, #{addressZh}, #{addressEn},
#{zipCode}, #{mapCoordinates}, #{businessHoursZh}, #{businessHoursEn}, #{createBy}, #{remark})
</insert>
<update id="update" parameterType="com.wuhansaga.server.entity.Contact">
UPDATE f_contact
<set>
<if test="companyInfoId != null">company_info_id = #{companyInfoId},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="fax != null">fax = #{fax},</if>
<if test="email != null">email = #{email},</if>
<if test="addressZh != null">address_zh = #{addressZh},</if>
<if test="addressEn != null">address_en = #{addressEn},</if>
<if test="zipCode != null">zip_code = #{zipCode},</if>
<if test="mapCoordinates != null">map_coordinates = #{mapCoordinates},</if>
<if test="businessHoursZh != null">business_hours_zh = #{businessHoursZh},</if>
<if test="businessHoursEn != null">business_hours_en = #{businessHoursEn},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = CURRENT_TIMESTAMP
</set>
WHERE contact_id = #{contactId} AND del_flag = 0
</update>
</mapper>