package com.dao.impl;

 import java.lang.reflect.ParameterizedType;
import java.util.Collection;
import java.util.List; import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository; import com.dao.IBaseDao;
import com.exception.CustomException;
import com.utils.BeanUtil;
import com.utils.Page;
import com.utils.QueryObject;
import com.utils.QueryParam; @SuppressWarnings("unchecked")
@Repository
public class BaseDao<T> implements IBaseDao<T>{ @Autowired(required = true)
@Qualifier("sessionFactory")
private SessionFactory sessionFactory; protected Session getCurrentSession() {
return this.sessionFactory.getCurrentSession();
} /**
* @Description: 根据ID获取对象
* @param id ID
* @return T
* @throws Exception
*/
public T get(String id) throws CustomException
{
List<T> objects = this.getAllByProperty("objId", id);
if (!objects.isEmpty())
{
return objects.get(0);
}
return null;
} /**
* @Description: 根据ID获取对象
* @param id ID
* @param c
* @return T
* @throws Exception
*/
public Object get(String id,Class c) throws CustomException
{
List<T> objects = (List<T>)this.getAllByProperty("objId", id,c);
if (!objects.isEmpty())
{
return objects.get(0);
}
return null;
} /**
* @Description: 根据属性获取对象
* @param propertyName 属性
* @param value 值
* @return T
* @throws Exception
*/
public T getObjectByProperty(String propertyName,Object value) throws CustomException
{
List<T> objects = this.getAllByProperty(propertyName, value);
if (!objects.isEmpty())
{
return objects.get(0);
}
return null;
} /**
* @Description: 根据属性获取对象
* @param propertyName 属性
* @param value 值
* @param c
* @return T
* @throws Exception
*/
public T getObjectByProperty(String propertyName,Object value,Class c) throws CustomException
{
List<T> objects = (List<T>)this.getAllByProperty(propertyName, value, c);
if (!objects.isEmpty())
{
return objects.get(0);
}
return null;
} /**
* @Description: 获取所有对象
* @return List<T>
* @throws Exception
*/
public List<T> getAll() throws CustomException
{
Class baseClass;
try
{
baseClass = Class.forName(BeanUtil.getParamType(this.getClass()).replace("class ", ""));
} catch (ClassNotFoundException e)
{
throw new CustomException(this.getClass()+"没有泛型! 或者没有重写 getBaseClass() method");
}
return this.getAll(baseClass);
} /**
* @Description: 获取所有对象
* @param c
* @return List<T>
* @throws Exception
*/
public List<T> getAll(Class c) throws CustomException
{
String hql = " from "+c.getSimpleName();
List<T> objects = this.getCurrentSession().createQuery(hql).list();
return objects;
} /**
* @Description: 根据属性获取所有对象
* @param propertyName 属性
* @param value 值
* @return List<T>
* @throws Exception
*/
public List<T> getAllByProperty(String propertyName,Object value) throws CustomException
{
Class baseClass;
try
{
baseClass = Class.forName(BeanUtil.getParamType(this.getClass()).replace("class ", ""));
} catch (ClassNotFoundException e)
{
throw new CustomException(this.getClass()+"没有泛型! 或者没有重写 getBaseClass() method");
}
return (List<T>)this.getAllByProperty(propertyName, value, baseClass);
} /**
* @Description: 根据属性获取所有对象
* @param propertyName 属性
* @param value 值
* @param c
* @return List<T>
* @throws Exception
*/
public List<Object> getAllByProperty(String propertyName,Object value,Class c) throws CustomException
{
StringBuffer hql = new StringBuffer();
hql.append(" from "+c.getSimpleName()+" where "+propertyName+" = '"+value+"'");
List<Object> objects = this.getCurrentSession().createQuery(hql.toString()).list();
return objects;
} /**
* @Description: 保存Object
* @param object 实体
* @return void
* @throws Exception
*/
public void save(T object)throws CustomException
{
this.getCurrentSession().saveOrUpdate(object);
} /**
* @Description: 保存Object
* @param object 实体
* @param c
* @return void
* @throws Exception
*/
public void save(Object object,Class c)throws CustomException
{
this.getCurrentSession().saveOrUpdate(object);
} /**
* @Description: 保存Object
* @param objects 实体
* @return void
* @throws Exception
*/
public void saveCollections(Collection<T> objects) throws CustomException
{
for (Object object:objects)
{
this.save((T)object);
}
} /**
* @Description: 保存Object
* @param objects 实体
* @param c
* @return void
* @throws Exception
*/
public void saveCollections(Collection<T> objects,Class c) throws CustomException
{
for (Object object:objects)
{
this.save((T)object);
}
} /**
* @Description: 删除对象
* @param id
* @return void
* @throws Exception
*/
public void remove(String id)
{
Class baseClass;
try
{
baseClass = Class.forName(BeanUtil.getParamType(this.getClass()).replace("class ", ""));
} catch (ClassNotFoundException e)
{
throw new CustomException(this.getClass()+"没有泛型! 或者没有重写 getBaseClass() method");
}
this.remove(id, baseClass);
} /**
* @Description: 删除对象
* @param ids
* @param c
* @return void
* @throws Exception
*/
public void remove(String[] ids,Class c)
{
for (String id:ids)
{
this.remove(id, c);
}
} /**
* @Description: 删除对象
* @param id
* @param c
* @return void
* @throws Exception
*/
public void remove(String id,Class c)
{
this.removeObjectByProperty("objId", id, c);
} /**
* @Description: 删除对象
* @param object 实体
* @return void
* @throws Exception
*/
public void remove(T object)
{
this.getCurrentSession().delete(object);
} /**
* @Description: 删除对象
* @param objects
* @return void
* @throws Exception
*/
public void removeCollections(Collection<T> objects) throws CustomException
{
for (Object object:objects)
{
this.remove((T)object);
}
} /**
* @Description: 删除对象
* @param propertyName 属性名
* @param value 值
* @return void
* @throws Exception
*/
public void removeObjectByProperty(String propertyName,Object value)throws CustomException
{
Class baseClass;
try
{
baseClass = Class.forName(BeanUtil.getParamType(this.getClass()).replace("class ", ""));
}
catch (ClassNotFoundException e)
{
throw new CustomException(this.getClass()+"没有泛型! 或者没有重写 getBaseClass() method");
}
this.removeObjectByProperty(propertyName, value, baseClass);
} /**
* @Description: 删除对象
* @param propertyName 属性名
* @param value 值
* @param c
* @return void
* @throws Exception
*/
public void removeObjectByProperty(String propertyName,Object value,Class c)throws CustomException
{
StringBuffer hql = new StringBuffer();
hql.append(" delete ").append(c.getSimpleName()).append(" ");
hql.append(" where ").append(propertyName).append(" = ? ");
this.getCurrentSession().createQuery(hql.toString()).setParameter(0, value).executeUpdate();
} /**
* @Description: 分页查询
* @param queryObject
* @param page
* @return void
* @throws Exception
*/
public void findByQueryObject(QueryObject queryObject,Page page)
{
StringBuffer hql = new StringBuffer();//hql语句
hql.append(" from ").append(queryObject.getEntityClass().getSimpleName()).append(" where 1=1 ");
String bieming = "bm";
for (QueryParam param:queryObject.getQueryParam().getAndParams()) //循环参数集合,拼接查询条件
{
if(!QueryParam.OPERATOR_IS.equals(param.getOperator())){
hql.append(" and ").append(param.getName()).append(" ").append(param.getOperator()).append(" ").append(":").append(bieming).append(" ");
}else{
hql.append(" and ").append(param.getName()).append(" ").append(param.getOperator()).append(" ").append("null");
}
bieming += bieming;
}
String sql = " ";
if(queryObject.getQueryProjections().getOrderProperty()!=null)//拼接排序条件
{
for(String s :queryObject.getQueryProjections().getOrderProperty())
{
sql = "order by "+ s ;
if(queryObject.getQueryProjections().getDescFlag()!=null &&queryObject.getQueryProjections().getDescFlag()[0])
{
sql = sql +" desc";
}
else
{
sql = sql + " asc";
}
}
}
Query query = this.getCurrentSession().createQuery(hql.toString()+sql);//查询结果集 bieming = "bm";
for (QueryParam param:queryObject.getQueryParam().getAndParams())
{
if( QueryParam.OPERATOR_IN.equals(param.getOperator()) || QueryParam.OPERATOR_NIN.equals(param.getOperator()) || QueryParam.OPERATOR_NOTIN.equals(param.getOperator())){
query.setParameterList(bieming, param.getValue().toString().split(","));
}else{
if(!QueryParam.OPERATOR_IS.equals(param.getOperator())){
query.setParameter(bieming, param.getValue());
}
}
bieming += bieming;
}
query.setFirstResult(page.getFirstResultNum());//设置分页显示的记录数
query.setMaxResults((int)page.getPageSize());
page.setData(query.setCacheable(true).list()); //查询总记录数
String hql_1 = "select count(*) " + hql.toString();
query = this.getCurrentSession().createQuery(hql_1);
bieming = "bm";
for (QueryParam param:queryObject.getQueryParam().getAndParams())
{
if( QueryParam.OPERATOR_IN.equals(param.getOperator())|| QueryParam.OPERATOR_NIN.equals(param.getOperator()) || QueryParam.OPERATOR_NOTIN.equals(param.getOperator())){
query.setParameterList(bieming, param.getValue().toString().split(","));
}else{
if(!QueryParam.OPERATOR_IS.equals(param.getOperator())){
query.setParameter(bieming, param.getValue());
}
}
bieming += bieming;
}
page.setTotal((Long)(query.setCacheable(true).list().get(0)));
} /**
* @Description: 公共查询
* @param queryObject
* @return List<T>
* @throws Exception
*/
public List<T> findByQueryObject(QueryObject queryObject)
{
StringBuffer hql = new StringBuffer();
hql.append(" from ").append(queryObject.getEntityClass().getSimpleName()).append(" where 1=1 ");
String bieming = "bm";
for (QueryParam param:queryObject.getQueryParam().getAndParams())
{
hql.append(" and ").append(param.getName()).append(" ").append(param.getOperator()).append(" ").append(":").append(bieming).append(" ");
bieming += bieming;
}
Query query = this.getCurrentSession().createQuery(hql.toString());
bieming = "bm";
for (QueryParam param:queryObject.getQueryParam().getAndParams())
{
if( QueryParam.OPERATOR_IN.equals(param.getOperator())|| QueryParam.OPERATOR_NIN.equals(param.getOperator()) || QueryParam.OPERATOR_NOTIN.equals(param.getOperator())){
query.setParameterList(bieming, param.getValue().toString().split(","));
}else{
query.setParameter(bieming, param.getValue());
}
bieming += bieming;
}
return query.list();
} /**
*
* @Description: sql+条件查询
* @param @param queryObject
* @param @return
* @return List<String>
* @throws
* @author ningpeng
* @date 2016年10月21日
*/
public List<Object[]> findDomainByQueryObject(QueryObject queryObject)
{
StringBuffer SQL = new StringBuffer();
String sql = queryObject.getQuerySql();
SQL.append(sql); for (QueryParam param:queryObject.getQueryParam().getAndParams())
{
SQL.append(" and ").append(param.getName()).append(" ").append(param.getOperator()).append(" ").append(" ? ");
}
Query query = this.getCurrentSession().createSQLQuery(sql.toString());
for (int i=0;i<queryObject.getQueryParam().getAndParams().size();i++)
{
query.setParameter(i, queryObject.getQueryParam().getAndParams().get(i).getValue());
}
return query.list();
} /**
* @Description: 修改
* @param 修改字段,修改值,条件字段,条件值
* @return void
* @throws Exception
*/
public void update(String propertyName,Object value,String conditionName,Object conditionValue)throws CustomException
{
Class baseClass;
try
{
baseClass = Class.forName(BeanUtil.getParamType(this.getClass()).replace("class ", ""));
}
catch (ClassNotFoundException e)
{
throw new CustomException(this.getClass()+"没有泛型! 或者没有重写 getBaseClass() method");
}
this.update(propertyName, value,conditionName,conditionValue,baseClass);
} /**
* @Description: 修改 修改字段,修改值,条件字段,条件值
* @param 修改字段,修改值,条件字段,条件值
* @param c
* @return void
* @throws Exception
*/
public void update(String propertyName,Object value,String conditionName,Object conditionValue,Class c)throws CustomException
{
StringBuffer hql = new StringBuffer();
hql.append(" update ").append(c.getSimpleName()).append(" ");
hql.append(" set ").append(propertyName).append(" = ? ");
hql.append(" where 1=1 and ").append(conditionName).append(" = ? ");
this.getCurrentSession().createQuery(hql.toString()).setParameter(0, value).setParameter(1, conditionValue).executeUpdate();
} /**
* @Description: 批量修改 修改字段,修改值,条件字段,条件值
* @param 修改字段,修改值,条件字段,条件值
* @param c
* @return void
* @throws Exception
*/
public void update(String propertyName,Object value,String conditionName,Object[] conditionValue,Class c)
{
for (Object id:conditionValue)
{
this.update(propertyName, value, conditionName, id);
}
} @Override
public String saveObjId(T object) throws CustomException {
// TODO Auto-generated method stub
return (String)this.getCurrentSession().save(object);
} public static String getParamType(Class c){
if (null != c ) {
ParameterizedType type = (ParameterizedType)c.getGenericSuperclass();
if (null != type.getActualTypeArguments() && type.getActualTypeArguments().length>0) {
return BeanUtil.toString(type.getActualTypeArguments());
}
}
return "";
} }
  package com.utils;

 import java.util.ArrayList;
