feat(消息模块与部门模块): 修改了消息模块的bug并从新建消息接口中独立出添加附件接口,部门模块新添加了部门树返回接口
This commit is contained in:
parent
30338520cf
commit
e535b745ea
@ -66,10 +66,10 @@ public class ApiExceptionHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO 跟全局security 冲突
|
//TODO 跟全局security 冲突
|
||||||
// @ExceptionHandler(value = {Exception.class})
|
@ExceptionHandler(value = {Exception.class})
|
||||||
// public ResponseEntity<Object> handleException(Exception ex) throws JsonProcessingException {
|
public ResponseEntity<Object> handleException(Exception ex) throws JsonProcessingException {
|
||||||
// log.error("Exception: {}", objectMapper.writeValueAsString(Map.of("msg", ex.getMessage())));
|
log.error("Exception: {}", objectMapper.writeValueAsString(Map.of("msg", ex.getMessage())));
|
||||||
// return new ResponseEntity<>(objectMapper.writeValueAsString(Map.of("msg", ex.getMessage())), HttpStatus.INTERNAL_SERVER_ERROR);
|
return new ResponseEntity<>(objectMapper.writeValueAsString(Map.of("msg", ex.getMessage())), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
// }
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import lombok.NoArgsConstructor;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class ResponseResult<T> {
|
public class ResponseResult<T> {
|
||||||
|
|
||||||
|
//TODO 返回封装处理
|
||||||
/**
|
/**
|
||||||
* 状态码
|
* 状态码
|
||||||
*/
|
*/
|
||||||
|
@ -24,7 +24,7 @@ import javax.sql.DataSource;
|
|||||||
* @author harry_yao
|
* @author harry_yao
|
||||||
*/
|
*/
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@EnableMethodSecurity
|
//@EnableMethodSecurity
|
||||||
//TODO 加入全局注解会报错
|
//TODO 加入全局注解会报错
|
||||||
@Configuration
|
@Configuration
|
||||||
public class SpringSecurityConfig {
|
public class SpringSecurityConfig {
|
||||||
|
@ -91,4 +91,11 @@ public class AttachmentController {
|
|||||||
return attachments;
|
return attachments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据附件ID删除附件信息
|
||||||
|
*/
|
||||||
|
@DeleteMapping("delete/{id}")
|
||||||
|
public Boolean delete(@PathVariable("id") String id) {
|
||||||
|
return service.delete(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,9 @@ package com.zsc.edu.gateway.modules.attachment.repo;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.zsc.edu.gateway.modules.attachment.entity.Attachment;
|
import com.zsc.edu.gateway.modules.attachment.entity.Attachment;
|
||||||
|
import org.apache.ibatis.annotations.Delete;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ftz
|
* @author ftz
|
||||||
|
@ -20,4 +20,6 @@ public interface AttachmentService extends IService<Attachment> {
|
|||||||
Resource loadAsResource(String id);
|
Resource loadAsResource(String id);
|
||||||
|
|
||||||
Attachment.Wrapper loadAsWrapper(String id);
|
Attachment.Wrapper loadAsWrapper(String id);
|
||||||
|
|
||||||
|
Boolean delete(String id);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.zsc.edu.gateway.modules.attachment.service.impl;
|
package com.zsc.edu.gateway.modules.attachment.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.zsc.edu.gateway.framework.storage.StorageProperties;
|
import com.zsc.edu.gateway.framework.storage.StorageProperties;
|
||||||
import com.zsc.edu.gateway.framework.storage.exception.StorageFileEmptyException;
|
import com.zsc.edu.gateway.framework.storage.exception.StorageFileEmptyException;
|
||||||
@ -201,4 +202,11 @@ public class AttachmentServiceImpl extends ServiceImpl<AttachmentRepository, Att
|
|||||||
return attachment;
|
return attachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean delete(String id) {
|
||||||
|
QueryWrapper<Attachment> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("id", id);
|
||||||
|
return remove(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -48,20 +48,6 @@ public class BulletinServiceImpl extends ServiceImpl<BulletinRepository, Bulleti
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public BulletinVo detail(UserDetailsImpl userDetails, Long id, Bulletin.State state) {
|
public BulletinVo detail(UserDetailsImpl userDetails, Long id, Bulletin.State state) {
|
||||||
// List<BulletinVo> bulletins = repo.selectByBulletinId(id);
|
|
||||||
// if (bulletins.isEmpty()) {
|
|
||||||
// return Collections.emptyList();
|
|
||||||
// }
|
|
||||||
// for (BulletinVo bulletin : bulletins) {
|
|
||||||
// if (state != null) {
|
|
||||||
// bulletin.getState().checkStatus(state);
|
|
||||||
// }
|
|
||||||
// bulletin.setEditUsername(userRepository.selectNameById(bulletin.getEditUserId()));
|
|
||||||
// bulletin.setPublishUsername(userRepository.selectNameById(bulletin.getPublishUserId()));
|
|
||||||
// bulletin.setCloseUsername(userRepository.selectNameById(bulletin.getCloseUserId()));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return bulletins;
|
|
||||||
BulletinVo bulletinVo = repo.selectByBulletinId(id);
|
BulletinVo bulletinVo = repo.selectByBulletinId(id);
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
bulletinVo.getState().checkStatus(state);
|
bulletinVo.getState().checkStatus(state);
|
||||||
|
@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/rest/authority")
|
@RequestMapping("/api/rest/authority")
|
||||||
public class AuthorityController {
|
public class AuthorityController {
|
||||||
|
//TODO 导入IOT
|
||||||
private AuthorityService service;
|
private AuthorityService service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
</collection>
|
</collection>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<select id="selectByBulletinId" resultMap="BulletinMap">
|
<select id="selectByBulletinId" resultMap="BulletinMap">
|
||||||
//TODO 查询数据问题已经修改
|
|
||||||
SELECT sb.*, a.id as attachment_id, a.file_name as attachment_file_name, a.url as attachment_url
|
SELECT sb.*, a.id as attachment_id, a.file_name as attachment_file_name, a.url as attachment_url
|
||||||
FROM sys_bulletin sb
|
FROM sys_bulletin sb
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
|
@ -28,7 +28,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
|||||||
|
|
||||||
@WebMvcTest(RoleController.class)
|
@WebMvcTest(RoleController.class)
|
||||||
public class RoleControllerTest extends MockMvcConfigBase {
|
public class RoleControllerTest extends MockMvcConfigBase {
|
||||||
|
//TODO 公告部分测试
|
||||||
private static Role role1;
|
private static Role role1;
|
||||||
|
|
||||||
private static Role role2;
|
private static Role role2;
|
||||||
|
Loading…
Reference in New Issue
Block a user