src/config/mybatis/mapper/common/CommentMapper.xml

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?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.ischoolbar.programmer.dao.common.CommentDao">
	<resultMap id="commentResultMap" type="com.ischoolbar.programmer.entity.common.Comment">
		<id column="c_id" property="id" />
		<result column="c_productId" property="productId" />
		<result column="c_userId" property="userId" />
		<result column="c_type" property="type" />
		<result column="c_content" property="content" />
		<result column="c_createTime" property="createTime" />
		<association property="product" javaType="com.ischoolbar.programmer.entity.common.Product">
			<id column="p_id" property="id" />
			<result column="p_name" property="name" />
			<result column="p_imageUrl" property="imageUrl" />
			<result column="p_price" property="price" />
		</association>
		<association property="account" javaType="com.ischoolbar.programmer.entity.common.Account">
			<id column="a_id" property="id" />
			<result column="a_name" property="name" />
		</association>
	</resultMap>
	
	
	<!-- 评论插入操作 -->
	<insert id="add" parameterType="com.ischoolbar.programmer.entity.common.Comment">
		insert into comment(id,productId,userId,type,content,createTime) values(null,#{productId},#{userId},#{type},#{content},#{createTime})
	</insert>
	<!-- 评论更新操作 -->
	<update id="edit" parameterType="com.ischoolbar.programmer.entity.common.Comment">
		update comment set type = #{type},content = #{content} where id = #{id}
	</update>
	<!-- 评论信息搜索查询 -->
	<select id="findList" parameterType="Map" resultMap="commentResultMap">
		select 
			c.id as c_id,c.productId as c_productId,c.userId as c_userId,c.type as c_type,c.content as c_content,c.createTime as c_createTime,
			p.id as p_id,p.name as p_name,p.imageUrl as p_imageUrl,p.price as p_price,
			a.id as a_id,a.name as a_name
		from comment c,product p,account a where c.productId = p.id and c.userId = a.id  
		<if test="productName != null">
			and p.name like '%${productName}%'  
		</if>
		<if test="productId != null">
			and p.id = #{productId}   
		</if>
		<if test="username != null">
			and a.name like '%${username}%'  
		</if>
		<if test="userId != null">
			and c.userId = #{userId}   
		</if>
		<if test="type != null">
			and c.type = #{type}  
		</if>
		<if test="orderBy != null and sort != null">
			order by ${orderBy} ${sort}   
		</if>
		<if test="offset != null and pageSize != null">
			limit #{offset},#{pageSize}
后面还有 24 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。