BookRelMapper.xml 2.32 KB
<?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.qgutech.qgyun.zxm.mapper.BookRelMapper">
  <resultMap id="bookRelMap" type="com.qgutech.qgyun.zxm.model.BookRel">
      <result column="id" property="id"/>
      <result column="refer_id" property="referId"/>
      <result column="fun_code" property="funCode"/>
      <result column="field_name" property="fieldName"/>
      <result column="book_id" property="bookId"/>
      <result column="corp_code" property="corpCode"/>
      <result column="created_at" property="createdAt"/>
      <result column="updated_at" property="updatedAt"/>
      <result column="created_by" property="createdBy"/>
      <result column="updated_by" property="updatedBy"/>
  </resultMap>
    <sql id="tableName">t_auto_zxm_book_rel bookRel</sql>
    <sql id="condition">
        <if test="con.id != null and con.id != ''">
         	and bookRel.id = #{con.id}
        </if>
        <if test="con.referId != null and con.referId != ''">
         	and bookRel.refer_id = #{con.referId}
        </if>
        <if test="con.funCode != null and con.funCode != ''">
         	and bookRel.fun_code = #{con.funCode}
        </if>
        <if test="con.fieldName != null and con.fieldName != ''">
         	and bookRel.field_name = #{con.fieldName}
        </if>
        <if test="con.bookId != null and con.bookId != ''">
         	and bookRel.book_id = #{con.bookId}
        </if>
        <if test="con.corpCode != null and con.corpCode != ''">
         	and bookRel.corp_code = #{con.corpCode}
        </if>
        <if test="con.createdAt != null"> 
         	and bookRel.created_at = #{con.createdAt}
        </if>
        <if test="con.updatedAt != null"> 
         	and bookRel.updated_at = #{con.updatedAt}
        </if>
        <if test="con.createdBy != null and con.createdBy != ''">
         	and bookRel.created_by = #{con.createdBy}
        </if>
        <if test="con.updatedBy != null and con.updatedBy != ''">
         	and bookRel.updated_by = #{con.updatedBy}
        </if>
    </sql>

    <select id="search" resultMap="bookRelMap">
        select bookRel.*
        from <include refid="tableName"/>
        WHERE 1=1 <include refid="condition"/>
        order by bookRel.created_at DESC
    </select>
</mapper>