package com.panzhihua.service_community.api;
|
|
import cn.hutool.core.bean.BeanUtil;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.panzhihua.common.controller.BaseController;
|
import com.panzhihua.common.model.dtos.community.sanshuo.ComSanshuoExpertDTO;
|
import com.panzhihua.common.model.vos.R;
|
import com.panzhihua.service_community.entity.ComSanshuoExpert;
|
import com.panzhihua.service_community.service.ComSanShuoExpertService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiParam;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
import javax.xml.crypto.Data;
|
import java.util.Date;
|
|
/**
|
* 三说会堂调解专家控制器
|
* */
|
@RestController
|
@RequestMapping("/sanshuo/expert")
|
public class ComSanShuoExpertApi extends BaseController {
|
|
@Resource
|
private ComSanShuoExpertService comSanShuoExpertService;
|
|
/**
|
* 添加专家
|
* */
|
@PostMapping
|
public R add(@RequestBody ComSanshuoExpertDTO comSanshuoExpertDTO){
|
comSanshuoExpertDTO.setCreateBy(this.getLoginUserInfo().getName());
|
return R.ok(comSanShuoExpertService.addExpert(comSanshuoExpertDTO));
|
}
|
|
/**
|
* 小程序获取可选择专家
|
* */
|
@GetMapping("appletsList")
|
public R appList(){
|
return R.ok(comSanShuoExpertService.list(new QueryWrapper<ComSanshuoExpert>().eq("status",1).eq("del_flag",1)));
|
}
|
|
/**
|
* 修改专家
|
* */
|
@PutMapping
|
public R update(@RequestBody ComSanshuoExpertDTO comSanshuoExpertDTO){
|
ComSanshuoExpert expert=new ComSanshuoExpert();
|
BeanUtil.copyProperties(comSanshuoExpertDTO,expert);
|
expert.setUpdateTime(new Date());
|
return R.ok(comSanShuoExpertService.updateById(expert));
|
}
|
|
/**
|
* 后台获取列表
|
* */
|
@GetMapping("/backstageList")
|
public R backList(@RequestParam(value = "keyWord",required = false)@ApiParam("搜索关键字") String keyWord,
|
@RequestParam(value = "page",required = false)Integer page,
|
@RequestParam(value = "size",required = false)Integer size){
|
//TODO 获取当前账号级别确定范围
|
Integer range=null;
|
Long id=null;
|
return R.ok(comSanShuoExpertService.expertPage(keyWord,page,size,range,id));
|
}
|
|
/**
|
* 删除
|
* */
|
@DeleteMapping("/remove/{id}")
|
public R remove(@PathVariable("id")Long id){
|
//TODO 是否有为解决事件
|
ComSanshuoExpert expert = comSanShuoExpertService.getById(id);
|
expert.setStatus(0);
|
expert.setDelFlag(0);
|
return R.ok(comSanShuoExpertService.updateById(expert));
|
}
|
|
/**
|
* 重置密码
|
* */
|
@PostMapping("/resetPassword")
|
public R resetPassword(@RequestBody ComSanshuoExpertDTO comSanshuoExpertDTO){
|
ComSanshuoExpert expert = comSanShuoExpertService.getById(comSanshuoExpertDTO.getId());
|
expert.setPassword(comSanshuoExpertDTO.getPassword());
|
return R.ok(comSanShuoExpertService.updateById(expert));
|
}
|
}
|