package com.idea.oa.apply.controller; import com.github.pagehelper.PageInfo; import com.idea.oa.apply.model.ApplyAddWorkTime; import com.idea.oa.apply.service.ApplyAddWorkTimeService; import com.rockstar.common.base.BaseController; import com.rockstar.common.domain.AjaxResult; import com.rockstar.frame.model.extend.DateTrans; import com.rockstar.frame.model.extend.TableSplitResult; import com.rockstar.frame.model.extend.Tablepar; import io.swagger.annotations.Api; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.Date; /** * Created by zt on 2023 */ @Controller @RequestMapping(value = "ApplyAddWorkTimeController") @Api(value="分表子表_加班申请时间表") public class ApplyAddWorkTimeController extends BaseController { //主表 @Autowired private ApplyAddWorkTimeService modelService; @PostMapping(value = "list",produces = {"application/json;charset=UTF-8"}) @ResponseBody public Object list(Tablepar tablepar, ApplyAddWorkTime model, DateTrans dt){ PageInfo page= modelService.list(tablepar,model,dt); TableSplitResult result=new TableSplitResult(page.getPageNum(), page.getTotal(), page.getList()); return result; } @PostMapping(value = "listAll",produces = {"application/json;charset=UTF-8"}) @ResponseBody public Object listAll(ApplyAddWorkTime model, DateTrans dt){ return modelService.listAll(model,dt); } @PostMapping(value = "add",produces = {"application/json;charset=UTF-8"}) @ResponseBody public AjaxResult add(ApplyAddWorkTime record){ record.setCreatedAt(new Date()); int result = modelService.insert(record); return result(result); } @PostMapping(value = "remove/{id}",produces = {"application/json;charset=UTF-8"}) @ResponseBody public AjaxResult remove(@PathVariable("id") String id){ int result = -1;//modelService.deleteByPrimaryKey(id); return result(result); } @PostMapping(value = "edit",produces = {"application/json;charset=UTF-8"}) @ResponseBody public AjaxResult editSave(ApplyAddWorkTime model){ int result = modelService.updateByPrimaryKeySelective(model); return result(result); } @PostMapping(value = "getById",produces = {"application/json;charset=UTF-8"}) @ResponseBody public ApplyAddWorkTime getById(String id) { return modelService.selectByPrimaryKey(id); } }