|
|
|
<?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="com.msdw.tms.dao.UserInfoDao">
|
|
|
|
|
|
|
|
<insert id="add" useGeneratedKeys="true" keyProperty="userId" keyColumn="userId">
|
|
|
|
insert into hr_user_info(
|
|
|
|
userName, uniqueIdentificationAccount, provinceId,
|
|
|
|
cityId, schoolId, phone,account,password,roleId,schoolId,creationTime)
|
|
|
|
values(
|
|
|
|
#{userName}, #{uniqueIdentificationAccount}, #{provinceId},
|
|
|
|
#{cityId}, #{schoolId},#{phone}, #{account},#{password},#{roleId},#{schoolId},now())
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="userInfupdateUserInfoById" parameterType="com.msdw.tms.entity.UserInfoEntity">
|
|
|
|
update hr_user_info
|
|
|
|
<set>
|
|
|
|
<if test="account!= null and account != '' ">
|
|
|
|
account = #{account},
|
|
|
|
</if>
|
|
|
|
<if test="countries!= null and countries != '' ">
|
|
|
|
countries = #{countries},
|
|
|
|
</if>
|
|
|
|
<if test="cityId!= null">
|
|
|
|
cityId = #{cityId},
|
|
|
|
</if>
|
|
|
|
<if test="dateBirth != null">
|
|
|
|
dateBirth = #{dateBirth},
|
|
|
|
</if>
|
|
|
|
<if test="documenttype != null">
|
|
|
|
documenttype = #{documenttype},
|
|
|
|
</if>
|
|
|
|
<if test="educationDegree != null">
|
|
|
|
educationDegree = #{educationDegree},
|
|
|
|
</if>
|
|
|
|
<if test="idNumber != null">
|
|
|
|
IDNumber = #{idNumber},
|
|
|
|
</if>
|
|
|
|
<if test="provinceId != null">
|
|
|
|
provinceId = #{provinceId},
|
|
|
|
</if>
|
|
|
|
<if test="sex != null">
|
|
|
|
sex = #{sex},
|
|
|
|
</if>
|
|
|
|
<if test="userName != null">
|
|
|
|
userName = #{userName},
|
|
|
|
</if>
|
|
|
|
<if test="schoolId != null">
|
|
|
|
schoolId = #{schoolId},
|
|
|
|
</if>
|
|
|
|
<if test="phone !=null">
|
|
|
|
phone = #{phone}
|
|
|
|
</if>
|
|
|
|
</set>
|
|
|
|
WHERE userId = #{userId};
|
|
|
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<select id="queryUserPassword" resultType="string">
|
|
|
|
SELECT `password` FROM hr_user_info WHERE userId = #{userId}
|
|
|
|
</select>
|
|
|
|
<select id="queryStudentAccount" resultType="com.msdw.tms.entity.StudentEntity">
|
|
|
|
SELECT
|
|
|
|
account
|
|
|
|
FROM
|
|
|
|
hr_user_info
|
|
|
|
WHERE
|
|
|
|
account = #{account}
|
|
|
|
and
|
|
|
|
schoolId = #{schoolId}
|
|
|
|
</select>
|
|
|
|
<select id="queryStudentPhone" resultType="com.msdw.tms.entity.StudentEntity">
|
|
|
|
SELECT
|
|
|
|
phone
|
|
|
|
FROM
|
|
|
|
hr_user_info
|
|
|
|
WHERE
|
|
|
|
phone = #{phone}
|
|
|
|
and
|
|
|
|
schoolId = #{schoolId}
|
|
|
|
</select>
|
|
|
|
<select id="queryPhone" resultType="java.lang.Integer">
|
|
|
|
SELECT
|
|
|
|
userId
|
|
|
|
FROM
|
|
|
|
hr_user_info
|
|
|
|
WHERE
|
|
|
|
phone = #{phone}
|
|
|
|
and
|
|
|
|
isdel = 0
|
|
|
|
</select>
|
|
|
|
<select id="queryAccount" resultType="com.msdw.tms.entity.vo.StaffVo">
|
|
|
|
SELECT
|
|
|
|
roleId
|
|
|
|
FROM
|
|
|
|
hr_user_info
|
|
|
|
WHERE
|
|
|
|
account = #{account}
|
|
|
|
and
|
|
|
|
isdel = 0
|
|
|
|
</select>
|
|
|
|
<select id="queryAccountUpdate" resultType="com.msdw.tms.entity.vo.StaffVo">
|
|
|
|
SELECT
|
|
|
|
roleId
|
|
|
|
FROM
|
|
|
|
hr_user_info
|
|
|
|
WHERE
|
|
|
|
userId = #{userId}
|
|
|
|
and
|
|
|
|
isdel = 0
|
|
|
|
</select>
|
|
|
|
<select id="queryUserInfo" resultType="com.msdw.tms.entity.vo.StaffVo">
|
|
|
|
SELECT
|
|
|
|
*
|
|
|
|
FROM
|
|
|
|
hr_user_info u,
|
|
|
|
staff s
|
|
|
|
WHERE
|
|
|
|
u.userId = s.userId
|
|
|
|
AND u.account = #{account} and u.phone = #{phone} and s.workNumber = #{workNumber}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<insert id="saveUserInfo" useGeneratedKeys="true" keyProperty="userId" keyColumn="userId">
|
|
|
|
INSERT INTO hr_user_info ( userName,email,phone,uniqueIdentificationAccount, schoolId, account,password, roleId,isdel,creationTime)
|
|
|
|
VALUES
|
|
|
|
( #{userName},#{email},#{phone},#{uniqueIdentificationAccount}, #{schoolId}, #{account}, #{password}, 4 ,0,now())
|
|
|
|
</insert>
|
|
|
|
<!-- <insert id="bacthAddStudents">-->
|
|
|
|
<!-- insert into hr_user_info(-->
|
|
|
|
<!-- userName, uniqueIdentificationAccount, schoolId, phone,account,password,roleId, schoolAppellationId,creationTime)-->
|
|
|
|
<!-- values-->
|
|
|
|
<!-- <foreach collection ="list" item="studentVo" index= "index" separator =",">-->
|
|
|
|
<!-- (#{studentVo.userName}, #{studentVo.uniqueIdentificationAccount},#{studentVo.schoolId},-->
|
|
|
|
<!-- #{studentVo.phone}, #{studentVo.account},#{studentVo.password},#{studentVo.roleId},-->
|
|
|
|
<!-- (SELECT schoolId FROM school WHERE schoolName = #{studentVo.schoolAppellationName}),now())-->
|
|
|
|
<!-- </foreach>-->
|
|
|
|
<!-- </insert>-->
|
|
|
|
<insert id="batchSaveUserInfo" useGeneratedKeys="true" keyProperty="userId" keyColumn="userId">
|
|
|
|
insert into hr_user_info(
|
|
|
|
userName, uniqueIdentificationAccount, phone,account,password,roleId, schoolId,creationTime)
|
|
|
|
values
|
|
|
|
(#{userName}, #{uniqueIdentificationAccount},
|
|
|
|
#{phone}, #{account},#{password},#{roleId},
|
|
|
|
(SELECT schoolId FROM school WHERE schoolName = #{schoolAppellationName}),now())
|
|
|
|
</insert>
|
|
|
|
<insert id="addUserinfo" useGeneratedKeys="true" keyProperty="userId" keyColumn="userId">
|
|
|
|
INSERT INTO hr_user_info ( account, userName, roleId, phone, email, uniqueIdentificationAccount, schoolId,creationTime,password)
|
|
|
|
VALUES
|
|
|
|
(#{account},#{userName},#{roleId},#{phone},#{email},#{uniqueIdentificationAccount},#{schoolId},now(),#{password})
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="initialPassword">
|
|
|
|
UPDATE
|
|
|
|
hr_user_info
|
|
|
|
SET
|
|
|
|
password = #{password}
|
|
|
|
WHERE
|
|
|
|
userId = #{userId}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<update id="disableAccount">
|
|
|
|
UPDATE
|
|
|
|
student stu,
|
|
|
|
hr_user_info u
|
|
|
|
SET
|
|
|
|
u.disableAccount = #{disableAccount}
|
|
|
|
WHERE
|
|
|
|
stu.studentId = #{studentId}
|
|
|
|
AND
|
|
|
|
stu.userId = u.userId
|
|
|
|
</update>
|
|
|
|
<update id="updateUserInfo">
|
|
|
|
UPDATE hr_user_info
|
|
|
|
<set>
|
|
|
|
<if test="account!= null and account != '' ">
|
|
|
|
account = #{account},
|
|
|
|
</if>
|
|
|
|
<if test="userName != null">
|
|
|
|
userName = #{userName},
|
|
|
|
</if>
|
|
|
|
<if test="phone !=null">
|
|
|
|
phone = #{phone},
|
|
|
|
</if>
|
|
|
|
<if test="email !=null">
|
|
|
|
email = #{email},
|
|
|
|
</if>
|
|
|
|
<if test="schoolAppellationId !=null">
|
|
|
|
schoolId = #{schoolAppellationId},
|
|
|
|
</if>
|
|
|
|
<if test="roleId !=null">
|
|
|
|
roleId = #{roleId}
|
|
|
|
</if>
|
|
|
|
</set>
|
|
|
|
WHERE userId = #{userId};
|
|
|
|
</update>
|
|
|
|
<update id="setNUM">
|
|
|
|
UPDATE hr_user_info u
|
|
|
|
SET
|
|
|
|
u.account = '00',u.phone = null
|
|
|
|
WHERE userId = #{userId}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<select id="queryPersonalFileES" parameterType="com.msdw.tms.entity.UserPersonalFileEntity"
|
|
|
|
resultType="hashMap">
|
|
|
|
SELECT
|
|
|
|
personalFileId,
|
|
|
|
schoolId,
|
|
|
|
schoolName,
|
|
|
|
disciplineId,
|
|
|
|
disciplineName,
|
|
|
|
professionalClassId,
|
|
|
|
professionalClassName,
|
|
|
|
professionalId,
|
|
|
|
professionalName,
|
|
|
|
personalCareerId
|
|
|
|
FROM
|
|
|
|
hr_personal_file
|
|
|
|
WHERE
|
|
|
|
userId = #{userId}
|
|
|
|
</select>
|
|
|
|
<select id="queryPersonalInfo" parameterType="com.msdw.tms.entity.UserInfoEntity"
|
|
|
|
resultType="hashMap">
|
|
|
|
SELECT
|
|
|
|
u.userId,
|
|
|
|
userName,
|
|
|
|
u.sex,
|
|
|
|
u.email,
|
|
|
|
u.phone,
|
|
|
|
u.account,
|
|
|
|
u.countries,
|
|
|
|
c.cityId,
|
|
|
|
c.cityName,
|
|
|
|
u.dateBirth,
|
|
|
|
u.weChatID,
|
|
|
|
u.IDNumber,
|
|
|
|
u.documentType,
|
|
|
|
u.educationDegree,
|
|
|
|
pro.provinceId,
|
|
|
|
pro.provinceName,
|
|
|
|
s.schoolId,
|
|
|
|
s.schoolName
|
|
|
|
FROM
|
|
|
|
hr_user_info u,
|
|
|
|
school s,
|
|
|
|
city c,
|
|
|
|
province pro
|
|
|
|
WHERE
|
|
|
|
u.provinceId = pro.provinceId
|
|
|
|
AND u.schoolId = s.schoolId
|
|
|
|
AND u.cityId = c.cityId
|
|
|
|
AND u.isdel = 0
|
|
|
|
AND u.provinceId = c.provinceId
|
|
|
|
AND u.userId = #{userid}
|
|
|
|
AND pro.isdel = 0
|
|
|
|
AND c.isdel = 0
|
|
|
|
AND s.isdel = 0
|
|
|
|
</select>
|
|
|
|
<select id="queryEmail" resultType="java.lang.Integer">
|
|
|
|
select useId from hr_user_info where email = #{email}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
</mapper>
|