Files
ks/ruoyi-bussiness/src/main/resources/mapper/app/AppUserMapper.xml
2025-10-22 17:18:47 +08:00

107 lines
6.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="com.ruoyi.cms.mapper.AppUserMapper">
<resultMap type="AppUser" id="AppUserResult">
<result property="userId" column="user_id" />
<result property="name" column="name" />
<result property="age" column="age" />
<result property="sex" column="sex" />
<result property="birthDate" column="birth_date" />
<result property="education" column="education" />
<result property="politicalAffiliation" column="political_affiliation" />
<result property="phone" column="phone" />
<result property="avatar" column="avatar" />
<result property="salaryMin" column="salary_min" />
<result property="salaryMax" column="salary_max" />
<result property="area" column="area" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="loginIp" column="login_ip" />
<result property="loginDate" column="login_date" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="jobTitleId" column="job_title_id" />
<result property="isRecommend" column="is_recommend" />
<result property="idCard" column="id_card" />
<result property="workExperience" column="work_experience" />
</resultMap>
<sql id="selectAppUserVo">
select user_id, name, age, sex, birth_date, education, political_affiliation, phone, avatar, salary_min, salary_max, area, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark,job_title_id,is_recommend,id_card,work_experience from app_user
</sql>
<select id="selectAppUserList" parameterType="AppUser" resultMap="AppUserResult">
<include refid="selectAppUserVo"/>
<where> del_flag = '0'
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="age != null and age != ''"> and age = #{age}</if>
<if test="sex != null and sex != ''"> and sex = #{sex}</if>
<if test="birthDate != null "> and birth_date = #{birthDate}</if>
<if test="education != null and education != ''"> and education = #{education}</if>
<if test="politicalAffiliation != null and politicalAffiliation != ''"> and political_affiliation = #{politicalAffiliation}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="avatar != null and avatar != ''"> and avatar = #{avatar}</if>
<if test="salaryMin != null and salaryMin != ''"> and salary_min = #{salaryMin}</if>
<if test="salaryMax != null and salaryMax != ''"> and salary_max = #{salaryMax}</if>
<if test="area != null and area != ''"> and area = #{area}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="loginIp != null and loginIp != ''"> and login_ip = #{loginIp}</if>
<if test="loginDate != null "> and login_date = #{loginDate}</if>
<if test="experience != null "> and experience = #{experience}</if>
<if test="idCard != null and idCard != ''"> and id_card like concat('%', CAST(#{idCard} AS VARCHAR), '%')</if>
</where>
</select>
<select id="selectByJobId" resultType="com.ruoyi.common.core.domain.entity.AppUser" parameterType="java.lang.Long">
SELECT * FROM app_user WHERE user_id IN (
select DISTINCT au.USER_ID from APP_USER au
INNER JOIN JOB_APPLY ja ON ja.USER_ID = au.USER_ID
WHERE au.DEL_FLAG = '0' AND ja.DEL_FLAG = '0' AND ja.JOB_Id = #{jobId})
</select>
<select id="selectByOpenid" resultType="com.ruoyi.common.core.domain.entity.AppUser">
<include refid="selectAppUserVo"/> WHERE DEL_FLAG = '0' and openid=#{openid} LIMIT 1
</select>
<insert id="insertSysUserRole" parameterType="java.util.Map">
insert into sys_user_role (user_id,role_id) values (#{userId},#{roleId})
</insert>
<insert id="insertSysUser" parameterType="com.ruoyi.common.core.domain.entity.SysUser" useGeneratedKeys="true" keyProperty="userId">
insert into sys_user(
<if test="userId != null and userId != 0">user_id,</if>
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="nickName != null and nickName != ''">nick_name,</if>
<if test="email != null and email != ''">email,</if>
<if test="avatar != null and avatar != ''">avatar,</if>
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
<if test="sex != null and sex != ''">sex,</if>
<if test="password != null and password != ''">password,</if>
<if test="status != null and status != ''">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
create_time
)values(
<if test="userId != null and userId != ''">#{userId},</if>
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="nickName != null and nickName != ''">#{nickName},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="avatar != null and avatar != ''">#{avatar},</if>
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
<if test="sex != null and sex != ''">#{sex},</if>
<if test="password != null and password != ''">#{password},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
sysdate()
)
</insert>
</mapper>