bug修复

This commit is contained in:
guo 2023-12-01 14:37:41 +08:00
parent aa0542d7b1
commit 40ce81b728
10 changed files with 117 additions and 31 deletions

View File

@ -86,8 +86,7 @@ public class SmartGroutDevController {
@ApiOperation(value = "添加智能压浆-设备信息", notes = "添加智能压浆-设备信息", httpMethod = "POST") @ApiOperation(value = "添加智能压浆-设备信息", notes = "添加智能压浆-设备信息", httpMethod = "POST")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<SmartGroutDev> add(@RequestBody SmartGroutDev smartGroutDev) { public Result<SmartGroutDev> add(@RequestBody SmartGroutDev smartGroutDev) {
smartGroutDev.setId(null); smartGroutDevService.add(smartGroutDev);
smartGroutDevService.save(smartGroutDev);
return Result.ok(); return Result.ok();
} }
@ -100,7 +99,7 @@ public class SmartGroutDevController {
@ApiOperation(value = "编辑智能压浆-设备信息", notes = "编辑智能压浆-设备信息", httpMethod = "POST") @ApiOperation(value = "编辑智能压浆-设备信息", notes = "编辑智能压浆-设备信息", httpMethod = "POST")
@PostMapping(value = "/edit") @PostMapping(value = "/edit")
public Result<SmartGroutDev> edit(@RequestBody SmartGroutDev smartGroutDev) { public Result<SmartGroutDev> edit(@RequestBody SmartGroutDev smartGroutDev) {
smartGroutDevService.updateById(smartGroutDev); smartGroutDevService.edit(smartGroutDev);
return Result.ok(); return Result.ok();
} }

View File

@ -18,4 +18,8 @@ public interface ISmartGroutDevService extends IService<SmartGroutDev> {
IPage<SmartGroutDev> queryPageList(HashMap<String, Object> paramMap); IPage<SmartGroutDev> queryPageList(HashMap<String, Object> paramMap);
List<SmartGroutDev> queryList(HashMap<String, Object> paramMap); List<SmartGroutDev> queryList(HashMap<String, Object> paramMap);
void add(SmartGroutDev smartGroutDev);
void edit(SmartGroutDev smartGroutDev);
} }

View File

@ -1,15 +1,18 @@
package com.zhgd.xmgl.modules.smartgrout.service.impl; package com.zhgd.xmgl.modules.smartgrout.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.jeecg.common.system.query.QueryGenerator; import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.modules.smartgrout.entity.SmartGroutDev; import com.zhgd.xmgl.modules.smartgrout.entity.SmartGroutDev;
import com.zhgd.xmgl.modules.smartgrout.mapper.SmartGroutDevMapper; import com.zhgd.xmgl.modules.smartgrout.mapper.SmartGroutDevMapper;
import com.zhgd.xmgl.modules.smartgrout.service.ISmartGroutDevService; import com.zhgd.xmgl.modules.smartgrout.service.ISmartGroutDevService;
import com.zhgd.xmgl.util.PageUtil; import com.zhgd.xmgl.util.PageUtil;
import com.zhgd.xmgl.util.RefUtil; import com.zhgd.xmgl.util.RefUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -25,6 +28,9 @@ import java.util.List;
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class SmartGroutDevServiceImpl extends ServiceImpl<SmartGroutDevMapper, SmartGroutDev> implements ISmartGroutDevService { public class SmartGroutDevServiceImpl extends ServiceImpl<SmartGroutDevMapper, SmartGroutDev> implements ISmartGroutDevService {
@Autowired
private SmartGroutDevMapper smartGroutDevMapper;
@Override @Override
public IPage<SmartGroutDev> queryPageList(HashMap<String, Object> paramMap) { public IPage<SmartGroutDev> queryPageList(HashMap<String, Object> paramMap) {
QueryWrapper<SmartGroutDev> queryWrapper = getQueryWrapper(paramMap); QueryWrapper<SmartGroutDev> queryWrapper = getQueryWrapper(paramMap);
@ -40,6 +46,30 @@ public class SmartGroutDevServiceImpl extends ServiceImpl<SmartGroutDevMapper, S
return dealList(baseMapper.queryList(queryWrapper)); return dealList(baseMapper.queryList(queryWrapper));
} }
@Override
public void add(SmartGroutDev smartGroutDev) {
String devSn = smartGroutDev.getDevSn();
SmartGroutDev dev = smartGroutDevMapper.selectOne(new LambdaQueryWrapper<SmartGroutDev>()
.eq(SmartGroutDev::getDevSn, devSn));
if (dev != null) {
throw new OpenAlertException("设备编号已存在");
}
smartGroutDev.setId(null);
baseMapper.insert(smartGroutDev);
}
@Override
public void edit(SmartGroutDev smartGroutDev) {
SmartGroutDev dev = smartGroutDevMapper.selectOne(new LambdaQueryWrapper<SmartGroutDev>()
.eq(SmartGroutDev::getDevSn, smartGroutDev.getDevSn())
.ne(SmartGroutDev::getId, smartGroutDev.getId())
);
if (dev != null) {
throw new OpenAlertException("设备编号已存在");
}
baseMapper.updateById(smartGroutDev);
}
private QueryWrapper<SmartGroutDev> getQueryWrapper(HashMap<String, Object> paramMap) { private QueryWrapper<SmartGroutDev> getQueryWrapper(HashMap<String, Object> paramMap) {
String alias = "sgd."; String alias = "sgd.";
QueryWrapper<SmartGroutDev> queryWrapper = QueryGenerator.initPageQueryWrapper(SmartGroutDev.class, paramMap, alias); QueryWrapper<SmartGroutDev> queryWrapper = QueryGenerator.initPageQueryWrapper(SmartGroutDev.class, paramMap, alias);

View File

@ -86,8 +86,7 @@ public class SmartTensionDevController {
@ApiOperation(value = "添加智能张拉-设备信息", notes = "添加智能张拉-设备信息", httpMethod = "POST") @ApiOperation(value = "添加智能张拉-设备信息", notes = "添加智能张拉-设备信息", httpMethod = "POST")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<SmartTensionDev> add(@RequestBody SmartTensionDev smartTensionDev) { public Result<SmartTensionDev> add(@RequestBody SmartTensionDev smartTensionDev) {
smartTensionDev.setId(null); smartTensionDevService.add(smartTensionDev);
smartTensionDevService.save(smartTensionDev);
return Result.ok(); return Result.ok();
} }
@ -100,7 +99,7 @@ public class SmartTensionDevController {
@ApiOperation(value = "编辑智能张拉-设备信息", notes = "编辑智能张拉-设备信息", httpMethod = "POST") @ApiOperation(value = "编辑智能张拉-设备信息", notes = "编辑智能张拉-设备信息", httpMethod = "POST")
@PostMapping(value = "/edit") @PostMapping(value = "/edit")
public Result<SmartTensionDev> edit(@RequestBody SmartTensionDev smartTensionDev) { public Result<SmartTensionDev> edit(@RequestBody SmartTensionDev smartTensionDev) {
smartTensionDevService.updateById(smartTensionDev); smartTensionDevService.edit(smartTensionDev);
return Result.ok(); return Result.ok();
} }

View File

@ -18,4 +18,9 @@ public interface ISmartTensionDevService extends IService<SmartTensionDev> {
IPage<SmartTensionDev> queryPageList(HashMap<String, Object> paramMap); IPage<SmartTensionDev> queryPageList(HashMap<String, Object> paramMap);
List<SmartTensionDev> queryList(HashMap<String, Object> paramMap); List<SmartTensionDev> queryList(HashMap<String, Object> paramMap);
void add(SmartTensionDev smartTensionDev);
void edit(SmartTensionDev smartTensionDev);
} }

View File

@ -1,8 +1,12 @@
package com.zhgd.xmgl.modules.smarttension.service.impl; package com.zhgd.xmgl.modules.smarttension.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.xmgl.modules.smartgrout.entity.SmartGroutDev;
import com.zhgd.xmgl.modules.smarttension.entity.SmartTensionDev; import com.zhgd.xmgl.modules.smarttension.entity.SmartTensionDev;
import com.zhgd.xmgl.modules.smarttension.mapper.SmartTensionDevMapper; import com.zhgd.xmgl.modules.smarttension.mapper.SmartTensionDevMapper;
import com.zhgd.xmgl.modules.smarttension.service.ISmartTensionDevService; import com.zhgd.xmgl.modules.smarttension.service.ISmartTensionDevService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -26,6 +30,9 @@ import org.springframework.transaction.annotation.Transactional;
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class SmartTensionDevServiceImpl extends ServiceImpl<SmartTensionDevMapper, SmartTensionDev> implements ISmartTensionDevService { public class SmartTensionDevServiceImpl extends ServiceImpl<SmartTensionDevMapper, SmartTensionDev> implements ISmartTensionDevService {
@Autowired
private SmartTensionDevMapper smartTensionDevMapper;
@Override @Override
public IPage<SmartTensionDev> queryPageList(HashMap<String, Object> paramMap) { public IPage<SmartTensionDev> queryPageList(HashMap<String, Object> paramMap) {
QueryWrapper<SmartTensionDev> queryWrapper = getQueryWrapper(paramMap); QueryWrapper<SmartTensionDev> queryWrapper = getQueryWrapper(paramMap);
@ -41,6 +48,30 @@ public class SmartTensionDevServiceImpl extends ServiceImpl<SmartTensionDevMappe
return dealList(baseMapper.queryList(queryWrapper)); return dealList(baseMapper.queryList(queryWrapper));
} }
@Override
public void add(SmartTensionDev smartTensionDev) {
String devSn = smartTensionDev.getDevSn();
SmartTensionDev dev = smartTensionDevMapper.selectOne(new LambdaQueryWrapper<SmartTensionDev>()
.eq(SmartTensionDev::getDevSn, devSn));
if (dev != null) {
throw new OpenAlertException("设备编号已存在");
}
smartTensionDev.setId(null);
baseMapper.insert(smartTensionDev);
}
@Override
public void edit(SmartTensionDev smartTensionDev) {
SmartTensionDev dev = smartTensionDevMapper.selectOne(new LambdaQueryWrapper<SmartTensionDev>()
.eq(SmartTensionDev::getDevSn, smartTensionDev.getDevSn())
.ne(SmartTensionDev::getId, smartTensionDev.getId())
);
if (dev != null) {
throw new OpenAlertException("设备编号已存在");
}
baseMapper.updateById(smartTensionDev);
}
private QueryWrapper<SmartTensionDev> getQueryWrapper(HashMap<String, Object> paramMap) { private QueryWrapper<SmartTensionDev> getQueryWrapper(HashMap<String, Object> paramMap) {
QueryWrapper<SmartTensionDev> queryWrapper = QueryGenerator.initPageQueryWrapper(SmartTensionDev.class, paramMap); QueryWrapper<SmartTensionDev> queryWrapper = QueryGenerator.initPageQueryWrapper(SmartTensionDev.class, paramMap);
queryWrapper.orderByDesc(RefUtil.fieldNameUlc(SmartTensionDev::getId)); queryWrapper.orderByDesc(RefUtil.fieldNameUlc(SmartTensionDev::getId));

View File

@ -250,6 +250,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/xmgl/vehiclePositionData/add").permitAll() .antMatchers("/xmgl/vehiclePositionData/add").permitAll()
.antMatchers("/xmgl/vehiclePositionAlarm/add").permitAll() .antMatchers("/xmgl/vehiclePositionAlarm/add").permitAll()
.antMatchers("/xmgl/vehiclePositionDayRecord/add").permitAll() .antMatchers("/xmgl/vehiclePositionDayRecord/add").permitAll()
.antMatchers("/xmgl/smartTensionData/add").permitAll()
.antMatchers("/xmgl/smartGroutData/add").permitAll()
.antMatchers(HttpMethod.OPTIONS, "/**").anonymous() .antMatchers(HttpMethod.OPTIONS, "/**").anonymous()
.anyRequest().authenticated() // 剩下所有的验证都需要验证 .anyRequest().authenticated() // 剩下所有的验证都需要验证
.and() .and()

View File

@ -88,8 +88,7 @@ public class ${entityName}Controller {
@ApiOperation(value = "添加${tableVo.ftlDescription}信息", notes = "添加${tableVo.ftlDescription}信息" , httpMethod="POST") @ApiOperation(value = "添加${tableVo.ftlDescription}信息", notes = "添加${tableVo.ftlDescription}信息" , httpMethod="POST")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<${entityName}> add(@RequestBody ${entityName} ${entityName?uncap_first}) { public Result<${entityName}> add(@RequestBody ${entityName} ${entityName?uncap_first}) {
${entityName?uncap_first}.setId(null); ${entityName?uncap_first}Service.add(${entityName?uncap_first});
${entityName?uncap_first}Service.save(${entityName?uncap_first});
return Result.ok(); return Result.ok();
} }
@ -101,7 +100,7 @@ public class ${entityName}Controller {
@ApiOperation(value = "编辑${tableVo.ftlDescription}信息", notes = "编辑${tableVo.ftlDescription}信息" , httpMethod="POST") @ApiOperation(value = "编辑${tableVo.ftlDescription}信息", notes = "编辑${tableVo.ftlDescription}信息" , httpMethod="POST")
@PostMapping(value = "/edit") @PostMapping(value = "/edit")
public Result<${entityName}> edit(@RequestBody ${entityName} ${entityName?uncap_first}) { public Result<${entityName}> edit(@RequestBody ${entityName} ${entityName?uncap_first}) {
${entityName?uncap_first}Service.updateById(${entityName?uncap_first}); ${entityName?uncap_first}Service.edit(${entityName?uncap_first});
return Result.ok(); return Result.ok();
} }

View File

@ -17,4 +17,8 @@ public interface I${entityName}Service extends IService<${entityName}> {
IPage<${entityName}> queryPageList(HashMap<String, Object> paramMap); IPage<${entityName}> queryPageList(HashMap<String, Object> paramMap);
List<${entityName}> queryList(HashMap<String, Object> paramMap); List<${entityName}> queryList(HashMap<String, Object> paramMap);
void add(${entityName} ${entityName?uncap_first});
void edit(${entityName} ${entityName?uncap_first});
} }

View File

@ -24,6 +24,8 @@ import org.springframework.transaction.annotation.Transactional;
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, ${entityName}> implements I${entityName}Service { public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, ${entityName}> implements I${entityName}Service {
@Autowired
private ${entityName}Mapper ${entityName?uncap_first}Mapper;
@Override @Override
public IPage<${entityName}> queryPageList(HashMap<String, Object> paramMap) { public IPage<${entityName}> queryPageList(HashMap<String, Object> paramMap) {
QueryWrapper<${entityName}> queryWrapper = getQueryWrapper(paramMap); QueryWrapper<${entityName}> queryWrapper = getQueryWrapper(paramMap);
@ -49,4 +51,15 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
private List<${entityName}> dealList(List<${entityName}> list) { private List<${entityName}> dealList(List<${entityName}> list) {
return list; return list;
} }
@Override
public void add(${entityName} ${entityName?uncap_first}) {
${entityName?uncap_first}.setId(null);
baseMapper.insert(${entityName?uncap_first});
}
@Override
public void edit(${entityName} ${entityName?uncap_first}) {
baseMapper.updateById(${entityName?uncap_first});
}
} }