zhangtiansen
2022-09-06 c9a036da723b08fc34ecc90c0668348f01e01458
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package com.panzhihua.service_community.api;
 
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.community.sanshuo.ComSanShuoIndustryCenterDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.service_community.entity.ComSanshuoIndustryCenter;
import com.panzhihua.service_community.service.ComSanShuoIndustryCenterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
/**
 * 三说会堂业务中心管理控制器
 * */
@RestController
@RequestMapping("/sanshuo/industryCenter")
public class ComSanShuoIndustryCenterApi extends BaseController {
    @Resource
    private ComSanShuoIndustryCenterService comSanShuoIndustryCenterService;
 
    @GetMapping("/list")
    public R list(@RequestParam(value = "keyWord",required = false)String keyWord,
                  @RequestParam(value = "page",required = false)Integer page,
                  @RequestParam(value = "size",required = false)Integer size){
        return R.ok(comSanShuoIndustryCenterService.pageIndustryCenter(keyWord,page,size));
    }
 
    /**
     * 添加业务中心
     * */
    @PostMapping
    public R add(@RequestBody ComSanShuoIndustryCenterDTO comSanShuoIndustryCenterDTO){
        comSanShuoIndustryCenterDTO.setCreateBy(this.getLoginUserInfo().getName());
        return R.ok(comSanShuoIndustryCenterService.addOrUpdate(comSanShuoIndustryCenterDTO));
    }
 
    /**
     * 修改业务中心
     * */
    @PutMapping
    public R update(@RequestBody ComSanShuoIndustryCenterDTO comSanShuoIndustryCenterDTO){
        return R.ok(comSanShuoIndustryCenterService.addOrUpdate(comSanShuoIndustryCenterDTO));
    }
 
    /**
     * 删除业务中心
     * */
    @DeleteMapping("/remove/{id}")
    public R remove(@PathVariable("id") Long id){
        ComSanshuoIndustryCenter center = comSanShuoIndustryCenterService.getById(id);
        center.setDelFlag(0);
        center.setStatus(0);
        return R.ok(comSanShuoIndustryCenterService.updateById(center));
    }
 
    /**
     * 重置密码
     * */
    @PostMapping("/resetPass")
    public R resetPassword(@RequestBody ComSanShuoIndustryCenterDTO comSanShuoIndustryCenterDTO){
        ComSanshuoIndustryCenter center = comSanShuoIndustryCenterService.getById(comSanShuoIndustryCenterDTO.getId());
        center.setPassword(comSanShuoIndustryCenterDTO.getPassword());
        return R.ok(comSanShuoIndustryCenterService.updateById(center));
    }
 
}