|
package com.ekexiu.portal.msg;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import org.jfw.apt.annotation.Nullable;
import org.jfw.apt.orm.annotation.dao.DAO;
import org.jfw.apt.orm.annotation.dao.method.Exclude;
import org.jfw.apt.orm.annotation.dao.method.From;
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
import org.jfw.apt.orm.annotation.dao.method.Where;
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
import org.jfw.apt.orm.annotation.dao.method.operator.LimitSelect;
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
import org.jfw.apt.orm.annotation.dao.param.Alias;
import org.jfw.apt.orm.annotation.dao.param.GroupSqlColumn;
import org.jfw.apt.orm.annotation.dao.param.GtEq;
import org.jfw.apt.orm.annotation.dao.param.LessThan;
import org.jfw.apt.orm.annotation.dao.param.LtEq;
import org.jfw.apt.orm.annotation.dao.param.Set;
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
import org.jfw.util.PageQueryResult;
@DAO
public interface WebMsgDao {
@Exclude({ "showOfOwner", "showOfActor" })
@SelectList
@OrderBy("ORDER BY LAST_TIME DESC")
List<WebMsgIdx> query(Connection con, @GroupSqlColumn(handlerClass = StringHandler.class, isAnd = false, value = { "OWNER=? AND SHOW_OF_OWNER='1'",
"ACTOR=? AND SHOW_OF_ACTOR='1'" }, force = false) String id) throws SQLException;
@SelectOne
@Nullable
WebMsgIdx query(Connection con, String owner, String actor) throws SQLException;
@Exclude({ "showOfOwner", "showOfActor" })
@PageSelect
@OrderBy("ORDER BY LAST_TIME DESC,OWNER DESC")
PageQueryResult<WebMsgIdx> query(Connection con, @GroupSqlColumn(handlerClass = StringHandler.class, isAnd = false, value = {
"OWNER=? AND SHOW_OF_OWNER='1'", "ACTOR=? AND SHOW_OF_ACTOR='1'" }, force = false) String id, int pageSize, int pageNo) throws SQLException;
@Insert
int insert(Connection con, WebMsgCnt cnt) throws SQLException;
@Insert
int insert(Connection con, WebMsgIdx idx) throws SQLException;
@UpdateWith
@From(WebMsgIdx.class)
@SetSentence("NUM_OF_ACTOR = NUM_OF_ACTOR + 1,SHOW_OF_ACTOR='1'")
int incActorNum(Connection con, String owner, String actor, @Set String lastCnt, @Set long lastTime) throws SQLException;
@UpdateWith
@From(WebMsgIdx.class)
@SetSentence("NUM_OF_OWNER = NUM_OF_OWNER + 1,SHOW_OF_OWNER='1'")
int incOwnerNum(Connection con, String owner, String actor, @Set String lastCnt, @Set long lastTime) throws SQLException;
@UpdateWith
@From(WebMsgIdx.class)
int decActorNum(Connection con, String owner, String actor, @Set("= NUM_OF_ACTOR - ?") int numOfActor) throws SQLException;
@UpdateWith
@From(WebMsgIdx.class)
int decOwnerNum(Connection con, String owner, String actor, @Set("= NUM_OF_OWNER - ?") int numOfOwner) throws SQLException;
@SelectList
@OrderBy("ORDER BY SEND_TIME ASC")
List<WebMsgCnt> query(Connection con, String sender, String reciver, @Nullable @GtEq @Alias("sendTime") String bt,
@Nullable @LtEq @Alias("sendTime") String et) throws SQLException;
@LimitSelect
@OrderBy("ORDER BY SEND_TIME DESC")
List<WebMsgCnt> query4Desc(Connection con, String sender, String reciver,@Nullable @LessThan String sendTime,int rows) throws SQLException;
@SelectList
@OrderBy("ORDER BY SEND_TIME ASC")
List<WebMsgCnt> queryAll(Connection con,
@GroupSqlColumn(handlerClass = StringHandler.class, value = { "SENDER=?", "RECIVER=?" }, isAnd = false) String actor1,
@GroupSqlColumn(handlerClass = StringHandler.class, value = { "SENDER=?", "RECIVER=?" }, isAnd = false) String actor2,
@Nullable @GtEq @Alias("sendTime") String bt, @Nullable @LtEq @Alias("sendTime") String et) throws SQLException;
@LimitSelect
@OrderBy("ORDER BY SEND_TIME DESC")
List<WebMsgCnt> queryAll4Desc(Connection con,
@GroupSqlColumn(handlerClass = StringHandler.class, value = { "SENDER=?", "RECIVER=?" }, isAnd = false) String actor1,
@GroupSqlColumn(handlerClass = StringHandler.class, value = { "SENDER=?", "RECIVER=?" }, isAnd = false) String actor2,
@Nullable @LessThan String sendTime,int rows) throws SQLException;
@UpdateWith
@From(WebMsgCnt.class)
@SetSentence("READED='1'")
@Where("READED='0'")
int readed(Connection con, String sender, String reciver, @LtEq String sendTime) throws SQLException;
@UpdateWith
@From(WebMsgIdx.class)
@SetSentence("SHOW_OF_OWNER='0'")
@Where("SHOW_OF_OWNER='1'")
int disableOwnerShow(Connection con, String owner, String actor) throws SQLException;
@UpdateWith
@From(WebMsgIdx.class)
@SetSentence("SHOW_OF_ACTOR='0'")
@Where("SHOW_OF_ACTOR='1'")
int disableActorShow(Connection con, String owner, String actor) throws SQLException;
}
|