Explorar el Código

时间标签的添加

hace 5 años
padre
commit
5cee86b313
Se han modificado 17 ficheros con 580 adiciones y 13 borrados
  1. 22 0
      cloud-model/src/main/java/com/hssx/cloudmodel/controller/NewsNoticeController.java
  2. 46 0
      cloud-model/src/main/java/com/hssx/cloudmodel/controller/NewsNoticeUserController.java
  3. 218 0
      cloud-model/src/main/java/com/hssx/cloudmodel/entity/NewsNotice.java
  4. 94 0
      cloud-model/src/main/java/com/hssx/cloudmodel/entity/NewsNoticeUser.java
  5. 3 1
      cloud-model/src/main/java/com/hssx/cloudmodel/mapper/CompanyMapper.java
  6. 16 0
      cloud-model/src/main/java/com/hssx/cloudmodel/mapper/NewsNoticeMapper.java
  7. 16 0
      cloud-model/src/main/java/com/hssx/cloudmodel/mapper/NewsNoticeUserMapper.java
  8. 16 0
      cloud-model/src/main/java/com/hssx/cloudmodel/service/NewsNoticeService.java
  9. 16 0
      cloud-model/src/main/java/com/hssx/cloudmodel/service/NewsNoticeUserService.java
  10. 11 10
      cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/CompanyServiceImpl.java
  11. 20 0
      cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/NewsNoticeServiceImpl.java
  12. 20 0
      cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/NewsNoticeUserServiceImpl.java
  13. 1 1
      cloud-model/src/main/java/com/hssx/cloudmodel/util/CodeGenerator.java
  14. 10 0
      cloud-model/src/main/java/com/hssx/cloudmodel/util/NewsNoticeTemplate.java
  15. 27 1
      cloud-model/src/main/resources/mapper/CompanyMapper.xml
  16. 26 0
      cloud-model/src/main/resources/mapper/NewsNoticeMapper.xml
  17. 18 0
      cloud-model/src/main/resources/mapper/NewsNoticeUserMapper.xml

+ 22 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/controller/NewsNoticeController.java

@@ -0,0 +1,22 @@
+package com.hssx.cloudmodel.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+@RestController
+@RequestMapping("/newsnotice")
+public class NewsNoticeController {
+
+
+}
+

+ 46 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/controller/NewsNoticeUserController.java

@@ -0,0 +1,46 @@
+package com.hssx.cloudmodel.controller;
+
+
+import com.hssx.cloudmodel.entity.NewsNoticeUser;
+import com.hssx.cloudmodel.service.NewsNoticeService;
+import com.hssx.cloudmodel.util.HttpRespMsg;
+import com.hssx.cloudmodel.util.PageUtil;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+@Controller
+@RequestMapping("/newsnoticeuser")
+public class NewsNoticeUserController {
+    @Autowired
+    private NewsNoticeService newsNoticeService;
+
+    /**
+     * 消息通知列表
+     * 参数:id 登陆者的用户ID
+     * @return
+     */
+    @ApiOperation("消息通知列表")
+    @RequestMapping("/list")
+    @ResponseBody
+    public HttpRespMsg deleteRole(@RequestParam(required = false)String keyName, HttpServletRequest request,
+                                  HttpServletResponse response, PageUtil page, @RequestParam(required = false)Integer companyType) {
+        HttpRespMsg msg = new HttpRespMsg();
+//        msg = companyService.pageList(page,keyName,companyType);
+        return msg;
+    }
+
+}
+

+ 218 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/entity/NewsNotice.java

