target/classes/mapper/EmpMapper.xml

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?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.xtu.hrms.mapper.EmpMapper">
<!--    resultMap:自定义结果集映射规则-->
<!--    自定义某个javaBean的封装规则
        type 自定义规则的Java类型  id 唯一id方便使用
-->
    <resultMap id="MyEmp" type="com.xtu.hrms.bean.Emp">
<!--         指定主键列的封装规则  column:指定哪一列 property:指定对于的javaBean属性-->
<!--        id 定义主键-->
        <id column="id" property="id"/>
<!--        result 定义普通列封装规则-->
        <result column="name" property="name"/>
<!--        其他不指定的列会自动封装,推荐全写-->
        <result column="age" property="age"/>
        <result column="gender" property="gender"/>
        <result column="birthday" property="birthday"/>
        <result column="IDCard" property="IDCard"/>
        <result column="wedlock" property="wedlock"/>
        <result column="nationId" property="nationId"/>
        <result column="nativePlace" property="nativePlace"/>
        <result column="email" property="email"/>
        <result column="phone" property="phone"/>
        <result column="address" property="address"/>
        <result column="deptId" property="deptId"/>
        <result column="posId" property="posId"/>
        <result column="degree" property="degree"/>
        <result column="school" property="school"/>
        <result column="edate" property="edate"/>
        <result column="workState" property="workState"/>
        <result column="workID" property="workID"/>
        <result column="conversionTime" property="conversionTime"/>
        <result column="workAge" property="workAge"/>
        <result column="notWorkDate" property="notWorkDate"/>
<!--        联合查询,级联属性封装结果集-->
<!--        <result column="did" property="dept.id"/>-->
<!--        <result column="deptname" property="dept.name"/>-->
<!--        association可以指定联合的javaBean对象
            property="dept"指定哪个属性是联合的对象
            javaType指定这个属性对象的类型
-->
<!--        使用association定义关联的单个对象封装规则-->
        <association property="dept" javaType="com.xtu.hrms.bean.Dept">
            <id column="did" property="id"/>
            <result column="deptname" property="name"/>
        </association>
        <association property="position" javaType="com.xtu.hrms.bean.Position">
            <id column="pid" property="id"/>
            <result column="posname" property="name"/>
        </association>
    </resultMap>

    <select id="getEmpById" resultType="com.xtu.hrms.bean.Emp">
        select * from emp where id=#{id}
    </select>

    <select id="findNormalUser" resultType="com.xtu.hrms.bean.Emp">
        select * from emp where name = #{name} and password=#{password}
后面还有 79 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。