对Entity的未用字段进行借鸡下蛋

17 篇文章 0 订阅
3 篇文章 0 订阅
.


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>




.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值