luo
2023-12-08 1300cd0e47d9f0890d972bafeba888d10395ed38
12.8
32个文件已修改
7个文件已删除
53个文件已添加
4488 ■■■■ 已修改文件
.idea/.gitignore 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/compiler.xml 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/encodings.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/jarRepositories.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/misc.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/vcs.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-admin/src/main/resources/application.yml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-core/target/classes/META-INF/spring-configuration-metadata.json 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-core/target/classes/META-INF/spring.factories 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-core/target/classes/default-config.properties 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-generator/target/classes/gunsTemplate/advanced/Controller.java.btl 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-generator/target/classes/gunsTemplate/advanced/menu_sql.sql.btl 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-generator/target/classes/gunsTemplate/advanced/page.html.btl 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-generator/target/classes/gunsTemplate/advanced/page.js.btl 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-generator/target/classes/gunsTemplate/advanced/page_add.html.btl 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-generator/target/classes/gunsTemplate/advanced/page_edit.html.btl 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-generator/target/classes/gunsTemplate/advanced/page_info.js.btl 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/pom.xml 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/config/web/ShiroConfig.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/api/ApiController.java 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/api/AppUserController.java 200 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/api/BannerController.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/api/EncyclopedicKnowledgeController.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/api/HouseResourceController.java 159 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/api/HousingDemandController.java 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/api/RegionController.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/HostController.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/HouseController.java 180 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/MediumController.java 106 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/SysDeptController.java 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/SysRoleController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/UserController.java 376 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/AppUserMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/EncyclopedicKnowledgeMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/HouseResourceMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/UserMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/AppUserMapper.xml 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/EncyclopedicKnowledgeMapper.xml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserMapper.xml 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/Medium.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/THouseResource.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/model/Banner.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/model/Dept.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/model/EncyclopedicKnowledge.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/model/HouseResource.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/model/HouseType.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IAppUserService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IEncyclopedicKnowledgeService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IHouseResourceService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IUserService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/AppUserServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/EncyclopedicKnowledgeServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/HouseResourceService.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/transfer/UserDto.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/java/com/stylefeng/guns/modular/system/warpper/req/AddHouseReq.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/resources/application-dev.yml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/src/main/resources/application.yml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/META-INF/spring-configuration-metadata.json 145 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/META-INF/spring-devtools.properties 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/application-dev.yml 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/application-produce.yml 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/application.yml 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/AppUserMapper.xml 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/BannerMapper.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/CollectionHouseResourceMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/CollectionHousingDemandMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/DeptMapper.xml 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/DictMapper.xml 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/EncyclopedicKnowledgeMapper.xml 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/EncyclopedicKnowledgeUpvoteMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/ExpenseMapper.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/FeedBackMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml 417 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/HouseTypeMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/HousingDemandDistrictMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/HousingDemandMapper.xml 155 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/LoginLogMapper.xml 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/MenuMapper.xml 177 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/NoticeMapper.xml 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/OperationLogMapper.xml 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/RegionMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/RelationMapper.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/ReportHouseResourceMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/ReportHousingDemandMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/RoleMapper.xml 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/SearchHistoryConditionMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/SysDataTypeMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/UserMapper.xml 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/ehcache.xml 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-management/target/classes/logback-spring.xml 222 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/.gitignore
New file
@@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
.idea/compiler.xml
New file
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="CompilerConfiguration">
    <annotationProcessing>
      <profile name="Maven default annotation processors profile" enabled="true">
        <sourceOutputDir name="target/generated-sources/annotations" />
        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
        <outputRelativeToContentRoot value="true" />
        <module name="guns-generator" />
        <module name="guns-admin" />
        <module name="guns-core" />
        <module name="guns-management" />
      </profile>
    </annotationProcessing>
  </component>
  <component name="JavacSettings">
    <option name="ADDITIONAL_OPTIONS_OVERRIDE">
      <module name="guns-admin" options="-parameters" />
      <module name="guns-core" options="-parameters" />
      <module name="guns-generator" options="-parameters" />
      <module name="guns-management" options="-parameters" />
    </option>
  </component>
</project>
.idea/encodings.xml
New file
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="Encoding">
    <file url="file://$PROJECT_DIR$/guns-admin/src/main/java" charset="UTF-8" />
    <file url="file://$PROJECT_DIR$/guns-core/src/main/java" charset="UTF-8" />
    <file url="file://$PROJECT_DIR$/guns-generator/src/main/java" charset="UTF-8" />
    <file url="file://$PROJECT_DIR$/guns-management/src/main/java" charset="UTF-8" />
    <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
  </component>
</project>
.idea/jarRepositories.xml
New file
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="RemoteRepositoriesConfiguration">
    <remote-repository>
      <option name="id" value="central" />
      <option name="name" value="Central Repository" />
      <option name="url" value="https://repo.maven.apache.org/maven2" />
    </remote-repository>
    <remote-repository>
      <option name="id" value="central" />
      <option name="name" value="Maven Central repository" />
      <option name="url" value="https://repo1.maven.org/maven2" />
    </remote-repository>
    <remote-repository>
      <option name="id" value="jboss.community" />
      <option name="name" value="JBoss Community repository" />
      <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
    </remote-repository>
  </component>
</project>
.idea/misc.xml
New file
@@ -0,0 +1,11 @@
<project version="4">
  <component name="ExternalStorageConfigurationManager" enabled="true" />
  <component name="MavenProjectsManager">
    <option name="originalFiles">
      <list>
        <option value="$PROJECT_DIR$/pom.xml" />
      </list>
    </option>
  </component>
  <component name="ProjectRootManager" version="2" project-jdk-name="corretto-1.8" project-jdk-type="JavaSDK" />
</project>
.idea/vcs.xml
New file
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="VcsDirectoryMappings">
    <mapping directory="" vcs="Git" />
  </component>
</project>
guns-admin/src/main/resources/application.yml
@@ -31,3 +31,9 @@
spring:
  profiles:
    active: @spring.active@
pagehelper:
helperDialect: mysql
reasonable: true\
supportMethodsArguments: true
params: count=countSql
guns-core/target/classes/META-INF/spring-configuration-metadata.json
New file
@@ -0,0 +1,98 @@
{
  "hints": [],
  "groups": [
    {
      "sourceType": "com.stylefeng.guns.core.config.DefaultProperties",
      "name": "spring.datasource",
      "sourceMethod": "druidProperties()",
      "type": "com.stylefeng.guns.core.config.properties.DruidProperties"
    }
  ],
  "properties": [
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.DruidProperties",
      "name": "spring.datasource.driver-class-name",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.DruidProperties",
      "name": "spring.datasource.filters",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.DruidProperties",
      "name": "spring.datasource.initial-size",
      "type": "java.lang.Integer"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.DruidProperties",
      "name": "spring.datasource.max-active",
      "type": "java.lang.Integer"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.DruidProperties",
      "name": "spring.datasource.max-pool-prepared-statement-per-connection-size",
      "type": "java.lang.Integer"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.DruidProperties",
      "name": "spring.datasource.max-wait",
      "type": "java.lang.Integer"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.DruidProperties",
      "name": "spring.datasource.min-evictable-idle-time-millis",
      "type": "java.lang.Integer"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.DruidProperties",
      "name": "spring.datasource.min-idle",
      "type": "java.lang.Integer"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.DruidProperties",
      "name": "spring.datasource.password",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.DruidProperties",
      "name": "spring.datasource.pool-prepared-statements",
      "type": "java.lang.Boolean"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.DruidProperties",
      "name": "spring.datasource.test-on-borrow",
      "type": "java.lang.Boolean"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.DruidProperties",
      "name": "spring.datasource.test-on-return",
      "type": "java.lang.Boolean"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.DruidProperties",
      "name": "spring.datasource.test-while-idle",
      "type": "java.lang.Boolean"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.DruidProperties",
      "name": "spring.datasource.time-between-eviction-runs-millis",
      "type": "java.lang.Integer"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.DruidProperties",
      "name": "spring.datasource.url",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.DruidProperties",
      "name": "spring.datasource.username",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.DruidProperties",
      "name": "spring.datasource.validation-query",
      "type": "java.lang.String"
    }
  ]
}
guns-core/target/classes/META-INF/spring.factories
New file
@@ -0,0 +1,6 @@
# AutoConfiguration
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.stylefeng.guns.core.base.controller.GlobalController,\
com.stylefeng.guns.core.config.DefaultFastjsonConfig,\
com.stylefeng.guns.core.config.DefaultProperties,\
com.stylefeng.guns.core.config.DefaultWebConfig
guns-core/target/classes/default-config.properties
New file
@@ -0,0 +1,36 @@
#\u8FD9\u4E2A\u914D\u7F6E\u6587\u4EF6\u91CC\u5199\u5176\u4ED6\u9879\u76EE\u53EF\u80FD\u5171\u7528\u7684\u914D\u7F6E,\u53EF\u4EE5\u5728application.yml\u4E2D\u914D\u7F6E\u4FE1\u606F\u8986\u76D6\u8FD9\u91CC\u7684\u914D\u7F6E
######################### springs\u9ED8\u8BA4\u914D\u7F6E #########################
spring.aop.proxy-target-class=true
###################### mybatis-plus\u9ED8\u8BA4\u914D\u7F6E #######################
mybatis-plus.mapper-locations=classpath*:com/stylefeng/guns/**/mapping/*.xml
# 0:\u6570\u636E\u5E93ID\u81EA\u589E   1:\u7528\u6237\u8F93\u5165id  2:\u5168\u5C40\u552F\u4E00id(IdWorker)  3:\u5168\u5C40\u552F\u4E00ID(uuid)
mybatis-plus.global-config.id-type=0
mybatis-plus.global-config.db-column-underline=false
mybatis-plus.global-config.refresh-mapper=true
mybatis-plus.global-config.logic-delete-value=0
mybatis-plus.global-config.logic-not-delete-value=1
mybatis-plus.global-config.sql-injector=com.baomidou.mybatisplus.mapper.LogicSqlInjector
mybatis-plus.configuration.map-underscore-to-camel-case=false
#\u914D\u7F6E\u7684\u7F13\u5B58\u7684\u5168\u5C40\u5F00\u5173
mybatis-plus.configuration.cache-enabled=true
# \u5EF6\u65F6\u52A0\u8F7D\u7684\u5F00\u5173
mybatis-plus.configuration.lazyLoadingEnabled=true
# \u5F00\u542F\u7684\u8BDD\uFF0C\u5EF6\u65F6\u52A0\u8F7D\u4E00\u4E2A\u5C5E\u6027\u65F6\u4F1A\u52A0\u8F7D\u8BE5\u5BF9\u8C61\u5168\u90E8\u5C5E\u6027\uFF0C\u5426\u5219\u6309\u9700\u52A0\u8F7D\u5C5E\u6027
mybatis-plus.configuration.multipleResultSetsEnabled=true
# \u6253\u5370sql\u8BED\u53E5,\u8C03\u8BD5\u7528
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
########################## beetl\u9ED8\u8BA4\u914D\u7F6E ###########################
#\u5F00\u59CB\u7ED3\u675F\u6807\u7B7E(yaml\u4E0D\u5141\u8BB8@\u5F00\u5934)
beetl.delimiter-statement-start=@
beetl.delimiter-statement-end=null
#\u81EA\u5B9A\u4E49\u6807\u7B7E\u6587\u4EF6Root\u76EE\u5F55\u548C\u540E\u7F00
beetl.resource-tagroot=common/tags
beetl.resource-tagsuffix=tag
#\u662F\u5426\u68C0\u6D4B\u6587\u4EF6\u53D8\u5316,\u5F00\u53D1\u7528true\u5408\u9002\uFF0C\u4F46\u7EBF\u4E0A\u8981\u6539\u4E3Afalse
beetl.resource-auto-check=true
guns-generator/target/classes/gunsTemplate/advanced/Controller.java.btl
New file
@@ -0,0 +1,96 @@
package ${controller.packageName};
<% for(import in controller.imports!){ %>
import ${import};
<% } %>
/**
 * ${context.bizChName}控制器
 *
 * @author fengshuonan
 * @Date ${tool.currentTime()}
 */
@Controller
@RequestMapping("/${context.bizEnName}")
public class ${context.bizEnBigName}Controller extends BaseController {
    private String PREFIX = "/${context.moduleName}/${context.bizEnName}/";
    @Autowired
    private I${context.entityName}Service ${context.bizEnName}Service;
    /**
     * 跳转到${context.bizChName}首页
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "${context.bizEnName}.html";
    }
    /**
     * 跳转到添加${context.bizChName}
     */
    @RequestMapping("/${context.bizEnName}_add")
    public String ${context.bizEnName}Add() {
        return PREFIX + "${context.bizEnName}_add.html";
    }
    /**
     * 跳转到修改${context.bizChName}
     */
    @RequestMapping("/${context.bizEnName}_update/{${context.bizEnName}Id}")
    public String ${context.bizEnName}Update(@PathVariable Integer ${context.bizEnName}Id, Model model) {
        ${context.entityName} ${context.bizEnName} = ${context.bizEnName}Service.selectById(${context.bizEnName}Id);
        model.addAttribute("item",${context.bizEnName});
        LogObjectHolder.me().set(${context.bizEnName});
        return PREFIX + "${context.bizEnName}_edit.html";
    }
    /**
     * 获取${context.bizChName}列表
     */
    @RequestMapping(value = "/list")
    @ResponseBody
    public Object list(String condition) {
        return ${context.bizEnName}Service.selectList(null);
    }
    /**
     * 新增${context.bizChName}
     */
    @RequestMapping(value = "/add")
    @ResponseBody
    public Object add(${context.entityName} ${context.bizEnName}) {
        ${context.bizEnName}Service.insert(${context.bizEnName});
        return SUCCESS_TIP;
    }
    /**
     * 删除${context.bizChName}
     */
    @RequestMapping(value = "/delete")
    @ResponseBody
    public Object delete(@RequestParam Integer ${context.bizEnName}Id) {
        ${context.bizEnName}Service.deleteById(${context.bizEnName}Id);
        return SUCCESS_TIP;
    }
    /**
     * 修改${context.bizChName}
     */
    @RequestMapping(value = "/update")
    @ResponseBody
    public Object update(${context.entityName} ${context.bizEnName}) {
        ${context.bizEnName}Service.updateById(${context.bizEnName});
        return SUCCESS_TIP;
    }
    /**
     * ${context.bizChName}详情
     */
    @RequestMapping(value = "/detail/{${context.bizEnName}Id}")
    @ResponseBody
    public Object detail(@PathVariable("${context.bizEnName}Id") Integer ${context.bizEnName}Id) {
        return ${context.bizEnName}Service.selectById(${context.bizEnName}Id);
    }
}
guns-generator/target/classes/gunsTemplate/advanced/menu_sql.sql.btl
New file
@@ -0,0 +1,3 @@
<% for(menu in sqls.menus!){ %>
INSERT INTO `guns`.`sys_menu` (`id`, `code`, `pcode`, `pcodes`, `name`, `icon`, `url`, `num`, `levels`, `ismenu`, `tips`, `status`, `isopen`) VALUES ('${menu.id}', '${menu.code}', '${menu.pcode}', '${menu.pcodes}', '${menu.name}', '${menu.icon}', '${menu.url}', '${menu.num}', '${menu.levels}', '${menu.ismenu}', NULL, '${menu.status}', '${menu.isopen}');
<% } %>
guns-generator/target/classes/gunsTemplate/advanced/page.html.btl
New file
@@ -0,0 +1,38 @@
@layout("/common/_container.html"){
<div class="row">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>${context.bizChName}管理</h5>
            </div>
            <div class="ibox-content">
                <div class="row row-lg">
                    <div class="col-sm-12">
                        <div class="row">
                            <div class="col-sm-3">
                                <#NameCon id="condition" name="名称" />
                            </div>
                            <div class="col-sm-3">
                                <#button name="搜索" icon="fa-search" clickFun="${context.bizEnBigName}.search()"/>
                            </div>
                        </div>
                        <div class="hidden-xs" id="${context.bizEnBigName}TableToolbar" role="group">
                            @if(shiro.hasPermission("/${context.bizEnName}/add")){
                                <#button name="添加" icon="fa-plus" clickFun="${context.bizEnBigName}.openAdd${context.bizEnBigName}()"/>
                            @}
                            @if(shiro.hasPermission("/${context.bizEnName}/update")){
                                <#button name="修改" icon="fa-edit" clickFun="${context.bizEnBigName}.open${context.bizEnBigName}Detail()" space="true"/>
                            @}
                            @if(shiro.hasPermission("/${context.bizEnName}/delete")){
                                <#button name="删除" icon="fa-remove" clickFun="${context.bizEnBigName}.delete()" space="true"/>
                            @}
                        </div>
                        <#table id="${context.bizEnBigName}Table"/>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="\${ctxPath}/static/modular/${context.moduleName}/${context.bizEnName}/${context.bizEnName}.js"></script>
@}
guns-generator/target/classes/gunsTemplate/advanced/page.js.btl
New file
@@ -0,0 +1,102 @@
/**
 * ${context.bizChName}管理初始化
 */
var ${context.bizEnBigName} = {
    id: "${context.bizEnBigName}Table",    //表格id
    seItem: null,        //选中的条目
    table: null,
    layerIndex: -1
};
/**
 * 初始化表格的列
 */
