| | |
| | | * @return |
| | | */ |
| | | public DataTableEntity getMaterialTypeTree() { |
| | | return baseDao.listTable(CmnConst.PRODUCT_SYS_DICT, "dict_name=?", new Object[] {CmnConst.MATERIAL_TYPE}); |
| | | return baseDao.listTable(CmnConst.PRODUCT_PROJECT_BASE_MATERIAL_TYPE); |
| | | } |
| | | |
| | | /** |
| | | * 新增材料类型 |
| | | * @param fse |
| | | * @return |
| | | */ |
| | | public String saveMaterialType(FieldSetEntity fse) { |
| | | if (BaseUtil.strIsNull(fse.getUUID())) { |
| | | FieldSetEntity fseMaxValue = baseDao.getFieldSetEntityBySQL("SELECT IFNULL((MAX(material_type_value) + 1),0) material_type_value FROM product_project_base_material_type", new Object[] {}, false); |
| | | fse.setValue(CmnConst.MATERIAL_TYPE_VALUE, fseMaxValue.getString(CmnConst.MATERIAL_TYPE_VALUE)); |
| | | } else { |
| | | if ("0".equals(fse.getString(CmnConst.IS_USED))) { |
| | | StringBuilder sb = new StringBuilder(256); |
| | | sb.append("SELECT SUM(num)num FROM ( ") |
| | | .append(" select COUNT(*)num from product_project_budget A where a.material_type=? ") |
| | | .append(" UNION ALL ") |
| | | .append(" select COUNT(*)num from product_project_base_material WHERE FIND_IN_SET (?,material_type)>0 ") |
| | | .append(" )A "); |
| | | FieldSetEntity fseCount = baseDao.getFieldSetEntityBySQL(sb.toString(), new Object[] { fse.getString("material_type_value"),fse.getString("material_type_value") }, false); |
| | | if (fseCount.getInteger("num")<1) { |
| | | baseDao.executeUpdate("DELETE FROM product_project_base_material_type WHERE uuid=?", new Object[] {fse.getUUID()}); |
| | | return fse.getUUID(); |
| | | } |
| | | } |
| | | } |
| | | baseDao.saveFieldSetEntity(fse); |
| | | return fse.getUUID(); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (BaseUtil.strIsNull(fse.getString(CmnConst.MATERIAL_TYPE)) || fse.getInteger(CmnConst.MATERIAL_TYPE)==-1) { |
| | | dt = baseDao.listTable(CmnConst.PRODUCT_PROJECT_BASE_MATERIAL, null, null, null, null, fse.getInteger(CmnConst.PAGESIZE), fse.getInteger(CmnConst.CPAGE)); |
| | | }else { |
| | | dt = baseDao.listTable(CmnConst.PRODUCT_PROJECT_BASE_MATERIAL, "material_type=?", new Object[] {fse.getInteger(CmnConst.MATERIAL_TYPE)}, null, null, fse.getInteger(CmnConst.PAGESIZE), fse.getInteger(CmnConst.CPAGE)); |
| | | dt = baseDao.listTable(CmnConst.PRODUCT_PROJECT_BASE_MATERIAL, "CONCAT(',',material_type,',') like ?", new Object[] {"%,"+fse.getInteger(CmnConst.MATERIAL_TYPE)+",%"}, null, null, fse.getInteger(CmnConst.PAGESIZE), fse.getInteger(CmnConst.CPAGE)); |
| | | } |
| | | |
| | | baseDao.loadPromptData(dt); |