@SuppressWarnings("unused")public class DMBService { IDao dao=new DaoImpl(); public List<?> querydmb() throws Exception { System.out.println("查询列表--->M--->模型层DMBService.java"); return dao.executeQueryForList("select * from dmb"); } public void add(String dmnr, String lbbh, String bzmc, String remark) throws Exception { String sql="insert into dmb "+ " (dmbid, dmlbbh, dmnr, bz, bz_mc) "+ " values "+ " (?, ?, ?, ?, ?)"; int[] types={12,12,12,12,12}; Object[] values={UUID.randomUUID().toString(),dmnr,lbbh,bzmc,remark}; System.out.println(dmnr+"-"+lbbh+"-"+bzmc+"-"+remark); dao.executeUpdate(sql, types, values); } public Map<String, Object> queryById(String id) throws Exception { return dao.executeQueryForMap("select * from dmb where dmbid='"+id+"'"); } public void edit(String id, String dmnr, String lbbh, String bzmc,String remark) throws Exception { String sql ="update dmb "+ " set "+ " dmlbbh = ?, "+ " dmnr = ?, "+ " bz = ?, "+ " bz_mc = ? "+ " where dmbid = ?"; int[] types = new int[5]; types[0]=Types.VARCHAR; types[1]=Types.VARCHAR; types[2]=Types.VARCHAR; types[3]=Types.VARCHAR; types[4]=Types.VARCHAR; Object[] values = new Object[5]; values[0]=dmnr; values[1]=lbbh; values[2]=bzmc; values[3]=remark; values[4]=id; dao.executeUpdate(sql, types, values); } public void del(String[] ids) throws Exception { for (int i = 0; i < ids.length; i++) { dao.executeUpdate("delete from dmb where dmbid= '"+ids[i]+"'"); } }
添加回答
举报
0/150
提交
取消