${context.bizEnBigName}.initColumn = function () {
    return [
        {field: 'selectItem', radio: true},
        <% for(item in table.fields!){ %>
        <% if(itemLP.last != true){ %>
            {title: '${item.comment}', field: '${item.propertyName}', visible: true, align: 'center', valign: 'middle'},
        <% }else{ %>
            {title: '${item.comment}', field: '${item.propertyName}', visible: true, align: 'center', valign: 'middle'}
        <% }} %>
    ];
};
/**
 * 检查是否选中
 */
${context.bizEnBigName}.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if(selected.length == 0){
        Feng.info("请先选中表格中的某一记录!");
        return false;
    }else{
        ${context.bizEnBigName}.seItem = selected[0];
        return true;
    }
};
/**
 * 点击添加${context.bizChName}
 */
${context.bizEnBigName}.openAdd${context.bizEnBigName} = function () {
    var index = layer.open({
        type: 2,
        title: '添加${context.bizChName}',
        area: ['800px', '420px'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/${context.bizEnName}/${context.bizEnName}_add'
    });
    this.layerIndex = index;
};
/**
 * 打开查看${context.bizChName}详情
 */
${context.bizEnBigName}.open${context.bizEnBigName}Detail = function () {
    if (this.check()) {
        var index = layer.open({
            type: 2,
            title: '${context.bizChName}详情',
            area: ['800px', '420px'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/${context.bizEnName}/${context.bizEnName}_update/' + ${context.bizEnBigName}.seItem.id
        });
        this.layerIndex = index;
    }
};
/**
 * 删除${context.bizChName}
 */
${context.bizEnBigName}.delete = function () {
    if (this.check()) {
        var ajax = new $ax(Feng.ctxPath + "/${context.bizEnName}/delete", function (data) {
            Feng.success("删除成功!");
            ${context.bizEnBigName}.table.refresh();
        }, function (data) {
            Feng.error("删除失败!" + data.responseJSON.message + "!");
        });
        ajax.set("${context.bizEnName}Id",this.seItem.id);
        ajax.start();
    }
};
/**
 * 查询${context.bizChName}列表
 */
${context.bizEnBigName}.search = function () {
    var queryData = {};
    queryData['condition'] = $("#condition").val();
    ${context.bizEnBigName}.table.refresh({query: queryData});
};
$(function () {
    var defaultColunms = ${context.bizEnBigName}.initColumn();
    var table = new BSTable(${context.bizEnBigName}.id, "/${context.bizEnName}/list", defaultColunms);
    table.setPaginationType("client");
    ${context.bizEnBigName}.table = table.init();
});
guns-generator/target/classes/gunsTemplate/advanced/page_add.html.btl
New file
@@ -0,0 +1,41 @@
@layout("/common/_container.html"){
<div class="ibox float-e-margins">
    <div class="ibox-content">
        <div class="form-horizontal">
            <div class="row">
                <div class="col-sm-6 b-r">
                    <% var leftSize = tool.toInt((table.fields.~size + 1) / 2); %>
                    <% var rightSize = tool.toInt(table.fields.~size - leftSize); %>
                    <% for(var i=0;i<leftSize;i++){ %>
                        <% if(i != (leftSize-1) ){ %>
                            <#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}" underline="true"/>
                        <% }else{ %>
                            <#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}"/>
                        <% } %>
                    <% } %>
                </div>
                <div class="col-sm-6">
                    <% for(var i=leftSize;i<table.fields.~size;i++){ %>
                        <% if(i != (rightSize-1) ){ %>
                            <#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}" underline="true"/>
                        <% }else{ %>
                            <#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}"/>
                        <% } %>
                    <% } %>
                </div>
            </div>
            <div class="row btn-group-m-t">
                <div class="col-sm-10">
                    <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="${context.bizEnBigName}InfoDlg.addSubmit()"/>
                    <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="${context.bizEnBigName}InfoDlg.close()"/>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="\${ctxPath}/static/modular/${context.moduleName}/${context.bizEnName}/${context.bizEnName}_info.js"></script>
@}
guns-generator/target/classes/gunsTemplate/advanced/page_edit.html.btl
New file
@@ -0,0 +1,41 @@
@layout("/common/_container.html"){
<div class="ibox float-e-margins">
    <div class="ibox-content">
        <div class="form-horizontal">
            <div class="row">
                <div class="col-sm-6 b-r">
                    <% var leftSize = tool.toInt((table.fields.~size + 1) / 2); %>
                    <% var rightSize = tool.toInt(table.fields.~size - leftSize); %>
                    <% for(var i=0;i<leftSize;i++){ %>
                        <% if(i != (leftSize-1) ){ %>
                            <#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}" value="\${item.${table.fields[i].propertyName}}" underline="true"/>
                        <% }else{ %>
                            <#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}" value="\${item.${table.fields[i].propertyName}}" />
                        <% } %>
                    <% } %>
                </div>
                <div class="col-sm-6">
                    <% for(var i=leftSize;i<table.fields.~size;i++){ %>
                        <% if(i != (table.fields.~size-1) ){ %>
                            <#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}" value="\${item.${table.fields[i].propertyName}}" underline="true"/>
                        <% }else{ %>
                            <#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}" value="\${item.${table.fields[i].propertyName}}" />
                        <% } %>
                    <% } %>
                </div>
            </div>
            <div class="row btn-group-m-t">
                <div class="col-sm-10">
                    <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="${context.bizEnBigName}InfoDlg.editSubmit()"/>
                    <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="${context.bizEnBigName}InfoDlg.close()"/>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="\${ctxPath}/static/modular/${context.moduleName}/${context.bizEnName}/${context.bizEnName}_info.js"></script>
@}
guns-generator/target/classes/gunsTemplate/advanced/page_info.js.btl
New file
@@ -0,0 +1,98 @@
/**
 * 初始化${context.bizChName}详情对话框
 */
var ${context.bizEnBigName}InfoDlg = {
    ${context.bizEnName}InfoData : {}
};
/**
 * 清除数据
 */
${context.bizEnBigName}InfoDlg.clearData = function() {
    this.${context.bizEnName}InfoData = {};
}
/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
${context.bizEnBigName}InfoDlg.set = function(key, val) {
    this.${context.bizEnName}InfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
    return this;
}
/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
${context.bizEnBigName}InfoDlg.get = function(key) {
    return $("#" + key).val();
}
/**
 * 关闭此对话框
 */
${context.bizEnBigName}InfoDlg.close = function() {
    parent.layer.close(window.parent.${context.bizEnBigName}.layerIndex);
}
/**
 * 收集数据
 */
${context.bizEnBigName}InfoDlg.collectData = function() {
    this
    <% for(item in table.fields!){ %>
    <% if(itemLP.last != true){ %>
    .set('${item.propertyName}')
    <% }else{ %>
    .set('${item.propertyName}');
    <% }} %>
}
/**
 * 提交添加
 */
${context.bizEnBigName}InfoDlg.addSubmit = function() {
    this.clearData();
    this.collectData();
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/${context.bizEnName}/add", function(data){
        Feng.success("添加成功!");
        window.parent.${context.bizEnBigName}.table.refresh();
        ${context.bizEnBigName}InfoDlg.close();
    },function(data){
        Feng.error("添加失败!" + data.responseJSON.message + "!");
    });
    ajax.set(this.${context.bizEnName}InfoData);
    ajax.start();
}
/**
 * 提交修改
 */
${context.bizEnBigName}InfoDlg.editSubmit = function() {
    this.clearData();
    this.collectData();
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/${context.bizEnName}/update", function(data){
        Feng.success("修改成功!");
        window.parent.${context.bizEnBigName}.table.refresh();
        ${context.bizEnBigName}InfoDlg.close();
    },function(data){
        Feng.error("修改失败!" + data.responseJSON.message + "!");
    });
    ajax.set(this.${context.bizEnName}InfoData);
    ajax.start();
}
$(function() {
});
guns-management/pom.xml
@@ -12,6 +12,32 @@
    <dependencies>
        <dependency>
            <groupId>com.auth0</groupId>
            <artifactId>java-jwt</artifactId>
            <version>3.4.0</version>
        </dependency>
<!--        <dependency>-->
<!--            <groupId>org.apache.shiro</groupId>-->
<!--            <artifactId>shiro-spring</artifactId>-->
<!--            <version>1.3.2</version>-->
<!--        </dependency>-->
        <!-- shiro-redis缓存插件 -->
        <dependency>
            <groupId>org.crazycake</groupId>
            <artifactId>shiro-redis</artifactId>
            <version>2.4.2.1-RELEASE</version>
        </dependency>
        <!--分页-->
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper-spring-boot-starter</artifactId>
            <version>1.4.6</version>
        </dependency>
        <dependency>
            <groupId>com.stylefeng</groupId>
            <artifactId>guns-core</artifactId>
        </dependency>
guns-management/src/main/java/com/stylefeng/guns/config/web/ShiroConfig.java
@@ -168,17 +168,19 @@
        hashMap.put("/swagger-resources/configuration/ui/**", "anon");
        hashMap.put("/swagger-resources/configuration/security/**", "anon");
        hashMap.put("/base/**", "anon");
//        hashMap.put("/base/**", "anon");
        hashMap.put("/upload/**", "anon");
        hashMap.put("/api/**", "anon");
        hashMap.put("/auth/**", "anon");
        hashMap.put("/static/**", "anon");
        hashMap.put("/gunsApi/**", "anon");
        hashMap.put("/login", "anon");
        hashMap.put("/login.html", "anon");
        hashMap.put("/updatepwdpage", "anon");
        hashMap.put("/updatepwd", "anon");
        hashMap.put("/global/sessionError", "anon");
        hashMap.put("/kaptcha", "anon");
        hashMap.put("/base/user/login", "anon");
        hashMap.put("/**", "user");
        shiroFilter.setFilterChainDefinitionMap(hashMap);
        return shiroFilter;
