public interface Service {
//----------------query-------------------//
RpcResult<Page<Vo>> listPage(Query query);
RpcResult<List<Vo>> list(Query query);
RpcResult<Vo> findById(JtnQuery query);
RpcResult<List<Vo>> findByIdList(List<Integer> idList);
//----------------update-------------------//
RpcResult<Integer> save(Update update);
RpcResult<Integer> add(Create create);
RpcResult<Boolean> updateById(Update update);
RpcResult<Boolean> removeById(Integer id);
RpcResult<Boolean> removeById(JtnRemove remove);
}
|
1、list, 多個。list不分頁,list分頁。
2、find,精確查找。一般是根據 id 或 idList。
3、save,保存,add和updateById 適配
4、add添加,updatById,更新
5、removeById,根據id刪除
特別需要說明,根據id查找和 根據id刪除。
這2個功能,本身 只需要 id一個參數,但是爲了 滿足所有情況,做了抽象封裝。
@Data
public class JtnQuery {
//主鍵id
private Integer id;
//應用id
private Integer appId;
//是否查詢關聯字段
private Integer relationFieldYn;
//批量查詢
private List<Integer> idList;
}
|
@Data
public class JtnRemove {
// 主鍵id
private Integer id;
// 應用id
private Integer appId;
//批量刪除
private List<Integer> idList;
// 是否刪除關聯字段,刪除PostCategory時,級聯邏輯刪除Post(暫不實現)
private Integer relationFieldYn;
}
|
天鳥技術/FansUnion/雷哥
2019年11月16日
北京