|
@@ -0,0 +1,102 @@
|
|
|
+package com.ozs.web.controller.base;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.ozs.base.domain.BaseAgency;
|
|
|
+import com.ozs.base.domain.BaseExpert;
|
|
|
+import com.ozs.base.domain.BaseProfessional;
|
|
|
+import com.ozs.base.domain.BaseSupplier;
|
|
|
+import com.ozs.base.domain.vo.BaseExpertVo;
|
|
|
+import com.ozs.base.domain.vo.BaseProfessionalVo;
|
|
|
+import com.ozs.base.service.BaseExpertService;
|
|
|
+import com.ozs.base.service.BaseProfessionalService;
|
|
|
+import com.ozs.base.vo.BaseAgentPageReqVo;
|
|
|
+import com.ozs.common.core.controller.BaseController;
|
|
|
+import com.ozs.common.core.domain.AjaxResult;
|
|
|
+import com.ozs.common.utils.StringUtils;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.validation.constraints.NotEmpty;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 专业库管理
|
|
|
+ *
|
|
|
+ * @author sunhh
|
|
|
+ */
|
|
|
+@Api(tags = "专家库管理")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/base/expert")
|
|
|
+public class BaseExpertController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private BaseExpertService baseExpertService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "新增专家库", notes = "必传 专家库名称")
|
|
|
+ @PostMapping("/insertExpert")
|
|
|
+ public AjaxResult insertExpert(BaseExpert baseExpert) {
|
|
|
+ if (StringUtils.isNull(baseExpert) || StringUtils.isNull(baseExpert.getExpertName())) {
|
|
|
+ return error("专家库名称不能为空");
|
|
|
+ }
|
|
|
+ return toAjax(baseExpertService.save(baseExpert));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "删除专家库", notes = "必传 id")
|
|
|
+ @PostMapping("/deleteExpert")
|
|
|
+ public AjaxResult deleteExpert(BaseExpert baseExpert) {
|
|
|
+ if (StringUtils.isNull(baseExpert) || StringUtils.isNull(baseExpert.getId())) {
|
|
|
+ return error("专家库id不能为空");
|
|
|
+ }
|
|
|
+ return toAjax(baseExpertService.removeById(baseExpert.getId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "修改专家库", notes = "必传 id 及修改数据")
|
|
|
+ @PostMapping("/updateExpert")
|
|
|
+ public AjaxResult updateProfessional(BaseExpert baseExpert) {
|
|
|
+ if (StringUtils.isNull(baseExpert) || StringUtils.isNull(baseExpert.getId())) {
|
|
|
+ return error("专家库id和修改数据不能为空");
|
|
|
+ }
|
|
|
+ return toAjax(baseExpertService.updateById(baseExpert));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询专家库树结构", notes = "非必传 查询条件:品目名称")
|
|
|
+ @PostMapping("/selectExpert")
|
|
|
+ public AjaxResult selectExpert(@NotEmpty(message = "数据为空") @RequestBody BaseExpertVo baseExpertVo) {
|
|
|
+ LambdaQueryWrapper<BaseExpert> lw = new LambdaQueryWrapper<BaseExpert>();
|
|
|
+ if (!StringUtils.isBlank(baseExpertVo.getExpertName())) {
|
|
|
+ lw.like(BaseExpert::getExpertName, baseExpertVo.getExpertName());
|
|
|
+ }
|
|
|
+ if (!StringUtils.isBlank(baseExpertVo.getMajorType())) {
|
|
|
+ lw.eq(BaseExpert::getMajorType, baseExpertVo.getMajorType());
|
|
|
+ }
|
|
|
+ if (!ObjectUtils.isEmpty(baseExpertVo.getMajorGrade())) {
|
|
|
+ lw.eq(BaseExpert::getMajorGrade, baseExpertVo.getMajorGrade());
|
|
|
+ }
|
|
|
+ IPage<BaseExpert> page = baseExpertService.page(new Page<BaseExpert>(baseExpertVo.getPageNum(), baseExpertVo.getPageSize()), lw);
|
|
|
+ return success(page);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "黑白名单开关", notes = "必传id,supplierType 其他字段不传; 黑名单传0,白名单传1")
|
|
|
+ @PostMapping("/updateSupplierType")
|
|
|
+ public AjaxResult updateSupplierType(BaseExpert baseExpert) {
|
|
|
+ if (StringUtils.isNull(baseExpert) || StringUtils.isNull(baseExpert.getId()) || StringUtils.isNotNull(baseExpert.getStatus())) {
|
|
|
+ return error("状态及ID不能为空");
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<BaseExpert> lw = new LambdaQueryWrapper<BaseExpert>();
|
|
|
+ if (!StringUtils.isNull(baseExpert.getId())) {
|
|
|
+ lw.eq(BaseExpert::getId, baseExpert.getId());
|
|
|
+ }
|
|
|
+ if (!StringUtils.isBlank(baseExpert.getStatus())) {
|
|
|
+ lw.like(BaseExpert::getStatus, baseExpert.getStatus());
|
|
|
+ }
|
|
|
+ return toAjax(baseExpertService.update(lw));
|
|
|
+ }
|
|
|
+}
|