| | |
| | | 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 { |
| | |
| | | @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, |
| | |
| | | @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(); |
| | | } |
| | |
| | | if (Cools.isEmpty(planType) || null==planType.getId()){ |
| | | return R.error(); |
| | | } |
| | | planType.setUpdateBy(getUserId()); |
| | | planType.setUpdateTime(new Date()); |
| | | planTypeService.updateById(planType); |
| | | return R.ok(); |
| | | } |