90 lines
4.5 KiB
XML
90 lines
4.5 KiB
XML
<?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.datang.pet.mapperExtend.GivePetMapperExtend">
|
|
|
|
<resultMap id="getGivePetListByCityResultMap" type="com.datang.pet.vo.GetGivePetListByCityResponse">
|
|
<id column="id" jdbcType="INTEGER" property="id"/>
|
|
<result column="district" jdbcType="VARCHAR" property="district"/>
|
|
<result column="src" jdbcType="VARCHAR" property="src"/>
|
|
<result column="width" jdbcType="DOUBLE" property="width"/>
|
|
<result column="height" jdbcType="DOUBLE" property="height"/>
|
|
<result column="head_portrait" jdbcType="VARCHAR" property="headPortrait"/>
|
|
<result column="nike_name" jdbcType="VARCHAR" property="nikeName"/>
|
|
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="getGiveInfoResultMap" type="com.datang.pet.vo.GetGiveInfoResponse">
|
|
<result column="id" jdbcType="VARCHAR" property="id" />
|
|
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
|
<result column="resource" jdbcType="VARCHAR" property="resource" />
|
|
<result column="pet_describe" jdbcType="VARCHAR" property="petDescribe" />
|
|
<result column="adopt_claim" jdbcType="VARCHAR" property="adoptClaim" />
|
|
<result column="sterilization" jdbcType="CHAR" property="sterilization" />
|
|
<result column="vaccine" jdbcType="CHAR" property="vaccine" />
|
|
<result column="expelling" jdbcType="CHAR" property="expelling" />
|
|
<result column="province" jdbcType="VARCHAR" property="province" />
|
|
<result column="city" jdbcType="VARCHAR" property="city" />
|
|
<result column="district" jdbcType="VARCHAR" property="district" />
|
|
<result column="address" jdbcType="VARCHAR" property="address" />
|
|
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
|
|
<result column="cancel" jdbcType="CHAR" property="cancel" />
|
|
<result column="nike_name" jdbcType="VARCHAR" property="nikeName" />
|
|
<result column="head_portrait" jdbcType="VARCHAR" property="headPortrait" />
|
|
<collection property="resourceList" ofType="com.datang.pet.pojo.Resource">
|
|
<result column="id" jdbcType="VARCHAR" property="id"/>
|
|
<result column="src" jdbcType="VARCHAR" property="src"/>
|
|
<result column="sequence" jdbcType="INTEGER" property="sequence"/>
|
|
<result column="width" jdbcType="DOUBLE" property="width"/>
|
|
<result column="height" jdbcType="DOUBLE" property="height"/>
|
|
<result column="size" jdbcType="DOUBLE" property="size"/>
|
|
</collection>
|
|
|
|
</resultMap>
|
|
|
|
<select id="getGivePetListByCity" resultMap="getGivePetListByCityResultMap">
|
|
SELECT g.id,g.district,g.src,g.width,g.height,u.head_portrait,u.nike_name,g.create_date FROM
|
|
(
|
|
SELECT g. id,g.user_id,g.create_date,g.district,r.src,r.width,r.height FROM
|
|
(
|
|
SELECT id,user_id,resource,district,create_date FROM give_pet
|
|
<where>
|
|
<if test="time != null ">
|
|
AND create_Date < #{time}
|
|
</if>
|
|
<if test="city != null &city!='' ">
|
|
AND city=#{city}
|
|
</if>
|
|
AND cancel='0'
|
|
</where>
|
|
)AS g
|
|
LEFT JOIN resource AS r ON g.resource=r.id AND r.sequence=1
|
|
)AS g
|
|
LEFT JOIN user_info AS u ON g.user_id=u.id
|
|
ORDER BY create_date DESC LIMIT 0,10
|
|
</select>
|
|
|
|
<select id="getGiveListByUserId" resultMap="getGivePetListByCityResultMap">
|
|
SELECT g.id,g.district,g.src,g.width,g.height,u.head_portrait,u.nike_name,g.create_date FROM
|
|
(
|
|
SELECT g. id,g.user_id,g.create_date,g.district,r.src,r.width,r.height FROM
|
|
(
|
|
SELECT id,user_id,resource,district,create_date FROM give_pet
|
|
WHERE user_id=#{userId} AND cancel='0'
|
|
)AS g
|
|
LEFT JOIN resource AS r ON g.resource=r.id AND r.sequence=1
|
|
)AS g
|
|
LEFT JOIN user_info AS u ON g.user_id=u.id
|
|
ORDER BY create_date DESC
|
|
</select>
|
|
|
|
<select id="getGiveInfo" resultMap="getGiveInfoResultMap">
|
|
SELECT * FROM
|
|
(
|
|
SELECT g.*,u.nike_name,u.head_portrait FROM
|
|
(
|
|
SELECT * FROM give_pet WHERE id =#{id} AND cancel ='0'
|
|
)AS g LEFT JOIN user_info AS u ON g.user_id = u.id
|
|
)AS g LEFT JOIN resource AS r ON r.id = g.resource
|
|
</select>
|
|
|
|
</mapper> |