guns-management/src/main/java/com/stylefeng/guns/modular/api/ApiController.java
File was deleted
guns-management/src/main/java/com/stylefeng/guns/modular/api/AppUserController.java
File was deleted
guns-management/src/main/java/com/stylefeng/guns/modular/api/BannerController.java
File was deleted
guns-management/src/main/java/com/stylefeng/guns/modular/api/EncyclopedicKnowledgeController.java
File was deleted
guns-management/src/main/java/com/stylefeng/guns/modular/api/HouseResourceController.java
File was deleted
guns-management/src/main/java/com/stylefeng/guns/modular/api/HousingDemandController.java
File was deleted
guns-management/src/main/java/com/stylefeng/guns/modular/api/RegionController.java
File was deleted
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/HostController.java
@@ -3,7 +3,10 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.core.page.PageInfoBT;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.modular.system.dto.Host;
import com.stylefeng.guns.modular.system.model.AppUser;
@@ -32,19 +35,20 @@
    @ResponseBody
    @PostMapping("/add")
    @ApiOperation(value = "添加用户", tags = {"后台-用户管理"})
    public ResultUtil addHost(@RequestBody Host host){
    public ResultUtil addHost( Host host){
       System.out.println("===================添加房东==");
       AppUser appUser = new AppUser();
        BeanUtils.copyProperties(host,appUser);
        appUser.setInsertTime(new Date());
        appUser.setStatus(1);
        appUser.setAuditStatus(2);
        appUserService.insert(appUser);
        return ResultUtil.success("增加成功");
    }
    @ResponseBody
    @PostMapping("/pre/update")
    @GetMapping("/pre/update")
    @ApiOperation(value = "编辑前获取用户信息", tags = {"后台-用户管理"})
    public Host preupdate(Integer id){
        AppUser appUser = appUserService.selectById(id);
@@ -52,9 +56,46 @@
        BeanUtils.copyProperties(appUser,host);
        return host;
    }
    @ResponseBody
    @PutMapping("/update")
    @ApiOperation(value = "编辑用户信息", tags = {"后台-用户管理"})
    public ResultUtil update(Host host){
        AppUser appUser =new AppUser();
        BeanUtils.copyProperties(host,appUser);
        appUserService.updateById(appUser);
        return ResultUtil.success("编辑成功");
    }
    @ResponseBody
    @PutMapping("/forzen")
    @ApiOperation(value = "更改状态1=正常,2=冻结,3=删除", tags = {"后台-用户管理"})
    public ResultUtil frozen(Integer id,Integer status){
        AppUser appUser = appUserService.selectById(id);
        appUser.setStatus(status);
        appUserService.updateById(appUser);
        String res = "";
        switch (status) {
            case 1:
                res = "解冻";
                break;
            case 2:
                res = "冻结";
                break;
            case 3:
                res = "删除";
                break;
        }
        return ResultUtil.success(res+"成功");
    }
    @ResponseBody
    @GetMapping ("/list")
    @ApiOperation(value = "查询用户", tags = {"后台-用户管理"})
    @ApiOperation(value = "查询用户(房东)", tags = {"后台-用户管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "nickname", value = "微信昵称", required = false),
            @ApiImplicitParam(name = "userType", value = "用户类型(1=普通,2=房东)",dataType = "int",required = false),
@@ -64,10 +105,18 @@
            @ApiImplicitParam(name = "pageSize",required = false),
    })
    public List<Host> list(String nickname,Integer userType,Integer status,String phone,int pageNo, int pageSize){
    public List<Host> list(String nickname,Integer userType,Integer status,String phone,@RequestParam() int pageNo, @RequestParam()int pageSize){
        int index = (pageNo-1)*pageSize;
        int size = pageSize;
        List<Host>  hosts =  appUserService.listHost(nickname,userType,status,phone,index,size);
        PageHelper.startPage(0,4);
        PageInfo<Host> info=new PageInfo<>(hosts);
        System.err.println(info);
        return hosts;
    }
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/HouseController.java
New file
@@ -0,0 +1,180 @@
package com.stylefeng.guns.modular.code.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.stylefeng.guns.modular.system.dto.Host;
import com.stylefeng.guns.modular.system.dto.THouseResource;
import com.stylefeng.guns.modular.system.model.HouseResource;
import com.stylefeng.guns.modular.system.model.HouseType;
import com.stylefeng.guns.modular.system.service.IHouseResourceService;
import com.stylefeng.guns.modular.system.service.IHouseTypeService;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.warpper.req.AddHouseReq;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
@Controller
@RequestMapping("/base/house")
public class HouseController {
    @Autowired
    private IHouseTypeService houseTypeService;
    @Autowired
    private IHouseResourceService houseResourceService;
    @ResponseBody
    @PostMapping("/addHouse/add")
    @ApiOperation(value = "发布房源", tags = {"后台-房源管理"})
    public ResultUtil addHouse(@RequestBody AddHouseReq req){
        return houseResourceService.addHouse(req);
    }
    @ResponseBody
    @GetMapping("/getHouseType")
    @ApiOperation(value = "获取房源类型", tags = {"后台-房源管理"})
    public ResultUtil<List<HouseType>> getHouseType(){
        List<HouseType> houseTypes = houseTypeService.selectList(null);
        return ResultUtil.success(houseTypes);
    }
    @ResponseBody
    @PostMapping("/addHouseType")
    @ApiOperation(value = "增加房源类型", tags = {"后台-房源管理"})
    public ResultUtil addHouseType(HouseType houseType){
        houseType.setInsertTime(new Date());
        houseTypeService.insert(houseType);
        return ResultUtil.success("增加成功");
    }
    @ResponseBody
    @DeleteMapping("/deleteHouseType")
    @ApiOperation(value = "删除房源类型", tags = {"后台-房源管理"})
    public ResultUtil deleteHouseType(Integer id){
        houseTypeService.deleteById(id);
        return ResultUtil.success("删除成功");
    }
    @ResponseBody
    @GetMapping("/pre/edit")
    @ApiOperation(value = "编辑房源前", tags = {"后台-房源管理"})
    public AddHouseReq preEdit(Integer id){
        HouseResource houseResource = houseResourceService.selectById(id);
        AddHouseReq addHouseReq = new AddHouseReq();
        BeanUtils.copyProperties(houseResource,addHouseReq);
        return addHouseReq;
    }
    @ResponseBody
    @PutMapping("/edit")
    @ApiOperation(value = "编辑房源", tags = {"后台-房源管理"})
    public ResultUtil edit(@RequestBody AddHouseReq req){
        return houseResourceService.editHouse(req);
    }
    @ResponseBody
    @GetMapping("/list")
    @ApiOperation(value = "列表", tags = {"后台-房源管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "每页数量", required = true, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "cellName", value = "小区名称", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "dataType", value = "房屋类型(1=出租,2=卖房)", dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "isManage", value = "1后台2房东3中介", dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "name", value = "姓名", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "saleAmount", value = "售卖金额区间'-'分隔", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "status", value = "状态1=正常,2=冻结", dataType = "Integer", paramType = "query")
    })
    public PageInfo<THouseResource> list(@RequestParam int pageNum,
                                         @RequestParam int  pageSize,
                                         String cellName,
                                         Integer dataType,
                                         Integer isManage,
                                         String name,
                                         String saleAmount,
                                         Integer status){
        PageHelper.startPage(pageNum,pageSize);
        List<THouseResource> houseResources =houseResourceService.list(cellName,dataType,isManage,name,saleAmount,status);
        PageInfo<THouseResource> info=new PageInfo<>(houseResources);
        System.err.println(info);
        return  info;
    }
    @ResponseBody
    @GetMapping("/au/list")
    @ApiOperation(value = "审核列表", tags = {"后台-房源管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "每页数量", required = true, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "cellName", value = "小区名称", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "dataType", value = "房屋类型(1=出租,2=卖房)", dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "isManage", value = "1后台2房东3中介", dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "name", value = "姓名", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "saleAmount", value = "售卖金额区间'-'分隔", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "size", value = "面积", dataType = "Integer", paramType = "query")
    })
    public PageInfo<THouseResource> auList(@RequestParam int pageNum,
                                         @RequestParam int  pageSize,
                                         String cellName,
                                         Integer dataType,
                                         Integer isManage,
                                         String name,
                                         String saleAmount,
                                         Integer id,String size){
        PageHelper.startPage(pageNum,pageSize);
        List<THouseResource> houseResources =houseResourceService.aulist(id,cellName,dataType,isManage,name,saleAmount,size);
        PageInfo<THouseResource> info=new PageInfo<>(houseResources);
        System.err.println(info);
        return  info;
    }
    @ResponseBody
    @PutMapping("/change")
    @ApiOperation(value = "(0=下架,1=上架,2=删除,3通过审核,4拒绝审核)", tags = {"后台-房源管理"})
    public ResultUtil change(Integer id,Integer status){
        HouseResource houseResource = houseResourceService.selectById(id);
        if (status==0||status==1){
            houseResource.setStatus(status);
        }else if (status==2){
            houseResource.setIsDelete(1);
        }else if (status ==3){
            houseResource.setAuthStatus(2);
        }else if (status == 4){
            houseResource.setAuthStatus(3);
        }
        houseResourceService.updateById(houseResource);
        return ResultUtil.success("操作成功");
    }
}
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/MediumController.java
New file
@@ -0,0 +1,106 @@
package com.stylefeng.guns.modular.code.controller;
import com.stylefeng.guns.modular.system.dto.Host;
import com.stylefeng.guns.modular.system.dto.Medium;
import com.stylefeng.guns.modular.system.model.AppUser;
import com.stylefeng.guns.modular.system.service.IAppUserService;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
@Controller
@RequestMapping("/base/medium")
public class MediumController {
    @Autowired
    private IAppUserService appUserService;
    @ResponseBody
    @GetMapping("/list")
    @ApiOperation(value = "查询中介列表", tags = {"后台-中介管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "nickname", value = "微信昵称", required = false),
            @ApiImplicitParam(name = "userType", value = "3(房东)",dataType = "int",required = true),
            @ApiImplicitParam(name = "status", value = "状态(1=正常,2=冻结,3=删除)",dataType = "int",required = false),
            @ApiImplicitParam(name = "phone", value = "电话",required = false),
            @ApiImplicitParam(name = "pageNo", required = false),
            @ApiImplicitParam(name = "pageSize",required = false),
    })
    public List<Medium> list(String nickname, Integer userType, Integer status, String phone, @RequestParam() int pageNo, @RequestParam()int pageSize){
        int index = (pageNo-1)*pageSize;
        int size = pageSize;
        List<Medium>  medius =  appUserService.listMedium(nickname,userType,status,phone,index,size);
        return medius;
    }
    @ResponseBody
    @PostMapping("/add")
    @ApiOperation(value = "添加中介", tags = {"后台-中介管理"})
    public ResultUtil addHost( Medium host){
        System.out.println("===================添加房东==");
        AppUser appUser = new AppUser();
        BeanUtils.copyProperties(host,appUser);
        appUser.setInsertTime(new Date());
        appUser.setStatus(1);
        appUser.setAuditStatus(2);
        appUserService.insert(appUser);
        return ResultUtil.success("增加成功");
    }
    @ResponseBody
    @GetMapping("/pre/update")
    @ApiOperation(value = "编辑前获取中介信息", tags = {"后台-中介管理"})
    public Medium preupdate(Integer id){
        AppUser appUser = appUserService.selectById(id);
        Medium host = new Medium();
        BeanUtils.copyProperties(appUser,host);
        return host;
    }
    @ResponseBody
    @PutMapping("/forzen")
    @ApiOperation(value = "更改状态1=正常,2=冻结,3=删除", tags = {"后台-中介管理"})
    public ResultUtil frozen(Integer id,Integer status){
        AppUser appUser = appUserService.selectById(id);
        appUser.setStatus(status);
        appUserService.updateById(appUser);
        String res = "";
        switch (status) {
            case 1:
                res = "解冻";
                break;
            case 2:
                res = "冻结";
                break;
            case 3:
                res = "删除";
                break;
        }
        return ResultUtil.success(res+"成功");
    }
    @ResponseBody
    @PutMapping("/update")
    @ApiOperation(value = "编辑中介", tags = {"后台-中介管理"})
    public ResultUtil update(Medium host){
//        AppUser appUser = appUserService.selectById(id);
//        Host host = new Host();
        AppUser appUser =new AppUser();
        BeanUtils.copyProperties(host,appUser);
        appUserService.updateById(appUser);
        return ResultUtil.success("编辑成功");
    }
}
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/SysDeptController.java
@@ -2,18 +2,22 @@
import com.stylefeng.guns.core.common.annotion.BussinessLog;
import com.stylefeng.guns.core.common.constant.dictmap.DeptDict;
import com.stylefeng.guns.core.common.constant.factory.ConstantFactory;
import com.stylefeng.guns.core.common.exception.BizExceptionEnum;
import com.stylefeng.guns.core.exception.GunsException;
import com.stylefeng.guns.core.log.LogObjectHolder;
import com.stylefeng.guns.core.mutidatasource.annotion.DataSource;
import com.stylefeng.guns.core.node.ZTreeNode;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.model.Dept;
import com.stylefeng.guns.modular.system.service.IDeptService;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.warpper.DeptWarpper;
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.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.xml.transform.Result;
import java.util.List;
@@ -28,16 +32,18 @@
    @DataSource(name = "dataSourceBiz")
    @RequestMapping(value = "/list")
    @GetMapping(value = "/list")
    @ApiOperation(value = "列表", tags = {"后台-部门管理"})
    @ResponseBody
    public Object list(String condition) {
        List<Map<String, Object>> list = this.deptService.list(condition);
    public Object list(String name) {
        List<Map<String, Object>> list = this.deptService.list(name);
        return list;
    }
    @DataSource(name = "dataSourceGuns")
    @BussinessLog(value = "添加部门", key = "simplename", dict = DeptDict.class)
    @RequestMapping(value = "/add")
    @ApiOperation(value = "添加部门", tags = {"后台-部门管理"})
    @PostMapping(value = "/add")
    @ResponseBody
    public ResultUtil add(Dept dept) {
        if (ToolUtil.isOneEmpty(dept, dept.getSimplename())) {
@@ -50,6 +56,41 @@
    }
    @DataSource(name = "dataSourceBiz")
    @GetMapping(value = "/tree")
    @ApiOperation(value = "获取部门树", tags = {"后台-部门管理"})
    @ResponseBody
    public List<ZTreeNode> tree() {
        List<ZTreeNode> tree = this.deptService.tree();
        tree.add(ZTreeNode.createParent());
        return tree;
    }
    @DataSource(name = "dataSourceBiz")
    @GetMapping ("pre/edit/{deptId}")
    public Dept deptUpdate(@PathVariable Integer deptId, Model model) {
        Dept dept = deptService.selectById(deptId);
       return dept;
    }
    @DataSource(name = "dataSourceGuns")
    @BussinessLog(value = "修改部门", key = "simplename", dict = DeptDict.class)
    @ApiOperation(value = "修改部门", tags = {"后台-部门管理"})
    @PutMapping (value = "/update")
    @ResponseBody
    public ResultUtil update(Dept dept) {
        if (ToolUtil.isEmpty(dept) || dept.getId() == null) {
            throw new GunsException(BizExceptionEnum.REQUEST_NULL);
        }
        deptSetPids(dept);
        Dept dept1 = deptService.selectById(dept.getId());
        deptService.updateById(dept);
        return ResultUtil.success("修改成功");
    }
    private void deptSetPids(Dept dept) {
        if (ToolUtil.isEmpty(dept.getPid()) || dept.getPid().equals(0)) {
            dept.setPid(0);
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/SysRoleController.java
@@ -143,7 +143,7 @@
    @GetMapping(value = "/roleTreeList")
    @ApiOperation(value = "获取上级名称", tags = {"后台-角色管理"})
    @ApiOperation(value = "获取角色树", tags = {"后台-角色管理"})
    @ResponseBody
    public List<ZTreeNode> roleTreeList() {
        List<ZTreeNode> roleTreeList = this.roleService.roleTreeList();
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/UserController.java
@@ -1,37 +1,222 @@
package com.stylefeng.guns.modular.code.controller;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.core.base.tips.ErrorTip;
import com.stylefeng.guns.core.base.tips.Tip;
import com.stylefeng.guns.core.common.annotion.BussinessLog;
import com.stylefeng.guns.core.common.constant.Const;
import com.stylefeng.guns.core.common.constant.dictmap.UserDict;
import com.stylefeng.guns.core.common.constant.factory.ConstantFactory;
import com.stylefeng.guns.core.common.constant.state.ManagerStatus;
import com.stylefeng.guns.core.common.exception.BizExceptionEnum;
import com.stylefeng.guns.core.exception.GunsException;
import com.stylefeng.guns.core.log.LogManager;
import com.stylefeng.guns.core.log.LogObjectHolder;
import com.stylefeng.guns.core.log.factory.LogTaskFactory;
import com.stylefeng.guns.core.mutidatasource.annotion.DataSource;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.shiro.ShiroUser;
import com.stylefeng.guns.core.support.HttpKit;
import com.stylefeng.guns.core.util.JwtTokenUtil;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.dao.UserMapper;
import com.stylefeng.guns.modular.system.dto.Host;
import com.stylefeng.guns.modular.system.factory.UserFactory;
import com.stylefeng.guns.modular.system.model.User;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.IBannerService;
import com.stylefeng.guns.modular.system.service.IEncyclopedicKnowledgeService;
import com.stylefeng.guns.modular.system.service.ISysDataTypeService;
import com.stylefeng.guns.modular.system.service.IUserService;
import com.stylefeng.guns.modular.system.transfer.UserDto;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.warpper.UserWarpper;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import org.apache.shiro.crypto.hash.Md5Hash;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.util.ByteSource;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import javax.naming.NoPermissionException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.stylefeng.guns.core.support.HttpKit.getIp;
@Controller
@RequestMapping("/base/user")
public class UserController {
    protected HttpServletResponse getHttpServletResponse() {
        return HttpKit.getResponse();
    }
    protected HttpServletRequest getHttpServletRequest() {
        return HttpKit.getRequest();
    }
    @Autowired
    private IUserService userService;
    @Autowired
    private IBannerService bannerService;
    @Autowired
    private IEncyclopedicKnowledgeService knowledgeService;
    @Autowired
    private ISysDataTypeService typeService;
    @Autowired
    private UserMapper userMapper;
    @ApiOperation(value = "拿token", tags = {"登录"})
    @PostMapping("/token/auth")
    @ResponseBody
    public Object auth(@RequestParam("username") String username,
                       @RequestParam("password") String password) {
        //封装请求账号密码为shiro可验证的token
        UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(username, password.toCharArray());
        //获取数据库中的账号密码,准备比对
//        User user = userMapper.getByAccount(username);
        User user = new User();
        List<User> account = userMapper.selectList(new EntityWrapper<User>().eq("account", username));
        user = account.get(0);
        String credentials = user.getPassword();
        String salt = user.getSalt();
        ByteSource credentialsSalt = new Md5Hash(salt);
        SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo(
                new ShiroUser(), credentials, credentialsSalt, "");
        //校验用户账号密码
        HashedCredentialsMatcher md5CredentialsMatcher = new HashedCredentialsMatcher();
        md5CredentialsMatcher.setHashAlgorithmName(ShiroKit.hashAlgorithmName);
        md5CredentialsMatcher.setHashIterations(ShiroKit.hashIterations);
        boolean passwordTrueFlag = md5CredentialsMatcher.doCredentialsMatch(
                usernamePasswordToken, simpleAuthenticationInfo);
        if (passwordTrueFlag) {
            HashMap<String, Object> result = new HashMap<>();
            result.put("token", JwtTokenUtil.generateToken(String.valueOf(user.getId())));
            return result;
        } else {
            return new ErrorTip(500, "账号密码错误!");
        }
    }
    @GetMapping(value = "/logout")
    @ApiOperation(value = "注销", tags = {"登录"})
    @ResponseBody
    public ResultUtil logOut() {
        System.err.println(ShiroKit.getUser());
        LogManager.me().executeLog(LogTaskFactory.exitLog(ShiroKit.getUser().getId(), getIp()));
        ShiroKit.getSubject().logout();
        deleteAllCookie();
        return ResultUtil.success("注销成功");
    }
    protected void deleteAllCookie() {
        Cookie[] cookies = this.getHttpServletRequest().getCookies();
        for (Cookie cookie : cookies) {
            Cookie temp = new Cookie(cookie.getName(), "");
            temp.setMaxAge(0);
            this.getHttpServletResponse().addCookie(temp);
        }
    }
    @GetMapping(value = "/tt")
    @ApiOperation(value = "tt", tags = {"登录"})
    @ResponseBody
    public void tt() {
        System.err.println(ShiroKit.getUser().getName());
    }
    @ApiOperation(value = "登录", tags = {"登录"})
    @ResponseBody
    @PostMapping(value = "/login")
    public ResultUtil loginVali(Model model) {
        model.addAttribute("updatePaw", false);
        String username = "admin";
        String password = "123456";
        //验证验证码是否正确
//        if (KaptchaUtil.getKaptchaOnOff()) {
//            String kaptcha = super.getPara("kaptcha").trim();
//            String code = (String) super.getSession().getAttribute(Constants.KAPTCHA_SESSION_KEY);
//            if (ToolUtil.isEmpty(kaptcha) || !kaptcha.equalsIgnoreCase(code)) {
//                model.addAttribute("tips", "验证码错误");
//                return "/login.html";
//            }
//        }
        User user = userService.selectOne(new EntityWrapper<User>().eq("account", username).ne("status", 3));
//        if(null == user.getUpdatePasswordTime() || (user.getUpdatePasswordTime().getTime() + 7776000000L) <= System.currentTimeMillis()){
//            model.addAttribute("tips", "密码已经90天没更新了,请先修改密码!");
//            model.addAttribute("updatePaw", true);
//            return "/login.html";
//        }
//        Long t = loginTime.get(username);
//        t = null == t ? 0 : t;
//        //超过30分钟初始化
//        if(System.currentTimeMillis() - t > (30 * 60 * 1000)){
//            loginFailures.put(username, 0);
//            loginTime.put(username, System.currentTimeMillis());
//        }
//
//        Integer f = loginFailures.get(username);
//        f = f == null ? 0 : f;
        //密码错误开始记录
        if(!user.getPassword().equals(ShiroKit.md5(password, user.getSalt()))) {
            return ResultUtil.error("密码错误");
        }
//            f++;
//            loginFailures.put(username, f);
//        }
//        if(f > 5 && (System.currentTimeMillis() - t) <= (30 * 60 * 1000)){
//            model.addAttribute("tips", "错误次数过多,请等30分钟再试!");
//            return "/login.html";
//        }
        Subject currentUser = ShiroKit.getSubject();
        UsernamePasswordToken token = new UsernamePasswordToken(username, password.toCharArray());
        token.setRememberMe(false);
//        currentUser.login(token);
        ShiroUser shiroUser = ShiroKit.getUser();
//        super.getSession().setAttribute("shiroUser", shiroUser);
//        super.getSession().setAttribute("username", shiroUser.getAccount());
        LogManager.me().executeLog(LogTaskFactory.loginLog(shiroUser.getId(), getIp()));
        ShiroKit.getSession().setAttribute("sessionFlag", true);
        System.out.println(ShiroKit.getUser().getName());
        return ResultUtil.success("1");
    }
@@ -56,8 +241,189 @@
        user.setPassword(ShiroKit.md5(user.getPassword(), user.getSalt()));
        user.setStatus(ManagerStatus.OK.getCode());
        user.setCreatetime(new Date());
//        user.setVersion(1);
        this.userService.insert(UserFactory.createUser(user));
        return ResultUtil.success("添加成功");
    }
    @ApiOperation(value = "查询管理员", tags = {"后台-系统设置"})
    @GetMapping("/list")
    @ResponseBody
    public Object list(String account, @RequestParam()int pageNo, @RequestParam()int pageSize,@RequestParam("1=平台管理员 2=员工") int version) {
        int index = (pageNo-1)*pageSize;
        int size = pageSize;
        List<Map<String, Object>> users = userService.getUsers(account,index,size,version);
        return users;
    }
    @DataSource(name = "dataSourceGuns")
    @PutMapping("/setRole")
    @BussinessLog(value = "分配角色", key = "userId,roleIds", dict = UserDict.class)
    @ApiOperation(value = "分配角色", tags = {"后台-系统设置"})
    @ResponseBody
    public ResultUtil setRole(@RequestParam("userId") Integer userId, @RequestParam("roleIds") String roleIds) {
        if (ToolUtil.isOneEmpty(userId, roleIds)) {
            throw new GunsException(BizExceptionEnum.REQUEST_NULL);
        }
        //不能修改超级管理员
        if (userId.equals(Const.ADMIN_ID)) {
            throw new GunsException(BizExceptionEnum.CANT_CHANGE_ADMIN);
        }
//        assertAuth(userId);
        this.userService.setRoles(userId, roleIds);
        User user = userService.selectById(userId);
        return ResultUtil.success("分配成功");
    }
    @DataSource(name = "dataSourceBiz")
    @GetMapping("/pre/edit/{userId}")
    @ApiOperation(value = "编辑获取信息", tags = {"后台-系统设置"})
    public User edit(@PathVariable Integer userId, Model model) {
        User user = this.userService.selectById(userId);
        return user;
    }
    @DataSource(name = "dataSourceGuns")
    @PutMapping("/edit")
    @BussinessLog(value = "修改管理员", key = "account", dict = UserDict.class)
    @ApiOperation(value = "修改管理员", tags = {"后台-系统设置"})
    @ResponseBody
    public ResultUtil edit(@Valid UserDto user, BindingResult result) throws NoPermissionException {
        User oldUser = userService.selectById(user.getId());
            this.userService.updateById(UserFactory.editUser(user, oldUser));
            return ResultUtil.success("修改成功");
    }
    @DataSource(name = "dataSourceGuns")
    @PutMapping("/frozen")
    @BussinessLog(value = "冻结-解冻-删除", key = "account", dict = UserDict.class)
    @ApiOperation(value = "冻结-解冻-删除", tags = {"后台-系统设置"})
    @ResponseBody
    public ResultUtil frozen(@RequestParam Integer userId,@RequestParam("1:解冻  2:冻结  3:删除") Integer status ) throws NoPermissionException {
        User user = userService.selectById(userId);
        user.setStatus(status);
        userService.updateById(user);
        String res = "";
        switch (status) {
            case 1:
                res = "解冻";
                break;
            case 2:
                res = "冻结";
                break;
            case 3:
                res = "删除";
                break;
        }
        return ResultUtil.success(res+"成功");
    }
    @ResponseBody
    @GetMapping ("/text")
    @ApiOperation(value = "3系统公告....", tags = {"后台-基础信息管理"})
    public List<Banner> text(){
        Integer [] ids = {3,4,5};
        return     bannerService.selectList(new EntityWrapper<Banner>().in("position",ids));
    }
    @ResponseBody
    @PutMapping ("/text/edit")
    @ApiOperation(value = "编辑系统公告", tags = {"后台-基础信息管理"})
    public ResultUtil textUpdate(Banner banner){
            bannerService.insertOrUpdate(banner);
            return ResultUtil.success("保存成功");
    }
    @ResponseBody
    @GetMapping ("/know/list")
    @ApiOperation(value = "列表", tags = {"后台-知识百科"})
    public List<EncyclopedicKnowledge> list(Integer type, String title,@RequestParam int pageNo,@RequestParam int pageSize){
        int index = (pageNo-1)*pageSize;
        int size = pageSize;
     return  knowledgeService.list(type,title,index,size);
    }
    @ResponseBody
    @GetMapping ("/know/select")
    @ApiOperation(value = "类型下拉框", tags = {"后台-知识百科"})
    public List<SysDataType> select(){
        return  typeService.getSysDataType(1);
    }
    @ResponseBody
    @PostMapping ("/know/add")
    @ApiOperation(value = "添加", tags = {"后台-知识百科"})
    public ResultUtil add(EncyclopedicKnowledge knowledge){
        knowledge.setInsertTime(new Date());
        knowledgeService.insert(knowledge);
        return ResultUtil.success("添加成功");
    }
    @ResponseBody
    @GetMapping  ("/know/pre/edit")
    @ApiOperation(value = "编辑获取信息", tags = {"后台-知识百科"})
    public EncyclopedicKnowledge preedit(Integer id){
        return knowledgeService.selectById(id);
    }
    @ResponseBody
    @PutMapping ("/know/edit")
    @ApiOperation(value = "修改", tags = {"后台-知识百科"})
    public ResultUtil edit(EncyclopedicKnowledge knowledge){
        knowledgeService.updateById(knowledge);
        return ResultUtil.success("修改成功");
    }
    @ResponseBody
    @DeleteMapping  ("/know/delete")
    @ApiOperation(value = "编辑获取信息", tags = {"后台-知识百科"})
    public ResultUtil delete(Integer id){
         knowledgeService.deleteById(id);
         return ResultUtil.success("删除成功");
    }
    private void assertAuth(Integer userId) {
        if (ShiroKit.isAdmin()) {
            return;
        }
        List<Integer> deptDataScope = ShiroKit.getDeptDataScope();
        User user = this.userService.selectById(userId);
        Integer deptid = user.getDeptid();
        if (deptDataScope.contains(deptid)) {
            return;
        } else {
            throw new GunsException(BizExceptionEnum.NO_PERMITION);
        }
    }
}
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/AppUserMapper.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.stylefeng.guns.modular.system.dto.Host;
import com.stylefeng.guns.modular.system.dto.Medium;
import com.stylefeng.guns.modular.system.model.AppUser;
import com.stylefeng.guns.modular.system.warpper.req.SearchIntermediaryReq;
import com.stylefeng.guns.modular.system.warpper.res.SearchIntermediaryListRes;
@@ -23,4 +24,6 @@
                        @Param("phone")String phone,
                        @Param("index")int index,
                        @Param("size")int size);
    List<Medium> listMedium(String nickname, Integer userType, Integer status, String phone, int index, int size);
}
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/EncyclopedicKnowledgeMapper.java
@@ -20,4 +20,6 @@
     * @return
     */
    List<EncyclopedicKnowledgeRes> getEncyclopedicKnowledgeList(@Param("typeId") Integer typeId);
    List<EncyclopedicKnowledge> list(Integer type, String title, int index, int size);
}
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/HouseResourceMapper.java
@@ -1,6 +1,7 @@
package com.stylefeng.guns.modular.system.dao;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.stylefeng.guns.modular.system.dto.THouseResource;
import com.stylefeng.guns.modular.system.model.HouseResource;
import com.stylefeng.guns.modular.system.warpper.req.HouseQuery;
import com.stylefeng.guns.modular.system.warpper.req.SearchHouseResourceReq;
@@ -59,4 +60,8 @@
    List<CollectListRes> release(@Param("query") UserInfoQuery query,@Param("ids")List<Integer> collect);
    List<THouseResource> list(String cellName, Integer dataType, Integer isManage, String name, String min,String max, Integer status);
    List<THouseResource> aulist(Integer id,String cellName, Integer dataType, Integer isManage, String name, String min,String max, String size);
}
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/UserMapper.java
@@ -44,4 +44,6 @@
    User getByAccount(@Param("account") String account);
    Map<String, Object> getSysUserDetails(Integer id);
    List<Map<String, Object>> getUsers(String account, int index, int size,int version);
}
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/AppUserMapper.xml
@@ -40,6 +40,7 @@
        SELECT id,insert_time,nickname,phone,profile_photo,user_type,wechat_qr_code,watch_app,phone,status
        from t_app_user
        <where>
            status != 3
            <if test="null != nickname and '' != nickname">
                and nickname like CONCAT('%', #{nickname}, '%')
            </if>
@@ -57,4 +58,25 @@
    </select>
    <select id="listMedium" resultType="com.stylefeng.guns.modular.system.dto.Medium">
        SELECT id,insert_time,nickname,company_name,agent_licence_code,wechat_qr_code,watch_app,phone,status
        from t_app_user
        <where>
            status != 3
            <if test="null != nickname and '' != nickname">
                and nickname like CONCAT('%', #{nickname}, '%')
            </if>
            <if test="null != userType">
                and user_type = #{userType}
            </if>
            <if test="null != status">
                and status = #{status}
            </if>
            <if test="null != phone and '' != phone">
                and phone like CONCAT('%', #{phone}, '%')
            </if>
        </where>
        limit #{index},#{size}
    </select>
</mapper>
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/EncyclopedicKnowledgeMapper.xml
@@ -11,4 +11,20 @@
        content_text as content
        from t_encyclopedic_knowledge where sys_data_type_id = #{typeId} order by insert_time desc
    </select>
    <select id="list" resultType="com.stylefeng.guns.modular.system.model.EncyclopedicKnowledge">
        SELECT kn.id,ty.`name` as type ,kn.title,kn.content,us.`name`,kn.insert_time as insertTime
        FROM t_encyclopedic_knowledge kn
                 LEFT JOIN t_sys_data_type ty ON kn.sys_data_type_id = ty.id
                 LEFT JOIN sys_user us ON kn.create_by = us.id
          <where>
              <if test="null != type ">
                  and kn.sys_data_type_id = #{type}
              </if>
          </where>
    </select>
</mapper>
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml
@@ -323,6 +323,95 @@
            </foreach>
        </if>
    </select>
    <select id="list" resultType="com.stylefeng.guns.modular.system.dto.THouseResource">
        select * from (
        SELECT hs.insert_time as insertTime, hs.id, hs.cell_name as cellName, hs.house_address as houseAddress,
        hs.data_type as dataType,
        CASE
        WHEN hs.is_manage IS NULL AND ap.user_type = 2 THEN 2
        WHEN hs.is_manage IS NULL AND ap.user_type = 3 THEN 3
        ELSE hs.is_manage
        END AS isManage,
        IFNULL(ap.nickname,su.`name`) as name, IFNULL(ap.phone,su.phone) as phone,
        hs.house_model as houseModel, hs.building_orientation as buildingOrientation, hs.sale_amount as saleAmount,
        hs.house_area as houseArea , hs.status
        FROM t_house_resource hs
        LEFT JOIN t_app_user ap ON hs.insert_user_id = ap.id
        LEFT JOIN sys_user su ON hs.insert_user_id = su.id AND hs.is_manage = 1
        where     hs.is_delete = 0 and hs.auth_status = 2
        ) a
        <where>
            <if test="null != cellName and '' != cellName">
                and a.cell_name like CONCAT('%', #{cellName}, '%')
            </if>
            <if test="null != dataType">
                and a.dataType = #{dataType}
            </if>
            <if test="null != isManage">
                and a.isManage = #{isManage}
            </if>
            <if test="null != name and '' != name">
                and a.name like CONCAT('%', #{name}, '%')
            </if>
            <if test="null != min and '' != min">
                and a.saleAmount between #{min} and #{max}
            </if>
            <if test="null != status">
                and a.status = #{status}
            </if>
        </where>
    </select>
    <select id="aulist" resultType="com.stylefeng.guns.modular.system.dto.THouseResource">
        select * from (
        SELECT hs.insert_time as insertTime, hs.id, hs.cell_name as cellName, hs.house_address as houseAddress,
        hs.data_type as dataType,
        CASE
        WHEN hs.is_manage IS NULL AND ap.user_type = 2 THEN 2
        WHEN hs.is_manage IS NULL AND ap.user_type = 3 THEN 3
        ELSE hs.is_manage
        END AS isManage,
        IFNULL(ap.nickname,su.`name`) as name, IFNULL(ap.phone,su.phone) as phone,
        hs.house_model as houseModel, hs.building_orientation as buildingOrientation, hs.sale_amount as saleAmount,
        hs.house_area as houseArea , hs.status,hs.auth_status AS authStatus
        FROM t_house_resource hs
        LEFT JOIN t_app_user ap ON hs.insert_user_id = ap.id
        LEFT JOIN sys_user su ON hs.insert_user_id = su.id AND hs.is_manage = 1
        where     hs.is_delete = 0
        ) a
        <where>
            <if test="null != id">
                and a.id = #{id}
            </if>
            <if test="null != cellName and '' != cellName">
                and a.cellName like CONCAT('%', #{cellName}, '%')
            </if>
            <if test="null != dataType">
                and a.dataType = #{dataType}
            </if>
            <if test="null != isManage">
                and a.isManage = #{isManage}
            </if>
            <if test="null != name and '' != name">
                and a.name like CONCAT('%', #{name}, '%')
            </if>
            <if test="null != min and '' != min">
                and a.saleAmount between #{min} and #{max}
            </if>
            <if test="null != size and '' != size">
                and a.houseArea = #{size}
            </if>
        </where>
    </select>
</mapper>
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserMapper.xml
@@ -78,4 +78,19 @@
    <select id="getSysUserDetails" resultType="map">
        select * ,IF( sex = 1, '男', '女' ) sexName  FROM  sys_user  where  id=#{id}
    </select>
    <select id="getUsers" resultType="java.util.Map">
        SELECT us.createtime,us.account,us.`name`,us.sex,sr.`name` as roleName,sd.simplename as deptName,us.email,us.phone,us.`status`
        from sys_user us
                 LEFT JOIN sys_role sr ON us.roleid = sr.id
                 LEFT JOIN sys_dept sd on us.deptid = sd.id
        <where>
            us.version = #{version} and us.status != 3
            <if test="null != account and '' != account">
                and us.account like CONCAT('%', #{account}, '%')
            </if>
        </where>
            limit #{index},#{size}
    </select>
</mapper>
guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/Medium.java
New file
@@ -0,0 +1,52 @@
package com.stylefeng.guns.modular.system.dto;
import com.baomidou.mybatisplus.annotations.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
public class Medium {
    @TableField("profile_photo")
    @ApiModelProperty(value = "头像", required = true)
    private String profilePhoto;
    @TableField("nickname")
    @ApiModelProperty(value = "昵称", required = true)
    private String nickname;
    @TableField("user_type")
    @ApiModelProperty(value = "用户类型(1=普通,2=房东)", required = true)
    private Integer userType;
    @TableField("phone")
    @ApiModelProperty(value = "电话号码", required = true)
    private String phone;
    @TableField("wechat_qr_code")
    @ApiModelProperty(value = "微信二维码", required = true)
    private String wechatQRCode;
    @TableField("watch_app")
    @ApiModelProperty(value = "watchApp", required = true)
    private String watchApp;
    @TableField("status")
    @ApiModelProperty(value = "状态(1=正常,2=冻结,3=删除)", required = false)
    private Integer status;
    @ApiModelProperty(value = "id", required = false)
    private Integer id;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "注册时间", required = false)
    private Date insertTime;
    @ApiModelProperty(value = "名片照", required = true)
    private String businessCardPhoto;
    @ApiModelProperty(value = "个人简介", required = true)
    private String introduce;
    @ApiModelProperty(value = "代理人牌照号", required = true)
    private String agentLicenceCode;
    @ApiModelProperty(value = "公司名称", required = true)
    private String companyName;
    @ApiModelProperty(value = "公司地址", required = true)
    private String companyAddress;
    @ApiModelProperty(value = "城市id", required = true)
    private Integer cityId;
    @ApiModelProperty(value = "区id", required = true)
    private Integer districtId;
}
guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/THouseResource.java
New file
@@ -0,0 +1,41 @@
package com.stylefeng.guns.modular.system.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class THouseResource {
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "添加时间", required = false)
    private Date insertTime;
    @ApiModelProperty(value = "房屋id", required = false)
    private Integer id;
    @ApiModelProperty(value = "小区名", required = false)
    private String cellName;
    @ApiModelProperty(value = "地理位置", required = false)
    private String houseAddress;
    @ApiModelProperty(value = "房屋类型", required = false)
    private Integer dataType;
    @ApiModelProperty(value = "录入人类型1平台,2房东,3中介", required = false)
    private Integer isManage;
    @ApiModelProperty(value = "录入人姓名", required = false)
    private String name;
    @ApiModelProperty(value = "录入人电话", required = false)
    private String phone;
    @ApiModelProperty(value = "户型", required = false)
    private String houseModel;
    @ApiModelProperty(value = "房屋朝向", required = false)
    private String buildingOrientation;
    @ApiModelProperty(value = "价格", required = false)
    private BigDecimal saleAmount;
    @ApiModelProperty(value = "房屋大小", required = false)
    private String houseArea;
    @ApiModelProperty(value = "房源状态0=下架,1=上架", required = false)
    private Integer status;
    @ApiModelProperty(value = "1=待审核,2=已通过,3=已拒绝", required = false)
    private Integer authStatus;
}
guns-management/src/main/java/com/stylefeng/guns/modular/system/model/Banner.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@@ -24,6 +25,7 @@
     * 位置(1=首页,2=详情)
     */
    @TableField("position")
    @ApiModelProperty(value = "文案设置 3=系统公告,4隐私,5协议", required = true)
    private Integer position;
    /**
     * 图片路径
@@ -34,6 +36,7 @@
     * 富文本内容
     */
    @TableField("content")
    @ApiModelProperty(value = "富文本内容", required = true)
    private String content;
    /**
     * 排序
guns-management/src/main/java/com/stylefeng/guns/modular/system/model/Dept.java
@@ -25,6 +25,7 @@
     * 主键id
     */
    @TableId(value="id", type= IdType.AUTO)
    @ApiModelProperty(value = "id", required = false)
    private Integer id;
    /**
     * 排序
guns-management/src/main/java/com/stylefeng/guns/modular/system/model/EncyclopedicKnowledge.java
@@ -4,6 +4,8 @@
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@@ -19,26 +21,31 @@
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty(value = "id", required = false)
    private Integer id;
    /**
     * 数据类型id
     */
    @TableField("sys_data_type_id")
    @ApiModelProperty(value = "类别", required = true)
    private Integer sysDataTypeId;
    /**
     * 标题
     */
    @TableField("title")
    @ApiModelProperty(value = "标题", required = true)
    private String title;
    /**
     * 列表图片
     */
    @TableField("img_url")
    @ApiModelProperty(value = "图片", required = true)
    private String imgUrl;
    /**
     * 富文本内容
     */
    @TableField("content")
    @ApiModelProperty(value = "内容", required = true)
    private String content;
    /**
     * 纯文本内容
@@ -54,5 +61,14 @@
     * 添加时间
     */
    @TableField("insert_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date insertTime;
    @TableField("create_by")
    private Integer createBy;
    @TableField(exist = false)
    private String createByName;
    @TableField(exist = false)
    private String type;
}
guns-management/src/main/java/com/stylefeng/guns/modular/system/model/HouseResource.java
@@ -251,4 +251,7 @@
     */
    @TableField("type")
    private Integer type;
    @TableField("is_manage")
    private Integer isManage;
}
guns-management/src/main/java/com/stylefeng/guns/modular/system/model/HouseType.java
@@ -6,6 +6,8 @@
import com.baomidou.mybatisplus.enums.IdType;
import lombok.Data;
import java.util.Date;
/**
 * @author zhibing.pu
 * @Date 2023/11/14 14:43
@@ -23,4 +25,7 @@
     */
    @TableField("name")
    private String name;
    @TableField("insert_time")
    private Date insertTime;
}
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IAppUserService.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.service.IService;
import com.stylefeng.guns.modular.system.dto.Host;
import com.stylefeng.guns.modular.system.dto.Medium;
import com.stylefeng.guns.modular.system.model.AppUser;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.warpper.req.RegisterAccountReq;
@@ -59,4 +60,6 @@
    ResultUtil<CollectRes> release(UserInfoQuery query);
    List<Host> listHost(String nickname, Integer userType, Integer status, String phone, int index, int size);
    List<Medium> listMedium(String nickname, Integer userType, Integer status, String phone, int index, int size);
}
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IEncyclopedicKnowledgeService.java
@@ -37,4 +37,6 @@
     * @return
     */
    ResultUtil upvoteEncyclopedicKnowledge(Integer id);
    List<EncyclopedicKnowledge> list(Integer type, String title, int index, int size);
}
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IHouseResourceService.java
@@ -1,6 +1,7 @@
package com.stylefeng.guns.modular.system.service;
import com.baomidou.mybatisplus.service.IService;
import com.stylefeng.guns.modular.system.dto.THouseResource;
import com.stylefeng.guns.modular.system.model.HouseResource;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.warpper.req.AddHouseReq;
@@ -65,4 +66,10 @@
    List<CollectListRes> collect(List<Integer> ids);
    ResultUtil editHouse(AddHouseReq req);
    List<THouseResource> list(String cellName, Integer dataType, Integer isManage, String name, String saleAmount, Integer status);
    List<THouseResource> aulist(Integer id,String cellName, Integer dataType, Integer isManage, String name, String saleAmount,String size);
}
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IUserService.java
@@ -45,4 +45,6 @@
    Map<String,Object> getSysUserDetails(Integer id);
    List<Map<String, Object>> getUsers(String account, int index, int size,int version);
}
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/AppUserServiceImpl.java
@@ -9,6 +9,7 @@
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.dao.AppUserMapper;
import com.stylefeng.guns.modular.system.dto.Host;
import com.stylefeng.guns.modular.system.dto.Medium;
import com.stylefeng.guns.modular.system.model.AppUser;
import com.stylefeng.guns.modular.system.model.CollectionHouseResource;
import com.stylefeng.guns.modular.system.model.HouseResource;
@@ -337,6 +338,11 @@
        return this.baseMapper.listHost(nickname,userType,status,phone,index,size);
    }
    @Override
    public List<Medium> listMedium(String nickname, Integer userType, Integer status, String phone, int index, int size) {
        return this.baseMapper.listMedium(nickname,userType,status,phone,index,size);
    }
    /**
     * 添加新用户到数据库
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/EncyclopedicKnowledgeServiceImpl.java
@@ -98,4 +98,9 @@
        }
        return ResultUtil.success();
    }
    @Override
    public List<EncyclopedicKnowledge> list(Integer type, String title, int index, int size) {
        return this.baseMapper.list(type,title,index,size);
    }
}
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/HouseResourceService.java
@@ -7,6 +7,7 @@
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.dao.HouseResourceMapper;
import com.stylefeng.guns.modular.system.dto.THouseResource;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.util.ResultUtil;
@@ -331,44 +332,15 @@
    @Override
    public ResultUtil addHouse(AddHouseReq req) {
        Integer appUserId = appUserService.getAppUser().getId();
        AppUser appUser = appUserService.selectOne(new EntityWrapper<AppUser>()
                .eq("id", appUserId)
                .eq("audit_status", 2)
                .eq("status", 1));
        if (appUser!=null){
            if (appUser.getAgentLicenceCode()==null){
                // 未认证 只能能发布三条房源信息
                List<HouseResource> houseResources = this.selectList(new EntityWrapper<HouseResource>()
                        .eq("app_user_id", appUserId)
                        .eq("is_delete", 1)
                        .eq("status", 1)
                );
                if (houseResources.size()>=3){
                    return ResultUtil.error("中介账号未认证,只能同时上架3条房源信息");
                }
            }else{
                // 已经认证 只能能发布20条房源信息
                List<HouseResource> houseResources = this.selectList(new EntityWrapper<HouseResource>()
                        .eq("app_user_id", appUserId)
                        .eq("is_delete", 1)
                        .eq("status", 1)
                );
                if (houseResources.size()>=20){
                    return ResultUtil.error("当前中介账号只能同时上架20条房源信息");
                }
            }
            HouseResource houseResource = new HouseResource();
            BeanUtils.copyProperties(req,houseResource);
            System.err.println(houseResource);
            houseResource.setInsertTime(new Date());
            houseResource.setAuthStatus(1);
            houseResource.setAuthStatus(2);
            houseResource.setIsDelete(0);
            houseResource.setInsertUserId(appUserId);
            houseResource.setInsertUserId(null);
            houseResource.setViewsNumber(0);
            houseResource.setStatus(0);
            houseResource.setStatus(1);
            houseResource.setLeaseTime(req.getTime());
            houseResource.setFirmHouse(req.getFirmHouse());
            if (req.getTime().contains("年")){
@@ -376,10 +348,51 @@
            }else{
                houseResource.setRentalDuration(1);
            }
            houseResource.setIsManage(1);
            this.baseMapper.insert(houseResource);
            return ResultUtil.success();
            return ResultUtil.success("添加成功");
        }
        return ResultUtil.success();
    @Override
    public ResultUtil editHouse(AddHouseReq req) {
        HouseResource houseResource = new HouseResource();
        BeanUtils.copyProperties(req,houseResource);
        if (req.getTime().contains("年")){
            houseResource.setRentalDuration(2);
        }else{
            houseResource.setRentalDuration(1);
        }
        this.baseMapper.updateById(houseResource);
        return ResultUtil.success("编辑成功");
    }
    @Override
    public List<THouseResource> list(String cellName, Integer dataType, Integer isManage, String name, String saleAmount, Integer status) {
        if (saleAmount!=null) {
            String [] split = saleAmount.split("-");
            return this.baseMapper.list(cellName,dataType,isManage,name,split[0],split[1],status);
        }
        return this.baseMapper.list(cellName,dataType,isManage,name,null,null,status);
    }
    @Override
    public List<THouseResource> aulist(Integer id ,String cellName, Integer dataType, Integer isManage, String name, String saleAmount, String size) {
        if (saleAmount!=null) {
            String [] split = saleAmount.split("-");
            return this.baseMapper.aulist(id,cellName,dataType,isManage,name,split[0],split[1],size);
        }
        return this.baseMapper.aulist(id,cellName,dataType,isManage,name,null,null,size);
    }
    @Override
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserServiceImpl.java
@@ -51,4 +51,9 @@
        return this.baseMapper.getSysUserDetails(id);
    }
    @Override
    public List<Map<String, Object>> getUsers(String account, int index, int size,int version) {
        return this.baseMapper.getUsers(account,index,size,version);
    }
}
guns-management/src/main/java/com/stylefeng/guns/modular/system/transfer/UserDto.java
@@ -1,5 +1,6 @@
package com.stylefeng.guns.modular.system.transfer;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@@ -13,20 +14,27 @@
public class UserDto{
    private Integer id;
    @ApiModelProperty(value = "账号", required = true)
    private String account;
    @ApiModelProperty(value = "密码", required = true)
    private String password;
    private String salt;
    @ApiModelProperty(value = "姓名", required = true)
    private String name;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birthday;
    @ApiModelProperty(value = "性别(1:男 2:女)", required = true)
    private Integer sex;
    private String email;
    @ApiModelProperty(value = "电话", required = true)
    private String phone;
    private String roleid;
    @ApiModelProperty(value = "部门id", required = true)
    private Integer deptid;
    private Integer status;
    private Date createtime;
    @ApiModelProperty(value = "1=平台管理员 2=员工", required = true)
    private Integer version;
    private String avatar;
guns-management/src/main/java/com/stylefeng/guns/modular/system/warpper/req/AddHouseReq.java
@@ -76,5 +76,9 @@
    private Integer sex;
    @ApiModelProperty(value ="类型1为草稿 2为发布",required = true)
    private Integer type;
    @ApiModelProperty(value ="必看好房(0=否,1=是)',",required = true)
    private Integer goodHouse;
    private Integer id;
}
guns-management/src/main/resources/application-dev.yml
@@ -4,9 +4,9 @@
spring:
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    url: jdbc:mysql://192.168.110.80:3306/rental_house_applet?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai
    url: jdbc:mysql://127.0.0.1:3306/rental_house_applet?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai
    username: root
    password: 123456
    password: root
    db-name: rental_house_applet #用来搜集数据库的所有表
    filters: wall,mergeStat
guns-management/src/main/resources/application.yml
@@ -21,6 +21,7 @@
      max-request-size: 100MB
      max-file-size: 100MB
mybatis-plus:
  typeAliasesPackage: com.stylefeng.guns.modular.system.model
  configuration:
@@ -31,3 +32,4 @@
spring:
  profiles:
    active: @spring.active@
guns-management/target/classes/META-INF/spring-configuration-metadata.json
New file
@@ -0,0 +1,145 @@
{
  "hints": [],
  "groups": [
    {
      "sourceType": "com.stylefeng.guns.config.properties.BeetlProperties",
      "name": "beetl",
      "type": "com.stylefeng.guns.config.properties.BeetlProperties"
    },
    {
      "sourceType": "com.stylefeng.guns.config.properties.GunsProperties",
      "name": "guns",
      "type": "com.stylefeng.guns.config.properties.GunsProperties"
    },
    {
      "sourceType": "com.stylefeng.guns.config.datasource.MultiDataSourceConfig",
      "name": "guns.muti-datasource",
      "sourceMethod": "mutiDataSourceProperties()",
      "type": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties"
    }
  ],
  "properties": [
    {
      "sourceType": "com.stylefeng.guns.config.properties.BeetlProperties",
      "name": "beetl.delimiter-statement-end",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.config.properties.BeetlProperties",
      "name": "beetl.delimiter-statement-start",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.config.properties.BeetlProperties",
      "name": "beetl.properties",
      "type": "java.util.Properties"
    },
    {
      "sourceType": "com.stylefeng.guns.config.properties.BeetlProperties",
      "name": "beetl.resource-auto-check",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.config.properties.BeetlProperties",
      "name": "beetl.resource-tagroot",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.config.properties.BeetlProperties",
      "name": "beetl.resource-tagsuffix",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.config.properties.GunsProperties",
      "name": "guns.file-upload-path",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.config.properties.GunsProperties",
      "name": "guns.kaptcha-open",
      "type": "java.lang.Boolean"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
      "name": "guns.muti-datasource.data-source-names",
      "type": "java.lang.String[]"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
      "name": "guns.muti-datasource.data-source-names",
      "type": "java.lang.String[]"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
      "name": "guns.muti-datasource.driver-class-name",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
      "name": "guns.muti-datasource.driver-class-name",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
      "name": "guns.muti-datasource.password",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
      "name": "guns.muti-datasource.password",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
      "name": "guns.muti-datasource.url",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
      "name": "guns.muti-datasource.url",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
      "name": "guns.muti-datasource.username",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
      "name": "guns.muti-datasource.username",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
      "name": "guns.muti-datasource.validation-query",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
      "name": "guns.muti-datasource.validation-query",
      "type": "java.lang.String"
    },
    {
      "sourceType": "com.stylefeng.guns.config.properties.GunsProperties",
      "name": "guns.session-invalidate-time",
      "description": "session 失效时间(默认为30分钟 单位:秒)",
      "type": "java.lang.Integer"
    },
    {
      "sourceType": "com.stylefeng.guns.config.properties.GunsProperties",
      "name": "guns.session-validation-interval",
      "description": "session 验证失效时间(默认为15分钟 单位:秒)",
      "type": "java.lang.Integer"
    },
    {
      "sourceType": "com.stylefeng.guns.config.properties.GunsProperties",
      "name": "guns.spring-session-open",
      "type": "java.lang.Boolean"
    },
    {
      "sourceType": "com.stylefeng.guns.config.properties.GunsProperties",
      "name": "guns.swagger-open",
      "type": "java.lang.Boolean"
    }
  ]
}
guns-management/target/classes/META-INF/spring-devtools.properties
New file
@@ -0,0 +1 @@
restart.include.beetl=/beetl-2.8.5.jar
guns-management/target/classes/application-dev.yml
New file
@@ -0,0 +1,62 @@
server:
  port: 81
spring:
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    url: jdbc:mysql://127.0.0.1:3306/rental_house_applet?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai
    username: root
    password: root
    db-name: rental_house_applet #用来搜集数据库的所有表
    filters: wall,mergeStat
#多数据源情况的配置
guns:
  muti-datasource:
    open: false #生产环境设置true     读写分离(从数据库)
    url: jdbc:mysql://127.0.0.1:3306/rental_house_applet?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai
    username: root
    password: 123456
    dataSourceNames:
    - dataSourceGuns
    - dataSourceBiz
---
wx:
  grantType: authorization_code #填authorization_code
  appid: 11 #应用唯一标识,在微信开放平台提交应用审核通过后获得
  appSecret: 11 #应用密钥AppSecret,在微信开放平台提交应用审核通过后获得
  appletsAppid: 111 #小程序APPid
  appletsAppSecret: 1111 #
  officialAccountAppid: 11111
  officialAccountAppSecret: 1111
  webAppId: 111
  webAppSecret: 11
  mchId: 11 #微信支付分配的商户号
  key: 11 #key为商户平台设置的密钥key:
---
#redis配置
redis:
  host: 127.0.0.1
  port: 6379
  password: 123456
  database: 0
  timeout: 600000
  block-when-exhausted: true
  jedis:
    pool:
      max-active: 800
      max-wait: 30000
      max-idle: 100
      min-idle: 0
---
spring:
  data:
    mongodb:
      uri: mongodb://192.168.110.188:27017/admin
guns-management/target/classes/application-produce.yml
New file
@@ -0,0 +1,57 @@
server:
  port: 81
spring:
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
#    生产环境
    url: jdbc:mysql://10.160.202.2:3306/qiaopai?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai
    username: root
    password: rpZv3E6pHn6uGRNqqrtmmzh2
    db-name: qiaopai #用来搜集数据库的所有表
    filters: wall,mergeStat
#多数据源情况的配置
guns:
  muti-datasource:
    open: false #生产环境设置true     读写分离(从数据库)
    url: jdbc:mysql://10.160.202.3:3306/qiaopai?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai
    username: root
    password: rpZv3E6pHn6uGRNqqrtmmzh2
    dataSourceNames:
      - dataSourceGuns
      - dataSourceBiz
---
wx:
  grantType: authorization_code #填authorization_code
  appid: 11 #应用唯一标识,在微信开放平台提交应用审核通过后获得
  appSecret: 11 #应用密钥AppSecret,在微信开放平台提交应用审核通过后获得
  appletsAppid: 1111 #小程序APPid
  appletsAppSecret: 1111 #
  officialAccountAppid: 11111
  officialAccountAppSecret: 1111
  webAppId: 111
  webAppSecret: 11
  mchId: 11 #微信支付分配的商户号
  key: 11 #key为商户平台设置的密钥key:
---
#redis配置
redis:
  host: 127.0.0.1
  port: 6379
  password: 123456
  database: 0
  timeout: 600000
  block-when-exhausted: true
  jedis:
    pool:
      max-active: 800
      max-wait: 30000
      max-idle: 100
      min-idle: 0
guns-management/target/classes/application.yml
New file
@@ -0,0 +1,35 @@
guns:
  swagger-open: true              #是否开启swagger (true/false)
  kaptcha-open: true             #是否开启登录时验证码 (true/false)
  #  file-upload-path: d:/tmp       #文件上传目录(不配置的话为java.io.tmpdir目录)
  spring-session-open: false      #是否开启spring session,如果是多机环境需要开启(true/false)
  session-invalidate-time: 1800     #session失效时间(只在单机环境下生效,多机环境在SpringSessionConfig类中配置) 单位:秒
  session-validation-interval: 900  #多久检测一次失效的session(只在单机环境下生效) 单位:秒
spring:
  mvc:
    static-path-pattern: /static/**
    view:
      prefix: /WEB-INF/view
  devtools:
    restart:
      enabled: false
      additional-paths: src/main/java
      exclude: static/**,WEB-INF/view/**
  servlet:
    multipart:
      max-request-size: 100MB
      max-file-size: 100MB
mybatis-plus:
  typeAliasesPackage: com.stylefeng.guns.modular.system.model
  configuration:
    log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
---
spring:
  profiles:
    active: dev
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/AppUserMapper.xml
New file
@@ -0,0 +1,82 @@
<?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.stylefeng.guns.modular.system.dao.AppUserMapper">
    <select id="searchIntermediaryList"
            resultType="com.stylefeng.guns.modular.system.warpper.res.SearchIntermediaryListRes">
        select t1.id,t1.profile_photo as profilePhoto,t1.nickname as nickname,t1.company_name as companyName,
        t1.company_address as companyAddress,t1.introduce as introduce,t1.phone as phone,
        COUNT(t2.id) AS houseCount
        from t_app_user t1
        left join t_house_resource t2 on t1.id = t2.insert_user_id
        <where>
            <if test="null != req.name and '' != req.name">
                and t1.nickname = CONCAT('%', #{req.name}, '%')
            </if>
            <if test="null != cityIds">
                and t1.city_id in
                <foreach collection="cityIds" item="item" index="index" separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="null != districtIds">
                and t1.district_id in
                <foreach collection="districtIds" item="item" index="index" separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            and t1.audit_status = 2
            and t1.status = 1
            and t1.user_type = 3
            and t2.auth_status = 2
            and t2.is_delete = 0
            and t2.status = 1
            and t2.type=2
        </where>
        group by t1.id
        order by houseCount desc
    </select>
    <select id="listHost" resultType="com.stylefeng.guns.modular.system.dto.Host">
        SELECT id,insert_time,nickname,phone,profile_photo,user_type,wechat_qr_code,watch_app,phone,status
        from t_app_user
        <where>
            status != 3
            <if test="null != nickname and '' != nickname">
                and nickname like CONCAT('%', #{nickname}, '%')
            </if>
            <if test="null != userType">
                and user_type = #{userType}
            </if>
            <if test="null != status">
                and status = #{status}
            </if>
            <if test="null != phone and '' != phone">
                and phone like CONCAT('%', #{phone}, '%')
            </if>
        </where>
        limit #{index},#{size}
    </select>
    <select id="listMedium" resultType="com.stylefeng.guns.modular.system.dto.Medium">
        SELECT id,insert_time,nickname,company_name,agent_licence_code,wechat_qr_code,watch_app,phone,status
        from t_app_user
        <where>
            status != 3
            <if test="null != nickname and '' != nickname">
                and nickname like CONCAT('%', #{nickname}, '%')
            </if>
            <if test="null != userType">
                and user_type = #{userType}
            </if>
            <if test="null != status">
                and status = #{status}
            </if>
            <if test="null != phone and '' != phone">
                and phone like CONCAT('%', #{phone}, '%')
            </if>
        </where>
        limit #{index},#{size}
    </select>
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/BannerMapper.xml
New file
@@ -0,0 +1,10 @@
<?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.stylefeng.guns.modular.system.dao.BannerMapper">
    <select id="getBanners" resultType="com.stylefeng.guns.modular.system.warpper.res.BannerRes">
        select id, img_url as imgUrl, content from t_banner where `position` = #{position} order by `sort` desc
    </select>
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/CollectionHouseResourceMapper.xml
New file
@@ -0,0 +1,6 @@
<?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.stylefeng.guns.modular.system.dao.CollectionHouseResourceMapper">
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/CollectionHousingDemandMapper.xml
New file
@@ -0,0 +1,6 @@
<?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.stylefeng.guns.modular.system.dao.CollectionHousingDemandMapper">
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/DeptMapper.xml
New file
@@ -0,0 +1,37 @@
<?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.stylefeng.guns.modular.system.dao.DeptMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.Dept">
        <id column="id" property="id"/>
        <result column="num" property="num"/>
        <result column="pid" property="pid"/>
        <result column="pids" property="pids"/>
        <result column="simplename" property="simplename"/>
        <result column="fullname" property="fullname"/>
        <result column="tips" property="tips"/>
        <result column="version" property="version"/>
    </resultMap>
    <select id="tree" resultType="com.stylefeng.guns.core.node.ZTreeNode">
        select id,pid as pId,simplename as name,
        (
        CASE
        WHEN (pId = 0 OR pId IS NULL) THEN
        'true'
        ELSE
        'false'
        END
        ) as isOpen from sys_dept
    </select>
    <select id="list" resultType="map">
        select * from sys_dept
        <if test="condition != null and condition != ''">
            where simplename like CONCAT('%',#{condition},'%') or fullname like CONCAT('%',#{condition},'%')
        </if>
        order by num ASC
    </select>
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/DictMapper.xml
New file
@@ -0,0 +1,42 @@
<?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.stylefeng.guns.modular.system.dao.DictMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.Dict">
        <id column="id" property="id"/>
        <result column="num" property="num"/>
        <result column="pid" property="pid"/>
        <result column="name" property="name"/>
        <result column="code" property="code"/>
        <result column="tips" property="tips"/>
    </resultMap>
    <sql id="Base_Column_List">
        id, num, pid, name,code,tips
    </sql>
    <select id="selectByCode" resultType="com.stylefeng.guns.modular.system.model.Dict">
        select
        <include refid="Base_Column_List"/>
        from sys_dict
        where code = #{code}
    </select>
    <select id="selectByParentCode" resultType="com.stylefeng.guns.modular.system.model.Dict">
        select
        <include refid="Base_Column_List"/>
        from sys_dict
        where pid in(select id  from sys_dict where code = #{code}) order by num asc
    </select>
    <select id="list" resultType="map">
        select * from sys_dict
        where pid = 0
        <if test="condition != null and condition != ''">
            AND name like CONCAT('%',#{condition},'%')
        </if>
        order by id ASC
    </select>
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/EncyclopedicKnowledgeMapper.xml
New file
@@ -0,0 +1,30 @@
<?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.stylefeng.guns.modular.system.dao.EncyclopedicKnowledgeMapper">
    <select id="getEncyclopedicKnowledgeList" resultType="com.stylefeng.guns.modular.system.warpper.res.EncyclopedicKnowledgeRes">
        select
        id,
        title,
        img_url as imgUrl,
        content_text as content
        from t_encyclopedic_knowledge where sys_data_type_id = #{typeId} order by insert_time desc
    </select>
    <select id="list" resultType="com.stylefeng.guns.modular.system.model.EncyclopedicKnowledge">
        SELECT kn.id,ty.`name` as type ,kn.title,kn.content,us.`name`,kn.insert_time as insertTime
        FROM t_encyclopedic_knowledge kn
                 LEFT JOIN t_sys_data_type ty ON kn.sys_data_type_id = ty.id
                 LEFT JOIN sys_user us ON kn.create_by = us.id
          <where>
              <if test="null != type ">
                  and kn.sys_data_type_id = #{type}
              </if>
          </where>
    </select>
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/EncyclopedicKnowledgeUpvoteMapper.xml
New file
@@ -0,0 +1,5 @@
<?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.stylefeng.guns.modular.system.dao.EncyclopedicKnowledgeUpvoteMapper">
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/ExpenseMapper.xml
New file
@@ -0,0 +1,20 @@
<?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.stylefeng.guns.modular.system.dao.ExpenseMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.Expense">
        <id column="id" property="id" />
        <result column="money" property="money" />
        <result column="desc" property="desc" />
        <result column="createtime" property="createtime" />
        <result column="state" property="state" />
        <result column="userid" property="userid" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, money, desc, createtime, state, userid
    </sql>
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/FeedBackMapper.xml
New file
@@ -0,0 +1,6 @@
<?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.stylefeng.guns.modular.system.dao.FeedBackMapper">
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml
New file
@@ -0,0 +1,417 @@
<?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.stylefeng.guns.modular.system.dao.HouseResourceMapper">
    <select id="searchHouseResource" resultType="com.stylefeng.guns.modular.system.warpper.res.SearchHouseResourceListRes">
        select
        hr.id,
        au.user_type as houseResource,
        hr.house_photo as imgUrl,
        hr.title,
        hr.house_area as houseArea,
        hr.house_model as houseModel,
        concat(rp.`name`, rc.`name`) as address,
        hr.longitude,
        hr.latitude,
        hr.sale_amount as saleAmount,
        au.profile_photo as profilePhoto,
        au.nickname,
        hr.elevator,
        hr.drying_area as dryingArea,
        hr.garden,
        hr.carport,
        hr.balcony,
        hr.keep_pet as keepPet
        from t_house_resource hr
        left join t_app_user au on (hr.app_user_id = au.id)
        left join t_region rc on (hr.district_id = rc.id)
        left join t_region rp on (rp.id = rc.parent_id)
        where hr.is_delete = 0 and hr.`status` = 1 and hr.auth_status = 2
        and hr.type=2
        <if test="null != req.type">
            and hr.data_type = #{req.type}
        </if>
        <if test="null != req.userType and 4 != req.userType">
            and au.user_type = #{req.userType}
        </if>
        <if test="null != req.userType and 4 == req.userType">
            and hr.firm_house = 1
        </if>
        <if test="null != req.content and '' != req.content">
            and hr.title = CONCAT('%', #{req.content}, '%')
        </if>
        <if test="null != cityIds and cityIds.size()>0" >
            and hr.city_id in
            <foreach collection="cityIds" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != districtIds and districtIds.size()>0">
            and hr.district_id in
            <foreach collection="districtIds" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != saleAmountStart and null != saleAmountEnd">
            and hr.sale_amount &gt;= #{saleAmountStart} and hr.sale_amount &lt; #{saleAmountEnd}
        </if>
        <if test="null != houseModels">
            and hr.house_model in
            <foreach collection="houseModels" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != req.elevator">
            and hr.elevator = #{req.elevator}
        </if>
        <if test="null != houseTypeIds">
            and hr.house_type_id in
            <foreach collection="houseTypeIds" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != req.rentalDuration">
            and hr.rental_duration = #{req.rentalDuration}
        </if>
        <if test="null != req.balcony">
            and hr.balcony = #{req.balcony}
        </if>
        <if test="null != req.keepPet">
            and hr.keep_pet = #{req.keepPet}
        </if>
        <if test="null != req.createTime and req.createTime == 3">
            and now() &lt;= DATE_ADD(hr.insert_time,INTERVAL 3 day)
        </if>
        <if test="null != req.createTime and req.createTime == 7">
            and now() &lt;= DATE_ADD(hr.insert_time,INTERVAL 7 day)
        </if>
        <if test="null != req.createTime and req.createTime == 30">
            and now() &lt;= DATE_ADD(hr.insert_time,INTERVAL 1 MONTH)
        </if>
        <if test="null != req.createTime and req.createTime == 60">
            and now() &lt;= DATE_ADD(hr.insert_time,INTERVAL 2 MONTH)
        </if>
        <if test="null != req.createTime and req.createTime == 90">
            and now() &lt;= DATE_ADD(hr.insert_time,INTERVAL 3 MONTH)
        </if>
        <if test="null != req.dataType and req.dataType == 1">
            and hr.good_house = 1
        </if>
        <if test="null != req.dataType and req.dataType == 2">
            and now() &lt;= DATE_ADD(hr.insert_time,INTERVAL 7 day)
        </if>
        <if test="null != req.sort and req.sort == 1">
            order by hr.insert_time desc
        </if>
        <if test="null != req.sort and req.sort == 2">
            order by hr.good_house desc
        </if>
        <if test="null != req.sort and req.sort == 3">
            order by hr.sale_amount
        </if>
        <if test="null != req.sort and req.sort == 4">
            order by hr.sale_amount desc
        </if>
        limit #{req.pageNum}, #{req.pageSize}
    </select>
    <select id="searchHouseResourceCount" resultType="int">
        select
        count(1)
        from t_house_resource hr
        left join t_app_user au on (hr.app_user_id = au.id)
        where hr.is_delete = 0 and hr.`status` = 1 and hr.auth_status = 2
        and hr.type=2
        <if test="null != req.type">
            and hr.data_type = #{req.type}
        </if>
        <if test="null != req.userType and 4 != req.userType">
            and au.user_type = #{req.userType}
        </if>
        <if test="null != req.userType and 4 == req.userType">
            and hr.firm_house = 1
        </if>
        <if test="null != req.content and '' != req.content">
            and hr.title = CONCAT('%', #{req.content}, '%')
        </if>
        <if test="null != cityIds and cityIds.size()>0" >
            and hr.city_id in
            <foreach collection="cityIds" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != districtIds and districtIds.size()>0">
            and hr.district_id in
            <foreach collection="districtIds" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != saleAmountStart and null != saleAmountEnd">
            and hr.sale_amount &gt;= #{saleAmountStart} and hr.sale_amount &lt; #{saleAmountEnd}
        </if>
        <if test="null != houseModels">
            and hr.house_model in
            <foreach collection="houseModels" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != req.elevator">
            and hr.elevator = #{req.elevator}
        </if>
        <if test="null != houseTypeIds">
            and hr.house_type_id in
            <foreach collection="houseTypeIds" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != req.rentalDuration">
            and hr.rental_duration = #{req.rentalDuration}
        </if>
        <if test="null != req.balcony">
            and hr.balcony = #{req.balcony}
        </if>
        <if test="null != req.keepPet">
            and hr.keep_pet = #{req.keepPet}
        </if>
        <if test="null != req.createTime and req.createTime == 3">
            and now() &lt;= DATE_ADD(hr.insert_time,INTERVAL 3 day)
        </if>
        <if test="null != req.createTime and req.createTime == 7">
            and now() &lt;= DATE_ADD(hr.insert_time,INTERVAL 7 day)
        </if>
        <if test="null != req.createTime and req.createTime == 30">
            and now() &lt;= DATE_ADD(hr.insert_time,INTERVAL 1 MONTH)
        </if>
        <if test="null != req.createTime and req.createTime == 60">
            and now() &lt;= DATE_ADD(hr.insert_time,INTERVAL 2 MONTH)
        </if>
        <if test="null != req.createTime and req.createTime == 90">
            and now() &lt;= DATE_ADD(hr.insert_time,INTERVAL 3 MONTH)
        </if>
        <if test="null != req.dataType and req.dataType == 1">
            and hr.good_house = 1
        </if>
        <if test="null != req.dataType and req.dataType == 2">
            and now() &lt;= DATE_ADD(hr.insert_time,INTERVAL 7 day)
        </if>
    </select>
    <select id="getDistrictHouseResourceNumber" resultType="com.stylefeng.guns.modular.system.warpper.res.DistrictHouseResourceNumberRes">
        select
        r.name,
        r.id as districtId,
        pr.id as cityId,
        dn.number,
        r.longitude,
        r.latitude
        from (
            select
            hr.district_id,
            count(hr.id) as number
            from t_house_resource hr
            left join t_app_user au on (hr.app_user_id = au.id)
            where hr.is_delete = 0 and hr.`status` = 1 and hr.auth_status = 2
        and hr.type=2
            <if test="null != userType and 4 != userType">
                and au.user_type = #{userType} and au.status = 1 and au.audit_status = 2
            </if>
            <if test="null != userType and 4 == userType">
                and hr.firm_house = 1
            </if>
            <if test="null != dataType">
                and hr.data_type = #{dataType}
            </if>
            group by hr.district_id
        ) as dn
        left join t_region r on (dn.district_id = r.id)
        left join t_region pr on (pr.id = r.parent_id)
    </select>
    <select id="listHouse"
            resultType="com.stylefeng.guns.modular.system.warpper.res.SearchHouseResourceListRes">
        select
        hr.id,
        hr.house_photo as imgUrl,
        hr.title,
        hr.house_area as houseArea,
        hr.house_model as houseModel,
        concat(rp.`name`, rc.`name`) as address,
        hr.longitude,
        hr.latitude,
        hr.sale_amount as saleAmount,
        hr.elevator,
        hr.drying_area as dryingArea,
        hr.garden,
        hr.carport,
        hr.balcony,
        hr.keep_pet as keepPet
        from t_house_resource hr
        left join t_region rc on (hr.district_id = rc.id)
        left join t_region rp on (rp.id = rc.parent_id)
        where hr.is_delete = 0 and hr.`status` = 1 and hr.auth_status = 2
        and hr.type=2
        and hr.app_user_id = #{query.id}
        and hr.data_type = #{query.type}
    </select>
    <select id="collect" resultType="com.stylefeng.guns.modular.system.warpper.res.CollectListRes">
        select
        hr.id,
        hr.title,
        hr.sale_amount as saleAmount,
        hr.elevator,
        hr.drying_area as dryingArea,
        hr.garden,
        hr.carport,
        hr.balcony,
        hr.city_id as cityId,
        hr.district_id as districtId,
        hr.keep_pet as keepPet,
        hr.views_number as viewsNumber,
        hr.code as code,
        hr.leaseTime as leaseTime,
        hr.data_type as dataType,
        hr.insert_time as insertTime,hr.type as `type`,
        hr.status as status
        from t_house_resource hr
        left join t_collection_house_resource t1 on hr.id = t1.house_resource_id
        where hr.is_delete = 0 and hr.`status` = 1 and hr.auth_status = 2
        <if test="null != ids and ids.size()>0">
            and hr.id in
            <foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
    </select>
    <select id="release" resultType="com.stylefeng.guns.modular.system.warpper.res.CollectListRes">
        select
        hr.id,
        hr.title,
        hr.sale_amount as saleAmount,
        hr.elevator,
        hr.drying_area as dryingArea,
        hr.garden,
        hr.carport,
        hr.balcony,
        hr.app_user_id as appUserId,
        hr.city_id as cityId,
        hr.district_id as districtId,
        hr.keep_pet as keepPet,
        hr.views_number as viewsNumber,
        hr.code as code,
        hr.leaseTime as leaseTime,
        hr.data_type as dataType,
        hr.house_photo as housePhoto,
        hr.house_video as houseVideo,
        hr.insert_time as insertTime,hr.type as `type`,
        hr.status as status,
        au.profile_photo as profilePhoto,
        au.nickname as nickname,
        au.user_type as userType
        from t_house_resource hr
        left join t_collection_house_resource t1 on hr.id = t1.house_resource_id
        left join t_app_user au on hr.app_user_id = au.id
        where hr.is_delete = 0 and hr.`status` = 1 and hr.auth_status = 2
        <if test="null != ids and ids.size()>0">
            and hr.id in
            <foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
    </select>
    <select id="list" resultType="com.stylefeng.guns.modular.system.dto.THouseResource">
        select * from (
        SELECT hs.insert_time as insertTime, hs.id, hs.cell_name as cellName, hs.house_address as houseAddress,
        hs.data_type as dataType,
        CASE
        WHEN hs.is_manage IS NULL AND ap.user_type = 2 THEN 2
        WHEN hs.is_manage IS NULL AND ap.user_type = 3 THEN 3
        ELSE hs.is_manage
        END AS isManage,
        IFNULL(ap.nickname,su.`name`) as name, IFNULL(ap.phone,su.phone) as phone,
        hs.house_model as houseModel, hs.building_orientation as buildingOrientation, hs.sale_amount as saleAmount,
        hs.house_area as houseArea , hs.status
        FROM t_house_resource hs
        LEFT JOIN t_app_user ap ON hs.insert_user_id = ap.id
        LEFT JOIN sys_user su ON hs.insert_user_id = su.id AND hs.is_manage = 1
        where     hs.is_delete = 0 and hs.auth_status = 2
        ) a
        <where>
            <if test="null != cellName and '' != cellName">
                and a.cell_name like CONCAT('%', #{cellName}, '%')
            </if>
            <if test="null != dataType">
                and a.dataType = #{dataType}
            </if>
            <if test="null != isManage">
                and a.isManage = #{isManage}
            </if>
            <if test="null != name and '' != name">
                and a.name like CONCAT('%', #{name}, '%')
            </if>
            <if test="null != min and '' != min">
                and a.saleAmount between #{min} and #{max}
            </if>
            <if test="null != status">
                and a.status = #{status}
            </if>
        </where>
    </select>
    <select id="aulist" resultType="com.stylefeng.guns.modular.system.dto.THouseResource">
        select * from (
        SELECT hs.insert_time as insertTime, hs.id, hs.cell_name as cellName, hs.house_address as houseAddress,
        hs.data_type as dataType,
        CASE
        WHEN hs.is_manage IS NULL AND ap.user_type = 2 THEN 2
        WHEN hs.is_manage IS NULL AND ap.user_type = 3 THEN 3
        ELSE hs.is_manage
        END AS isManage,
        IFNULL(ap.nickname,su.`name`) as name, IFNULL(ap.phone,su.phone) as phone,
        hs.house_model as houseModel, hs.building_orientation as buildingOrientation, hs.sale_amount as saleAmount,
        hs.house_area as houseArea , hs.status,hs.auth_status AS authStatus
        FROM t_house_resource hs
        LEFT JOIN t_app_user ap ON hs.insert_user_id = ap.id
        LEFT JOIN sys_user su ON hs.insert_user_id = su.id AND hs.is_manage = 1
        where     hs.is_delete = 0
        ) a
        <where>
            <if test="null != id">
                and a.id = #{id}
            </if>
            <if test="null != cellName and '' != cellName">
                and a.cellName like CONCAT('%', #{cellName}, '%')
            </if>
            <if test="null != dataType">
                and a.dataType = #{dataType}
            </if>
            <if test="null != isManage">
                and a.isManage = #{isManage}
            </if>
            <if test="null != name and '' != name">
                and a.name like CONCAT('%', #{name}, '%')
            </if>
            <if test="null != min and '' != min">
                and a.saleAmount between #{min} and #{max}
            </if>
            <if test="null != size and '' != size">
                and a.houseArea = #{size}
            </if>
        </where>
    </select>
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/HouseTypeMapper.xml
New file
@@ -0,0 +1,4 @@
<?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.stylefeng.guns.modular.system.dao.HouseTypeMapper">
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/HousingDemandDistrictMapper.xml
New file
@@ -0,0 +1,4 @@
<?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.stylefeng.guns.modular.system.dao.HousingDemandDistrictMapper">
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/HousingDemandMapper.xml
New file
@@ -0,0 +1,155 @@
<?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.stylefeng.guns.modular.system.dao.HousingDemandMapper">
    <select id="searchHousingDemand" resultType="com.stylefeng.guns.modular.system.warpper.res.SearchHousingDemandListRes">
        select
        hd.id,
        hd.app_user_id as appuserId,
        hd.title,
        hd.house_model as houseModel,
        hd.sale_amount as saleAmount,
        au.profile_photo as profilePhoto,
        au.nickname,
        hd.elevator,
        hd.drying_area as dryingArea,
        hd.garden,
        hd.carport,
        hd.balcony,
        hd.type,
        hd.keep_pet as keepPet
        from t_housing_demand hd
        left join t_app_user au on (hd.app_user_id = au.id)
        where hd.`status` = 1 and hd.is_delete = 0
        <if test="null != req.type">
            and hd.data_type = #{req.type}
        </if>
        <if test="null != req.content and '' != req.content">
            and hd.title = CONCAT('%', #{req.content}, '%')
        </if>
        <if test="null != district and '' != district">
            and hd.id in (select housing_demand_id from t_housing_demand_district where CONCAT('cityId:', city_id, ',districtId:', district_id) in
            <foreach collection="district" item="item" index="index" open="(" separator="," close=")">
                #{item}
            </foreach>
            )
        </if>
        <if test="null != saleAmountStart and null != saleAmountEnd">
            and hd.sale_amount &gt;= #{saleAmountStart} and hd.sale_amount &lt; #{saleAmountEnd}
        </if>
        <if test="null != houseModels">
            and hd.house_model in
            <foreach collection="houseModels" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != houseTypeIds">
            and hd.house_type_id in
            <foreach collection="houseTypeIds" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != req.elevator">
            and hd.elevator = #{req.elevator}
        </if>
        <if test="null != req.rentalDuration">
            and hd.rental_duration = #{req.rentalDuration}
        </if>
        <if test="null != req.balcony">
            and hd.balcony = #{req.balcony}
        </if>
        <if test="null != req.keepPet">
            and hd.keep_pet = #{req.keepPet}
        </if>
        <if test="null != req.createTime and req.createTime == 3">
            and now() &lt;= DATE_ADD(hd.insert_time,INTERVAL 3 day)
        </if>
        <if test="null != req.createTime and req.createTime == 7">
            and now() &lt;= DATE_ADD(hd.insert_time,INTERVAL 7 day)
        </if>
        <if test="null != req.createTime and req.createTime == 30">
            and now() &lt;= DATE_ADD(hd.insert_time,INTERVAL 1 MONTH)
        </if>
        <if test="null != req.createTime and req.createTime == 60">
            and now() &lt;= DATE_ADD(hd.insert_time,INTERVAL 2 MONTH)
        </if>
        <if test="null != req.createTime and req.createTime == 90">
            and now() &lt;= DATE_ADD(hd.insert_time,INTERVAL 3 MONTH)
        </if>
        <if test="null != req.sort and req.sort == 1">
            order by hd.insert_time desc
        </if>
        <if test="null != req.sort and req.sort == 3">
            order by hd.sale_amount
        </if>
        <if test="null != req.sort and req.sort == 4">
            order by hd.sale_amount desc
        </if>
        limit #{req.pageNum}, #{req.pageSize}
    </select>
    <select id="searchHousingDemandCount" resultType="int">
        select
        count(1)
        from t_housing_demand hd
        where hd.`status` = 1 and hd.is_delete = 0
        <if test="null != req.type">
            and hd.data_type = #{req.type}
        </if>
        <if test="null != req.content and '' != req.content">
            and hd.title = CONCAT('%', #{req.content}, '%')
        </if>
        <if test="null != district and '' != district">
            and hd.id in (select housing_demand_id from t_housing_demand_district where CONCAT('cityId:', city_id, ',districtId:', district_id) in
            <foreach collection="district" item="item" index="index" open="(" separator="," close=")">
                #{item}
            </foreach>
            )
        </if>
        <if test="null != saleAmountStart and null != saleAmountEnd">
            and hd.sale_amount &gt;= #{saleAmountStart} and hd.sale_amount &lt; #{saleAmountEnd}
        </if>
        <if test="null != houseModels">
            and hd.house_model in
            <foreach collection="houseModels" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != houseTypeIds">
            and hd.house_type_id in
            <foreach collection="houseTypeIds" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != req.elevator">
            and hd.elevator = #{req.elevator}
        </if>
        <if test="null != req.rentalDuration">
            and hd.rental_duration = #{req.rentalDuration}
        </if>
        <if test="null != req.balcony">
            and hd.balcony = #{req.balcony}
        </if>
        <if test="null != req.keepPet">
            and hd.keep_pet = #{req.keepPet}
        </if>
        <if test="null != req.createTime and req.createTime == 3">
            and now() &lt;= DATE_ADD(hd.insert_time,INTERVAL 3 day)
        </if>
        <if test="null != req.createTime and req.createTime == 7">
            and now() &lt;= DATE_ADD(hd.insert_time,INTERVAL 7 day)
        </if>
        <if test="null != req.createTime and req.createTime == 30">
            and now() &lt;= DATE_ADD(hd.insert_time,INTERVAL 1 MONTH)
        </if>
        <if test="null != req.createTime and req.createTime == 60">
            and now() &lt;= DATE_ADD(hd.insert_time,INTERVAL 2 MONTH)
        </if>
        <if test="null != req.createTime and req.createTime == 90">
            and now() &lt;= DATE_ADD(hd.insert_time,INTERVAL 3 MONTH)
        </if>
    </select>
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/LoginLogMapper.xml
New file
@@ -0,0 +1,41 @@
<?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.stylefeng.guns.modular.system.dao.LoginLogMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.LoginLog">
        <id column="id" property="id" />
        <result column="logname" property="logname" />
        <result column="userid" property="userid" />
        <result column="createtime" property="createtime" />
        <result column="succeed" property="succeed" />
        <result column="message" property="message" />
        <result column="ip" property="ip" />
    </resultMap>
    <select id="getLoginLogs" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
        select * from sys_login_log where 1 = 1
        <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''">
            and (createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
        </if>
        <if test="logName != null and logName !=''">
            and logname like CONCAT('%',#{logName},'%')
        </if>
        <choose>
            <when test="orderByField != null and orderByField !=''">
                <choose>
                    <when test="isAsc == true">
                        order by ${orderByField} ASC
                    </when>
                    <otherwise>
                        order by ${orderByField} DESC
                    </otherwise>
                </choose>
            </when>
            <otherwise>
                order by createtime DESC
            </otherwise>
        </choose>
    </select>
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/MenuMapper.xml
New file
@@ -0,0 +1,177 @@
<?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.stylefeng.guns.modular.system.dao.MenuMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.Menu">
        <id column="id" property="id" />
        <result column="code" property="code" />
        <result column="pcode" property="pcode" />
        <result column="pcodes" property="pcodes" />
        <result column="name" property="name" />
        <result column="icon" property="icon" />
        <result column="url" property="url" />
        <result column="num" property="num" />
        <result column="levels" property="levels" />
        <result column="ismenu" property="ismenu" />
        <result column="tips" property="tips" />
        <result column="status" property="status" />
        <result column="isopen" property="isopen" />
    </resultMap>
    <sql id="Base_Column_List">
        id, code, pcode, name, icon, url, num, levels,pcodes,
        tips, status,isopen,ismenu
    </sql>
    <select id="selectMenus" resultType="map">
        select
        <include refid="Base_Column_List" />
        from sys_menu
        where status = 1
        <if test="condition != null and condition != ''">
            and (name like CONCAT('%',#{condition},'%') or code like CONCAT('%',#{condition},'%'))
        </if>
        <if test="level != null and level != ''">
            and levels = #{level}
        </if>
    </select>
    <select id="getMenuIdsByRoleId" resultType="long">
        select menuid from
        sys_relation where roleid = #{roleId}
    </select>
    <select id="menuTreeList" resultType="com.stylefeng.guns.core.node.ZTreeNode">
        SELECT
        m1.id AS id,
        (
        CASE
        WHEN (m2.id = 0 OR m2.id IS NULL) THEN
        0
        ELSE
        m2.id
        END
        ) AS pId,
        m1. NAME
        AS NAME,
        (
        CASE
        WHEN (m2.id = 0 OR m2.id IS NULL) THEN
        'true'
        ELSE
        'false'
        END
        ) as isOpen
        FROM
        sys_menu m1
        LEFT join sys_menu m2 ON m1.pcode = m2. CODE
        ORDER BY
        m1.id ASC
    </select>
    <select id="menuTreeListByMenuIds" resultType="com.stylefeng.guns.core.node.ZTreeNode">
        SELECT
        m1.id AS id,
        (
        CASE
        WHEN (m2.id = 0 OR m2.id IS NULL) THEN
        0
        ELSE
        m2.id
        END
        ) AS pId,
        m1. NAME AS NAME,
        (
        CASE
        WHEN (m2.id = 0 OR m2.id IS
        NULL) THEN
        'true'
        ELSE
        'false'
        END
        ) as isOpen,
        (
        CASE
        WHEN (m3.ID = 0 OR m3.ID
        IS NULL) THEN
        'false'
        ELSE
        'true'
        END
        ) "checked"
        FROM
        sys_menu m1
        LEFT JOIN
        sys_menu m2
        ON m1.pcode = m2. CODE
        left join (
        SELECT
        ID
        FROM
        sys_menu
        WHERE
        ID IN
        <foreach collection="list" index="index" item="i" open="("
                 separator="," close=")">
            #{i}
        </foreach>
        ) m3 on m1.id = m3.id
        ORDER BY
        m1.id ASC
    </select>
    <delete id="deleteRelationByMenu">
        delete from sys_relation where menuid = #{menuId}
    </delete>
    <select id="getResUrlsByRoleId" resultType="string">
        select url from
        sys_relation rel
        inner join sys_menu m on rel.menuid = m.id
        where rel.roleid = #{roleId}
    </select>
    <select id="getMenusByRoleIds" resultType="com.stylefeng.guns.core.node.MenuNode">
        SELECT
        m1.id AS id,
        m1.icon AS icon,
        (
        CASE
        WHEN (m2.id = 0 OR m2.id IS NULL) THEN
        0
        ELSE
        m2.id
        END
        ) AS parentId,
        m1.NAME as name,
        m1.url as url,
        m1.levels as levels,
        m1.ismenu as ismenu,
        m1.num as num
        FROM
        sys_menu m1
        LEFT join sys_menu m2 ON m1.pcode = m2. CODE
        INNER JOIN (
        SELECT
        ID
        FROM
        sys_menu
        WHERE
        ID IN (
        SELECT
        menuid
        FROM
        sys_relation rela
        WHERE
        rela.roleid IN
        <foreach collection="list" index="index" item="i" open="(" separator="," close=")">
            #{i}
        </foreach>
        )
        ) m3 ON m1.id = m3.id
        where m1.ismenu = 1
        order by levels,num asc
    </select>
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/NoticeMapper.xml
New file
@@ -0,0 +1,23 @@
<?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.stylefeng.guns.modular.system.dao.NoticeMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.Notice">
        <id column="id" property="id"/>
        <result column="title" property="title"/>
        <result column="type" property="type"/>
        <result column="content" property="content"/>
        <result column="createtime" property="createtime"/>
        <result column="creater" property="creater"/>
    </resultMap>
    <select id="list" resultType="map">
        select * from sys_notice
        <if test="condition != null and condition != ''">
            where title like CONCAT('%',#{condition},'%') or content like CONCAT('%',#{condition},'%')
        </if>
        order by createtime DESC
    </select>
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/OperationLogMapper.xml
New file
@@ -0,0 +1,46 @@
<?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.stylefeng.guns.modular.system.dao.OperationLogMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.OperationLog">
        <id column="id" property="id" />
        <result column="logtype" property="logtype" />
        <result column="logname" property="logname" />
        <result column="userid" property="userid" />
        <result column="classname" property="classname" />
        <result column="method" property="method" />
        <result column="createtime" property="createtime" />
        <result column="succeed" property="succeed" />
        <result column="message" property="message" />
    </resultMap>
    <select id="getOperationLogs" resultType="map">
        select * from sys_operation_log where 1 = 1
        <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''">
            and (createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
        </if>
        <if test="logName != null and logName !=''">
            and logname like CONCAT('%',#{logName},'%')
        </if>
        <if test="logType != null and logType !=''">
            and logtype like CONCAT('%',#{logType},'%')
        </if>
        <choose>
            <when test="orderByField != null and orderByField !=''">
                <choose>
                    <when test="isAsc == true">
                        order by ${orderByField} ASC
                    </when>
                    <otherwise>
                        order by ${orderByField} DESC
                    </otherwise>
                </choose>
            </when>
            <otherwise>
                order by createtime DESC
            </otherwise>
        </choose>
    </select>
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/RegionMapper.xml
New file
@@ -0,0 +1,14 @@
<?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.stylefeng.guns.modular.system.dao.RegionMapper">
    <select id="getDistrict" resultType="com.stylefeng.guns.modular.system.warpper.res.DistrictRes">
      select
      id,
      `name`,
      code
      from  t_region where parent_id = #{parentId} order by code
    </select>
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/RelationMapper.xml
New file
@@ -0,0 +1,12 @@
<?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.stylefeng.guns.modular.system.dao.RelationMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.Relation">
        <id column="id" property="id" />
        <result column="menuid" property="menuid" />
        <result column="roleid" property="roleid" />
    </resultMap>
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/ReportHouseResourceMapper.xml
New file
@@ -0,0 +1,6 @@
<?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.stylefeng.guns.modular.system.dao.ReportHouseResourceMapper">
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/ReportHousingDemandMapper.xml
New file
@@ -0,0 +1,6 @@
<?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.stylefeng.guns.modular.system.dao.ReportHousingDemandMapper">
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/RoleMapper.xml
New file
@@ -0,0 +1,80 @@
<?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.stylefeng.guns.modular.system.dao.RoleMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.Role">
        <id column="id" property="id" />
        <result column="num" property="num" />
        <result column="pid" property="pid" />
        <result column="name" property="name" />
        <result column="deptid" property="deptid" />
        <result column="tips" property="tips" />
        <result column="version" property="version" />
    </resultMap>
    <sql id="Base_Column_List">
        id, num, pid, name, deptid, tips, version
    </sql>
    <select id="selectRoles" resultType="map">
        select
        <include refid="Base_Column_List" />
        from sys_role
        <if test="condition != null">
            where name like CONCAT('%',#{condition},'%')
        </if>
        order by id
    </select>
    <delete id="deleteRolesById">
        delete from sys_relation where roleid = #{roleId}
    </delete>
    <select id="roleTreeList" resultType="com.stylefeng.guns.core.node.ZTreeNode">
        select id "id",pId
        "pId",name as "name",(case when (pId=0 or pId is null) then 'true'
        else 'false' end) "open" from sys_role
    </select>
    <select id="roleTreeListByRoleId" resultType="com.stylefeng.guns.core.node.ZTreeNode">
        SELECT
        r.id "id",
        pId "pId",
        NAME AS "name",
        (
        CASE
        WHEN (pId = 0 OR pId IS NULL) THEN
        'true'
        ELSE
        'false'
        END
        ) "open",
        (
        CASE
        WHEN (r1.ID = 0 OR r1.ID IS NULL) THEN
        'false'
        ELSE
        'true'
        END
        ) "checked"
        FROM
        sys_role r
        LEFT JOIN (
        SELECT
        ID
        FROM
        sys_role
        WHERE
        ID IN
        <foreach collection="array" index="index" item="i" open="(" separator="," close=")">
            #{i}
        </foreach>
        ) r1 ON r.ID = r1.ID
        ORDER BY
        pId,
        num ASC
    </select>
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/SearchHistoryConditionMapper.xml
New file
@@ -0,0 +1,6 @@
<?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.stylefeng.guns.modular.system.dao.SearchHistoryConditionMapper">
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/SysDataTypeMapper.xml
New file
@@ -0,0 +1,6 @@
<?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.stylefeng.guns.modular.system.dao.SysDataTypeMapper">
</mapper>
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/UserMapper.xml
New file
@@ -0,0 +1,96 @@
<?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.stylefeng.guns.modular.system.dao.UserMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.User">
        <id column="id" property="id" />
        <result column="avatar" property="avatar" />
        <result column="account" property="account" />
        <result column="password" property="password" />
        <result column="salt" property="salt" />
        <result column="name" property="name" />
        <result column="birthday" property="birthday" />
        <result column="sex" property="sex" />
        <result column="email" property="email" />
        <result column="phone" property="phone" />
        <result column="roleid" property="roleid" />
        <result column="deptid" property="deptid" />
        <result column="status" property="status" />
        <result column="createtime" property="createtime" />
        <result column="version" property="version" />
        <result column="updatePasswordTime" property="updatePasswordTime"/>
    </resultMap>
    <sql id="Base_Column_List">
        id, account, name, birthday, sex, email, avatar,
        phone, roleid,
        deptid, status,
        createtime, version, updatePasswordTime
    </sql>
    <sql id="Base_Column_List_With_Pwd">
        id, account, name, birthday,password, sex, email, avatar,
        phone, roleid,salt,
        deptid, status,
        createtime, version, updatePasswordTime
    </sql>
    <select id="selectUsers" resultType="map">
        select
        <include refid="Base_Column_List" />
        from sys_user
        where status != 3
        <if test="name != null and name != ''">
            and (phone like CONCAT('%',#{name},'%')
            or account like CONCAT('%',#{name},'%')
            or name like CONCAT('%',#{name},'%'))
        </if>
        <if test="deptid != null and deptid != 0">
            and (deptid = #{deptid} or deptid in ( select id from sys_dept where pids like CONCAT('%[', #{deptid}, ']%') ))
        </if>
        <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
            and (createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
        </if>
    </select>
    <update id="setStatus">
        update sys_user set status = #{status} where id =
        #{userId}
    </update>
    <update id="changePwd">
        update sys_user set password = #{pwd} where id =
        #{userId}
    </update>
    <update id="setRoles">
        update sys_user set roleid = #{roleIds} where id =
        #{userId}
    </update>
    <select id="getByAccount" resultType="com.stylefeng.guns.modular.system.model.User">
        select
        <include refid="Base_Column_List_With_Pwd" />
        from sys_user where account = #{account} and status != 3
    </select>
    <select id="getSysUserDetails" resultType="map">
        select * ,IF( sex = 1, '男', '女' ) sexName  FROM  sys_user  where  id=#{id}
    </select>
    <select id="getUsers" resultType="java.util.Map">
        SELECT us.createtime,us.account,us.`name`,us.sex,sr.`name` as roleName,sd.simplename as deptName,us.email,us.phone,us.`status`
        from sys_user us
                 LEFT JOIN sys_role sr ON us.roleid = sr.id
                 LEFT JOIN sys_dept sd on us.deptid = sd.id
        <where>
            us.version = #{version} and us.status != 3
            <if test="null != account and '' != account">
                and us.account like CONCAT('%', #{account}, '%')
            </if>
        </where>
            limit #{index},#{size}
    </select>
</mapper>
guns-management/target/classes/ehcache.xml
New file
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="ehcache.xsd"
         updateCheck="false" monitoring="autodetect"
         dynamicConfig="true" >
    <diskStore path="java.io.tmpdir/ehcache"/>
    <defaultCache
            maxElementsInMemory="50000"
            eternal="false"
            timeToIdleSeconds="3600"
            timeToLiveSeconds="3600"
            overflowToDisk="true"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
    />
    <!-- 全局变量:永不过期-->
    <cache name="CONSTANT"
           maxElementsInMemory="50000"
           eternal="true"
           clearOnFlush="false"
           overflowToDisk="true"
           diskSpoolBufferSizeMB="1024"
           maxElementsOnDisk="100000"
           diskPersistent="false"
           diskExpiryThreadIntervalSeconds="120"
           memoryStoreEvictionPolicy="LFU"
           transactionalMode="off">
    </cache>
</ehcache>
    <!--
        maxElementsInMemory="10000"     //Cache中最多允许保存的数据对象的数量
        external="false"                 //缓存中对象是否为永久的,如果是,超时设置将被忽略,对象从不过期
        timeToLiveSeconds="3600"          //缓存的存活时间,从开始创建的时间算起
        timeToIdleSeconds="3600"          //多长时间不访问该缓存,那么ehcache 就会清除该缓存
        这两个参数很容易误解,看文档根本没用,我仔细分析了ehcache的代码。结论如下:
        1、timeToLiveSeconds的定义是:以创建时间为基准开始计算的超时时长;
        2、timeToIdleSeconds的定义是:在创建时间和最近访问时间中取出离现在最近的时间作为基准计算的超时时长;
        3、如果仅设置了timeToLiveSeconds,则该对象的超时时间=创建时间+timeToLiveSeconds,假设为A;
        4、如果没设置timeToLiveSeconds,则该对象的超时时间=min(创建时间,最近访问时间)+timeToIdleSeconds,假设为B;
        5、如果两者都设置了,则取出A、B最少的值,即min(A,B),表示只要有一个超时成立即算超时。
        overflowToDisk="true"            //内存不足时,是否启用磁盘缓存
        diskSpoolBufferSizeMB    //设置DiskStore(磁盘缓存)的缓存区大小。默认是30MB。每个Cache都应该有自己的一个缓冲区
        maxElementsOnDisk        //硬盘最大缓存个数
        diskPersistent            //是否缓存虚拟机重启期数据The default value is false
        diskExpiryThreadIntervalSeconds    //磁盘失效线程运行时间间隔,默认是120秒。
        memoryStoreEvictionPolicy="LRU" //当达到maxElementsInMemory限制时,Ehcache将会根据指定的策略去清理内存。默认策略是LRU(最近最少使用)。你可以设置为FIFO(先进先出)或是LFU(较少使用)。
        clearOnFlush    //内存数量最大时是否清除
        maxEntriesLocalHeap="0"  //堆内存中最大缓存对象数,0没有限制
        maxEntriesLocalDisk="1000" //硬盘最大缓存个数。
    -->
guns-management/target/classes/logback-spring.xml
New file
@@ -0,0 +1,222 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,比如: 如果设置为WARN,则低于WARN的信息都不会输出 -->
<!-- scan:当此属性设置为true时,配置文档如果发生改变,将会被重新加载,默认值为true -->
<!-- scanPeriod:设置监测配置文档是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 -->
<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 -->
<configuration  scan="true" scanPeriod="10 seconds">
<contextName>logback</contextName>
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义后,可以使“${}”来使用变量。 -->
<property name="log.path" value="/home/OPXCX2021/server/logs"/>
<!--0. 日志格式和颜色渲染 -->
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!--1. 输出到控制台-->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
        <level>debug</level>
    </filter>
    <encoder>
        <Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
        <!-- 设置字符集 -->
        <charset>UTF-8</charset>
    </encoder>
</appender>
<!--2. 输出到文档-->
<!-- 2.1 level为 DEBUG 日志,时间滚动输出  -->
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <!-- 正在记录的日志文档的路径及文档名 -->
    <file>${log.path}/debug.log</file>
    <!--日志文档输出格式-->
    <encoder>
        <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
        <charset>UTF-8</charset> <!-- 设置字符集 -->
    </encoder>
    <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <!-- 日志归档 -->
        <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
        <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
            <maxFileSize>100MB</maxFileSize>
        </timeBasedFileNamingAndTriggeringPolicy>
        <!--日志文档保留天数-->
        <maxHistory>15</maxHistory>
    </rollingPolicy>
    <!-- 此日志文档只记录debug级别的 -->
    <filter class="ch.qos.logback.classic.filter.LevelFilter">
        <level>debug</level>
        <onMatch>ACCEPT</onMatch>
        <onMismatch>DENY</onMismatch>
    </filter>
</appender>
<!-- 2.2 level为 INFO 日志,时间滚动输出  -->
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <!-- 正在记录的日志文档的路径及文档名 -->
    <file>${log.path}/info.log</file>
    <!--日志文档输出格式-->
    <encoder>
        <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
        <charset>UTF-8</charset>
    </encoder>
    <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <!-- 每天日志归档路径以及格式 -->
        <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
        <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
            <maxFileSize>100MB</maxFileSize>
        </timeBasedFileNamingAndTriggeringPolicy>
        <!--日志文档保留天数-->
        <maxHistory>15</maxHistory>
    </rollingPolicy>
    <!-- 此日志文档只记录info级别的 -->
    <filter class="ch.qos.logback.classic.filter.LevelFilter">
        <level>info</level>
        <onMatch>ACCEPT</onMatch>
        <onMismatch>DENY</onMismatch>
    </filter>
</appender>
<!-- 2.3 level为 WARN 日志,时间滚动输出  -->
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <!-- 正在记录的日志文档的路径及文档名 -->
    <file>${log.path}/warn.log</file>
    <!--日志文档输出格式-->
    <encoder>
        <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
        <charset>UTF-8</charset> <!-- 此处设置字符集 -->
    </encoder>
    <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
        <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
            <maxFileSize>100MB</maxFileSize>
        </timeBasedFileNamingAndTriggeringPolicy>
        <!--日志文档保留天数-->
        <maxHistory>15</maxHistory>
    </rollingPolicy>
    <!-- 此日志文档只记录warn级别的 -->
    <filter class="ch.qos.logback.classic.filter.LevelFilter">
        <level>warn</level>
        <onMatch>ACCEPT</onMatch>
        <onMismatch>DENY</onMismatch>
    </filter>
</appender>
<!-- 2.4 level为 ERROR 日志,时间滚动输出  -->
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <!-- 正在记录的日志文档的路径及文档名 -->
    <file>${log.path}/error.log</file>
    <!--日志文档输出格式-->
    <encoder>
        <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
        <charset>UTF-8</charset> <!-- 此处设置字符集 -->
    </encoder>
    <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
        <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
            <maxFileSize>100MB</maxFileSize>
        </timeBasedFileNamingAndTriggeringPolicy>
        <!--日志文档保留天数-->
        <maxHistory>15</maxHistory>
    </rollingPolicy>
    <!-- 此日志文档只记录ERROR级别的 -->
    <filter class="ch.qos.logback.classic.filter.LevelFilter">
        <level>ERROR</level>
        <onMatch>ACCEPT</onMatch>
        <onMismatch>DENY</onMismatch>
    </filter>
</appender>
<!-- 2.5 所有 除了DEBUG级别的其它高于DEBUG的 日志,记录到一个文件  -->
<appender name="ALL_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <!-- 正在记录的日志文档的路径及文档名 -->
    <file>${log.path}/all.log</file>
    <!--日志文档输出格式-->
    <encoder>
        <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
        <charset>UTF-8</charset> <!-- 此处设置字符集 -->
    </encoder>
    <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/all-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
        <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
            <maxFileSize>100MB</maxFileSize>
        </timeBasedFileNamingAndTriggeringPolicy>
        <!--日志文档保留天数-->
        <maxHistory>15</maxHistory>
    </rollingPolicy>
    <!-- 此日志文档记录除了DEBUG级别的其它高于DEBUG的 -->
    <filter class="ch.qos.logback.classic.filter.LevelFilter">
        <level>DEBUG</level>
        <onMatch>DENY</onMatch>
        <onMismatch>ACCEPT</onMismatch>
    </filter>
</appender>
<!--
    <logger>用来设置某一个包或者具体的某一个类的日志打印级别、
    以及指定<appender>。<logger>仅有一个name属性,
    一个可选的level和一个可选的addtivity属性。
    name:用来指定受此logger约束的某一个包或者具体的某一个类。
    level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,
          还有一个特殊值INHERITED或者同义词NULL,代表强制执行上级的级别。
          如果未设置此属性,那么当前logger将会继承上级的级别。
    addtivity:是否向上级logger传递打印信息。默认是true。
    <logger name="org.springframework.web" level="info"/>
    <logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/>
-->
<!--
    root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性
    level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,
    不能设置为INHERITED或者同义词NULL。默认是DEBUG
    可以包含零个或多个元素,标识这个appender将会添加到这个logger。
-->
<!-- 4  最终的策略:
             基本策略(root级) + 根据profile在启动时, logger标签中定制化package日志级别(优先级高于上面的root级)-->
<springProfile name="dev">
    <root level="info">
        <appender-ref ref="CONSOLE" />
        <appender-ref ref="DEBUG_FILE" />
        <appender-ref ref="INFO_FILE" />
        <appender-ref ref="WARN_FILE" />
        <appender-ref ref="ERROR_FILE" />
        <appender-ref ref="ALL_FILE" />
    </root>
    <logger name="com.stylefeng.guns.modular.system.dao" level="debug"/>
</springProfile>
<springProfile name="test">
    <root level="info">
        <appender-ref ref="CONSOLE" />
        <appender-ref ref="DEBUG_FILE" />
        <appender-ref ref="INFO_FILE" />
        <appender-ref ref="WARN_FILE" />
        <appender-ref ref="ERROR_FILE" />
        <appender-ref ref="ALL_FILE" />
    </root>
</springProfile>
<springProfile name="produce">
    <root level="info">
        <!-- 生产环境最好不配置console写文件 -->
        <appender-ref ref="DEBUG_FILE" />
        <appender-ref ref="INFO_FILE" />
        <appender-ref ref="WARN_FILE" />
        <appender-ref ref="ERROR_FILE" />
        <appender-ref ref="ALL_FILE" />
    </root>
</springProfile>
</configuration>