@@ -0,0 +1,218 @@
+package com.hssx.cloudmodel.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+@TableName("tb_news_notice")
+public class NewsNotice extends Model<NewsNotice> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 消息盒子表主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 项目id
+     */
+    @TableField("project_id")
+    private Integer projectId;
+
+    /**
+     * 项目名
+     */
+    @TableField("project_name")
+    private String projectName;
+
+    /**
+     * 模具id(针对消息提醒类型1,2)
+     */
+    @TableField("mould_id")
+    private Integer mouldId;
+
+    /**
+     * 消息提醒类型0-审批,1-保养,2-告警
+     */
+    @TableField("notice_type")
+    private Integer noticeType;
+
+    /**
+     * 内容
+     */
+    @TableField("content")
+    private String content;
+
+    /**
+     * 模具编号(针对消息提醒类型1)
+     */
+    @TableField("mould_no")
+    private String mouldNo;
+
+    /**
+     * 文件id
+     */
+    @TableField("file_id")
+    private Integer fileId;
+
+    /**
+     * 文件所属类型
+     */
+    @TableField("file_blong_type")
+    private Integer fileBlongType;
+
+    /**
+     * 设备id(针对消息提醒类型2)
+     */
+    @TableField("equipment_id")
+    private Integer equipmentId;
+
+    /**
+     * 设备编号(针对消息提醒类型2)
+     */
+    @TableField("equipment_no")
+    private String equipmentNo;
+
+    /**
+     * 时间
+     */
+    @TableField("indate")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private LocalDateTime indate;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(Integer projectId) {
+        this.projectId = projectId;
+    }
+
+    public String getProjectName() {
+        return projectName;
+    }
+
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+
+    public Integer getMouldId() {
+        return mouldId;
+    }
+
+    public void setMouldId(Integer mouldId) {
+        this.mouldId = mouldId;
+    }
+
+    public Integer getNoticeType() {
+        return noticeType;
+    }
+
+    public void setNoticeType(Integer noticeType) {
+        this.noticeType = noticeType;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getMouldNo() {
+        return mouldNo;
+    }
+
+    public void setMouldNo(String mouldNo) {
+        this.mouldNo = mouldNo;
+    }
+
+    public Integer getFileId() {
+        return fileId;
+    }
+
+    public void setFileId(Integer fileId) {
+        this.fileId = fileId;
+    }
+
+    public Integer getFileBlongType() {
+        return fileBlongType;
+    }
+
+    public void setFileBlongType(Integer fileBlongType) {
+        this.fileBlongType = fileBlongType;
+    }
+
+    public Integer getEquipmentId() {
+        return equipmentId;
+    }
+
+    public void setEquipmentId(Integer equipmentId) {
+        this.equipmentId = equipmentId;
+    }
+
+    public String getEquipmentNo() {
+        return equipmentNo;
+    }
+
+    public void setEquipmentNo(String equipmentNo) {
+        this.equipmentNo = equipmentNo;
+    }
+
+    public LocalDateTime getIndate() {
+        return indate;
+    }
+
+    public void setIndate(LocalDateTime indate) {
+        this.indate = indate;
+    }
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+    @Override
+    public String toString() {
+        return "NewsNotice{" +
+        "id=" + id +
+        ", projectId=" + projectId +
+        ", projectName=" + projectName +
+        ", mouldId=" + mouldId +
+        ", noticeType=" + noticeType +
+        ", content=" + content +
+        ", mouldNo=" + mouldNo +
+        ", fileId=" + fileId +
+        ", fileBlongType=" + fileBlongType +
+        ", equipmentId=" + equipmentId +
+        ", equipmentNo=" + equipmentNo +
+        ", indate=" + indate +
+        "}";
+    }
+}

+ 94 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/entity/NewsNoticeUser.java

@@ -0,0 +1,94 @@
+package com.hssx.cloudmodel.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+@TableName("tb_news_notice_user")
+public class NewsNoticeUser extends Model<NewsNoticeUser> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 消息通知者表主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 通知者id
+     */
+    @TableField("user_id")
+    private Integer userId;
+
+    /**
+     * 是否已读 0-未读,1-已读
+     */
+    @TableField("is_read")
+    private Integer isRead;
+
+    /**
+     * 消息通知表id
+     */
+    @TableField("news_id")
+    private Integer newsId;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public Integer getIsRead() {
+        return isRead;
+    }
+
+    public void setIsRead(Integer isRead) {
+        this.isRead = isRead;
+    }
+
+    public Integer getNewsId() {
+        return newsId;
+    }
+
+    public void setNewsId(Integer newsId) {
+        this.newsId = newsId;
+    }
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+    @Override
+    public String toString() {
+        return "NewsNoticeUser{" +
+        "id=" + id +
+        ", userId=" + userId +
+        ", isRead=" + isRead +
+        ", newsId=" + newsId +
+        "}";
+    }
+}

+ 3 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/mapper/CompanyMapper.java

@@ -3,6 +3,7 @@ package com.hssx.cloudmodel.mapper;
 import com.hssx.cloudmodel.entity.Company;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.hssx.cloudmodel.entity.User;