import java.util.List; /**
* 查询参数对象
* @ClassName QueryParam
* @Description:TODO(这里用一句话描述这个类的作用)
*/
public final class QueryParam { public final static String AND = "and"; public final static String OR = "or"; public final static String NOT = "not"; public final static String OPERATOR_EQ = "="; public final static String OPERATOR_BT = "bt"; public final static String OPERATOR_NE = "!="; public final static String OPERATOR_NE_ANSINULL_OFF = "!=%"; public final static String OPERATOR_GE = ">="; public final static String OPERATOR_GT = ">"; public final static String OPERATOR_NGE = "!>="; public final static String OPERATOR_NGT = "!>"; public final static String OPERATOR_LE = "<="; public final static String OPERATOR_LT = "<"; public final static String OPERATOR_NLE = "!<="; public final static String OPERATOR_NLT = "!<"; public final static String OPERATOR_LIKE = "like"; public final static String OPERATOR_LEFTLIKE = "llike"; public final static String OPERATOR_RIGHTLIKE = "rlike"; public final static String OPERATOR_NLIKE = "!like"; public final static String OPERATOR_NLEFTLIKE = "!llike"; public final static String OPERATOR_NRIGHTLIKE = "!rlike"; public final static String OPERATOR_INCLUDE = "include"; public final static String OPERATOR_NINCLUDE = "!include"; public final static String OPERATOR_ILIKE = "ilike"; public final static String OPERATOR_NILIKE = "!ilike"; public final static String OPERATOR_IINCLUDE = "iinclude"; public final static String OPERATOR_NIINCLUDE = "!iinclude"; public final static String OPERATOR_IS = "is"; public final static String OPERATOR_NIS = "!is"; public final static String OPERATOR_IN = "in"; public final static String OPERATOR_NIN = "!in"; public final static String OPERATOR_NOTIN = "not in"; public final static String OPERATOR_EXIST = "exists"; public final static String OPERATOR_NEXIST = "not exists"; public final static String FETCH = "fetch"; private String name; //实体属性名,对应请求的键 private Object value; //查询参数,对应请求的值 private String operator = OPERATOR_EQ;//操作符,对应包含“_op”键的值 private List<QueryParam> andParams = new ArrayList<QueryParam>(0);
private List<QueryParam> orParams = new ArrayList<QueryParam>(0);
private List<QueryParam> notParams = new ArrayList<QueryParam>(0); public QueryParam() { } /**
*
* @Title QueryParam
* @Description TODO(这里用一句话描述这个方法的作用)
* @param name 查询实体的属性名
* @param operator 操作符,从请求包含“_op”的键中获取的值
* @param value 查询实体属性名所对应的键值
* @throws
*/
public QueryParam(String name, String operator, Object value) {
if (OPERATOR_LIKE.equals(operator)||OPERATOR_NLIKE.equals(operator)) {
value = "%"+value+"%";
}
if(OPERATOR_IS.equals(operator) || OPERATOR_NIS.equals(operator)) {
value=null;
}
if (null == value || "".equals(value)) {
if (OPERATOR_EQ.equals(operator)) {
operator = OPERATOR_IS;
} else if (OPERATOR_NE.equals(operator)) {
operator = OPERATOR_NIS;
}
} else {
if (OPERATOR_IS.equals(operator)) {
operator = OPERATOR_EQ;
} else if (OPERATOR_NIS.equals(operator)) {
operator = OPERATOR_NE;
}
}
if (OPERATOR_IN.equals(operator) || OPERATOR_NIN.equals(operator)) {
//value = value.toString().replaceAll(",", "','");
}
if (OPERATOR_EXIST.equals(operator) || OPERATOR_NEXIST.equals(operator)) {
value = value.toString().replaceAll(",", "','");
}
this.name = name;
this.value = value;
this.operator = operator;
this.validateOperator();
} public void and(QueryParam queryParam) {
andParams.add(queryParam);
} public void or(QueryParam queryParam) {
orParams.add(queryParam);
} public void not(QueryParam queryParam) {
notParams.add(queryParam);
} public String getName() {
return name;
} public String getOperator() {
return operator;
} public Object getValue() {
return value;
} //检查操作符是否有效
private void validateOperator() {
if(this.operator.startsWith("not")){
if(OPERATOR_NEXIST.equals(this.operator))
return;
if(OPERATOR_NOTIN.equals(this.operator))
return;
}else if (this.operator.startsWith("!")) {
if (this.operator.endsWith("%"))
return;
if (OPERATOR_NE.equals(this.operator))
return;
if (OPERATOR_NGE.equals(this.operator))
return;
if (OPERATOR_NGT.equals(this.operator))
return;
if (OPERATOR_NLE.equals(this.operator))
return;
if (OPERATOR_NLT.equals(this.operator))
return;
if (OPERATOR_NLIKE.equals(this.operator))
return;
if (OPERATOR_NLEFTLIKE.equals(this.operator))
return;
if (OPERATOR_NRIGHTLIKE.equals(this.operator))
return;
if (OPERATOR_NINCLUDE.equals(this.operator))
return;
if (OPERATOR_NILIKE.equals(this.operator))
return;
if (OPERATOR_NIINCLUDE.equals(this.operator))
return;
if (OPERATOR_NIS.equals(this.operator))
return;
if (OPERATOR_NIN.equals(this.operator))
return;
} else {
if (OPERATOR_EQ.equals(this.operator))
return;
if (OPERATOR_GE.equals(this.operator))
return;
if (OPERATOR_GT.equals(this.operator))
return;
if (OPERATOR_LE.equals(this.operator))
return;
if (OPERATOR_LT.equals(this.operator))
return;
if (OPERATOR_LIKE.equals(this.operator))
return;
if (OPERATOR_LEFTLIKE.equals(this.operator))
return;
if (OPERATOR_RIGHTLIKE.equals(this.operator))
return;
if (OPERATOR_INCLUDE.equals(this.operator))
return;
if (OPERATOR_ILIKE.equals(this.operator))
return;
if (OPERATOR_IINCLUDE.equals(this.operator))
return;
if (OPERATOR_IS.equals(this.operator))
return;
if (OPERATOR_IN.equals(this.operator))
return;
if (FETCH.equals(this.operator))
return;
if (OPERATOR_BT.equals(this.operator))
return;
if(OPERATOR_EXIST.equals(this.operator))
return;
}
throw new RuntimeException ("The operator " + this.operator + " could be incorrect!");
} public List<QueryParam> getAndParams() {
return andParams;
} public List<QueryParam> getNotParams() {
return notParams;
} public List<QueryParam> getOrParams() {
return orParams;
} }
 package com.utils;
