yonghuifan пре 1 година
родитељ
комит
d08d1dcc18

+ 1 - 0
src/main/java/com/dragon/tj/portal/auth/config/WebSecurityConfig.java

@@ -67,6 +67,7 @@ public class WebSecurityConfig {
         whiteList.append("/test/login" + whiteListSplit);
         whiteList.append("/subscribe/*" + whiteListSplit);
         whiteList.append("/test/test1" + whiteListSplit);
+        whiteList.append("/file/**" + whiteListSplit);
     }
 
     @Bean

+ 22 - 0
src/main/java/com/dragon/tj/portal/common/util/UploadUtils.java

@@ -0,0 +1,22 @@
+package com.dragon.tj.portal.common.util;
+
+import java.util.UUID;
+
+public class UploadUtils {
+    /**
+     * 获取随机名称
+     *
+     * @param realName 真实名称
+     * @return uuid 随机名称
+     */
+    public static String getUUIDName(String realName) {
+        //获取后缀名
+        int index = realName.lastIndexOf(".");
+        if (index == -1) {//如果没有后缀
+            return UUID.randomUUID().toString().replace("-", "").toUpperCase();
+        } else { //如果有后缀就接上
+            return UUID.randomUUID().toString().replace("-", "")
+                    .toUpperCase() + realName.substring(index);
+        }
+    }
+}

+ 11 - 0
src/main/java/com/dragon/tj/portal/common/vo/app/AppInfoVo.java

@@ -0,0 +1,11 @@
+package com.dragon.tj.portal.common.vo.app;
+
+import com.dragon.tj.portal.entity.AppInfo;
+import lombok.Data;
+
+@Data
+public class AppInfoVo extends AppInfo {
+
+
+
+}

+ 19 - 0
src/main/java/com/dragon/tj/portal/component/page/FilePathConfig.java

@@ -0,0 +1,19 @@
+package com.dragon.tj.portal.component.page;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+@Configuration
+public class FilePathConfig implements WebMvcConfigurer {
+
+    @Value("${dragon.file.path}")
+    private String localPath;
+
+    @Override
+    public void addResourceHandlers(ResourceHandlerRegistry registry) {
+        registry.addResourceHandler("/file/**")//虚拟地址
+                .addResourceLocations("file:" + localPath);// 真实路径
+    }
+}

+ 32 - 0
src/main/java/com/dragon/tj/portal/component/page/MybatisPlusConfig.java

@@ -0,0 +1,32 @@
+package com.dragon.tj.portal.component.page;
+
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+import java.util.Collections;
+
+@Configuration
+@EnableTransactionManagement
+public class MybatisPlusConfig {
+    @Bean
+    public PaginationInnerInterceptor paginationInnerInterceptor() {
+        PaginationInnerInterceptor paginationInterceptor = new PaginationInnerInterceptor();
+        // 设置最大单页限制数量,默认 500 条,-1 不受限制
+        paginationInterceptor.setMaxLimit(-1L);
+        paginationInterceptor.setDbType(DbType.MYSQL);
+        // 开启 count 的 join 优化,只针对部分 left join
+        paginationInterceptor.setOptimizeJoin(true);
+        return paginationInterceptor;
+    }
+    @Bean
+    public MybatisPlusInterceptor mybatisPlusInterceptor(){
+        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
+        mybatisPlusInterceptor.setInterceptors(Collections.singletonList(paginationInnerInterceptor()));
+        return mybatisPlusInterceptor;
+    }
+
+}

+ 123 - 0
src/main/java/com/dragon/tj/portal/controller/AppController.java

