|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | public int save(PltProduct p) { | 
|---|
|  |  |  | //判断产品不能重名 | 
|---|
|  |  |  | if (dao.exists(p.name, p.id)) { | 
|---|
|  |  |  | throw new RuntimeException("产品名称重复"); | 
|---|
|  |  |  | //判断产品 名称和型号 不能重名 | 
|---|
|  |  |  | if (dao.exists(p.name.trim(), p.type.trim() ,p.id)) { | 
|---|
|  |  |  | throw new RuntimeException("已经存在相同的产品名称&型号"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | int flag=0; | 
|---|
|  |  |  | do { | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | public int update(PltProduct p) { | 
|---|
|  |  |  | if (dao.exists(p.name, p.id)) { | 
|---|
|  |  |  | throw new RuntimeException("产品名称重复"); | 
|---|
|  |  |  | if (dao.exists(p.name.trim(), p.type.trim(),p.id)) { | 
|---|
|  |  |  | throw new RuntimeException("已经存在相同的产品名称&型号"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | int count = dao.updateByPrimaryKeySelective(p); | 
|---|
|  |  |  | //删除旧数据,重新插入 | 
|---|
|  |  |  | 
|---|
|  |  |  | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); | 
|---|
|  |  |  | return dao.selectAll(params); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public List<PltProduct> getProduct(Long orderId) { | 
|---|
|  |  |  | return dao.selectByOrderId(orderId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    public void downloadDoc(HttpServletResponse response) { | 
|---|
|  |  |  | //        PltProduct pro=dao.selectByPrimaryKey(Long.valueOf(1)); | 
|---|