.
1.实体
2.页面使用
3.[color=red]由于需要用户名,但是对于一个image来说userId是一个数字,所以采用借鸡下蛋,借用未使用的 sourcePath来当做userName[/color]
.
1.实体
public class Image extends BaseEntity {
/**
* serialVersionUID.
*/
private static final long serialVersionUID = -9072699651769160951L;
private String userId;
private String title;// 标题
private String sourcePath;// 图片原图路径
private String smallPath;// 缩略图路径
private String description;// 图片描述
private int likes;// 得票数
private String lgt;// 经度
private String lat;// 维度
private boolean isJoinTheme = false;// 不参加主题精选:0 参加s为1
private Date createDate;
private Date modifyDate;
private Comment comment;// 最新留言
private String photoAlbumId;// 相册编号id
private String advertisementId = "1";// 广告活动表 id,默认值为1表示不参加活动
private boolean isAlive = true;// 照片是否被禁止,0或false、禁止;1或true、不禁止
}
2.页面使用
<tr>
<th width="30"><input type="checkbox" id="checkAll"/></th>
<th>序號</th>
<th>照片名稱</th>
<th>照片描述</th>
<th>是否已參加活動</th>
<th>票數</th>
<th>上傳用戶</th>
<th>上傳時間</th>
<th>照片是否有效</th>
<th>操作</th>
</tr>
3.[color=red]由于需要用户名,但是对于一个image来说userId是一个数字,所以采用借鸡下蛋,借用未使用的 sourcePath来当做userName[/color]
<!-- 根据条件返回照片列表 -->
<select id="selectImageByOffsetAndSizeWithKeyword"
parameterType="map" resultType="image">
SELECT
p.id,p.userId,p.smallPath,u.userName AS
sourcePath,p.likes,p.isJoinTheme,p.modifyDate,p.photoAlbumId,p.title,p.sourcePath,p.createDate,p.description
FROM image p
LEFT JOIN user u ON u.id=p.userId
WHERE p.title LIKE
"%"#{imageName}"%"
<if test="userName !=null">
AND u.userName LIKE "%"#{userName}"%"
</if>
<if test="imageUpDate !=null">
AND p.createDate LIKE "%"#{imageUpDate}"%"
</if>
LIMIT #{offset},#{pageSize};
</select>
.