@@ -0,0 +1,123 @@
+package com.dragon.tj.portal.controller;
+
+import com.dragon.tj.portal.auth.model.LoginUser;
+import com.dragon.tj.portal.auth.util.SecurityUtils;
+import com.dragon.tj.portal.common.base.R;
+import com.dragon.tj.portal.entity.AppInfo;
+import com.dragon.tj.portal.entity.PageParam;
+import com.dragon.tj.portal.service.AppService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.web.bind.annotation.*;
+
+import java.time.LocalDateTime;
+
+@RestController
+@RequestMapping("/app")
+@EnableScheduling
+public class AppController {
+
+
+    @Autowired
+    private AppService appService;
+
+    /*
+     *    1. 我的应用查询 批量排序收藏
+     * */
+    @PostMapping("list")
+    public R appList(@RequestBody PageParam<AppInfo> appInfoPage) {
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        return R.ok(appService.installApp(appInfoPage,loginUser));
+    }
+
+    /*
+     *  1-1安装应用
+     * */
+    @GetMapping("install/{appId}")
+    public R install(@PathVariable("appId") Integer appId) {
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        return R.ok(appService.install(appId,loginUser.getIdCard()));
+    }
+
+    /*
+     *  1-2卸载应用
+     * */
+    @GetMapping("uninstall/{appId}")
+    public R uninstall(@PathVariable("appId") Integer appId) {
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        return R.ok(appService.uninstall(appId,loginUser.getIdCard()));
+    }
+
+    /***************************************/
+
+    /*
+     *    2. 类型查询
+     * */
+    @GetMapping("types")
+    public R getAppType() {
+        return appService.getType();
+    }
+
+    /*
+     *    3. 应用 CRUD
+     * */
+//    @SysLog("添加应用")
+    @PostMapping("add")
+    public R addApp(@RequestBody AppInfo appInfo) {
+        System.out.println(appInfo);
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        return R.ok(appService.add(appInfo, loginUser));
+    }
+
+    //    @SysLog("应用删除")
+    @GetMapping("delete/{id}")
+    public R delete(@PathVariable("id") Long id) {
+        return R.ok(appService.delete(id));
+    }
+
+    //    @SysLog("应用更新")
+    @PostMapping("update")
+    public R update(@RequestBody AppInfo appInfo) {
+        appInfo.setUpdateTime(LocalDateTime.now());
+        return R.ok(appService.update(appInfo));
+    }
+
+    //    @SysLog("通过ID获取应用")
+    @GetMapping("info/{id}")
+    public R detail(@PathVariable("id") Long id) {
+        return R.ok(appService.detail(id));
+    }
+
+    /*
+     *   通过应用名称,应用事权单位名称搜索app
+     * */
+    @GetMapping("search")
+    public R search(@RequestBody PageParam<AppInfo> appInfoPage) {
+
+        return R.ok(appService.search(appInfoPage));
+    }
+
+
+    /*
+     *    4. 热门应用统计 定时、实时?
+     * */
+    @Scheduled(fixedDelay = 1000 * 60 * 60)
+    public void appStatHandler(){
+
+        appService.updateAppStat();
+    }
+
+    /*
+     *    5. 专项工具为应用类型的一种
+     * */
+    /**********************/
+
+    /*
+    * 上传图片
+    * */
+
+
+
+}
+

+ 65 - 0
src/main/java/com/dragon/tj/portal/controller/FileManageController.java

@@ -0,0 +1,65 @@
+package com.dragon.tj.portal.controller;
+
+import com.dragon.tj.portal.common.base.R;
+import com.dragon.tj.portal.common.util.UploadUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.ApplicationContext;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/file")
+public class FileManageController {
+
+    @Value("${dragon.file.path}")
+    private String localPath;
+
+    @Autowired
+    private ApplicationContext applicationContext;
+
+    @PostMapping("/upload/{type}")
+    public R upload(MultipartFile file, @PathVariable("type")String type){
+
+        String originalFilename = file.getOriginalFilename();
+        System.out.println(originalFilename);
+
+        String uuidFilename = UploadUtils.getUUIDName(originalFilename);
+
+        File dateDir = new File(localPath + type);
+        if (!dateDir.exists()) {
+            dateDir.mkdirs();
+        }
+
+        File newFile = new File(dateDir.getPath(),uuidFilename);
+
+        try {
+            file.transferTo(newFile);
+        } catch (IOException e) {
+            e.printStackTrace();
+            return R.failed().setMsg(e.getMessage());
+        }
+
+        Map<String,String> res = new HashMap<>();
+        try {
+            String hostAddress = InetAddress.getLocalHost().getHostAddress();
+            String port = applicationContext.getEnvironment().getProperty("server.port");
+            res.put("url","http://"+ hostAddress + ":" + port + "/file/" + type + "/" +uuidFilename);
+        } catch (UnknownHostException e) {
+            e.printStackTrace();
+        }
+
+        return R.ok().setData(res).setMsg("okk");
+    }
+
+}

+ 106 - 0
src/main/java/com/dragon/tj/portal/entity/AppInfo.java

