371 lines
13 KiB
XML
371 lines
13 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="user_level" property="userLevel"/>
|
|
<result column="user_sex" property="userSex"/>
|
|
<result column="user_sex_name" property="userSexName"/>
|
|
<result column="user_birth" property="userBirth"/>
|
|
<result column="user_education" property="userEducation"/>
|
|
<result column="user_education_name" property="userEducationName"/>
|
|
<result column="user_politic" property="userPolitic"/>
|
|
<result column="user_politic_name" property="userPoliticName"/>
|
|
<result column="smc_state" property="smcState"/>
|
|
<result column="smc_meeting" property="smcMeetingId"/>
|
|
<result column="smc_username" property="smcUsername"/>
|
|
<result column="smc_password" property="smcPassword"/>
|
|
<result column="smc_number" property="smcNumber"/>
|
|
<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="user_level" property="userLevel"/>
|
|
<result column="user_sex" property="userSex"/>
|
|
<result column="user_sex_name" property="userSexName"/>
|
|
<result column="user_birth" property="userBirth"/>
|
|
<result column="user_education" property="userEducation"/>
|
|
<result column="user_education_name" property="userEducationName"/>
|
|
<result column="user_politic" property="userPolitic"/>
|
|
<result column="user_politic_name" property="userPoliticName"/>
|
|
<result column="smc_state" property="smcState"/>
|
|
<result column="smc_meeting_id" property="smcMeetingId"/>
|
|
<result column="smc_username" property="smcUsername"/>
|
|
<result column="smc_password" property="smcPassword"/>
|
|
<result column="smc_number" property="smcNumber"/>
|
|
<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 '描述',
|
|
`user_level` int(2) DEFAULT '1' COMMENT '用户级别',
|
|
`user_sex` char(36) DEFAULT NULL COMMENT '性别',
|
|
`user_sex_name` varchar(255) DEFAULT NULL COMMENT '性别',
|
|
`user_birth` varchar(255) DEFAULT NULL COMMENT '出生年月',
|
|
`user_politic` char(36) DEFAULT NULL COMMENT '政治面貌',
|
|
`user_politic_name` varchar(255) DEFAULT NULL COMMENT '政治面貌',
|
|
`user_education` char(36) DEFAULT NULL COMMENT '学历',
|
|
`smc_state` varchar(255) DEFAULT NULL COMMENT '融合通信状态',
|
|
`smc_meeting_id` varchar(255) DEFAULT NULL COMMENT '融合通信会议室ID',
|
|
`smc_username` varchar(255) DEFAULT NULL COMMENT '融合通信账号',
|
|
`smc_password` varchar(255) DEFAULT NULL COMMENT '融合通信密码',
|
|
`smc_number` 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,
|
|
user_level,
|
|
user_sex,
|
|
user_sex_name,
|
|
user_birth,
|
|
user_education,
|
|
user_education_name,
|
|
user_politic,
|
|
user_politic_name,
|
|
smc_state,
|
|
smc_meeting_id,
|
|
smc_username,
|
|
smc_password,
|
|
smc_number,
|
|
creator,
|
|
gmt_create,
|
|
modifier,
|
|
gmt_modified
|
|
) VALUES(
|
|
#{userId},
|
|
#{areaCode},
|
|
#{areaName},
|
|
#{userLevel},
|
|
#{userSex},
|
|
#{userSexName},
|
|
#{userBirth},
|
|
#{userEducation},
|
|
#{userEducationName},
|
|
#{userPolitic},
|
|
#{userPoliticName},
|
|
#{smcState},
|
|
#{smcMeetingId},
|
|
#{smcUsername},
|
|
#{smcPassword},
|
|
#{smcNumber},
|
|
#{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>
|
|
<if test="userLevel != null">
|
|
user_level = #{userLevel},
|
|
</if>
|
|
<if test="userSex != null">
|
|
user_sex = #{userSex},
|
|
</if>
|
|
<if test="userSexName != null">
|
|
user_sex_name = #{userSexName},
|
|
</if>
|
|
<if test="userBirth != null">
|
|
user_birth = #{userBirth},
|
|
</if>
|
|
<if test="userEducation != null">
|
|
user_education = #{userEducation},
|
|
</if>
|
|
<if test="userEducationName != null">
|
|
user_education_name = #{userEducationName},
|
|
</if>
|
|
<if test="userPolitic != null">
|
|
user_politic = #{userPolitic},
|
|
</if>
|
|
<if test="userPoliticName != null">
|
|
user_politic_name = #{userPoliticName},
|
|
</if>
|
|
smc_state = #{smcState},
|
|
smc_meeting_id = #{smcMeetingId},
|
|
smc_username = #{smcUsername},
|
|
smc_password = #{smcPassword},
|
|
smc_number = #{smcNumber},
|
|
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.user_level,
|
|
t1.user_sex,
|
|
t1.user_sex_name,
|
|
t1.user_birth,
|
|
t1.user_education,
|
|
t1.user_education_name,
|
|
t1.user_politic,
|
|
t1.user_politic_name,
|
|
t1.smc_state,
|
|
t1.smc_meeting_id,
|
|
t1.smc_username,
|
|
t1.smc_password,
|
|
t1.smc_number,
|
|
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.user_level,
|
|
t1.user_sex,
|
|
t1.user_sex_name,
|
|
t1.user_birth,
|
|
t1.user_education,
|
|
t1.user_education_name,
|
|
t1.user_politic,
|
|
t1.user_politic_name,
|
|
t1.smc_state,
|
|
t1.smc_meeting_id,
|
|
t1.smc_username,
|
|
t1.smc_password,
|
|
t1.smc_number,
|
|
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.user_level,
|
|
t1.user_sex,
|
|
t1.user_sex_name,
|
|
t1.user_birth,
|
|
t1.user_education,
|
|
t1.user_education_name,
|
|
t1.user_politic,
|
|
t1.user_politic_name,
|
|
t1.smc_state,
|
|
t1.smc_meeting_id,
|
|
t1.smc_username,
|
|
t1.smc_password,
|
|
t1.smc_number,
|
|
t1.creator,
|
|
t1.gmt_create,
|
|
t1.modifier,
|
|
t1.gmt_modified
|
|
FROM
|
|
sys_user_expand t1
|
|
<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>
|
|
</select>
|
|
|
|
<!-- 列表 -->
|
|
<select id="list" parameterType="map" resultMap="userExpandDTO">
|
|
SELECT
|
|
t1.user_id,
|
|
t1.area_code,
|
|
t1.area_name,
|
|
t1.user_level,
|
|
t1.user_sex,
|
|
t1.user_sex_name,
|
|
t1.user_birth,
|
|
t1.user_education,
|
|
t1.user_education_name,
|
|
t1.user_politic,
|
|
t1.user_politic_name,
|
|
t1.smc_state,
|
|
t1.smc_meeting_id,
|
|
t1.smc_username,
|
|
t1.smc_password,
|
|
t1.smc_number
|
|
FROM
|
|
sys_user_expand t1
|
|
<where>
|
|
<if test="areaCode != null and areaCode != ''">
|
|
t1.area_code = #{areaCode}
|
|
</if>
|
|
<if test="areaCodeLike != null and areaCodeLike != ''">
|
|
AND
|
|
t1.area_code LIKE CONCAT(#{areaCodeLike}, '%')
|
|
</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>
|
|
<if test="roleId != null and roleId != ''">
|
|
AND
|
|
EXISTS (SELECT 1 FROM sys_role_user st1 WHERE t1.user_id = st1.user_id AND st1.role_id = #{roleId})
|
|
</if>
|
|
AND
|
|
EXISTS (SELECT 1 FROM sys_user st1 WHERE t1.user_id = st1.user_id)
|
|
</where>
|
|
</select>
|
|
|
|
<select id="count" parameterType="map" resultType="java.lang.Integer">
|
|
SELECT
|
|
COUNT(*)
|
|
FROM
|
|
sys_user_expand sue
|
|
INNER JOIN
|
|
sys_user su
|
|
ON
|
|
sue.user_id = su.user_id
|
|
<where>
|
|
su.is_delete = 0
|
|
<if test="areaCode != null and areaCode != ''">
|
|
AND
|
|
area_code = #{areaCode}
|
|
</if>
|
|
<if test="areaCodeLike != null and areaCodeLike != ''">
|
|
AND
|
|
area_code LIKE CONCAT(#{areaCodeLike}, '%')
|
|
</if>
|
|
<if test="roleId != null and roleId != ''">
|
|
AND
|
|
su.user_id IN (
|
|
SELECT
|
|
sru.user_id
|
|
FROM
|
|
sys_role_user sru
|
|
WHERE
|
|
sru.role_id = #{roleId}
|
|
)
|
|
</if>
|
|
<if test="gridCode != null and gridCode != ''">
|
|
AND
|
|
su.user_id IN (
|
|
SELECT
|
|
mgr.relation_id
|
|
FROM
|
|
map_grid_relation mgr
|
|
WHERE
|
|
mgr.grid_id IN (
|
|
SELECT
|
|
mg.grid_id
|
|
FROM
|
|
map_grid mg
|
|
WHERE
|
|
mg.grid_code = #{gridCode}
|
|
)
|
|
)
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
</mapper> |