| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?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.InfoAddressMapper">
-
- <resultMap type="InfoAddress" id="InfoAddressResult">
- <result property="id" column="id" />
- <result property="userId" column="user_id" />
- <result property="name" column="name" />
- <result property="phone" column="phone" />
- <result property="address" column="address" />
- <result property="addressDetail" column="address_detail" />
- <result property="longitude" column="longitude" />
- <result property="latitude" column="latitude" />
- <result property="country" column="country" />
- <result property="province" column="province" />
- <result property="city" column="city" />
- <result property="area" column="area" />
- </resultMap>
- <sql id="selectInfoAddressVo">
- select id, user_id, name, phone, address, address_detail, longitude, latitude, country, province, city, area from info_address
- </sql>
- <select id="selectInfoAddressList" parameterType="InfoAddress" resultMap="InfoAddressResult">
- <include refid="selectInfoAddressVo"/>
- <where>
- <if test="userId != null "> and user_id = #{userId}</if>
- <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
- <if test="phone != null and phone != ''"> and phone = #{phone}</if>
- <if test="country != null and country != ''"> and country = #{country}</if>
- <if test="province != null and province != ''"> and province = #{province}</if>
- <if test="city != null and city != ''"> and city = #{city}</if>
- <if test="area != null and area != ''"> and area = #{area}</if>
- </where>
- order by id desc
- </select>
-
- <select id="selectInfoAddressById" parameterType="Long" resultMap="InfoAddressResult">
- <include refid="selectInfoAddressVo"/>
- where id = #{id}
- </select>
-
- <insert id="insertInfoAddress" parameterType="InfoAddress" useGeneratedKeys="true" keyProperty="id">
- insert into info_address
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="userId != null">user_id,</if>
- <if test="name != null and name != ''">name,</if>
- <if test="phone != null and phone != ''">phone,</if>
- <if test="address != null and address != ''">address,</if>
- <if test="addressDetail != null and addressDetail != ''">address_detail,</if>
- <if test="longitude != null">longitude,</if>
- <if test="latitude != null">latitude,</if>
- <if test="country != null">country,</if>
- <if test="province != null">province,</if>
- <if test="city != null">city,</if>
- <if test="area != null">area,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="userId != null">#{userId},</if>
- <if test="name != null and name != ''">#{name},</if>
- <if test="phone != null and phone != ''">#{phone},</if>
- <if test="address != null and address != ''">#{address},</if>
- <if test="addressDetail != null and addressDetail != ''">#{addressDetail},</if>
- <if test="longitude != null">#{longitude},</if>
- <if test="latitude != null">#{latitude},</if>
- <if test="country != null">#{country},</if>
- <if test="province != null">#{province},</if>
- <if test="city != null">#{city},</if>
- <if test="area != null">#{area},</if>
- </trim>
- </insert>
- <update id="updateInfoAddress" parameterType="InfoAddress">
- update info_address
- <trim prefix="SET" suffixOverrides=",">
- <if test="userId != null">user_id = #{userId},</if>
- <if test="name != null and name != ''">name = #{name},</if>
- <if test="phone != null and phone != ''">phone = #{phone},</if>
- <if test="address != null and address != ''">address = #{address},</if>
- <if test="addressDetail != null and addressDetail != ''">address_detail = #{addressDetail},</if>
- <if test="longitude != null">longitude = #{longitude},</if>
- <if test="latitude != null">latitude = #{latitude},</if>
- <if test="country != null">country = #{country},</if>
- <if test="province != null">province = #{province},</if>
- <if test="city != null">city = #{city},</if>
- <if test="area != null">area = #{area},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteInfoAddressById" parameterType="Long">
- delete from info_address where id = #{id}
- </delete>
- <delete id="deleteInfoAddressByIds" parameterType="String">
- delete from info_address where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|