|
@@ -1,123 +0,0 @@
|
|
|
-<?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="userSqlMapper">
|
|
|
-
|
|
|
- <sql id="base_column">
|
|
|
- user_id as id,
|
|
|
- email_address as email,
|
|
|
- username,
|
|
|
- password,
|
|
|
- default_account_id as userGroupId,
|
|
|
- contact_name as contactName,
|
|
|
- contact_phone as phone,
|
|
|
- active as status,
|
|
|
- date_created as createDate,
|
|
|
- updated as modifyDate
|
|
|
- </sql>
|
|
|
-
|
|
|
- <select id="selectByUsername" parameterType="string" resultType="com.cloudcross.ssp.model.User">
|
|
|
- select
|
|
|
- <include refid="base_column" />
|
|
|
- from rv_users
|
|
|
- <where>
|
|
|
- username = #{username}
|
|
|
- </where>
|
|
|
- order by user_id desc
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="selectById" parameterType="int" resultType="com.cloudcross.ssp.model.User">
|
|
|
- select
|
|
|
- <include refid="base_column" />
|
|
|
- from rv_users
|
|
|
- <where>
|
|
|
- user_id = #{id} and
|
|
|
- active != -1
|
|
|
- </where>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="selectByUserGroupType" parameterType="string" resultType="com.cloudcross.ssp.model.User">
|
|
|
- select
|
|
|
- <include refid="base_column" />
|
|
|
- from rv_users
|
|
|
- <where>
|
|
|
- exists(select account_id from rv_accounts where account_type=#{userGroupType} and
|
|
|
- account_id=default_account_id) and
|
|
|
- active != -1
|
|
|
- </where>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="selectByParams" parameterType="map" resultType="com.cloudcross.ssp.model.User">
|
|
|
- select
|
|
|
- <include refid="base_column" />
|
|
|
- from rv_users where active != -1
|
|
|
- <if test="key!=null and value!=null">
|
|
|
- <choose>
|
|
|
- <when test="key=='username'">
|
|
|
- and username like #{value}
|
|
|
- </when>
|
|
|
- <when test="key=='contactName'">
|
|
|
- and contact_name like #{value}
|
|
|
- </when>
|
|
|
- </choose>
|
|
|
- </if>
|
|
|
- <if test="userGroupType!=null">
|
|
|
- and exists(
|
|
|
- select account_id from rv_accounts
|
|
|
- where account_id=default_account_id and
|
|
|
- account_type=#{userGroupType})
|
|
|
- </if>
|
|
|
- order by user_id desc
|
|
|
- limit #{pager.offset}, #{pager.limit}
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="countByParams" parameterType="map" resultType="int">
|
|
|
- select count(user_id)
|
|
|
- from rv_users where active != -1
|
|
|
- <if test="key!=null and value!=null">
|
|
|
- <choose>
|
|
|
- <when test="key=='username'">
|
|
|
- and username like #{value}
|
|
|
- </when>
|
|
|
- <when test="key=='contactName'">
|
|
|
- and contact_name like #{value}
|
|
|
- </when>
|
|
|
- </choose>
|
|
|
- </if>
|
|
|
- <if test="userGroupType!=null">
|
|
|
- and exists(
|
|
|
- select account_id from rv_accounts
|
|
|
- where account_id=default_account_id and
|
|
|
- account_type=#{userGroupType})
|
|
|
- </if>
|
|
|
- </select>
|
|
|
-
|
|
|
- <insert id="addUser" parameterType="com.cloudcross.ssp.model.User">
|
|
|
- insert into rv_users(username,password,contact_name,contact_phone,active,default_account_id,updated,date_created)
|
|
|
- values(#{username},#{password},#{contactName},#{phone},#{status},#{userGroupId}, #{createDate},#{createDate})
|
|
|
- </insert>
|
|
|
-
|
|
|
- <update id="editUser" parameterType="com.cloudcross.ssp.model.User">
|
|
|
- update rv_users
|
|
|
- set username=#{username},
|
|
|
- <if test="password !=null ">
|
|
|
- password=#{password},
|
|
|
- </if>
|
|
|
- contact_name=IFNULL(#{contactName},default(contact_name)),
|
|
|
- contact_phone=IFNULL(#{phone},default(contact_phone)),
|
|
|
- <if test="status !=null">
|
|
|
- active=#{status},
|
|
|
- </if>
|
|
|
- updated=#{modifyDate}
|
|
|
- where user_id=#{id}
|
|
|
- </update>
|
|
|
-
|
|
|
- <update id="updateUserStatus" parameterType="HashMap">
|
|
|
- update rv_users
|
|
|
- set active = #{status},updated = #{modifyDate}
|
|
|
- where user_id in
|
|
|
- <foreach item="userId" collection="userIdList"
|
|
|
- open="(" separator="," close=")">
|
|
|
- #{userId}
|
|
|
- </foreach>
|
|
|
- </update>
|
|
|
-</mapper>
|