TCmsPostMapper.xml 1.1 KB

1234567891011121314151617181920212223242526
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.sooka.mybatis.mapper.TCmsPostMapper">
  4. <resultMap id="BaseResultMap" type="com.sooka.mybatis.model.TCmsPost">
  5. <id column="post_id" jdbcType="BIGINT" property="id" />
  6. <result column="post_name" jdbcType="VARCHAR" property="postName" />
  7. <result column="enterprise_id" jdbcType="BIGINT" property="enterpriseId" />
  8. <association property="enterprise" javaType="com.sooka.mybatis.model.TCmsEnterprise" column="enterprise_id" select="com.sooka.mybatis.mapper.TCmsEnterpriseMapper.selectEnterpriseById"></association>
  9. </resultMap>
  10. <select id="selectPostByEnterpriseId" parameterType="com.sooka.mybatis.model.TCmsPost" resultMap="BaseResultMap">
  11. SELECT
  12. *
  13. FROM
  14. t_cms_post
  15. <trim prefix="WHERE (" suffix=")" prefixOverrides="AND|OR">
  16. <if test="enterpriseId!=null">
  17. enterprise_id = #{enterpriseId,jdbcType=BIGINT}
  18. </if>
  19. </trim>
  20. </select>
  21. </mapper>