@@ -0,0 +1,106 @@
+package com.dragon.tj.portal.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 lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 应用信息
+ */
+@Getter
+@Setter
+@Accessors(chain = true)
+@TableName("app_info")
+public class AppInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+         * 应用类型(1市局系统,2区县系统,3派出所常用系统,4办公综合系统,5专项工具)
+     */
+    private Integer appType;
+
+    /**
+     * 应用系统名称
+     */
+    private String systemName;
+
+    /**
+     * 应用系统编号
+     */
+    private String systemNumber;
+
+    /**
+     * 应用简称
+     */
+    private String shortName;
+
+    /**
+     * 应用事权单位名称
+     */
+    private String deptName;
+
+    /**
+     * 应用系统访问地址
+     */
+    private String url;
+
+
+
+    /**
+     * 系统在用标识(1在用)
+     */
+    private Integer activeFlag;
+
+    /**
+     * 图标path
+     */
+    private String icon;
+
+    /**
+     * 警种分类
+     */
+    private String policeCategory;
+
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    private String createUser;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+
+    /**
+     * 删除状态 默认0 有效 1无效
+     */
+    private Integer delFlag;
+
+    /**
+     * 版本号
+     */
+    private String version;
+
+    /**
+     * 收藏数量
+     */
+    private Long star;
+
+
+}

+ 55 - 0
src/main/java/com/dragon/tj/portal/entity/InstallInfo.java

