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.
xmkf/zhengyi/WebRoot/WEB-INF/classes/com/mapping/Comment.xml

47 lines
1.6 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.dao.CommentDAO">
<resultMap type="com.entity.Comment" id="BaseResultMap">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="memberid" property="memberid" jdbcType="INTEGER"/>
<result column="productid" property="productid" jdbcType="INTEGER"/>
<result column="quality" property="quality" jdbcType="INTEGER"/>
<result column="price" property="price" jdbcType="INTEGER"/>
<result column="content" property="content" jdbcType="VARCHAR"/>
<result column="replycontent" property="replycontent" jdbcType="VARCHAR"/>
<result column="savetime" property="savetime" jdbcType="VARCHAR"/>
</resultMap>
<insert id="add" parameterType="Comment">
insert into comment values(null,#{memberid},#{productid},#{quality},#{price},#{content},#{replycontent},now());
</insert>
<select id="selectProduct" parameterType="Int" resultMap="BaseResultMap">
select * from comment where productid = #{0} order by id desc
</select>
<delete id="delete" parameterType="Int">
delete from comment where id=#{id}
</delete>
<update id="update" parameterType="Comment">
update comment
<set>
<if test="replycontent!=null and replycontent!=''">
replycontent=#{replycontent}
</if>
</set>
where id=#{id}
</update>
<select id="findById" parameterType="Int" resultType="Comment">
select * from comment where id=#{id}
</select>
</mapper>