<?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">
<!--
  {{ModuleName}} Mapper — {{moduleName}} 表的 MyBatis XML 映射文件。
  请按项目规范补齐查询方法与结果映射。
-->
<mapper namespace="{{basePackage}}.mapper.{{ModuleName}}Mapper">

    <!-- 结果映射 -->
    <resultMap id="BaseResultMap" type="{{basePackage}}.entity.{{ModuleName}}">
        <!-- 请补齐字段映射 -->
    </resultMap>

    <!-- 按主键查询 -->
    <select id="selectById" parameterType="long" resultMap="BaseResultMap">
        SELECT * FROM {{table_name}} WHERE id = #{id}
    </select>

    <!-- 按条件分页查询 -->
    <select id="selectByCondition" parameterType="map" resultMap="BaseResultMap">
        SELECT * FROM {{table_name}}
        <where>
            <if test="status != null">AND status = #{status}</if>
        </where>
        ORDER BY id DESC
    </select>

</mapper>
