refactor(notice): 重构公告模块
- 移除了 AttachmentServiceImpl、BulletinServiceImpl 中未使用的导入- 删除了未使用的 BulletinUser、BulletinUserRepository、MessageAttachmentRepository 类 - 更新了 EventMapper、ProductMapper、ServeMapper 中的查询语句,使用 foreign_type 和 foreign_id 字段 - 在数据库中添加了测试消息数据
This commit is contained in:
parent
df72492f90
commit
68e00e21d5
@ -8,7 +8,6 @@ import com.zsc.edu.gateway.framework.storage.exception.StorageFileNotFoundExcept
|
||||
import com.zsc.edu.gateway.modules.attachment.entity.Attachment;
|
||||
import com.zsc.edu.gateway.modules.attachment.repo.AttachmentRepository;
|
||||
import com.zsc.edu.gateway.modules.attachment.service.AttachmentService;
|
||||
import com.zsc.edu.gateway.modules.notice.repo.BulletinAttachmentRepository;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
@ -16,7 +15,6 @@ import org.apache.tika.Tika;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
@ -1,11 +1,6 @@
|
||||
package com.zsc.edu.gateway.modules.iot.product.repo;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zsc.edu.gateway.modules.iot.product.entity.Product;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
@ -18,7 +13,5 @@ public interface ProductRepository extends BaseMapper<Product> {
|
||||
@Select("select * from iot_product where name=#{name}")
|
||||
Product findByName(@Param("name") String name);
|
||||
|
||||
Page<Product> page(Page<Product> page, @Param(Constants.WRAPPER) LambdaQueryWrapper<Product> wrapper);
|
||||
|
||||
Product selectById(@Param("id") Long id);
|
||||
}
|
||||
|
@ -1,31 +0,0 @@
|
||||
package com.zsc.edu.gateway.modules.notice.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author zhuang
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("sys_bulletin_user")
|
||||
public class BulletinUser {
|
||||
|
||||
/**
|
||||
* 公告ID
|
||||
*/
|
||||
public Long bulletinId;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
public Long userId;
|
||||
/**
|
||||
* 是否已读
|
||||
*/
|
||||
public Boolean isRead = true;
|
||||
}
|
@ -8,7 +8,6 @@ import com.zsc.edu.gateway.modules.notice.query.BulletinQuery;
|
||||
import com.zsc.edu.gateway.modules.notice.vo.BulletinVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公告Repo
|
||||
|
@ -1,16 +0,0 @@
|
||||
package com.zsc.edu.gateway.modules.notice.repo;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zsc.edu.gateway.modules.notice.entity.BulletinUser;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* @author zhuang
|
||||
*/
|
||||
public interface BulletinUserRepository extends BaseMapper<BulletinUser> {
|
||||
|
||||
// @Select("select * from sys_bulletin_user sbu where sbu.bulletin_id=#{bulletinId} and sbu.user_id=#{userId}")
|
||||
// Boolean selectByBulletinIdAndUserId(@Param("bulletinId") Long bulletinId, @Param("userId") Long userId);
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package com.zsc.edu.gateway.modules.notice.repo;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zsc.edu.gateway.modules.notice.entity.MessageAttachment;
|
||||
|
||||
public interface MessageAttachmentRepository extends BaseMapper<MessageAttachment> {
|
||||
}
|
@ -17,7 +17,6 @@ import com.zsc.edu.gateway.modules.notice.service.BulletinService;
|
||||
import com.zsc.edu.gateway.modules.notice.vo.BulletinVo;
|
||||
import com.zsc.edu.gateway.modules.system.repo.UserRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
@ -618,4 +618,26 @@ VALUES (2, 1, '研发部', 1, TRUE, 'admin', 'admin', CURRENT_TIMESTAMP, CURRENT
|
||||
(10, 1, '培训组', 9, TRUE, 'admin', 'admin', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, '负责员工培训'),
|
||||
(11, 1, '财务部', 10, TRUE, 'admin', 'admin', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, '负责财务管理');
|
||||
|
||||
INSERT INTO sys_message (type, system, email, sms, html, title, content, remark, create_time, create_by, update_time,
|
||||
update_by, dept_id)
|
||||
VALUES (1, TRUE, TRUE, FALSE, TRUE, '测试消息1', '这是第一条测试消息的内容。', '备注1', NOW(), 'system', NOW(), 'system',
|
||||
1),
|
||||
(2, FALSE, FALSE, TRUE, FALSE, '测试消息2', '这是第二条测试消息的内容。', '备注2', NOW(), 'user1', NOW(), 'user1',
|
||||
2),
|
||||
(1, TRUE, TRUE, TRUE, TRUE, '测试消息3', '这是第三条测试消息的内容。', '备注3', NOW(), 'system', NOW(), 'system',
|
||||
3),
|
||||
(2, FALSE, FALSE, FALSE, FALSE, '测试消息4', '这是第四条测试消息的内容。', '备注4', NOW(), 'user2', NOW(),
|
||||
'user2', 4),
|
||||
(1, TRUE, TRUE, TRUE, FALSE, '测试消息5', '这是第五条测试消息的内容。', '备注5', NOW(), 'system', NOW(), 'system',
|
||||
5),
|
||||
(2, FALSE, FALSE, TRUE, TRUE, '测试消息6', '这是第六条测试消息的内容。', '备注6', NOW(), 'user3', NOW(), 'user3',
|
||||
6),
|
||||
(1, TRUE, TRUE, FALSE, FALSE, '测试消息7', '这是第七条测试消息的内容。', '备注7', NOW(), 'system', NOW(),
|
||||
'system', 7),
|
||||
(2, FALSE, FALSE, TRUE, TRUE, '测试消息8', '这是第八条测试消息的内容。', '备注8', NOW(), 'user4', NOW(), 'user4',
|
||||
8),
|
||||
(1, TRUE, TRUE, TRUE, FALSE, '测试消息9', '这是第九条测试消息的内容。', '备注9', NOW(), 'system', NOW(), 'system',
|
||||
9),
|
||||
(2, FALSE, FALSE, FALSE, TRUE, '测试消息10', '这是第十条测试消息的内容。', '备注10', NOW(), 'user5', NOW(),
|
||||
'user5', 10);
|
||||
|
||||
|
@ -17,6 +17,8 @@
|
||||
<result column="uint" property="uint"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="identifier" property="identifier"/>
|
||||
<result column="foreign_type" property="foreignType"/>
|
||||
<result column="foreign_id" property="foreignId"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</collection>
|
||||
@ -32,8 +34,8 @@
|
||||
ip.name as param_name,
|
||||
ip.remark as param_remark
|
||||
from iot_event e
|
||||
left join iot_event_param ep on e.id = ep.event_id
|
||||
left join iot_param ip on ep.param_id = ip.id
|
||||
left join iot_param ip on ep.id = ip.foreign_id
|
||||
and ip.foreign_type = 1
|
||||
where e.id = #{id}
|
||||
</select>
|
||||
</mapper>
|
@ -22,6 +22,8 @@
|
||||
<result column="uint" property="uint"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="identifier" property="identifier"/>
|
||||
<result column="foreign_type" property="foreignType"/>
|
||||
<result column="foreign_id" property="foreignId"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</collection>
|
||||
@ -37,8 +39,8 @@
|
||||
ip.name as param_name,
|
||||
ip.remark as param_remark
|
||||
from iot_product p
|
||||
left join iot_product_param pp on p.id = pp.product_id
|
||||
left join iot_param ip on pp.param_id = ip.id
|
||||
left join iot_param ip on p.id = ip.foreign_id
|
||||
and ip.foreign_type = 3
|
||||
where p.id = #{id}
|
||||
</select>
|
||||
</mapper>
|
@ -9,6 +9,8 @@
|
||||
<result column="param_uint" property="uint"/>
|
||||
<result column="param_type" property="type"/>
|
||||
<result column="param_identifier" property="identifier"/>
|
||||
<result column="param_foreign_type" property="foreignType"/>
|
||||
<result column="param_foreign_id" property="foreignId"/>
|
||||
<result column="param_name" property="name"/>
|
||||
<result column="param_remark" property="remark"/>
|
||||
</resultMap>
|
||||
@ -46,29 +48,30 @@
|
||||
output_params.name as output_param_name,
|
||||
output_params.remark as output_param_remark
|
||||
FROM iot_serve s
|
||||
LEFT JOIN (SELECT sp.serve_id,
|
||||
ip.id,
|
||||
LEFT JOIN (SELECT ip.id,
|
||||
ip.data_type,
|
||||
ip.uint,
|
||||
ip.type,
|
||||
ip.identifier,
|
||||
ip.name,
|
||||
ip.remark
|
||||
FROM iot_serve_param sp
|
||||
JOIN iot_param ip ON sp.param_id = ip.id
|
||||
WHERE ip.type = 1) input_params ON s.id = input_params.serve_id
|
||||
LEFT JOIN (SELECT sp.serve_id,
|
||||
ip.id,
|
||||
ip.remark,
|
||||
ip.foreign_id,
|
||||
ip.foreign_type
|
||||
FROM iot_param ip
|
||||
WHERE ip.foreign_type = 1
|
||||
and ip.type = 1) input_params ON s.id = input_params.foreign_id
|
||||
LEFT JOIN (SELECT ip.id,
|
||||
ip.data_type,
|
||||
ip.uint,
|
||||
ip.type,
|
||||
ip.identifier,
|
||||
ip.name,
|
||||
ip.remark
|
||||
FROM iot_serve_param sp
|
||||
JOIN iot_param ip ON sp.param_id = ip.id
|
||||
WHERE ip.type = 2) output_params ON s.id = output_params.serve_id
|
||||
ip.remark,
|
||||
ip.foreign_id,
|
||||
ip.foreign_type
|
||||
FROM iot_param ip
|
||||
WHERE ip.foreign_type = 1
|
||||
and ip.type = 2) output_params ON s.id = output_params.foreign_id
|
||||
WHERE s.id = #{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user