不要进来看,这只是我为了以后方便复制,拿过来的myBatis的Mapper.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="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  #单位必须大写MB或不写(即为B)
      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
mybatis:
    # 搜索指定包别名
    typeAliasesPackage: cn.edu.imau.zy
    # 配置mapper的扫描,找到所有的mapper.xml映射文件
    mapperLocations: classpath*:mapper/**/*Mapper.xml
mapper:
  not-empty: true
  identity: MYSQL

# PageHelper分页插件
pagehelper: 
  helperDialect: mysql
  reasonable: true
  supportMethodsArguments: true
  params: count=countSql
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

殷丿grd_志鹏

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值