This commit is contained in:
AlanGao
2018-04-07 13:11:17 +08:00
parent 458409b463
commit 072599953e
205 changed files with 13055 additions and 15164 deletions

View File

@@ -7,32 +7,31 @@ import com.jsh.util.PageUtil;
import com.jsh.util.SearchConditionUtil;
import org.hibernate.Query;
public class MaterialDAO extends BaseDAO<Material> implements MaterialIDAO
{
/**
public class MaterialDAO extends BaseDAO<Material> implements MaterialIDAO {
/**
* 设置dao映射基类
*
* @return
*/
@Override
public Class<Material> getEntityClass()
{
@Override
public Class<Material> getEntityClass() {
return Material.class;
}
@SuppressWarnings("unchecked")
@Override
public void batchSetEnable(Boolean enable,String supplierIDs) {
String sql="update jsh_material m set m.enabled=" + enable + " where m.id in (" + supplierIDs + ")";
public void batchSetEnable(Boolean enable, String supplierIDs) {
String sql = "update jsh_material m set m.enabled=" + enable + " where m.id in (" + supplierIDs + ")";
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(sql);
query.executeUpdate();
}
@SuppressWarnings("unchecked")
@Override
public void findUnitName(PageUtil<Material> pageUtil,Long mId) throws JshException {
public void findUnitName(PageUtil<Material> pageUtil, Long mId) throws JshException {
//多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便,
StringBuffer queryString = new StringBuffer();
queryString.append("select jsh_unit.UName from jsh_unit inner join jsh_material on UnitId=jsh_unit.id where jsh_material.id="+mId);
queryString.append("select jsh_unit.UName from jsh_unit inner join jsh_material on UnitId=jsh_unit.id where jsh_material.id=" + mId);
Query query;
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
pageUtil.setTotalCount(query.list().size());