package com.hxzkappboot.controller;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.hxzkappboot.mapper.TbDepartmentMapper;
|
import com.hxzkappboot.mapper.TbWarnmesMapper;
|
import com.hxzkappboot.pojo.TbDepartment;
|
import com.hxzkappboot.pojo.TbWarnmes;
|
import com.hxzkappboot.service.TbWarnmesService;
|
import com.hxzkappboot.util.R;
|
import com.hxzkappboot.util.StatusCode;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.validation.Valid;
|
import java.text.ParseException;
|
import java.util.ArrayList;
|
import java.util.List;
|
|
|
@RestController
|
public class TbWarnmesController {
|
|
@Autowired
|
TbWarnmesMapper tbWarnmesMapper;
|
|
@GetMapping({"/api/wx/findWarnmes"})
|
public R findWarnmes(String type) throws ParseException {
|
R response ;
|
QueryWrapper queryWrapper = new QueryWrapper<>();
|
queryWrapper.eq("type",type);
|
response = new R(StatusCode.Success);
|
response.setData( tbWarnmesMapper.selectOne(queryWrapper));
|
return response;
|
}
|
|
|
@PostMapping("/api/wx/saveWarnmes")
|
public void saveWarnmes(@Valid @RequestBody TbWarnmes tbWarnmes) {
|
// R response;
|
|
QueryWrapper queryWrapper = new QueryWrapper<>();
|
queryWrapper.eq("type",tbWarnmes.getType());
|
// tbDepartmentMapper.selectList(queryWrapper);
|
tbWarnmesMapper.update(tbWarnmes,queryWrapper);
|
|
|
}
|
}
|