This commit is contained in:
linfso 2024-05-23 05:03:20 +08:00
parent 4b24e42703
commit 4814862ee2

View File

@ -15,8 +15,10 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.xdadan.erp.common.annotation.filter.jackson.JacksonFilter; import com.xdadan.erp.common.annotation.filter.jackson.JacksonFilter;
import com.xdadan.erp.emis.domain.EmisCustomerUser;
import com.xdadan.erp.emis.domain.EmisGoods; import com.xdadan.erp.emis.domain.EmisGoods;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -109,7 +111,12 @@ public class EmisProblemTypeController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody EmisProblemType emisProblemType) public AjaxResult add(@RequestBody EmisProblemType emisProblemType)
{ {
return toAjax(emisProblemTypeService.insertEmisProblemType(emisProblemType)); try {
return toAjax(emisProblemTypeService.insertEmisProblemType(emisProblemType));
} catch (DuplicateKeyException e) {
e.printStackTrace();
return AjaxResult.error("数据重复!");
}
} }
/** /**
@ -120,7 +127,13 @@ public class EmisProblemTypeController extends BaseController
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody EmisProblemType emisProblemType) public AjaxResult edit(@RequestBody EmisProblemType emisProblemType)
{ {
return toAjax(emisProblemTypeService.updateEmisProblemType(emisProblemType)); try {
return toAjax(emisProblemTypeService.updateEmisProblemType(emisProblemType));
} catch (DuplicateKeyException e) {
e.printStackTrace();
return AjaxResult.error("数据重复!");
}
} }
/** /**