import java.lang.reflect.ParameterizedType; /**
* @Description: 查询对象实现
* @param <T>
* @version V1.0
*/
public class QueryObjectBase<T> implements QueryObject<T> {
/**
* 泛型类参数类型
*/
private Class<T> entityClass; private QueryProjections queryProjections=new QueryProjections(); private String sql; /**
* 查询参数
*/
private QueryParam queryParam=new QueryParam(); @SuppressWarnings("unchecked")
public Class<T> getEntityClass() {
if(this.entityClass==null)
return (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
return this.entityClass;
}
public void setEntityClass(Class<T> entityClass) {
this.entityClass = entityClass;
}
public QueryProjections getQueryProjections() {
return queryProjections;
}
public void setQueryProjections(QueryProjections queryProjections) {
this.queryProjections = queryProjections;
}
public QueryParam getQueryParam() {
return queryParam;
}
public void setQueryParam(QueryParam queryParam) {
this.queryParam = queryParam;
}
public void setQuerySql(String sql) {
this.sql = sql;
}
public String getQuerySql() {
return sql;
}
}

hibernate dao 公共方法的更多相关文章

  1. 转:HIBERNATE一些_方法_@注解_代码示例---写的非常好

    HIBERNATE一些_方法_@注解_代码示例操作数据库7步骤 : 1 创建一个SessionFactory对象 2 创建Session对象 3 开启事务Transaction : hibernate ...

