138 lines
4.4 KiB
XML
138 lines
4.4 KiB
XML
|
<?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"/>
|
||
|
<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"/>
|
||
|
<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 '主键',
|
||
|
`area_code` varchar(255) DEFAULT NULL COMMENT '名称',
|
||
|
`area_name` varchar(255) DEFAULT NULL COMMENT '描述',
|
||
|
`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,
|
||
|
creator,
|
||
|
gmt_create,
|
||
|
modifier,
|
||
|
gmt_modified
|
||
|
) VALUES(
|
||
|
#{userId},
|
||
|
#{areaCode},
|
||
|
#{areaName},
|
||
|
#{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},
|
||
|
</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,
|
||
|
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,
|
||
|
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,
|
||
|
t1.creator,
|
||
|
t1.gmt_create,
|
||
|
t1.modifier,
|
||
|
t1.gmt_modified
|
||
|
FROM
|
||
|
sys_user_expand t1
|
||
|
WHERE
|
||
|
<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>
|
||
|
</select>
|
||
|
|
||
|
</mapper>
|