+import com.hssx.cloudmodel.entity.vo.CompanyVO;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -17,6 +18,7 @@ import java.util.List;
  */
 public interface CompanyMapper extends BaseMapper<Company> {
 
-    List<Company> getListByKeyName(@Param("keyName") String keyName, @Param("start")Integer start, @Param("pageSize") Integer pageSize,@Param("companyType")Integer companyType);
+    List<CompanyVO> getListByKeyName(@Param("keyName") String keyName, @Param("start")Integer start, @Param("pageSize") Integer pageSize, @Param("companyType")Integer companyType);
 
+    List<CompanyVO> getCustomerListByKeyName(@Param("keyName") String keyName, @Param("start")Integer start, @Param("pageSize") Integer pageSize, @Param("companyType")Integer companyType);
 }

+ 16 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/mapper/NewsNoticeMapper.java

@@ -0,0 +1,16 @@
+package com.hssx.cloudmodel.mapper;
+
+import com.hssx.cloudmodel.entity.NewsNotice;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+public interface NewsNoticeMapper extends BaseMapper<NewsNotice> {
+
+}

+ 16 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/mapper/NewsNoticeUserMapper.java

@@ -0,0 +1,16 @@
+package com.hssx.cloudmodel.mapper;
+
+import com.hssx.cloudmodel.entity.NewsNoticeUser;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+public interface NewsNoticeUserMapper extends BaseMapper<NewsNoticeUser> {
+
+}

+ 16 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/NewsNoticeService.java

@@ -0,0 +1,16 @@
+package com.hssx.cloudmodel.service;
+
+import com.hssx.cloudmodel.entity.NewsNotice;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+public interface NewsNoticeService extends IService<NewsNotice> {
+
+}

+ 16 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/NewsNoticeUserService.java

@@ -0,0 +1,16 @@
+package com.hssx.cloudmodel.service;
+
+import com.hssx.cloudmodel.entity.NewsNoticeUser;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+public interface NewsNoticeUserService extends IService<NewsNoticeUser> {
+
+}

+ 11 - 10
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/CompanyServiceImpl.java