  2. 【hibernate 执行方法未插入数据库】hibernate的save方法成功执行,但是未插入到数据库

    今天做项目,碰上这个问题: hibernate的save方法成功执行,但是未插入到数据库. Dao层代码: @Override public void save(T t) { this.getSess ...

  3. J2EE进阶(十六)Hibernate 中getHibernateTemplate()方法使用

    J2EE进阶(十六)Hibernate 中getHibernateTemplate()方法使用   spring 中获得由spring所配置的hibernate的操作对象,然后利用此对象进行,保存,修 ...

  4. Mybatis 原始dao CRUD方法

    用到的相关jar包及所用版本如下: 其中的Mybatis可以到github.com的网站下载 <project xmlns="http://maven.apache.org/POM/4 ...

  5. J2EE项目开发中常用到的公共方法

    在项目IDCM中涉及到多种工单,包括有:服务器|网络设备上下架工单.服务器|网络设备重启工单.服务器光纤网线更换工单.网络设备撤线布线工单.服务器|网络设备替换工单.服务器|网络设备RMA工单.通用原 ...

  6. php 图片上传的公共方法(按图片宽高缩放或原图)

    写的用于图片上传的公共方法类调用方法: $upload_name='pic';$type = 'logo_val';$file_name = 'logo_' . $user_id .create_st ...

  7. web开发过程中经常用到的一些公共方法及操作

    进化成为程序猿也有段岁月了,所谓的经验,广度还是依旧,只不过是对于某种功能有了多种实现方式的想法.每天依旧不厌其烦的敲打着代码,每一行代码的回车似乎都有一种似曾相识的感觉.于是乎:粘贴复制,再粘贴再复 ...

  8. iOS常用公共方法

      iOS常用公共方法 字数2917 阅读3070 评论45 喜欢236 1. 获取磁盘总空间大小 //磁盘总空间 + (CGFloat)diskOfAllSizeMBytes{ CGFloat si ...

  9. MyBatis学习--mybatis开发dao的方法

    简介 使用Mybatis开发Dao,通常有两个方法,即原始Dao开发方法和Mapper接口开发方法. 主要概念介绍: MyBatis中进行Dao开发时候有几个重要的类,它们是SqlSessionFac ...

随机推荐

  1. 【剑指Offer】59、按之字形顺序打印二叉树

      题目描述:   请实现一个函数按照之字形打印二叉树,即第一行按照从左到右的顺序打印,第二层按照从右至左的顺序打印,第三行按照从左到右的顺序打印,其他行以此类推.   解题思路:   这道题仍然是二 ...

  2. [模板]FFT

    郝神并没有令我明白这个. 但是巨神的题解太强了. #include <iostream> #include <complex> #include <cmath> # ...

  3. 08.Web服务器-3.Web静态服务器

    1.显示固定的页面 from socket import * from multiprocessing import * import os def handleClient(clientSocket ...

  4. 【Zoj 4061】Magic Multiplication

    [链接] 我是链接,点我呀:) [题意] [题解] /* for a[1] from 1~9 1*1=1 2*1=2 3*1=3 1*2=2 2*2=4 3*2=6 1*3=3 2*3=6 3*3=9 ...

  5. (18)使用模板(thymeleaf-freemarker)【从零开始学Spring Boot】

    整体步骤: (1)            在pom.xml中引入thymeleaf; (2)            如何关闭thymeleaf缓存 (3)            编写模板文件.html ...

  6. Method and apparatus for an atomic operation in a parallel computing environment

    A method and apparatus for a atomic operation is described. A method comprises receiving a first pro ...

  7. [bzoj1500][NOI2005]维修数列_非旋转Treap

    维修数列 bzoj-1500 NOI-2005 题目大意:给定n个数,m个操作,支持:在指定位置插入一段数:删除一个数:区间修改:区间翻转.查询:区间和:全局最大子序列. 注释:$1\le n_{ma ...

  8. djanjo ORM 一对多、多对多

    一.表操作之一对多 定义表结构:定义了UserType.两张表UserInfo,如下: from django.db import models class UserType(models.Model ...

  9. Anton and Letters

    Anton and Letters time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  10. oracle强化练习题

    编写简单的查询语句 1.显示部门表的所有信息 Select * from dept; 2.显示部门号码,部门名称 Selectdeptno,dname from dept; 3.显示下面字段及字符串的 ...