| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407 |
- <?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" >
- <!-- 管理员持久化层XML配置继承IRoleDao -->
- <mapper namespace="net.mingsoft.people.dao.IPeopleDao">
- <!-- 表字段开始 -->
- <sql id="column_list">
- PEOPLE_PHONE,PEOPLE_NAME,PEOPLE_PASSWORD,PEOPLE_CODE,
- PEOPLE_DATETIME,PEOPLE_MAIL,PEOPLE_STATE,PEOPLE_CODESENDDATE,
- PEOPLE_PHONECHECK,PEOPLE_MAILLCHECK
- </sql>
- <sql id="user_column_list">
- people_id,PU_REAL_NAME,PU_ADDRESS,PU_LEVEL,PU_LEVEL_NAME,PU_ICON,PU_NICKNAME,PU_SEX,PU_BIRTHDAY,PU_CARD,
- PROVINCE_ID,PROVINCE_NAME,CITY_ID,CITY_NAME,COUNTY_ID,COUNTY_NAME
- </sql>
- <!-- 将实体属性与表字段对接开始 -->
- <resultMap id="resultMap" type="net.mingsoft.people.bean.PeopleBean">
- <id column="id" property="id"/><!-- 将实体的ID属性与表的ID字段对接 -->
- <result column="PEOPLE_PHONE" property="peoplePhone"/><!-- 将实体的peoplePhone属性与表的peoplePhone字段对接 -->
- <result column="PEOPLE_NAME" property="peopleName"/><!-- 将实体的peopleName属性与表的peopleName字段对接 -->
- <result column="PEOPLE_PASSWORD" property="peoplePassword"/><!--
- 将实体的PEOPLE_PASSWORD属性与表的peoplePwd字段对接 -->
- <result column="PEOPLE_DATETIME" property="peopleDateTime"/><!--
- 将实体的peopleDateTime属性与表的peopleDateTime字段对接 -->
- <result column="PEOPLE_MAIL" property="peopleMail"/><!-- 用户邮箱 -->
- <result column="PEOPLE_IP" property="peopleIp"/><!-- 用户ip -->
- <result column="PEOPLE_STATE" property="peopleState"/><!-- 用户状态 -->
- <result column="PEOPLE_CODE" property="peopleCode"/><!-- 用户随机码 -->
- <result column="PEOPLE_CODESENDDATE" property="peopleCodeSendDate"/><!--
- 用户随机码发送时间 -->
- <result column="PEOPLE_MAILLCHECK" property="peopleMailCheck"/><!--
- 用户是否通过邮箱验证 -->
- <result column="PEOPLE_PHONECHECK" property="peoplePhoneCheck"/><!--
- 用户是否通过电话验证 -->
- <result column="PU_REAL_NAME" property="puRealName"/><!--用户的真实名称 -->
- <result column="PU_ADDRESS" property="puAddress"/><!--用户地址 -->
- <result column="PU_ICON" property="puIcon"/><!-- 用户头像 -->
- <result column="PU_LEVEL" property="puLevel"/><!-- 用户等级 -->
- <result column="PU_LEVEL_NAME" property="puLevelName"/><!-- 等级名称 -->
- <result column="PU_ICON" property="puIcon"/><!-- 用户头像 -->
- <result column="PU_NICKNAME" property="puNickname"/><!--用户昵称 -->
- <result column="PU_SEX" property="puSex"/><!-- 用户性别0.未知;1.男;2.女 -->
- <result column="PU_BIRTHDAY" property="puBirthday"/><!--用户生日 -->
- <result column="PU_CARD" property="puCard"/><!-- 用户身份证号码 -->
- </resultMap>
- <!-- 将实体属性与表字段对接开始 -->
- <resultMap id="resultMap2" type="net.mingsoft.people.bean.PeopleBeanExtension">
- <id column="id" property="id"/><!-- 将实体的ID属性与表的ID字段对接 -->
- <result column="PEOPLE_PHONE" property="peoplePhone"/><!-- 将实体的peoplePhone属性与表的peoplePhone字段对接 -->
- <result column="PEOPLE_NAME" property="peopleName"/><!-- 将实体的peopleName属性与表的peopleName字段对接 -->
- <result column="PEOPLE_PASSWORD" property="peoplePassword"/><!--
- 将实体的PEOPLE_PASSWORD属性与表的peoplePwd字段对接 -->
- <result column="PEOPLE_DATETIME" property="peopleDateTime"/><!--
- 将实体的peopleDateTime属性与表的peopleDateTime字段对接 -->
- <result column="PEOPLE_MAIL" property="peopleMail"/><!-- 用户邮箱 -->
- <result column="PEOPLE_IP" property="peopleIp"/><!-- 用户ip -->
- <result column="PEOPLE_STATE" property="peopleState"/><!-- 用户状态 -->
- <result column="PEOPLE_CODE" property="peopleCode"/><!-- 用户随机码 -->
- <result column="PEOPLE_CODESENDDATE" property="peopleCodeSendDate"/><!--
- 用户随机码发送时间 -->
- <result column="PEOPLE_MAILLCHECK" property="peopleMailCheck"/><!--
- 用户是否通过邮箱验证 -->
- <result column="PEOPLE_PHONECHECK" property="peoplePhoneCheck"/><!--
- 用户是否通过电话验证 -->
- <result column="PU_REAL_NAME" property="puRealName"/><!--用户的真实名称 -->
- <result column="PU_ADDRESS" property="puAddress"/><!--用户地址 -->
- <result column="PU_ICON" property="puIcon"/><!-- 用户头像 -->
- <result column="PU_LEVEL" property="puLevel"/><!-- 用户等级 -->
- <result column="PU_LEVEL_NAME" property="puLevelName"/><!-- 等级名称 -->
- <result column="PU_ICON" property="puIcon"/><!-- 用户头像 -->
- <result column="PU_NICKNAME" property="puNickname"/><!--用户昵称 -->
- <result column="PU_SEX" property="puSex"/><!-- 用户性别0.未知;1.男;2.女 -->
- <result column="PU_BIRTHDAY" property="puBirthday"/><!--用户生日 -->
- <result column="PU_CARD" property="puCard"/><!-- 用户身份证号码 -->
- <result column="COMPANY_NAME" property="companyName" /><!--公司名称 -->
- <result column="POSITION" property="position" /><!--职位 -->
- <result column="INVITATION_CODE" property="invitationCode" /><!--展商邀请码 -->
- <result column="INVITATION_USER_ID" property="invitationUserId" /><!--邀请用户ID -->
- <result column="CHANNEL" property="channel" /><!--了解渠道 -->
- <result column="PURPOSE" property="purpose" /><!--参观目的 -->
- </resultMap>
- <!-- 将实体属性与表字段对接结束 -->
- <sql id="insertColumns">
- <if test="peoplePhone != null">PEOPLE_PHONE,</if>
- <if test="peopleName != null">PEOPLE_NAME,</if>
- <if test="peoplePassword != null">PEOPLE_PASSWORD,</if>
- <if test="peopleDateTime != null">PEOPLE_DATETIME,</if>
- <if test="peopleMail != null">PEOPLE_MAIL,</if>
- <if test="peopleIp != null">PEOPLE_IP,</if>
- <if test="peopleState != null">PEOPLE_STATE,</if>
- <if test="peopleCode != null">PEOPLE_CODE,</if>
- <if test="peopleCodeSendDate != null">PEOPLE_CODESENDDATE,</if>
- <if test="peopleMailCheck != null and peopleMailCheck > -1">PEOPLE_MAILLCHECK,</if>
- <if test="peoplePhoneCheck != null and peoplePhoneCheck > -1">PEOPLE_PHONECHECK,</if>
- </sql>
- <sql id="insertValues">
- <if test="peoplePhone != null">#{peoplePhone},</if>
- <if test="peopleName != null">#{peopleName},</if>
- <if test="peoplePassword != null">#{peoplePassword},</if>
- <if test="peopleDateTime != null">#{peopleDateTime},</if>
- <if test="peopleMail != null">#{peopleMail},</if>
- <if test="peopleIp != null">#{peopleIp},</if>
- <if test="peopleState != null">#{peopleState},</if>
- <if test="peopleCode != null">#{peopleCode},</if>
- <if test="peopleCodeSendDate != null">#{peopleCodeSendDate},</if>
- <if test="peopleMailCheck != null and peopleMailCheck > -1">#{peopleMailCheck},</if>
- <if test="peoplePhoneCheck != null and peoplePhoneCheck > -1">#{peoplePhoneCheck},</if>
- </sql>
- <insert id="saveEntity"
- parameterType="net.mingsoft.base.entity.BaseEntity">
- insert into people
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <include refid="insertColumns"></include>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <include refid="insertValues"></include>
- </trim>
- </insert>
- <!-- 查询用户开始 -->
- <select id="getEntity" resultMap="resultMap" parameterType="String">
- select
- <include refid="column_list" />
- ,p.id,PU_NICKNAME,PU_REAL_NAME
- from people p LEFT JOIN people_user ON
- (p.id = people_user.PEOPLE_ID)
- where
- p.id =
- #{id}
- </select>
- <!-- 查询用户结束 -->
- <!-- 查询用户开始 -->
- <select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.people.entity.PeopleEntity">
- select
- <include refid="column_list" />
- ,PU_NICKNAME,PU_REAL_NAME,p.id
- from people p LEFT JOIN people_user ON
- (p.id = people_user.PEOPLE_ID)
- <where>
- <if test="id != null and id > 0">and p.id=#{id}</if>
- <if test="peopleName != null and peopleName != ''">and PEOPLE_NAME=#{peopleName}</if>
- <if test="peopleMail != null and peopleMail != ''">and PEOPLE_MAIL=#{peopleMail}</if>
- <if test="peoplePhone != null and peoplePhone != ''">and PEOPLE_PHONE=#{peoplePhone}</if>
- <if test="peopleMailCheck != null and peopleMailCheck > -1">and PEOPLE_MAILLCHECK=#{peopleMailCheck}</if>
- </where>
- </select>
- <!-- 查询用户结束 -->
- <sql id="updateEntitySet">
- <if test="peoplePhone != null">PEOPLE_PHONE=#{peoplePhone},</if>
- <if test="peopleName != null and peopleName != ''">PEOPLE_NAME=#{peopleName},</if>
- <if test="peoplePassword != null and peoplePassword != ''">PEOPLE_PASSWORD=#{peoplePassword},</if>
- <if test="peopleDateTime != null ">PEOPLE_DATETIME=#{peopleDateTime},</if>
- <if test="peopleMail != null">PEOPLE_MAIL=#{peopleMail},</if>
- <if test="peopleIp != null and peopleIp != ''">PEOPLE_IP=#{peopleIp},</if>
- <if test="peopleState != null">PEOPLE_STATE=#{peopleState},</if>
- <if test="peopleCode != null and peopleCode != ''">PEOPLE_CODE=#{peopleCode},</if>
- <if test="peopleCodeSendDate != null">PEOPLE_CODESENDDATE=#{peopleCodeSendDate},</if>
- <if test="peopleMailCheck != null and peopleMailCheck > -1">PEOPLE_MAILLCHECK=#{peopleMailCheck},</if>
- <if test="peoplePhoneCheck != null and peoplePhoneCheck > -1">PEOPLE_PHONECHECK=#{peoplePhoneCheck},</if>
- </sql>
- <!-- mysql和oracle更新用户开始 -->
- <update id="updateEntity" parameterType="net.mingsoft.base.entity.BaseEntity">
- update people
- <set>
- <include refid="updateEntitySet" />
- </set>
- where id = #{id}
- </update>
- <!-- 更新用户结束 -->
- <!-- 删除用户开始 -->
- <delete id="deleteEntity" parameterType="int">
- delete from people where
- id = #{id}
- </delete>
- <!-- 删除用户结束 -->
- <!-- 根据用户名(帐号,手机,邮箱)查询用户信息开始 -->
- <select id="getEntityByUserName" resultMap="resultMap">
- select
- <include refid="column_list" />
- ,people.id,<include refid="user_column_list" />
- from people LEFT JOIN people_user ON
- (people.id = people_user.PEOPLE_ID)
- where (people_name=#{userName} or
- (people_phone=#{userName} and PEOPLE_PHONECHECK=1) or
- people_mail=#{userName} and PEOPLE_MAILLCHECK=1)
- </select>
- <!-- 根据用户名(帐号,手机,邮箱)查询用户信息结束 -->
- <select id="getEntityByMailOrPhone" resultMap="resultMap">
- select
- <include refid="column_list" />
- ,people.id,<include refid="user_column_list" />
- from people LEFT JOIN people_user ON
- (people.id = people_user.PEOPLE_ID)
- where people_phone=#{userName} or
- people_mail=#{userName} and PEOPLE_MAILLCHECK=1
- </select>
- <select id="getByPeople" parameterType="net.mingsoft.people.entity.PeopleEntity"
- resultMap="resultMap">
- <if test="people != null">
- select
- <include refid="column_list" />
- ,people.id,<include refid="user_column_list" />
- from people LEFT JOIN people_user ON
- (people.id = people_user.PEOPLE_ID)
- <trim prefix="WHERE" prefixOverrides="AND|OR">
- <trim prefix="and (" prefixOverrides="AND|OR" suffix=")" >
- <if test="people.peopleName != null">
- or people_name = #{people.peopleName}
- </if>
- <if test="people.peopleMail != null and people.peopleMail != '' ">
- or (people_mail = #{people.peopleMail} and
- PEOPLE_MAILLCHECK=1
- )
- </if>
- <if test="people.peoplePhone !=null and people.peoplePhone != '' ">
- or (people_phone = #{people.peoplePhone} and
- PEOPLE_PHONECHECK=1)
- </if>
- </trim>
- </trim>
- </if>
- </select>
- <!-- 查询用户列表开始 -->
- <select id="query" resultMap="resultMap">
- select
- <include refid="column_list" />
- ,p.id,<include refid="user_column_list" />
- from people p left join people_user on
- p.id=PEOPLE_ID
- <where>
- <if test="where!=null">
- <if test="where.peopleName != null and where.peopleName!=''">
- and PEOPLE_NAME=#{where.peopleName}
- </if>
- <!-- 用户审核状态 -->
- <if test="where.peopleState!=null and where.peopleState > -1">
- and PEOPLE_STATE=#{where.peopleState}
- </if>
- <!-- 根据用户注册时间 <if test="people.peopleDateStartTime !=null "> </if> -->
- <!-- 根据用户昵称 -->
- <if test="where.puNickname !=null and where.puNickname!=''">
- and PU_NICKNAME=#{where.puNickname}
- </if>
- <!-- 根据用户性别 -->
- <if
- test="where.puSex != null and where.puSex > -1 ">
- and PU_SEX=#{where.puSex}
- </if>
- <!-- 根据用户真实姓名 -->
- <if
- test="where.puRealName != null and where.puRealName !=''">
- and PU_REAL_NAME=#{where.puRealName}
- </if>
- <if test="where.peopleDateStartTime != null and where.peopleDateEndTime !=null ">
- <if test="_databaseId == 'mysql'">
- and (PEOPLE_DATETIME between
- #{where.peopleDateStartTime} and #{where.peopleDateEndTime})
- </if>
- <if test="_databaseId == 'oracle'">
- and PEOPLE_DATETIME > to_date(#{where.peopleDateStartTime}, 'yyyy-mm-dd hh24:mi:ss')
- and PEOPLE_DATETIME < to_date(#{where.peopleDateEndTime}, 'yyyy-mm-dd hh24:mi:ss')
- </if>
- </if>
- <if test="where.peopleId != null and where.peopleId !=''">
- and p.id=#{where.peopleId}
- </if>
- <if test="where.peopleMail != null and where.peopleMail !=''">
- and p.PEOPLE_MAIL=#{where.peopleMail}
- </if>
- <if test="where.peoplePhone != null and where.peoplePhone !=''">
- and p.PEOPLE_PHONE=#{where.peoplePhone}
- </if>
- </if>
- </where>
- order by p.PEOPLE_DATETIME desc
- </select>
- <!-- 查询用户列表结束 -->
- <!-- 查询用户列表开始 -->
- <select id="query2" resultMap="resultMap2">
- select
- <include refid="column_list" />
- ,p.id,<include refid="user_column_list" />
- ,e.INVITATION_CODE,
- e.CHANNEL,
- e.INVITATION_USER_ID,
- e.POSITION,
- e.COMPANY_NAME,
- e.PURPOSE
- from people p left join people_user on p.id=PEOPLE_ID
- left join mdiy_model_people_info e on e.LINK_ID=p.id
- <where>
- <if test="where!=null">
- <if test="where.peopleName != null and where.peopleName!=''">
- and PEOPLE_NAME like CONCAT(CONCAT('%',#{where.peopleName}),'%')
- </if>
- <!-- 用户审核状态 -->
- <if test="where.peopleState!=null and where.peopleState > -1">
- and PEOPLE_STATE=#{where.peopleState}
- </if>
- <!-- 根据用户注册时间 <if test="people.peopleDateStartTime !=null "> </if> -->
- <!-- 根据用户昵称 -->
- <if test="where.puNickname !=null and where.puNickname!=''">
- and PU_NICKNAME like CONCAT(CONCAT('%',#{where.puNickname}),'%')
- </if>
- <!-- 根据用户性别 -->
- <if
- test="where.puSex != null and where.puSex > -1 ">
- and PU_SEX=#{where.puSex}
- </if>
- <!-- 根据用户真实姓名 -->
- <if
- test="where.puRealName != null and where.puRealName !=''">
- and PU_REAL_NAME like CONCAT(CONCAT('%',#{where.puRealName}),'%')
- </if>
- <if test="where.peopleDateStartTime != null and where.peopleDateEndTime !=null ">
- <if test="_databaseId == 'mysql'">
- and (PEOPLE_DATETIME between
- #{where.peopleDateStartTime} and #{where.peopleDateEndTime})
- </if>
- <if test="_databaseId == 'oracle'">
- and PEOPLE_DATETIME > to_date(#{where.peopleDateStartTime}, 'yyyy-mm-dd hh24:mi:ss')
- and PEOPLE_DATETIME < to_date(#{where.peopleDateEndTime}, 'yyyy-mm-dd hh24:mi:ss')
- </if>
- </if>
- <if test="where.peopleId != null and where.peopleId !=''">
- and p.id=#{where.peopleId}
- </if>
- <if test="where.peopleMail != null and where.peopleMail !=''">
- and p.PEOPLE_MAIL=#{where.peopleMail}
- </if>
- <if test="where.peoplePhone != null and where.peoplePhone !=''">
- and p.PEOPLE_PHONE=#{where.peoplePhone}
- </if>
- <if test="where.companyName != null and where.companyName !=''">
- and e.COMPANY_NAME like CONCAT(CONCAT('%',#{where.companyName}),'%')
- </if>
- <if test="where.position != null and where.position !=''">
- and e.POSITION like CONCAT(CONCAT('%',#{where.position}),'%')
- </if>
- <if test="where.channel != null and where.channel !=''">
- and e.CHANNEL=#{where.channel}
- </if>
- <if test="where.purpose != null and where.purpose !=''">
- and e.PURPOSE=#{where.purpose}
- </if>
- </if>
- </where>
- order by p.PEOPLE_DATETIME desc
- </select>
- <!-- 查询用户列表结束 -->
- <!-- 根据应用ID查询用户总数结束 -->
- <!-- 根据用户名(帐号,手机,邮箱)和验证码查询用户信息开始 -->
- <select id="getEntityByCode" resultMap="resultMap">
- select
- <include refid="column_list" />,p.id
- from people p
- where (people_name=#{userName} or
- people_phone=#{userName} or
- people_mail=#{userName}) and
- people_code=#{peopleCode}
- </select>
- <select id="getPeopleById" resultMap="resultMap">
- select
- <include refid="column_list" />
- ,p.id,<include refid="user_column_list" />
- from people p left join people_user on
- p.id=PEOPLE_ID where p.id = #{id}
- </select>
- <!-- 根据用户名(帐号,手机,邮箱)和验证码用户信息结束 -->
- <!-- 批量删除用户开始 -->
- <delete id="delete" parameterType="java.lang.String">
- delete from people
- <where>
- id in
- <foreach collection="ids" item="item" index="index"
- open="(" separator="," close=")">#{item}</foreach>
- </where>
- </delete>
- <!-- 批量删除用户结束 -->
- </mapper>
|