|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?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.iformall.mapper.UserBasicInfoAddressMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.UserBasicInfoAddress">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
- <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
- <result column="final_tenant_id" jdbcType="VARCHAR" property="finalTenantId"/>
- <result column="user_id" jdbcType="BIGINT" property="userId"/>
-
- <result column="consignee" jdbcType="VARCHAR" property="consignee"/>
- <result column="country" jdbcType="VARCHAR" property="country"/>
- <result column="province" jdbcType="VARCHAR" property="province"/>
- <result column="city" jdbcType="VARCHAR" property="city"/>
- <result column="district" jdbcType="VARCHAR" property="district"/>
- <result column="region" jdbcType="VARCHAR" property="region"/>
- <result column="address" jdbcType="VARCHAR" property="address"/>
- <result column="zipcode" jdbcType="VARCHAR" property="zipcode"/>
- <result column="mobile" jdbcType="VARCHAR" property="mobile"/>
-
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
-
- <result column="is_default" jdbcType="INTEGER" property="isDefault"/>
- <result column="mark" jdbcType="VARCHAR" property="mark"/>
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`,`final_tenant_id`,`user_id`,`consignee`,`country`,`province`,`city`,`district`,`region`,`address`,`zipcode`,`mobile`,
- `create_date`,`update_date`,`is_default`,`mark`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where `is_del` = 0
-
- <if test=" null != id ">
- and `id` = #{id}
- </if>
-
- <if test=" null != finalTenantId and '' != finalTenantId">
- and `final_tenant_id` = #{finalTenantId}
- </if>
-
- <if test=" null != userId ">
- and `user_id` = #{userId}
- </if>
- order by `is_default` desc,`update_date` desc
-
- </sql>
-
- <select id="findList" parameterType="com.iformall.domain.po.UserBasicInfoAddress" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from user_basic_info_address
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <update id="deleteById" parameterType="com.iformall.domain.po.UserBasicInfoAddress">
- update user_basic_info_address set is_del = 1, update_date=now() where id = #{id}
- </update>
-
- <update id="updateDefault" parameterType="com.iformall.domain.po.UserBasicInfoAddress">
- update user_basic_info_address
- set is_default = 1, update_date=now()
- where id = #{id}
- </update>
-
- <update id="updateUnDefault" parameterType="com.iformall.domain.po.UserBasicInfoAddress">
- update user_basic_info_address
- set is_default = 0, update_date=now()
- where user_id = #{userId}
- and id != #{id}
- </update>
-
-
- </mapper>
|