You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
2.3 KiB
64 lines
2.3 KiB
<?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.hc.business.mapper.UserAdviseMapper">
|
|
|
|
<resultMap type="userAdvise" id="UserAdviseMap">
|
|
<result property="adviceId" column="advice_id" jdbcType="INTEGER"/>
|
|
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
|
<result property="email" column="email" jdbcType="VARCHAR"/>
|
|
<result property="title" column="title" jdbcType="VARCHAR"/>
|
|
<result property="advise" column="advise" jdbcType="VARCHAR"/>
|
|
<result property="createTime" column="create_time" jdbcType="BIGINT"/>
|
|
<result property="adviceLogo" column="advice_logo" jdbcType="VARCHAR"/>
|
|
<result property="adviceType" column="advice_type" jdbcType="INTEGER"/>
|
|
<result property="isReply" column="is_reply" jdbcType="INTEGER"/>
|
|
<result property="userDel" column="user_del" jdbcType="INTEGER"/>
|
|
<result property="replyAdviceId" column="reply_advice_id" jdbcType="INTEGER"/>
|
|
</resultMap>
|
|
|
|
<sql id="Base_Column_List">
|
|
advice_id,
|
|
user_id,
|
|
email,
|
|
title,
|
|
advise,
|
|
advice_logo,
|
|
advice_type,
|
|
is_reply,
|
|
create_time,
|
|
user_del,
|
|
reply_advice_id
|
|
</sql>
|
|
|
|
<select id="queryAllByUserId" resultType="com.hc.business.dto.UserAdviseDto">
|
|
SELECT
|
|
*
|
|
FROM user_advise
|
|
WHERE user_id = #{userId} and (user_del!=1 or user_del is null)
|
|
ORDER BY advice_id DESC
|
|
</select>
|
|
|
|
<select id="queryAllByAdviceType" resultType="com.hc.business.dto.UserAdviseDto">
|
|
SELECT
|
|
*
|
|
FROM user_advise
|
|
WHERE advice_type = #{adviceType} and reply_advice_id is null
|
|
ORDER BY advice_id DESC
|
|
</select>
|
|
|
|
<select id="queryByAdviceId" resultMap="UserAdviseMap">
|
|
SELECT
|
|
<include refid="Base_Column_List"/>
|
|
FROM user_advise
|
|
WHERE reply_advice_id = #{adviceId}
|
|
ORDER BY advice_id DESC
|
|
</select>
|
|
|
|
<select id="queryAll" resultType="com.hc.business.dto.UserAdviseDto">
|
|
SELECT
|
|
*
|
|
FROM user_advise where reply_advice_id is null
|
|
ORDER BY advice_id DESC
|
|
</select>
|
|
|
|
</mapper> |