fix: Address
This commit is contained in:
@@ -31,7 +31,6 @@ public class AddressController {
|
|||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询接口方法地址")
|
@Log("查询接口方法地址")
|
||||||
@ApiOperation("查询接口方法地址")
|
@ApiOperation("查询接口方法地址")
|
||||||
//@PreAuthorize("@el.check('Address:list')")
|
|
||||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||||
return new ResponseEntity<>(addressService.queryAll(whereJson, page), HttpStatus.OK);
|
return new ResponseEntity<>(addressService.queryAll(whereJson, page), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@@ -39,7 +38,6 @@ public class AddressController {
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("新增接口方法地址")
|
@Log("新增接口方法地址")
|
||||||
@ApiOperation("新增接口方法地址")
|
@ApiOperation("新增接口方法地址")
|
||||||
//@PreAuthorize("@el.check('Address:add')")
|
|
||||||
public ResponseEntity<Object> create(@Validated @RequestBody AddressDto dto) {
|
public ResponseEntity<Object> create(@Validated @RequestBody AddressDto dto) {
|
||||||
addressService.create(dto);
|
addressService.create(dto);
|
||||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||||
@@ -48,7 +46,6 @@ public class AddressController {
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
@Log("修改接口方法地址")
|
@Log("修改接口方法地址")
|
||||||
@ApiOperation("修改接口方法地址")
|
@ApiOperation("修改接口方法地址")
|
||||||
//@PreAuthorize("@el.check('Address:edit')")
|
|
||||||
public ResponseEntity<Object> update(@Validated @RequestBody AddressDto dto) {
|
public ResponseEntity<Object> update(@Validated @RequestBody AddressDto dto) {
|
||||||
addressService.update(dto);
|
addressService.update(dto);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
@@ -56,7 +53,6 @@ public class AddressController {
|
|||||||
|
|
||||||
@Log("删除接口方法地址")
|
@Log("删除接口方法地址")
|
||||||
@ApiOperation("删除接口方法地址")
|
@ApiOperation("删除接口方法地址")
|
||||||
//@PreAuthorize("@el.check('Address:del')")
|
|
||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||||
addressService.deleteAll(ids);
|
addressService.deleteAll(ids);
|
||||||
@@ -66,7 +62,6 @@ public class AddressController {
|
|||||||
@Log("导出接口方法地址")
|
@Log("导出接口方法地址")
|
||||||
@ApiOperation("导出接口方法地址")
|
@ApiOperation("导出接口方法地址")
|
||||||
@GetMapping(value = "/download")
|
@GetMapping(value = "/download")
|
||||||
//@PreAuthorize("@el.check('Address:list')")
|
|
||||||
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
||||||
addressService.download(addressService.queryAll(whereJson), response);
|
addressService.download(addressService.queryAll(whereJson), response);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,19 +38,40 @@ public interface AddressService extends CommonService<Address> {
|
|||||||
*/
|
*/
|
||||||
List<AddressDto> queryAll(AddressQueryParam query);
|
List<AddressDto> queryAll(AddressQueryParam query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查地址
|
||||||
|
* @param id
|
||||||
|
* @return Address
|
||||||
|
*/
|
||||||
Address getById(String id);
|
Address getById(String id);
|
||||||
|
|
||||||
AddressDto findById(String id);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插入一条新数据。
|
* 新增
|
||||||
|
* @param resources
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
int insert(AddressDto resources);
|
int insert(AddressDto resources);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新
|
||||||
|
* @param resources
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
int updateById(AddressDto resources);
|
int updateById(AddressDto resources);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
int removeById(String id);
|
int removeById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
int removeByIds(Set<String> ids);
|
int removeByIds(Set<String> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -28,10 +29,6 @@ import org.nl.config.language.LangProcess;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
// 默认不使用缓存
|
|
||||||
//import org.springframework.cache.annotation.CacheConfig;
|
|
||||||
//import org.springframework.cache.annotation.CacheEvict;
|
|
||||||
//import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -44,14 +41,11 @@ import java.util.*;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
// @CacheConfig(cacheNames = SysInterfaceMethodsAddressService.CACHE_KEY)
|
|
||||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
|
||||||
public class AddressServiceImpl extends CommonServiceImpl<AddressMapper, Address> implements AddressService {
|
public class AddressServiceImpl extends CommonServiceImpl<AddressMapper, Address> implements AddressService {
|
||||||
|
|
||||||
// private final RedisUtils redisUtils;
|
// private final RedisUtils redisUtils;
|
||||||
private final AddressMapper sysInterfaceMethodsAddressMapper;
|
private final AddressMapper sysInterfaceMethodsAddressMapper;
|
||||||
|
|
||||||
private final String delete = "";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageInfo<AddressDto> queryAll(AddressQueryParam query, Pageable pageable) {
|
public PageInfo<AddressDto> queryAll(AddressQueryParam query, Pageable pageable) {
|
||||||
@@ -67,88 +61,43 @@ public class AddressServiceImpl extends CommonServiceImpl<AddressMapper, Address
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Address getById(String id) {
|
public Address getById(String id) {
|
||||||
|
Assert.notEmpty(id,LangProcess.msg("error_checkNumber","id"));
|
||||||
return sysInterfaceMethodsAddressMapper.selectById(id);
|
return sysInterfaceMethodsAddressMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
// @Cacheable(key = "'id:' + #p0")
|
|
||||||
public AddressDto findById(String id) {
|
|
||||||
return ConvertUtil.convert(getById(id), AddressDto.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public int insert(AddressDto resources) {
|
public int insert(AddressDto resources) {
|
||||||
Address entity = ConvertUtil.convert(resources, Address.class);
|
Address entity = ConvertUtil.convert(resources, Address.class);
|
||||||
return sysInterfaceMethodsAddressMapper.insert(entity);
|
return sysInterfaceMethodsAddressMapper.insert(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public int updateById(AddressDto resources) {
|
public int updateById(AddressDto resources) {
|
||||||
Address entity = ConvertUtil.convert(resources, Address.class);
|
Address entity = ConvertUtil.convert(resources, Address.class);
|
||||||
int ret = sysInterfaceMethodsAddressMapper.updateById(entity);
|
|
||||||
// delCaches(resources.id);
|
// delCaches(resources.id);
|
||||||
return ret;
|
return sysInterfaceMethodsAddressMapper.updateById(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public int removeByIds(Set<String> ids) {
|
public int removeByIds(Set<String> ids) {
|
||||||
// delCaches(ids);
|
// delCaches(ids);
|
||||||
return sysInterfaceMethodsAddressMapper.deleteBatchIds(ids);
|
return sysInterfaceMethodsAddressMapper.deleteBatchIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public int removeById(String id) {
|
public int removeById(String id) {
|
||||||
Set<String> set = new HashSet<>(1);
|
Set<String> set = new HashSet<>(1);
|
||||||
set.add(id);
|
set.add(id);
|
||||||
return this.removeByIds(set);
|
return this.removeByIds(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
private void delCaches(String id) {
|
|
||||||
redisUtils.delByKey(CACHE_KEY + "::id:", id);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void delCaches(Set<String> ids) {
|
|
||||||
for (String id: ids) {
|
|
||||||
delCaches(id);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
@Override
|
|
||||||
public void download(List<SysInterfaceMethodsAddressDto> all, HttpServletResponse response) throws IOException {
|
|
||||||
List<Map<String, Object>> list = new ArrayList<>();
|
|
||||||
for (SysInterfaceMethodsAddressDto sysInterfaceMethodsAddress : all) {
|
|
||||||
Map<String,Object> map = new LinkedHashMap<>();
|
|
||||||
map.put("方法编码", sysInterfaceMethodsAddress.getMethodsCode());
|
|
||||||
map.put("方法名称", sysInterfaceMethodsAddress.getMethodsName());
|
|
||||||
map.put("请求地址", sysInterfaceMethodsAddress.getMethodsUrl());
|
|
||||||
map.put("备注", sysInterfaceMethodsAddress.getRemark());
|
|
||||||
map.put("创建人", sysInterfaceMethodsAddress.getCreateId());
|
|
||||||
map.put("创建人姓名", sysInterfaceMethodsAddress.getCreateName());
|
|
||||||
map.put("创建时间", sysInterfaceMethodsAddress.getCreateTime());
|
|
||||||
map.put("修改人", sysInterfaceMethodsAddress.getUpdateOptid());
|
|
||||||
map.put("修改人姓名", sysInterfaceMethodsAddress.getUpdateOptname());
|
|
||||||
map.put("修改时间", sysInterfaceMethodsAddress.getUpdateTime());
|
|
||||||
map.put("是否删除", sysInterfaceMethodsAddress.getIsDelete());
|
|
||||||
list.add(map);
|
|
||||||
}
|
|
||||||
FileUtil.downloadExcel(list, response);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||||
// String blurry = "";
|
|
||||||
// if (whereJson.get("blurry") != null) {
|
|
||||||
// blurry = (String) whereJson.get("blurry");
|
|
||||||
// }
|
|
||||||
// JSONObject jo = WQL.getWO("Qdevice_query_002").addParam("flag", "3").addParam("blurry", blurry).pageQuery(WqlUtil.getHttpContext(page), "update_time desc");
|
|
||||||
// return jo;
|
|
||||||
|
|
||||||
IPage<Address> queryPage = PageUtil.toMybatisPage(page);
|
IPage<Address> queryPage = PageUtil.toMybatisPage(page);
|
||||||
LambdaQueryWrapper<Address> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Address> wrapper = new LambdaQueryWrapper<>();
|
||||||
@@ -161,32 +110,16 @@ public class AddressServiceImpl extends CommonServiceImpl<AddressMapper, Address
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AddressDto> queryAll(Map whereJson) {
|
public List<AddressDto> queryAll(Map whereJson) {
|
||||||
// WQLObject wo = WQLObject.getWQLObject("sys_interface_methods_address");
|
|
||||||
// JSONArray arr = wo.query().getResultJSONArray(0);
|
|
||||||
// List<AddressDto> list = arr.toJavaList(AddressDto.class);
|
|
||||||
// return list;
|
|
||||||
List<Address> addressList = new LambdaQueryChainWrapper<>(sysInterfaceMethodsAddressMapper)
|
List<Address> addressList = new LambdaQueryChainWrapper<>(sysInterfaceMethodsAddressMapper)
|
||||||
.list();
|
.list();
|
||||||
return ConvertUtil.convertList(addressList, AddressDto.class);
|
return ConvertUtil.convertList(addressList, AddressDto.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public AddressDto findById(String methods_id) {
|
|
||||||
// WQLObject wo = WQLObject.getWQLObject("sys_interface_methods_address");
|
|
||||||
// JSONObject json = wo.query("methods_id ='" + methods_id + "'").uniqueResult(0);
|
|
||||||
// final AddressDto obj = json.toJavaObject(AddressDto.class);
|
|
||||||
// return obj;
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AddressDto findByCode(String code) {
|
public AddressDto findByCode(String code) {
|
||||||
// WQLObject wo = WQLObject.getWQLObject("sys_interface_methods_address");
|
|
||||||
// JSONObject json = wo.query("methods_code ='" + code + "'").uniqueResult(0);
|
|
||||||
// if (ObjectUtil.isNotEmpty(json)){
|
|
||||||
// final AddressDto obj = json.toJavaObject(AddressDto.class);
|
|
||||||
// return obj;
|
|
||||||
// }
|
|
||||||
// return null;
|
|
||||||
|
|
||||||
Address address = new LambdaQueryChainWrapper<>(sysInterfaceMethodsAddressMapper)
|
Address address = new LambdaQueryChainWrapper<>(sysInterfaceMethodsAddressMapper)
|
||||||
.eq(Address::getMethods_code, code)
|
.eq(Address::getMethods_code, code)
|
||||||
@@ -199,7 +132,6 @@ public class AddressServiceImpl extends CommonServiceImpl<AddressMapper, Address
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void create(AddressDto dto) {
|
public void create(AddressDto dto) {
|
||||||
CommonFinalParam commonFinalParam = new CommonFinalParam();
|
CommonFinalParam commonFinalParam = new CommonFinalParam();
|
||||||
String Methods_code = dto.getMethods_code();
|
String Methods_code = dto.getMethods_code();
|
||||||
@@ -214,25 +146,19 @@ public class AddressServiceImpl extends CommonServiceImpl<AddressMapper, Address
|
|||||||
dto.setMethods_id(IdUtil.simpleUUID());
|
dto.setMethods_id(IdUtil.simpleUUID());
|
||||||
dto.setCreate_id(userId);
|
dto.setCreate_id(userId);
|
||||||
dto.setCreate_name(currentUsername);
|
dto.setCreate_name(currentUsername);
|
||||||
// dto.setCreate_by(userId);
|
|
||||||
// dto.setUpdate_by(userId);
|
|
||||||
dto.setUpdate_optid(userId);
|
dto.setUpdate_optid(userId);
|
||||||
dto.setUpdate_time(now);
|
dto.setUpdate_time(now);
|
||||||
dto.setCreate_time(now);
|
dto.setCreate_time(now);
|
||||||
|
|
||||||
// WQLObject wo = WQLObject.getWQLObject("sys_interface_methods_address");
|
|
||||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
|
||||||
//
|
|
||||||
// wo.insert(json);
|
|
||||||
|
|
||||||
Address entity = ConvertUtil.convert(dto, Address.class);
|
Address entity = ConvertUtil.convert(dto, Address.class);
|
||||||
sysInterfaceMethodsAddressMapper.insert(entity);
|
sysInterfaceMethodsAddressMapper.insert(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void update(AddressDto dto) {
|
public void update(AddressDto dto) {
|
||||||
AddressDto entity = this.findById(dto.getMethods_id());
|
Address addressSelect = this.getById(dto.getMethods_id());
|
||||||
|
AddressDto entity = ConvertUtil.convert(addressSelect, AddressDto.class);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
throw new BadRequestException(LangProcess.msg("error_sysAuth"));
|
throw new BadRequestException(LangProcess.msg("error_sysAuth"));
|
||||||
}
|
}
|
||||||
@@ -243,7 +169,6 @@ public class AddressServiceImpl extends CommonServiceImpl<AddressMapper, Address
|
|||||||
dto.setUpdate_optid(userId);
|
dto.setUpdate_optid(userId);
|
||||||
dto.setUpdate_optname(currentUsername);
|
dto.setUpdate_optname(currentUsername);
|
||||||
dto.setUpdate_time(now);
|
dto.setUpdate_time(now);
|
||||||
// dto.setUpdate_by(userId);
|
|
||||||
dto.setUpdate_optid(userId);
|
dto.setUpdate_optid(userId);
|
||||||
|
|
||||||
Address address = ConvertUtil.convert(dto, Address.class);
|
Address address = ConvertUtil.convert(dto, Address.class);
|
||||||
@@ -251,7 +176,6 @@ public class AddressServiceImpl extends CommonServiceImpl<AddressMapper, Address
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void deleteAll(String[] ids) {
|
public void deleteAll(String[] ids) {
|
||||||
for (String methods_id : ids) {
|
for (String methods_id : ids) {
|
||||||
this.removeById(methods_id);
|
this.removeById(methods_id);
|
||||||
|
|||||||
Reference in New Issue
Block a user