@@ -0,0 +1,55 @@
+package com.dragon.tj.portal.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 lombok.experimental.Accessors;
+
+import java.time.LocalDateTime;
+
+/**
+ * 应用安装信息
+ */
+@Getter
+@Setter
+@Accessors(chain = true)
+@TableName("install_info")
+public class InstallInfo {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 应用ID
+     */
+    private Integer appId;
+
+    /**
+     * 用户身份证号码
+     */
+    private String userIdcard;
+
+    /**
+     * 是否卸载
+     */
+    private Integer delFlag;
+
+    /**
+     * 安装时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+
+
+}

+ 17 - 0
src/main/java/com/dragon/tj/portal/entity/PageParam.java

@@ -0,0 +1,17 @@
+package com.dragon.tj.portal.entity;
+
+import lombok.Data;
+
+@Data
+public class PageParam<T> {
+    private static final long serialVersionUID = 1L;
+
+    private T params;
+
+    private Integer page;
+
+    private Integer size;
+
+    private String order;
+
+}

+ 18 - 0
src/main/java/com/dragon/tj/portal/mapper/app/AppInfoMapper.java

@@ -0,0 +1,18 @@
+package com.dragon.tj.portal.mapper.app;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.dragon.tj.portal.entity.AppInfo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Map;
+
+/**
+ * 应用程序
+ */
+@Mapper
+public interface AppInfoMapper extends BaseMapper<AppInfo> {
+
+    IPage<AppInfo> getInstalledApp(IPage<AppInfo> iPage,@Param("map") Map map);
+}

+ 19 - 0
src/main/java/com/dragon/tj/portal/mapper/app/InstallInfoMapper.java

@@ -0,0 +1,19 @@
+package com.dragon.tj.portal.mapper.app;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.dragon.tj.portal.entity.InstallInfo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 应用程序安装信息
+ */
+@Mapper
+public interface InstallInfoMapper extends BaseMapper<InstallInfo> {
+
+    @Select("select app_id as appId,count(1) as count from install_info GROUP BY app_id")
+    List<Map<String, Long>> getAppInstallCount();
+}

+ 52 - 0
src/main/java/com/dragon/tj/portal/service/AppService.java

@@ -0,0 +1,52 @@
+package com.dragon.tj.portal.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.dragon.tj.portal.auth.model.LoginUser;
+import com.dragon.tj.portal.common.base.R;
+import com.dragon.tj.portal.entity.AppInfo;
+import com.dragon.tj.portal.entity.PageParam;
+
+
+public interface AppService {
+    /*
+    * CRUD
+    * */
+    int add(AppInfo appInfo, LoginUser loginUser);
+
+    int delete(Long id);
+
+    int update(AppInfo appInfo);
+
+    AppInfo detail(Long id);
+
+
+    /*
+    * 获取类型
+    * */
+    R getType();
+
+
+    /*
+     * 分页搜索
+     * */
+    Page<AppInfo> search(PageParam<AppInfo> appInfoPage);
+
+
+
+    /*
+    *  安装应用程序
+    * */
+    int install(Integer appId,String userIdcard);
+
+
+    int uninstall(Integer appId, String idCard);
+
+
+    /*
+    * 查询已安装应用
+    * */
+    IPage<AppInfo> installApp(PageParam<AppInfo> appInfoPage, LoginUser loginUser);
+
+    void updateAppStat();
+}

+ 7 - 0
src/main/java/com/dragon/tj/portal/service/SysDictService.java

@@ -28,4 +28,11 @@ public interface SysDictService extends IService<SysDict> {
      * @return
      */
     R updateDict(SysDict sysDict);
+
+    /**
+     * 获取字典
+     * @param type 字典类型
+     * @return
+     */
+    R getDict(String type);
 }

+ 175 - 0
src/main/java/com/dragon/tj/portal/service/impl/AppServiceImpl.java

@@ -0,0 +1,175 @@
+package com.dragon.tj.portal.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.dragon.tj.portal.auth.model.LoginUser;
+import com.dragon.tj.portal.common.base.R;
+import com.dragon.tj.portal.entity.AppInfo;
+import com.dragon.tj.portal.entity.InstallInfo;
+import com.dragon.tj.portal.entity.PageParam;
+import com.dragon.tj.portal.mapper.app.AppInfoMapper;
+import com.dragon.tj.portal.mapper.app.InstallInfoMapper;
+import com.dragon.tj.portal.service.AppService;
+import com.dragon.tj.portal.service.SysDictService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class AppServiceImpl implements AppService {
+
+
+    @Autowired
+    private AppInfoMapper appInfoMapper;
+
+    @Autowired
+    private InstallInfoMapper installInfoMapper;
+
+    @Autowired
+    private SysDictService sysDictService;
+
+    /*
+     * CRUD
+     * */
+    @Override
+    public int add(AppInfo appInfo, LoginUser loginUser) {
+        appInfo.setCreateUser(loginUser.getUsername());
+
+        return appInfoMapper.insert(appInfo);
+    }
+
+    @Override
+    public int delete(Long id) {
+        AppInfo appInfo = new AppInfo();
+        appInfo.setId(id);
+        appInfo.setDelFlag(1);
+
+        return appInfoMapper.updateById(appInfo);
+    }
+
+    @Override
+    public int update(AppInfo appInfo) {
+        return appInfoMapper.updateById(appInfo);
+    }
+
+    @Override
+    public AppInfo detail(Long id) {
+        return appInfoMapper.selectById(id);
+    }
+
+    /*
+     * 获取类型
+     * */
+    @Override
+    public R getType() {
+        return sysDictService.getDict("app_type");
+    }
+
+    /*
+     * 搜索App
+     * */
+    @Override
+    public Page<AppInfo> search(PageParam<AppInfo> appInfoPage) {
+
+        AppInfo appInfo = appInfoPage.getParams();
+        Page<AppInfo> rowPage = new Page(appInfoPage.getPage(), appInfoPage.getSize());
+
+        LambdaQueryWrapper<AppInfo> queryWrapper = new LambdaQueryWrapper<>();
+
+        //应用名称
+        queryWrapper.like(StringUtils.isNotEmpty(appInfo.getSystemName()), AppInfo::getSystemName, appInfo.getSystemName());
+        //应用事权单位名称
+        queryWrapper.like(StringUtils.isNotEmpty(appInfo.getDeptName()), AppInfo::getDeptName, appInfo.getDeptName());
+        //应用类型
+        queryWrapper.eq(appInfo.getAppType() != null,AppInfo::getAppType, appInfo.getAppType());
+        queryWrapper.eq(appInfo.getDelFlag() != null,AppInfo::getDelFlag, appInfo.getDelFlag());
+
+        queryWrapper.orderByDesc(AppInfo::getStar);
+
+        return appInfoMapper.selectPage(rowPage, queryWrapper);
+    }
+
+
+    /*
+     * 安装应用
+     * */
+    @Override
+    public int install(Integer appId, String userIdcard) {
+
+        //是否已安装
+        QueryWrapper<InstallInfo> wrapper = new QueryWrapper<>();
+        wrapper.eq("app_id", appId);
+        wrapper.eq("user_idcard", userIdcard);
+        InstallInfo installed = installInfoMapper.selectOne(wrapper);
+
+        if (installed == null) {
+            InstallInfo installInfo = new InstallInfo();
+            installInfo.setAppId(appId);
+            installInfo.setUserIdcard(userIdcard);
+
+            return installInfoMapper.insert(installInfo);
+        }
+
+        installed.setDelFlag(0);
+        installed.setUpdateTime(LocalDateTime.now());
+
+        return installInfoMapper.updateById(installed);
+    }
+
+    /*
+     * 卸载
+     * */
+    @Override
+    public int uninstall(Integer appId, String idCard) {
+        InstallInfo installInfo = new InstallInfo();
+        installInfo.setDelFlag(1);
+        installInfo.setUpdateTime(LocalDateTime.now());
+        QueryWrapper<InstallInfo> wrapper = new QueryWrapper<>();
+        wrapper.eq("app_id", appId);
+        wrapper.eq("user_idcard", idCard);
+
+        return installInfoMapper.update(installInfo, wrapper);
+    }
+
+    /*
+     *  已安装应用
+     * */
+    @Override
+    public IPage<AppInfo> installApp(PageParam<AppInfo> page, LoginUser loginUser) {
+        AppInfo params = page.getParams();
+        IPage<AppInfo> iPage = new Page<>(page.getPage(), page.getSize());
+
+        Map map = new HashMap();
+
+        map.put("delFlag", params.getDelFlag());
+        map.put("idcard", loginUser.getIdCard());
+
+        return appInfoMapper.getInstalledApp(iPage,map);
+
+    }
+
+    /*
+    *  应用统计
+    * */
+    @Override
+    public void updateAppStat() {
+        //获取app安装次数
+        List<Map<String,Long>> apps = installInfoMapper.getAppInstallCount();
+        //更新star
+        apps.forEach(app ->{
+            AppInfo appInfo = new AppInfo();
+            appInfo.setId(app.get("appId"));
+            appInfo.setStar(app.get("count"));
+            appInfoMapper.updateById(appInfo);
+        });
+
+    }
+
+}

+ 17 - 0
src/main/java/com/dragon/tj/portal/service/impl/SysDictServiceImpl.java

@@ -1,5 +1,6 @@
 package com.dragon.tj.portal.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.dragon.tj.portal.common.base.R;
@@ -28,6 +29,9 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
     @Autowired
     private SysDictItemMapper dictItemMapper;
 
+    @Autowired
+    private SysDictMapper dictMapper;
+
     /**
      * 根据ID 删除字典
      *
@@ -59,4 +63,17 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
 
         return R.ok(this.updateById(dict));
     }
+
+    /**
+     * 获取字典
+     * @param type 字典类型
+     * @return
+     */
+    @Override
+    public R getDict(String type) {
+        QueryWrapper wrapper = new QueryWrapper();
+        wrapper.eq("type",type);
+        wrapper.eq("del_flag",0);
+        return R.ok(dictMapper.selectList(wrapper));
+    }
 }

