<?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.newfiber.api.pc.dao.PlanNewMapper"> <!-- 通用查询映射结果 --> <resultMap type="com.newfiber.api.pc.model.entity.PlanNew" id="PlanNewResult"> <result property="id" column="id"/> <result property="planName" column="plan_name"/> <result property="planType" column="plan_type"/> <result property="planFile" column="plan_file"/> <result property="remark" column="remark"/> <result property="status" column="status"/> <result property="delFlag" column="del_flag"/> <result property="createBy" column="create_by"/> <result property="createTime" column="create_time"/> <result property="updateBy" column="update_by"/> <result property="updateTime" column="update_time"/> <result property="planTypeName" column="plan_type_name"/> </resultMap> <!-- 通用查询结果列 --> <sql id="Base_Column_List"> t.id , t.plan_name , t.plan_type , t.plan_file , t.remark , t.status , t.del_flag , t.create_by , t.create_time , t.update_by , t.update_time , mptn.name as plan_type_name </sql> <sql id="Where_Condition"> <if test="request.planName != null and request.planName != ''"> and t.plan_name = #{request.planName} </if> <if test="request.planType != null and request.planType != ''"> and t.plan_type = #{request.planType} </if> <if test="request.planFile != null and request.planFile != ''"> and t.plan_file = #{request.planFile} </if> <if test="request.status != null and request.status != ''"> and t.status = #{request.status} </if> </sql> <sql id="Join_Table"> left join meet_plan_type_new mptn on mptn.code = t.plan_type </sql> <select id="selectByCondition" resultMap="PlanNewResult"> select <include refid="Base_Column_List"/> from meet_plan_new t <include refid="Join_Table"/> where t.del_flag = 0 <include refid="Where_Condition"/> order by t.${request.orderBy} </select> <select id="selectOneById" resultMap="PlanNewResult"> select <include refid="Base_Column_List"/> from meet_plan_new t <include refid="Join_Table"/> where t.id = #{id} and t.del_flag = 0 </select> <select id="selectPlanType" resultType="com.newfiber.api.pc.model.entity.PlanTypeNew"> select t.id ,t.code ,t.name from meet_plan_type_new t </select> </mapper>