| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.dto.UnitListQueryDto; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TCompany; |
| | | import com.ruoyi.other.service.TCompanyService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RestController |
| | | @RequestMapping("/t-company") |
| | | public class TCompanyController { |
| | | @Resource |
| | | private TCompanyService companyService; |
| | | |
| | | //单位分页 |
| | | @PostMapping(value = "/unit/page") |
| | | public R<Page<TCompany>> unitPage(@RequestBody UnitListQueryDto unitListQueryDto) { |
| | | Page<TCompany> page = companyService.lambdaQuery() |
| | | .orderByDesc(TCompany::getCreateTime) |
| | | .like(unitListQueryDto.getCompanyName()!=null&& unitListQueryDto.getCompanyName().isEmpty(), TCompany::getName, unitListQueryDto.getCompanyName()) |
| | | .page(Page.of(unitListQueryDto.getPageCurr(), unitListQueryDto.getPageSize())); |
| | | return R.ok(page); |
| | | |
| | | } |
| | | //单位添加 |
| | | @PostMapping(value = "/unit/addOrUpdate") |
| | | public R add(@RequestBody TCompany tCompany) { |
| | | if (tCompany.getId()==null){ |
| | | tCompany.setCreateTime(LocalDateTime.now()); |
| | | } |
| | | companyService.saveOrUpdate(tCompany); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping(value = "/unit/delete") |
| | | public R add(@RequestParam Integer id) { |
| | | companyService.removeById(id); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | | |