中扬CRM客户关系管理系统
#
luxiaotao1123
2022-11-22 60da5bb6db72be7d2ec74c97ea5ecd8291d6ec5d
src/main/java/com/zy/crm/manager/controller/PlanTypeController.java
@@ -16,10 +16,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@RestController
public class PlanTypeController extends BaseController {
@@ -27,15 +24,33 @@
    @Autowired
    private PlanTypeService planTypeService;
    @RequestMapping(value = "/planType/{id}/auth")
    @GetMapping(value = "/planType/{id}/auth")
    @ManagerAuth
    public R get(@PathVariable("id") String id) {
        return R.ok(planTypeService.selectById(String.valueOf(id)));
    }
    @RequestMapping(value = "/planType/list/auth")
    @PostMapping(value = "/planType/list/auth")
    public R list() {
        return R.ok().add(planTypeService.selectList(new EntityWrapper<PlanType>().orderBy("id")));
    }
    @PostMapping(value = "/planType/list/radio/auth")
    public R listRadio() {
        List<PlanType> planTypes = planTypeService.selectList(new EntityWrapper<PlanType>().orderBy("id"));
        for (int i = 0; i<planTypes.size(); i++) {
            planTypes.get(i).setData("");
            planTypes.get(i).setHtml("");
            if (i == 0) {
                planTypes.get(i).setChecked("checked");
            }
        }
        return R.ok().add(planTypes);
    }
    @RequestMapping(value = "/planType/page/auth")
    @ManagerAuth
    public R list(@RequestParam(defaultValue = "1")Integer curr,
    public R page(@RequestParam(defaultValue = "1")Integer curr,
                  @RequestParam(defaultValue = "10")Integer limit,
                  @RequestParam(required = false)String orderByField,
                  @RequestParam(required = false)String orderByType,
@@ -65,6 +80,12 @@
    @RequestMapping(value = "/planType/add/auth")
    @ManagerAuth
    public R add(PlanType planType) {
        planType.setHostId(getHostId());
        planType.setCreateBy(getUserId());
        planType.setCreateTime(new Date());
        planType.setUpdateBy(getUserId());
        planType.setUpdateTime(new Date());
        planType.setStatus(1);
        planTypeService.insert(planType);
        return R.ok();
    }
@@ -75,6 +96,8 @@
        if (Cools.isEmpty(planType) || null==planType.getId()){
            return R.error();
        }
        planType.setUpdateBy(getUserId());
        planType.setUpdateTime(new Date());
        planTypeService.updateById(planType);
        return R.ok();
    }