diff --git a/src/main/java/com/zsc/edu/gateway/modules/attachment/service/impl/AttachmentServiceImpl.java b/src/main/java/com/zsc/edu/gateway/modules/attachment/service/impl/AttachmentServiceImpl.java index df781c8..0babacb 100644 --- a/src/main/java/com/zsc/edu/gateway/modules/attachment/service/impl/AttachmentServiceImpl.java +++ b/src/main/java/com/zsc/edu/gateway/modules/attachment/service/impl/AttachmentServiceImpl.java @@ -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; diff --git a/src/main/java/com/zsc/edu/gateway/modules/iot/product/repo/ProductRepository.java b/src/main/java/com/zsc/edu/gateway/modules/iot/product/repo/ProductRepository.java index e027e6e..efb4d2c 100644 --- a/src/main/java/com/zsc/edu/gateway/modules/iot/product/repo/ProductRepository.java +++ b/src/main/java/com/zsc/edu/gateway/modules/iot/product/repo/ProductRepository.java @@ -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 { @Select("select * from iot_product where name=#{name}") Product findByName(@Param("name") String name); - Page page(Page page, @Param(Constants.WRAPPER) LambdaQueryWrapper wrapper); - Product selectById(@Param("id") Long id); } diff --git a/src/main/java/com/zsc/edu/gateway/modules/notice/entity/BulletinUser.java b/src/main/java/com/zsc/edu/gateway/modules/notice/entity/BulletinUser.java deleted file mode 100644 index 16c3f19..0000000 --- a/src/main/java/com/zsc/edu/gateway/modules/notice/entity/BulletinUser.java +++ /dev/null @@ -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; -} diff --git a/src/main/java/com/zsc/edu/gateway/modules/notice/repo/BulletinRepository.java b/src/main/java/com/zsc/edu/gateway/modules/notice/repo/BulletinRepository.java index 443289e..eba05df 100644 --- a/src/main/java/com/zsc/edu/gateway/modules/notice/repo/BulletinRepository.java +++ b/src/main/java/com/zsc/edu/gateway/modules/notice/repo/BulletinRepository.java @@ -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 diff --git a/src/main/java/com/zsc/edu/gateway/modules/notice/repo/BulletinUserRepository.java b/src/main/java/com/zsc/edu/gateway/modules/notice/repo/BulletinUserRepository.java deleted file mode 100644 index 79d8b52..0000000 --- a/src/main/java/com/zsc/edu/gateway/modules/notice/repo/BulletinUserRepository.java +++ /dev/null @@ -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 { - -// @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); -} diff --git a/src/main/java/com/zsc/edu/gateway/modules/notice/repo/MessageAttachmentRepository.java b/src/main/java/com/zsc/edu/gateway/modules/notice/repo/MessageAttachmentRepository.java deleted file mode 100644 index 2931591..0000000 --- a/src/main/java/com/zsc/edu/gateway/modules/notice/repo/MessageAttachmentRepository.java +++ /dev/null @@ -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 { -} diff --git a/src/main/java/com/zsc/edu/gateway/modules/notice/service/impl/BulletinServiceImpl.java b/src/main/java/com/zsc/edu/gateway/modules/notice/service/impl/BulletinServiceImpl.java index bdaf469..2a9ac10 100644 --- a/src/main/java/com/zsc/edu/gateway/modules/notice/service/impl/BulletinServiceImpl.java +++ b/src/main/java/com/zsc/edu/gateway/modules/notice/service/impl/BulletinServiceImpl.java @@ -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; diff --git a/src/main/resources/db/gateway.sql b/src/main/resources/db/gateway.sql index 240071b..18a0120 100644 --- a/src/main/resources/db/gateway.sql +++ b/src/main/resources/db/gateway.sql @@ -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); diff --git a/src/main/resources/mappers/iot/EventMapper.xml b/src/main/resources/mappers/iot/EventMapper.xml index 19b70c2..70b2382 100644 --- a/src/main/resources/mappers/iot/EventMapper.xml +++ b/src/main/resources/mappers/iot/EventMapper.xml @@ -17,6 +17,8 @@ + + @@ -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} \ No newline at end of file diff --git a/src/main/resources/mappers/iot/ProductMapper.xml b/src/main/resources/mappers/iot/ProductMapper.xml index b44b494..70ce24a 100644 --- a/src/main/resources/mappers/iot/ProductMapper.xml +++ b/src/main/resources/mappers/iot/ProductMapper.xml @@ -22,6 +22,8 @@ + + @@ -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} \ No newline at end of file diff --git a/src/main/resources/mappers/iot/ServeMapper.xml b/src/main/resources/mappers/iot/ServeMapper.xml index bc9a3d5..314291a 100644 --- a/src/main/resources/mappers/iot/ServeMapper.xml +++ b/src/main/resources/mappers/iot/ServeMapper.xml @@ -9,6 +9,8 @@ + + @@ -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} -