+ 3 - 1
src/main/resources/application-dev.properties

@@ -41,4 +41,6 @@ logging.level.org.springframework.security=trace
 logging.level.org.jasig.cas=trace
 logging.level.org.apache.kafka=warn
 
-server.port=8082
+server.port=8082
+
+dragon.file.path=D:/crayon/file/

+ 49 - 0
src/main/resources/mapper/app/AppInfoMapper.xml

@@ -0,0 +1,49 @@
+<?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.dragon.tj.portal.mapper.app.AppInfoMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.dragon.tj.portal.entity.AppInfo">
+        <id column="id" property="id" />
+        <result column="system_name" property="systemName" />
+        <result column="app_type" property="appType" />
+        <result column="system_number" property="systemNumber" />
+        <result column="short_name" property="shortName" />
+        <result column="dept_name" property="deptName" />
+        <result column="url" property="url" />
+        <result column="active_flag" property="activeFlag" />
+        <result column="icon" property="icon" />
+        <result column="police_category" property="policeCategory" />
+        <result column="create_time" property="createTime" />
+        <result column="update_time" property="updateTime" />
+        <result column="del_flag" property="delFlag" />
+        <result column="create_user" property="createUser" />
+        <result column="version" property="version" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        system_name, app_type, system_number, short_name,
+        dept_name, url, active_flag, icon, police_category, create_user, version
+    </sql>
+
+
+    <select id="getInstalledApp" resultType="com.dragon.tj.portal.entity.AppInfo">
+        select * from app_info t1
+        where t1.del_flag = 0
+        and t1.id in  (
+            select app_id from install_info t2
+            <where>
+                <if test="map.idcard != null and map.idcard != ''">
+                    and t2.user_idcard = #{map.idcard}
+                </if>
+                <if test="map.delFlag != null">
+                    and t2.del_flag = #{map.delFlag}
+                </if>
+            </where>
+
+        )
+    </select>
+
+
+</mapper>