@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -93,18 +94,18 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
     @Override
     public HttpRespMsg pageList(PageUtil page, String keyName,Integer companyType) {
         HttpRespMsg msg = new HttpRespMsg();
-        QueryWrapper<Company> qw = new QueryWrapper<>();
-        if (keyName != null && !"".equals(keyName)) {
-            qw.like("company_name", keyName);
-        }
-        if(companyType != null){
-            qw.eq("company_type",companyType);
-        }
+        List<CompanyVO> list = new ArrayList<>();
         Integer start = (page.getPageNum() - 1) * page.getPageSize();
-        Integer count = companyMapper.selectCount(qw);
-        page.setTotal(count);
         page.setPages(page.getTotal());
-        List<Company> list = companyMapper.getListByKeyName(keyName, start, page.getPageSize(),companyType);
+        if(companyType == 0){
+            list = companyMapper.getListByKeyName(keyName, start, page.getPageSize(),companyType);
+            Integer count = list.size();
+            page.setTotal(count);
+        }else{
+            list = companyMapper.getCustomerListByKeyName(keyName, start, page.getPageSize(),companyType);
+            Integer count = list.size();
+            page.setTotal(count);
+        }
         page.setList(list);
         msg.data = page;
         return msg;

+ 20 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/NewsNoticeServiceImpl.java

@@ -0,0 +1,20 @@
+package com.hssx.cloudmodel.service.impl;
+
+import com.hssx.cloudmodel.entity.NewsNotice;
+import com.hssx.cloudmodel.mapper.NewsNoticeMapper;
+import com.hssx.cloudmodel.service.NewsNoticeService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+@Service
+public class NewsNoticeServiceImpl extends ServiceImpl<NewsNoticeMapper, NewsNotice> implements NewsNoticeService {
+
+}

+ 20 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/NewsNoticeUserServiceImpl.java

@@ -0,0 +1,20 @@
+package com.hssx.cloudmodel.service.impl;
+
+import com.hssx.cloudmodel.entity.NewsNoticeUser;
+import com.hssx.cloudmodel.mapper.NewsNoticeUserMapper;
+import com.hssx.cloudmodel.service.NewsNoticeUserService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+@Service
+public class NewsNoticeUserServiceImpl extends ServiceImpl<NewsNoticeUserMapper, NewsNoticeUser> implements NewsNoticeUserService {
+
+}

+ 1 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/util/CodeGenerator.java

@@ -204,7 +204,7 @@ public class CodeGenerator {
         //若想要生成的实体类继承某个Controller,则可打开下面注释。写上需要继承的Controller的位置即可
 //        strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController");
         //此处user是表名,多个英文逗号分割
-        strategy.setInclude("tb_lng_lat_company");
+        strategy.setInclude("tb_news_notice");
 //        strategy.setExclude();//数据库表全生成
 //        strategy.setInclude(scanner("user").split(","));//表名,多个英文逗号分割
         strategy.setControllerMappingHyphenStyle(true);

+ 10 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/util/NewsNoticeTemplate.java

@@ -0,0 +1,10 @@
+package com.hssx.cloudmodel.util;
+
+/**
+ * Author: 吴涛涛 cuiyi@itany.com
+ * Date : 2019 - 08 - 09 15:43
+ * Description:<描述>
+ * Version: 1.0
+ */
+public class NewsNoticeTemplate {
+}

+ 27 - 1
cloud-model/src/main/resources/mapper/CompanyMapper.xml

@@ -9,13 +9,21 @@
         <result column="company_address" property="companyAddress" />
         <result column="company_type" property="companyType" />
     </resultMap>
+    <resultMap id="BaseResultMapVO" type="com.hssx.cloudmodel.entity.vo.CompanyVO">
+        <id column="id" property="id" />
+        <result column="company_name" property="companyName" />
+        <result column="company_address" property="companyAddress" />
+        <result column="company_type" property="companyType" />
+        <result column="y_lng" property="yLng" />
+        <result column="x_lat" property="xLat" />
+    </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
         id, company_name, company_address, company_type
     </sql>
 
-    <select id="getListByKeyName" resultMap="BaseResultMap">
+    <select id="getListByKeyName" resultMap="BaseResultMapVO">
         select
         <include refid="Base_Column_List"/>
         from
@@ -30,5 +38,23 @@
         </where>
         Limit #{start},#{pageSize}
     </select>
+    <select id="getCustomerListByKeyName" resultMap="BaseResultMapVO">
+        select
+        t.id, t.company_name, t.company_address, t.company_type,tc.y_lng, tc.x_lat
+        from
+        tb_company t
+        left join
+        tb_lng_lat_company tc
+        on tc.company_id = t.id
+        <where>
+            <if test="keyName != null and keyName != ''">
+               and t.company_name like concat('%',#{keyName},'%')
+            </if>
+            <if test="companyType != null">
+                and t.company_type = #{companyType}
+            </if>
+        </where>
+        Limit #{start},#{pageSize}
+    </select>
 
 </mapper>

+ 26 - 0
cloud-model/src/main/resources/mapper/NewsNoticeMapper.xml

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.hssx.cloudmodel.mapper.NewsNoticeMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.hssx.cloudmodel.entity.NewsNotice">
+        <id column="id" property="id" />
+        <result column="project_id" property="projectId" />
+        <result column="project_name" property="projectName" />
+        <result column="mould_id" property="mouldId" />
+        <result column="notice_type" property="noticeType" />
+        <result column="content" property="content" />
+        <result column="mould_no" property="mouldNo" />
+        <result column="file_id" property="fileId" />
+        <result column="file_blong_type" property="fileBlongType" />
+        <result column="equipment_id" property="equipmentId" />
+        <result column="equipment_no" property="equipmentNo" />
+        <result column="indate" property="indate" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, project_id, project_name, mould_id, notice_type, content, mould_no, file_id, file_blong_type, equipment_id, equipment_no, indate
+    </sql>
+
+</mapper>

+ 18 - 0
cloud-model/src/main/resources/mapper/NewsNoticeUserMapper.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.hssx.cloudmodel.mapper.NewsNoticeUserMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.hssx.cloudmodel.entity.NewsNoticeUser">
+        <id column="id" property="id" />
+        <result column="user_id" property="userId" />
+        <result column="is_read" property="isRead" />
+        <result column="news_id" property="newsId" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, user_id, is_read, news_id
+    </sql>
+
+</mapper>