Kaynağa Gözat

模板相关

zhoutg 6 yıl önce
ebeveyn
işleme
7616737232

+ 69 - 0
icssman-service/src/main/java/com/diagbot/entity/ModuleInfo.java

@@ -0,0 +1,69 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 模型表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-05
+ */
+@TableName("icss_module_info")
+@Getter
+@Setter
+public class ModuleInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+
+}

+ 12 - 0
icssman-service/src/main/java/com/diagbot/facade/ModuleDetailFacade.java

@@ -22,4 +22,16 @@ public class ModuleDetailFacade extends ModuleDetailServiceImpl {
     public void deleteByQuestionIdFac(Map map) {
         this.deleteByQuestionIds(map);
     }
+
+
+
+    /**
+     * 根据moduleId删除明细
+     *
+     * @param map
+     * @return
+     */
+    public void deleteByModuleIdFac(Map map) {
+        this.deleteByModuleIds(map);
+    }
 }

+ 50 - 0
icssman-service/src/main/java/com/diagbot/facade/ModuleInfoFacade.java

@@ -0,0 +1,50 @@
+package com.diagbot.facade;
+
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.impl.ModuleInfoServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.util.UserUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @Author:zhoutg
+ * @time: 2018/11/23 11:37
+ */
+@Component
+public class ModuleInfoFacade extends ModuleInfoServiceImpl {
+
+
+    @Autowired
+    ModuleDetailFacade moduleDetailFacade;
+
+    /**
+     * 根据id删除标签模板
+     *
+     * @param ids
+     * @return
+     */
+    public Boolean deleteByIdsFac(String ids) {
+        if(StringUtil.isEmpty(ids)) {
+            return true;
+        }
+        Map paramMap = new HashMap<>();
+        paramMap.put("delete", IsDeleteEnum.Y.getKey());
+        paramMap.put("ids", Arrays.asList(ids.split(",")));
+        paramMap.put("gmtModified", DateUtil.now());
+        paramMap.put("modifier", UserUtils.getCurrentPrincipleID());
+
+        //删除模板
+        this.deleteByIds(paramMap);
+
+        //删除明细表
+        moduleDetailFacade.deleteByModuleIdFac(paramMap);
+        return true;
+    }
+}

+ 2 - 2
icssman-service/src/main/java/com/diagbot/facade/QuestionInfoFacade.java

@@ -6,6 +6,7 @@ import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.service.impl.QuestionInfoServiceImpl;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.StringUtil;
+import com.diagbot.util.UserUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -45,8 +46,7 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
         paramMap.put("delete", IsDeleteEnum.Y.getKey());
         paramMap.put("ids", Arrays.asList(ids.split(",")));
         paramMap.put("gmtModified", DateUtil.now());
-        //TODO 获取当前修改人
-        paramMap.put("modifier", "modifier"); //修改人
+        paramMap.put("modifier", UserUtils.getCurrentPrincipleID());
 
         //删除自身
         this.deleteByIds(paramMap);

+ 2 - 0
icssman-service/src/main/java/com/diagbot/mapper/ModuleDetailMapper.java

@@ -16,4 +16,6 @@ import java.util.Map;
 public interface ModuleDetailMapper extends BaseMapper<ModuleDetail> {
 
     public void deleteByQuestionIds(Map map);
+
+    public void deleteByModuleIds(Map map);
 }

+ 19 - 0
icssman-service/src/main/java/com/diagbot/mapper/ModuleInfoMapper.java

@@ -0,0 +1,19 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.ModuleInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 模型表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-05
+ */
+public interface ModuleInfoMapper extends BaseMapper<ModuleInfo> {
+
+    public void deleteByIds(Map map);
+}

+ 9 - 0
icssman-service/src/main/java/com/diagbot/service/ModuleDetailService.java

@@ -22,4 +22,13 @@ public interface ModuleDetailService extends IService<ModuleDetail> {
      * @return
      */
     public void deleteByQuestionIds(Map map);
+
+
+    /**
+     * 根据id删除标签模板
+     *
+     * @param map
+     * @return
+     */
+    public void deleteByModuleIds(Map map);
 }

+ 25 - 0
icssman-service/src/main/java/com/diagbot/service/ModuleInfoService.java

@@ -0,0 +1,25 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.ModuleInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 模型表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-05
+ */
+public interface ModuleInfoService extends IService<ModuleInfo> {
+
+    /**
+     * 根据id删除标签模板
+     *
+     * @param map
+     * @return
+     */
+    public void deleteByIds(Map map);
+}

+ 5 - 0
icssman-service/src/main/java/com/diagbot/service/impl/ModuleDetailServiceImpl.java

@@ -23,4 +23,9 @@ public class ModuleDetailServiceImpl extends ServiceImpl<ModuleDetailMapper, Mod
     public void deleteByQuestionIds(Map map) {
         baseMapper.deleteByQuestionIds(map);
     }
+
+    @Override
+    public void deleteByModuleIds(Map map) {
+        baseMapper.deleteByModuleIds(map);
+    }
 }

+ 26 - 0
icssman-service/src/main/java/com/diagbot/service/impl/ModuleInfoServiceImpl.java

@@ -0,0 +1,26 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.ModuleInfo;
+import com.diagbot.mapper.ModuleInfoMapper;
+import com.diagbot.service.ModuleInfoService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 模型表 服务实现类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-05
+ */
+@Service
+public class ModuleInfoServiceImpl extends ServiceImpl<ModuleInfoMapper, ModuleInfo> implements ModuleInfoService {
+
+    @Override
+    public void deleteByIds(Map map) {
+        baseMapper.deleteByIds(map);
+    }
+}

