| | |
| | | return dataModel; |
| | | } |
| | | |
| | | public void export2Excel(){ |
| | | List<Map> list = sysSupplierService.exportExcelList(name); |
| | | try{ |
| | | sysSupplierService.export2Excel(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | FacesUtils.warn("导出失败"); |
| | | } |
| | | } |
| | | |
| | | public void uploadSupplier(FileUploadEvent event){ |
| | | try { |
| | | sysSupplierService.importSupplier(event); |
| | |
| | | public int deleteSysSupplier(List<String> ids) throws DataAccessException; |
| | | |
| | | void insertBatch(List<?> list); |
| | | |
| | | List<Map> exportExcelList(Map<String, String> params); |
| | | } |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="exportExcelList" parameterType="java.util.Map" resultType="java.util.Map"> |
| | | select name,person_name personName,phone,memo from sys_supplier |
| | | where valid_flag = 1 |
| | | <if test="name != null and name !=''"> |
| | | and name like concat("%",#{name},"%") |
| | | </if> |
| | | order by name ASC |
| | | </select> |
| | | |
| | | <insert id="insertBatch" parameterType="java.util.List"> |
| | | insert into sys_supplier |
| | | (id,name,person_name,phone,memo,create_time,valid_flag) |
| | |
| | | import org.primefaces.event.FileUploadEvent; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Created by johnny on 17/11/29. |
| | |
| | | public boolean deleteSysSupplier(List<SysSupplier> sysSupplierList); |
| | | |
| | | void importSupplier(FileUploadEvent event) throws Exception; |
| | | |
| | | List<Map> exportExcelList(String name); |
| | | |
| | | void export2Excel(List<Map> list) throws Exception; |
| | | } |
| | |
| | | import com.nanometer.smartlab.exception.AlarmException; |
| | | import com.nanometer.smartlab.exception.BusinessException; |
| | | import com.nanometer.smartlab.exception.ExceptionEnumCode; |
| | | import com.nanometer.smartlab.util.ExcelUtils; |
| | | import com.nanometer.smartlab.util.IDUtils; |
| | | import com.nanometer.smartlab.util.MessageUtil; |
| | | import org.apache.commons.lang.StringUtils; |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map> exportExcelList(String name) { |
| | | Map<String, String> params = new HashMap<>(); |
| | | params.put("name", name); |
| | | return sysSupplierDao.exportExcelList(params); |
| | | } |
| | | |
| | | @Override |
| | | public void export2Excel(List<Map> list) throws Exception { |
| | | Map<String,String> map = new LinkedHashMap<>(); |
| | | map.put("name", "供应商名"); |
| | | map.put("personName", "联系人"); |
| | | map.put("phone", "电话"); |
| | | map.put("memo", "备注"); |
| | | ExcelUtils.export2Excel(list,"供应商信息",map); |
| | | } |
| | | |
| | | } |
| | |
| | | </p:panelGrid> |
| | | </p:panel> |
| | | <p:panel styleClass="center-body"> |
| | | <p:panelGrid columns="5" styleClass="btn"> |
| | | <p:panelGrid columns="6" styleClass="btn"> |
| | | <p:commandButton value="新建" styleClass="new-btn" |
| | | process="@this" |
| | | actionListener="#{supplierInfoMngController.onNewBtnClick}" |
| | |
| | | <p:confirm header="确认" message="确认操作?"></p:confirm> |
| | | </p:commandButton> |
| | | <p:commandButton value="导入" styleClass="import-btn" onclick="importSupplier()"/> |
| | | <p:commandButton value="导出" styleClass="new-btn" ajax="false" actionListener="#{supplierInfoMngController.export2Excel}" /> |
| | | |
| | | <a href="resources/template/供应商导入模板.xlsx" style="display: inline-block;"><img src="resources/images/xlsx.png" width="30px;" alt=""/></a> |
| | | |