2021-11-12 17:03:53 +08:00
|
|
|
<?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="cn.com.tenlion.usercenter.dao.userexpand.IUserExpandDao">
|
|
|
|
|
|
|
|
<resultMap id="userExpandPO" type="cn.com.tenlion.usercenter.pojo.pos.userexpand.UserExpandPO">
|
|
|
|
<result column="user_id" property="userId"/>
|
|
|
|
<result column="area_code" property="areaCode"/>
|
|
|
|
<result column="area_name" property="areaName"/>
|
2021-11-14 16:26:03 +08:00
|
|
|
<result column="user_level" property="userLevel"/>
|
2021-11-12 17:03:53 +08:00
|
|
|
<result column="creator" property="creator"/>
|
|
|
|
<result column="gmt_create" property="gmtCreate"/>
|
|
|
|
<result column="modifier" property="modifier"/>
|
|
|
|
<result column="gmt_modified" property="gmtModified"/>
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<resultMap id="userExpandDTO" type="cn.com.tenlion.usercenter.pojo.dtos.userexpand.UserExpandDTO">
|
|
|
|
<result column="user_id" property="userId"/>
|
|
|
|
<result column="area_code" property="areaCode"/>
|
|
|
|
<result column="area_name" property="areaName"/>
|
2021-11-14 16:26:03 +08:00
|
|
|
<result column="user_level" property="userLevel"/>
|
2021-11-12 17:03:53 +08:00
|
|
|
<result column="gmt_create" property="gmtCreate"/>
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<!-- 建表 -->
|
|
|
|
<update id="createTable">
|
|
|
|
CREATE TABLE IF NOT EXISTS `sys_user_expand` (
|
|
|
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
|
|
|
`user_id` char(36) DEFAULT NULL COMMENT '主键',
|
2021-11-14 16:26:03 +08:00
|
|
|
`area_code` varchar(255) DEFAULT NULL COMMENT '地区编码',
|
|
|
|
`area_name` varchar(255) DEFAULT NULL COMMENT '地区名称',
|
2021-11-16 10:44:24 +08:00
|
|
|
`user_level` int(2) DEFAULT NULL COMMENT '地区级别',
|
2021-11-12 17:03:53 +08:00
|
|
|
`creator` char(36) DEFAULT NULL COMMENT '创建人',
|
|
|
|
`gmt_create` datetime DEFAULT NULL COMMENT '创建时间',
|
|
|
|
`modifier` char(36) DEFAULT NULL COMMENT '修改人',
|
|
|
|
`gmt_modified` datetime DEFAULT NULL COMMENT '修改时间',
|
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
UNIQUE KEY `user_id` (`user_id`)
|
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='';
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<!-- 新增 -->
|
|
|
|
<insert id="save" parameterType="map">
|
|
|
|
INSERT INTO sys_user_expand(
|
|
|
|
user_id,
|
|
|
|
area_code,
|
|
|
|
area_name,
|
2021-11-14 16:26:03 +08:00
|
|
|
user_level,
|
2021-11-12 17:03:53 +08:00
|
|
|
creator,
|
|
|
|
gmt_create,
|
|
|
|
modifier,
|
|
|
|
gmt_modified
|
|
|
|
) VALUES(
|
|
|
|
#{userId},
|
|
|
|
#{areaCode},
|
|
|
|
#{areaName},
|
2021-11-14 16:26:03 +08:00
|
|
|
#{userLevel},
|
2021-11-12 17:03:53 +08:00
|
|
|
#{creator},
|
|
|
|
#{gmtCreate},
|
|
|
|
#{modifier},
|
|
|
|
#{gmtModified}
|
|
|
|
)
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<!-- 删除(物理) -->
|
|
|
|
<update id="delete" parameterType="map">
|
|
|
|
DELETE FROM
|
|
|
|
sys_user_expand
|
|
|
|
WHERE
|
|
|
|
user_id IN
|
|
|
|
<foreach collection="userIds" index="index" open="(" separator="," close=")">
|
|
|
|
#{userIds[${index}]}
|
|
|
|
</foreach>
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<!-- 修改 -->
|
|
|
|
<update id="update" parameterType="map">
|
|
|
|
UPDATE
|
|
|
|
sys_user_expand
|
|
|
|
SET
|
|
|
|
<if test="areaCode != null">
|
|
|
|
area_code = #{areaCode},
|
|
|
|
</if>
|
|
|
|
<if test="areaName != null">
|
|
|
|
area_name = #{areaName},
|
2021-11-15 11:11:24 +08:00
|
|
|
</if>
|
|
|
|
<if test="userLevel != null">
|
|
|
|
user_level = #{userLevel},
|
2021-11-12 17:03:53 +08:00
|
|
|
</if>
|
|
|
|
gmt_modified = #{gmtModified},
|
|
|
|
modifier = #{modifier}
|
|
|
|
WHERE
|
|
|
|
user_id = #{userId}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<!-- 详情 -->
|
|
|
|
<select id="get" parameterType="map" resultMap="userExpandDTO">
|
|
|
|
SELECT
|
|
|
|
t1.user_id,
|
|
|
|
t1.area_code,
|
|
|
|
t1.area_name,
|
2021-11-14 16:26:03 +08:00
|
|
|
t1.user_level,
|
2021-11-12 17:03:53 +08:00
|
|
|
t1.gmt_create
|
|
|
|
FROM
|
|
|
|
sys_user_expand t1
|
|
|
|
WHERE
|
|
|
|
t1.user_id = #{userId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 详情 -->
|
|
|
|
<select id="getPO" parameterType="map" resultMap="userExpandPO">
|
|
|
|
SELECT
|
|
|
|
t1.user_id,
|
|
|
|
t1.area_code,
|
|
|
|
t1.area_name,
|
2021-11-14 16:26:03 +08:00
|
|
|
t1.user_level,
|
2021-11-12 17:03:53 +08:00
|
|
|
t1.creator,
|
|
|
|
t1.gmt_create,
|
|
|
|
t1.modifier,
|
|
|
|
t1.gmt_modified
|
|
|
|
FROM
|
|
|
|
sys_user_expand t1
|
|
|
|
WHERE
|
|
|
|
t1.user_id = #{userId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 列表 -->
|
|
|
|
<select id="listPO" parameterType="map" resultMap="userExpandPO">
|
|
|
|
SELECT
|
|
|
|
t1.user_id,
|
|
|
|
t1.area_code,
|
|
|
|
t1.area_name,
|
2021-11-14 16:26:03 +08:00
|
|
|
t1.user_level,
|
2021-11-12 17:03:53 +08:00
|
|
|
t1.creator,
|
|
|
|
t1.gmt_create,
|
|
|
|
t1.modifier,
|
|
|
|
t1.gmt_modified
|
|
|
|
FROM
|
|
|
|
sys_user_expand t1
|
2021-11-15 23:34:23 +08:00
|
|
|
<where>
|
|
|
|
<if test="areaCode != null and areaCode != ''">
|
|
|
|
t1.area_code = #{areaCode}
|
|
|
|
</if>
|
|
|
|
<if test="userIds != null and userIds.size > 0">
|
|
|
|
AND
|
|
|
|
t1.user_id IN
|
|
|
|
<foreach collection="userIds" index="index" open="(" separator="," close=")">
|
|
|
|
#{userIds[${index}]}
|
|
|
|
</foreach>
|
|
|
|
</if>
|
|
|
|
</where>
|
2021-11-12 17:03:53 +08:00
|
|
|
</select>
|
|
|
|
|
2021-11-14 16:26:03 +08:00
|
|
|
<!-- 列表 -->
|
|
|
|
<select id="list" parameterType="map" resultMap="userExpandDTO">
|
|
|
|
SELECT
|
|
|
|
t1.user_id,
|
|
|
|
t1.area_code,
|
|
|
|
t1.area_name,
|
|
|
|
t1.user_level
|
|
|
|
FROM
|
|
|
|
sys_user_expand t1
|
2021-11-15 23:34:23 +08:00
|
|
|
<where>
|
|
|
|
<if test="areaCode != null and areaCode != ''">
|
|
|
|
t1.area_code = #{areaCode}
|
|
|
|
</if>
|
|
|
|
<if test="userIds != null and userIds.size > 0">
|
|
|
|
AND
|
|
|
|
t1.user_id IN
|
|
|
|
<foreach collection="userIds" index="index" open="(" separator="," close=")">
|
|
|
|
#{userIds[${index}]}
|
|
|
|
</foreach>
|
|
|
|
</if>
|
|
|
|
</where>
|
2021-11-14 16:26:03 +08:00
|
|
|
</select>
|
|
|
|
|
2021-11-12 17:03:53 +08:00
|
|
|
</mapper>
|