Commit 9056c04f authored by jiaorz's avatar jiaorz

新增问题模块接口

parent 300b34ba
package com.xxfc.platform.im.entity;
import lombok.Data;
import javax.persistence.*;
@Table(name = "im_comment")
@Data
public class ImComment {
@Id
private Long id;
/**
* 问题Id
*/
@Column(name = "question_id")
private Long questionId;
/**
* 评论类容
*/
private String content;
private Long time;
/**
* 用户id
*/
@Column(name = "user_id")
private Long userId;
/**
* 是否显示
*/
private Integer visible = 1;
/**
* 是否只有自己可见(评论审核时仅自己可见)
*/
@Column(name = "visible_own")
private Integer visibleOwn = 1;
/**
* 状态
*/
private Integer state = 0;
/**
* 是否删除
*/
@Column(name = "is_del")
private Boolean isDel = false;
}
\ No newline at end of file
package com.xxfc.platform.im.entity;
import lombok.Data;
import javax.persistence.*;
@Table(name = "im_praise")
@Data
public class ImPraise {
@Id
private Long id;
/**
* 问题id
*/
@Column(name = "question_id")
private Long questionId;
/**
* 用户id
*/
@Column(name = "user_id")
private Long userId;
/**
* 时间
*/
private Long time;
/**
* 状态
*/
private Integer state;
/**
* 是否显示
*/
private Integer visible = 1;
/**
* 是否删除
*/
@Column(name = "is_del")
private Boolean isDel = false;
}
\ No newline at end of file
package com.xxfc.platform.im.entity;
import lombok.Data;
import javax.persistence.*;
@Table(name = "im_question")
@Data
public class ImQuestion {
@Id
private Long id;
/**
* 标题
*/
private String title;
/**
* 纬度
*/
private String latitude;
/**
* 经度
*/
private String longitude;
/**
* 手机型号
*/
private String model;
/**
* 添加时间
*/
private Long time;
@Column(name = "user_id")
private Long userId;
/**
* 是否显示
* 1,显示, 0、不显示
*/
private Integer visible = 1;
/**
* 状态
*/
private Integer state;
/**
* 是否删除
*/
@Column(name = "is_del")
private Boolean isDel = false;
/**
* 内容
*/
private String content;
private Integer commentCount;
private Integer praiseCount;
}
\ No newline at end of file
package com.xxfc.platform.im.mapper;
import com.xxfc.platform.im.entity.ImComment;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
public interface ImCommentMapper extends Mapper<ImComment> {
List<ImComment> selectByQuestionId(Long questionId);
}
\ No newline at end of file
package com.xxfc.platform.im.mapper;
import com.xxfc.platform.im.entity.ImPraise;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
public interface ImPraiseMapper extends Mapper<ImPraise> {
List<ImPraise> selectByQuestionId(Long questionId);
List<ImPraise> selectByQuestionIdAndTime(ImPraise imPraise);
}
\ No newline at end of file
package com.xxfc.platform.im.mapper;
import com.xxfc.platform.im.entity.ImQuestion;
import com.xxfc.platform.im.vo.QuestionListVo;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
import java.util.Map;
public interface ImQuestionMapper extends Mapper<ImQuestion> {
List<QuestionListVo> getQuestionList(Map<String, Object> param);
}
\ No newline at end of file
<?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.xxfc.platform.im.mapper.ImCommentMapper">
<resultMap id="BaseResultMap" type="com.xxfc.platform.im.entity.ImComment">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="question_id" jdbcType="BIGINT" property="questionId" />
<result column="content" jdbcType="VARCHAR" property="content" />
<result column="time" jdbcType="BIGINT" property="time" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="visible" jdbcType="INTEGER" property="visible" />
<result column="visible_own" jdbcType="INTEGER" property="visibleOwn" />
<result column="state" jdbcType="INTEGER" property="state" />
<result column="is_del" jdbcType="BIT" property="isDel" />
</resultMap>
<select id="selectByQuestionId" resultType="com.xxfc.platform.im.entity.ImComment" parameterType="java.lang.Long">
select * from im_comment
where question_id = #{questionId} and is_del = 0
</select>
</mapper>
\ No newline at end of file
<?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.xxfc.platform.im.mapper.ImPraiseMapper">
<resultMap id="BaseResultMap" type="com.xxfc.platform.im.entity.ImPraise">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="question_id" jdbcType="BIGINT" property="questionId" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="time" jdbcType="BIGINT" property="time" />
<result column="state" jdbcType="INTEGER" property="state" />
<result column="visible" jdbcType="INTEGER" property="visible" />
<result column="is_del" jdbcType="BIT" property="isDel" />
</resultMap>
<select id="selectByQuestionId" resultType="com.xxfc.platform.im.entity.ImPraise" parameterType="java.lang.Long">
select * from im_praise
where question_id = #{questionId} and is_del = 0 and visible = 1
</select>
<select id="selectByQuestionIdAndTime" resultType="com.xxfc.platform.im.entity.ImPraise" parameterType="com.xxfc.platform.im.dto.ImPraiseDto">
select * from im_praise
where question_id = #{questionId} and is_del = 0 and visible = 1
and time between #{startTime} and #{endTime}
</select>
</mapper>
\ No newline at end of file
<?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.xxfc.platform.im.mapper.ImQuestionMapper">
<resultMap id="BaseResultMap" type="com.xxfc.platform.im.entity.ImQuestion">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="title" jdbcType="VARCHAR" property="title"/>
<result column="latitude" jdbcType="VARCHAR" property="latitude"/>
<result column="longitude" jdbcType="VARCHAR" property="longitude"/>
<result column="model" jdbcType="VARCHAR" property="model"/>
<result column="time" jdbcType="BIGINT" property="time"/>
<result column="user_id" jdbcType="BIGINT" property="userId"/>
<result column="visible" jdbcType="INTEGER" property="visible"/>
<result column="state" jdbcType="VARCHAR" property="state"/>
<result column="is_del" jdbcType="BIT" property="isDel"/>
<result column="content" jdbcType="LONGVARCHAR" property="content"/>
</resultMap>
<resultMap id="listResultMap" type="com.xxfc.platform.im.vo.QuestionListVo">
<collection property="imComment" column="id"
select="com.xxfc.platform.im.mapper.ImCommentMapper.selectByQuestionId"
ofType="com.xxfc.platform.im.entity.ImComment">
</collection>
<collection column="id" property="imPraise"
select="com.xxfc.platform.im.mapper.ImPraiseMapper.selectByQuestionId"
ofType="com.xxfc.platform.im.entity.ImPraise"></collection>
</resultMap>
<select id="getQuestionList" parameterType="java.util.Map" resultMap="listResultMap">
select * from im_question
<where>
<if test="userId != null">
and user_id = #{userId}
</if>
<if test="visible != null">
and visible = #{visible}
</if>
<if test="state != null">
and state = #{state}
</if>
<if test="isDel != null">
and is_del = #{isDel}
</if>
</where>
order by time DESC
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment