New file |
| | |
| | | <?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.oying.modules.sh.mapper.UserAddressMapper"> |
| | | <resultMap id="BaseResultMap" type="com.oying.modules.sh.domain.UserAddress"> |
| | | <id column="address_id" property="addressId"/> |
| | | <result column="user_id" property="userId"/> |
| | | <result column="receiver_name" property="receiverName"/> |
| | | <result column="receiver_phone" property="receiverPhone"/> |
| | | <result column="province" property="province"/> |
| | | <result column="city" property="city"/> |
| | | <result column="district" property="district"/> |
| | | <result column="street" property="street"/> |
| | | <result column="short_address" property="shortAddress"/> |
| | | <result column="detail" property="detail"/> |
| | | <result column="longitude" property="longitude"/> |
| | | <result column="latitude" property="latitude"/> |
| | | <result column="is_default" property="isDefault"/> |
| | | <result column="tag" property="tag"/> |
| | | <result column="create_by" property="createBy"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_by" property="updateBy"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | address_id, user_id, receiver_name, receiver_phone, province, city, district, street, short_address, detail, longitude, latitude, is_default, tag, create_by, create_time, update_by, update_time |
| | | </sql> |
| | | <update id="isDefault"> |
| | | update sh_user_address |
| | | set is_default = false |
| | | where user_id = #{userId} |
| | | </update> |
| | | |
| | | <select id="findAll" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from sh_user_address |
| | | <where> |
| | | <if test="criteria.userId != null and criteria.userId != ''"> |
| | | and user_id = #{criteria.userId} |
| | | </if> |
| | | <if test="criteria.tag != null and criteria.tag != ''"> |
| | | and tag = #{criteria.tag} |
| | | </if> |
| | | <if test="criteria.phone != null and criteria.phone != ''"> |
| | | and receiver_phone like concat('%',#{criteria.phone},'%') |
| | | </if> |
| | | <if test="criteria.createTime != null and criteria.createTime.size() > 0"> |
| | | AND create_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]} |
| | | </if> |
| | | </where> |
| | | order by address_id desc |
| | | </select> |
| | | </mapper> |