<?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.edu.imau.zy.online_education.mapper.OeUserMapper">
<resultMap type="OeUser" id="OeUserResult">
<result property="id" column="id" />
<result property="jobNumber" column="job_number" />
<result property="studentNumber" column="student_number" />
<result property="userName" column="user_name" />
<result property="phoneNum" column="phone_num" />
<result property="level" column="level" />
<result property="description" column="description" />
<result property="avatar" column="avatar" />
<result property="gmtCreate" column="gmt_create" />
<result property="gmtModified" column="gmt_modified" />
</resultMap>
<sql id="selectOeUserVo">
select id, job_number, student_number, user_name, phone_num, level, description, avatar, gmt_create, gmt_modified from oe_user
</sql>
<select id="selectOeUserList" parameterType="OeUser" resultMap="OeUserResult">
<include refid="selectOeUserVo"/>/*引入公共头*/
<where>
<trim>
<if test="jobNumber != null and jobNumber != ''">and job_number = #{jobNumber}</if>
<if test="studentNumber != null and studentNumber != ''">student_number = #{studentNumber}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="phoneNum != null and phoneNum != ''">phone_num = #{phoneNum}</if>
<if test="level != null and level != ''">level = #{level}</if>
<if test="description != null and description != ''">description = #{descrition}</if>
</trim>
</where>
</select>
<select id="selectOeUserById" parameterType="Long" resultMap="OeUserResult">
<include refid="selectOeUserVo"/>
where id = #{id}
</select>
<select id="selectOurSchoolStudent" resultMap="OeUserResult">
<include refid="selectOeUserVo"/>
where student_number is not null
</select>
<select id="selectOurSchoolTeacher" resultMap="OeUserResult">
<include refid="selectOeUserVo"/>
where job_number is not null
</select>
<select id="selectCommonUser" resultMap="OeUserResult">
<include refid="selectOeUserVo"/>
where job_number is null and student_number is null
</select>
<insert id="insertOeUser" parameterType="OeUser">
insert into oe_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null ">id,</if>
<if test="jobNumber != null and jobNumber != ''">job_number,</if>
<if test="studentNumber != null and studentNumber != ''">student_number,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="phoneNum != null and phoneNum != ''">phone_num,</if>
<if test="level != null and level != ''">level,</if>
<if test="description != null and description != ''">description,</if>
<if test="avatar != null and avatar != ''">avatar,</if>
<if test="gmtCreate != null ">gmt_create,</if>
<if test="gmtModified != null ">gmt_modified,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null ">#{id},</if>
<if test="jobNumber != null and jobNumber != ''">#{jobNumber},</if>
<if test="studentNumber != null and studentNumber != ''">#{studentNumber},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="phoneNum != null and phoneNum != ''">#{phoneNum},</if>
<if test="level != null and level != ''">#{level},</if>
<if test="description != null and description != ''">#{description},</if>
<if test="avatar != null and avatar != ''">#{avatar},</if>
<if test="gmtCreate != null ">#{gmtCreate},</if>
<if test="gmtModified != null ">#{gmtModified},</if>
</trim>
</insert>
<update id="updateOeUser" parameterType="OeUser">
update oe_user
<trim prefix="SET" suffixOverrides=",">
<if test="jobNumber != null and jobNumber != ''">job_number = #{jobNumber},</if>
<if test="studentNumber != null and studentNumber != ''">student_number = #{studentNumber},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="phoneNum != null and phoneNum != ''">phone_num = #{phoneNum},</if>
<if test="level != null and level != ''">level = #{level},</if>
<if test="description != null and description != ''">description = #{description},</if>
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
<if test="gmtCreate != null ">gmt_create = #{gmtCreate},</if>
<if test="gmtModified != null ">gmt_modified = #{gmtModified},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteOeUserById" parameterType="Long">
delete from oe_user where id = #{id}
</delete>
<delete id="deleteOeUserByIds" parameterType="String">
delete from oe_user where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
server:
port: 0
logging:
level:
cn.edu.imau.zy: debug
org.springframework: warn
com.alibaba.nacos.client.naming: error
spring:
application:
name: xsc-online-education
profiles:
active: dev
devtools:
restart:
enabled: true
main:
allow-bean-definition-overriding: true
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
servlet:
multipart:
maxFileSize: 5MB
maxRequestSize: 10MB
cloud:
nacos:
config:
server-addr: 127.0.0.1:8848
file-extension: yml
discovery:
server-addr: 127.0.0.1:8848
management:
endpoints:
web:
exposure:
include: '*'
ribbon:
ReadTimeout: 10000
ConnectTimeout: 10000
mybatis:
typeAliasesPackage: cn.edu.imau.zy
mapperLocations: classpath*:mapper/**/*Mapper.xml
mapper:
not-empty: true
identity: MYSQL
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countSql