31 lines
1.1 KiB
Java
31 lines
1.1 KiB
Java
package com.sky.mapper;
|
|
|
|
import com.sky.entity.AddressBook;
|
|
import org.apache.ibatis.annotations.*;
|
|
|
|
import java.util.List;
|
|
|
|
@Mapper
|
|
public interface AddressBookMapper {
|
|
|
|
@Insert("insert into sky_take_out.address_book(user_id, consignee, sex, phone, province_code, province_name, city_code, city_name, district_code, district_name, detail, label, is_default) " +
|
|
"values (#{userId},#{consignee},#{sex},#{phone},#{provinceCode},#{provinceName},#{cityCode},#{cityName},#{districtCode},#{districtName},#{detail},#{label},#{isDefault})")
|
|
void insert(AddressBook addressBook);
|
|
|
|
List<AddressBook> list(AddressBook addressBook);
|
|
|
|
void update(AddressBook addressBook);
|
|
|
|
@Delete("delete from sky_take_out.address_book where id = #{id}")
|
|
void deleteById(Long id);
|
|
|
|
@Update("update sky_take_out.address_book set is_default = 0 where user_id = #{userId}")
|
|
void updateNotDefault(Long userId);
|
|
|
|
@Update("update sky_take_out.address_book set is_default = 1 where id = #{id}")
|
|
void updateDefault(Long id);
|
|
|
|
@Select("select * from sky_take_out.address_book where id = #{addressBookId}")
|
|
AddressBook getById(Long addressBookId);
|
|
}
|