+ 49 - 0
icssman-service/src/main/java/com/diagbot/web/ModuleInfoController.java

@@ -0,0 +1,49 @@
+package com.diagbot.web;
+
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.ModuleInfoFacade;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 模型表 前端控制器
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-05
+ */
+@RestController
+@RequestMapping("/moduleInfo")
+@Api(value = "标签模板相关API", tags = { "标签模板相关API" })
+public class ModuleInfoController {
+
+
+    @Autowired
+    ModuleInfoFacade moduleInfoFacade;
+
+    @ApiOperation(value = "标签模板新增或更新[by:zhoutg]",
+            notes = "")
+    @PostMapping("/saveOrUpdate")
+    @SysLogger("saveOrUpdate")
+    public RespDTO<Boolean> saveOrUpdate() {
+
+        return RespDTO.onSuc(true);
+    }
+
+
+    @ApiOperation(value = "标签模板删除[by:zhoutg]",
+            notes = "")
+    @PostMapping("/delete")
+    @SysLogger("delete")
+    public RespDTO<Boolean> delete(String ids) {
+        moduleInfoFacade.deleteByIdsFac(ids);
+        return RespDTO.onSuc(true);
+    }
+}

+ 1 - 2
icssman-service/src/main/java/com/diagbot/web/QuestionInfoController.java

@@ -22,12 +22,11 @@ import java.util.List;
  * 标签基础表 前端控制器
  * </p>
  *
- * @author zhaops
+ * @author zhoutg
  * @since 2018-11-23
  */
 @RestController
 @RequestMapping("/questionInfo")
-@SuppressWarnings("unchecked")
 @Api(value = "标签相关API——数据谨慎操作", tags = { "标签相关API——数据谨慎操作" })
 public class QuestionInfoController {
 

+ 11 - 0
icssman-service/src/main/resources/mapper/ModuleDetailMapper.xml

@@ -27,4 +27,15 @@
             #{id}
         </foreach>
     </delete>
+
+
+    <delete id="deleteByModuleIds" parameterType="java.util.Map">
+        update `icss_module_detail`
+        set gmt_modified = #{gmtModified}, modifier = #{modifier}, is_deleted = #{delete}
+        where is_deleted = 'N'
+        and module_id in
+        <foreach item="id" collection="ids" open="(" separator="," close=")" >
+            #{id}
+        </foreach>
+    </delete>
 </mapper>

+ 27 - 0
icssman-service/src/main/resources/mapper/ModuleInfoMapper.xml

@@ -0,0 +1,27 @@
+<?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.diagbot.mapper.ModuleInfoMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.ModuleInfo">
+        <id column="id" property="id" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+        <result column="name" property="name" />
+        <result column="remark" property="remark" />
+    </resultMap>
+
+
+    <delete id="deleteByIds" parameterType="java.util.Map">
+        update `icss_module_info`
+        set gmt_modified = #{gmtModified}, modifier = #{modifier}, is_deleted = #{delete}
+        where is_deleted = 'N'
+        and id in
+        <foreach item="id" collection="ids" open="(" separator="," close=")" >
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 0 - 2
icssman-service/src/main/resources/mapper/QuestionInfoMapper.xml

@@ -76,7 +76,5 @@
         <if test="type != null and type != ''">
             and type = #{type}
         </if>
-
-
     </select>
 </mapper>

+ 6 - 6
icssman-service/src/test/java/com/diagbot/CodeGeneration.java

@@ -27,13 +27,13 @@ public class CodeGeneration {
 
         // 全局配置
         GlobalConfig gc = new GlobalConfig();
-        gc.setOutputDir("E://code//biservice");
+        gc.setOutputDir("E://code");
         gc.setFileOverride(true);
         gc.setActiveRecord(false);// 不需要ActiveRecord特性的请改为false
         gc.setEnableCache(false);// XML 二级缓存
         gc.setBaseResultMap(true);// XML ResultMap
         gc.setBaseColumnList(false);// XML columList
-        gc.setAuthor("gaodm");// 作者
+        gc.setAuthor("zhoutg");// 作者
 
         // 自定义文件命名,注意 %s 会自动填充表实体属性!
         gc.setControllerName("%sController");
@@ -48,15 +48,15 @@ public class CodeGeneration {
         dsc.setDbType(DbType.MYSQL);
         dsc.setDriverName("com.mysql.jdbc.Driver");
         dsc.setUsername("root");
-        dsc.setPassword("root");
-        dsc.setUrl("jdbc:mysql://127.0.0.1:3306/sys-log?useUnicode=true&characterEncoding=utf-8");
+        dsc.setPassword("lantone");
+        dsc.setUrl("jdbc:mysql://192.168.2.236:3306/sys-icss?useUnicode=true&characterEncoding=utf-8");
         mpg.setDataSource(dsc);
 
         // 策略配置
         StrategyConfig strategy = new StrategyConfig();
-//        strategy.setTablePrefix(new String[] { "sys_" });// 此处可以修改为您的表前缀
+        strategy.setTablePrefix(new String[] { "icss_" });// 此处可以修改为您的表前缀
         strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
-        strategy.setInclude(new String[] { "sys_log" }); // 需要生成的表
+        strategy.setInclude(new String[] { "icss_module_detail" }); // 需要生成的表
 
         strategy.setSuperServiceClass(null);
         strategy.setSuperServiceImplClass(null);