<?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.hssx.pcbms.mapper.OperateRecordMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hssx.pcbms.entity.OperateRecord">
        <id column="id" property="id" />
        <result column="model_no" property="modelNo" />
        <result column="user_id" property="userId" />
        <result column="user_name" property="userName" />
        <result column="indate" property="indate" />
        <result column="content" property="content" />
        <result column="good_id" property="goodId" />
        <result column="good_no_id" property="goodNoId" />
        <result column="good_state" property="goodState" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, model_no, user_id, user_name, indate, content, good_id, good_no_id, good_state
    </sql>

    <resultMap id="BaseResultMapVO" type="com.hssx.pcbms.entity.vo.OperateRecordVO">
        <result column="model_no" property="modelNo" />
        <result column="oid" property="id" />
        <result column="uid" property="userId" />
        <result column="user_name" property="userName" />
        <result column="oindate" property="indate" />
        <result column="content" property="content" />
        <result column="good_id" property="goodId" />
        <result column="good_no_id" property="goodNoId" />
        <result column="good_state" property="goodState" />
    </resultMap>

    <select id="selectCondition" resultMap="BaseResultMapVO">
    select
        ore.model_no,
        ore.id oid, ore.user_id uid, ore.user_name, ore.indate oindate,
        ore.content, ore.good_id, ore.good_no_id, ore.good_state
    from
        operate_record ore
    where
        ore.good_id = #{goods.id}
    order by ore.indate desc
</select>

</mapper>
