rev:界面优化和新增点位角度
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
package org.nl.acs.angle.controller;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.angle.domain.AcsPointAngle;
|
||||
import org.nl.acs.angle.service.IAcsPointAngleService;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tq
|
||||
* @since 2023-12-13
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "点位角度管理")
|
||||
@RequestMapping("/api/acsPointAngle")
|
||||
@Slf4j
|
||||
public class AcsPointAngleController {
|
||||
@Autowired
|
||||
private IAcsPointAngleService acsPointAngleService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询点位角度")
|
||||
@ApiOperation("查询点位角度")
|
||||
//@PreAuthorize("@el.check('acsPointAngle:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(acsPointAngleService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增点位角度")
|
||||
@ApiOperation("新增点位角度")
|
||||
//@PreAuthorize("@el.check('acsPointAngle:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody AcsPointAngle dto) {
|
||||
acsPointAngleService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改点位角度")
|
||||
@ApiOperation("修改点位角度")
|
||||
//@PreAuthorize("@el.check('acsPointAngle:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody AcsPointAngle dto) {
|
||||
acsPointAngleService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除点位角度")
|
||||
@ApiOperation("删除点位角度")
|
||||
//@PreAuthorize("@el.check('acsPointAngle:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
acsPointAngleService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/updateActive")
|
||||
@Log("是否启用")
|
||||
@ApiOperation("是否启用")
|
||||
public ResponseEntity<Object> updateOn(@RequestParam Long id, @RequestParam String is_active) {
|
||||
acsPointAngleService.updateOn(id, is_active);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package org.nl.acs.angle.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author tq
|
||||
* @since 2023-12-13
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("acs_point_angle")
|
||||
@ApiModel(value="AcsPointAngle对象", description="")
|
||||
public class AcsPointAngle implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "id标识")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "起始点位编码")
|
||||
private String start_point_code;
|
||||
|
||||
@ApiModelProperty(value = "起始设备编码")
|
||||
private String start_device_code;
|
||||
|
||||
@ApiModelProperty(value = "目标点位编码")
|
||||
private String next_point_code;
|
||||
|
||||
@ApiModelProperty(value = "目标设备编码")
|
||||
private String next_device_code;
|
||||
|
||||
@ApiModelProperty(value = "起始点位角度")
|
||||
private BigDecimal start_point_angle;
|
||||
|
||||
@ApiModelProperty(value = "目标点位角度")
|
||||
private BigDecimal next_point_angle;
|
||||
|
||||
@ApiModelProperty(value = "是否启用")
|
||||
private String is_active;
|
||||
|
||||
@ApiModelProperty(value = "创建者")
|
||||
private String create_by;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private String create_time;
|
||||
|
||||
@ApiModelProperty(value = "修改者")
|
||||
private String update_by;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private String update_time;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.acs.angle.mapper;
|
||||
|
||||
import org.nl.acs.angle.domain.AcsPointAngle;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author tq
|
||||
* @since 2023-12-13
|
||||
*/
|
||||
public interface AcsPointAngleMapper extends BaseMapper<AcsPointAngle> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.nl.acs.angle.service;
|
||||
|
||||
import org.nl.acs.angle.domain.AcsPointAngle;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tq
|
||||
* @since 2023-12-13
|
||||
*/
|
||||
public interface IAcsPointAngleService extends IService<AcsPointAngle> {
|
||||
|
||||
void create(AcsPointAngle dto);
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(AcsPointAngle dto);
|
||||
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
void updateOn(Long id, String is_active);
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package org.nl.acs.angle.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import org.nl.acs.angle.domain.AcsPointAngle;
|
||||
import org.nl.acs.angle.mapper.AcsPointAngleMapper;
|
||||
import org.nl.acs.angle.service.IAcsPointAngleService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.utils.ConvertUtil;
|
||||
import org.nl.acs.utils.PageUtil;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author tq
|
||||
* @since 2023-12-13
|
||||
*/
|
||||
@Service
|
||||
public class AcsPointAngleServiceImpl extends ServiceImpl<AcsPointAngleMapper, AcsPointAngle> implements IAcsPointAngleService {
|
||||
|
||||
@Autowired
|
||||
private AcsPointAngleMapper acsPointAngleMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(AcsPointAngle dto) {
|
||||
AcsPointAngle acsPointAngle = new AcsPointAngle();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
acsPointAngle.setId(dto.getId());
|
||||
acsPointAngle.setStart_point_code(dto.getStart_point_code());
|
||||
acsPointAngle.setStart_device_code(dto.getStart_device_code());
|
||||
acsPointAngle.setNext_point_code(dto.getNext_point_code());
|
||||
acsPointAngle.setNext_device_code(dto.getNext_device_code());
|
||||
acsPointAngle.setStart_point_angle(dto.getStart_point_angle());
|
||||
acsPointAngle.setNext_point_angle(dto.getNext_point_angle());
|
||||
acsPointAngle.setIs_active(dto.getIs_active());
|
||||
acsPointAngle.setCreate_by("auto");
|
||||
acsPointAngle.setCreate_time(now);
|
||||
acsPointAngle.setUpdate_by(currentUsername);
|
||||
acsPointAngle.setUpdate_time(now);
|
||||
acsPointAngleMapper.insert(acsPointAngle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AcsPointAngle dto) {
|
||||
if (dto == null) {
|
||||
throw new BadRequestException(LangProcess.msg("error_nullPoint"));
|
||||
}
|
||||
AcsPointAngle acsPointAngle = new AcsPointAngle();
|
||||
acsPointAngle.setId(dto.getId());
|
||||
//起点角度,终点角度变化
|
||||
acsPointAngle.setStart_point_angle(dto.getStart_point_angle());
|
||||
acsPointAngle.setNext_point_angle(dto.getNext_point_angle());
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
acsPointAngle.setUpdate_by(currentUsername);
|
||||
acsPointAngle.setUpdate_time(now);
|
||||
acsPointAngleMapper.updateById(acsPointAngle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(String[] ids) {
|
||||
for (String id : ids) {
|
||||
AcsPointAngle pointAngle = new LambdaQueryChainWrapper<>(acsPointAngleMapper)
|
||||
.eq(AcsPointAngle::getId, id)
|
||||
.one();
|
||||
if (pointAngle == null) {
|
||||
continue;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", id);
|
||||
acsPointAngleMapper.deleteByMap(map);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
IPage<AcsPointAngle> queryPage = PageUtil.toMybatisPage(page);
|
||||
LambdaQueryWrapper<AcsPointAngle> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.orderByDesc(AcsPointAngle::getUpdate_time);
|
||||
IPage<AcsPointAngle> pointAnglePage = acsPointAngleMapper.selectPage(queryPage, wrapper);
|
||||
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(pointAnglePage, AcsPointAngle.class));
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOn(Long id, String is_active) {
|
||||
AcsPointAngle acsPointAngle = new AcsPointAngle();
|
||||
acsPointAngle.setId(id);
|
||||
acsPointAngle.setIs_active(is_active);
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
acsPointAngle.setUpdate_by(currentUsername);
|
||||
acsPointAngle.setUpdate_time(now);
|
||||
acsPointAngleMapper.updateById(acsPointAngle);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.acs.angle.mapper.AcsPointAngleMapper">
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, start_point_code, start_device_code, next_point_code, next_device_code, start_point_angle, next_point_angle, is_active, create_by, create_time, update_by, update_time
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user