Procházet zdrojové kódy

栏目类型权限 资源库

master
liugw před 5 roky
rodič
revize
78f09011b8
44 změnil soubory, kde provedl 1818 přidání a 118 odebrání
  1. 12
    0
      pom.xml
  2. 2
    0
      src/main/java/com/xdf/creative/CreativeApplication.java
  3. 4
    2
      src/main/java/com/xdf/creative/base/params/creative/InfoContentBackSearchQueryParam.java
  4. 37
    0
      src/main/java/com/xdf/creative/base/params/creative/InfoRoleImpowerTypeQueryParam.java
  5. 47
    0
      src/main/java/com/xdf/creative/base/params/creative/InfoRoleTypeQueryParam.java
  6. 62
    0
      src/main/java/com/xdf/creative/base/params/creative/InfoStoreAddParam.java
  7. 59
    0
      src/main/java/com/xdf/creative/base/params/creative/InfoStoreQueryParam.java
  8. 36
    0
      src/main/java/com/xdf/creative/base/params/creative/InfoStoreUrlEntityParam.java
  9. 37
    0
      src/main/java/com/xdf/creative/base/params/creative/InfoStoreUrlParam.java
  10. 3
    0
      src/main/java/com/xdf/creative/base/vo/creative/InfoContentWebAllQueryVo.java
  11. 40
    0
      src/main/java/com/xdf/creative/base/vo/creative/InfoRoleTypeQueryVo.java
  12. 49
    0
      src/main/java/com/xdf/creative/base/vo/creative/InfoStoreQueryVo.java
  13. 4
    1
      src/main/java/com/xdf/creative/config/CustomExceptionHandler.java
  14. 94
    0
      src/main/java/com/xdf/creative/config/CustomScheduled.java
  15. 2
    0
      src/main/java/com/xdf/creative/enums/ApiCode.java
  16. 1
    1
      src/main/java/com/xdf/creative/enums/ServiceFileDirEnum.java
  17. 2
    2
      src/main/java/com/xdf/creative/enums/StatusCode.java
  18. 90
    0
      src/main/java/com/xdf/creative/module/controller/InfoRoleTypeController.java
  19. 156
    0
      src/main/java/com/xdf/creative/module/controller/InfoStoreController.java
  20. 1
    2
      src/main/java/com/xdf/creative/module/controller/SysUserController.java
  21. 46
    0
      src/main/java/com/xdf/creative/module/entity/InfoRoleType.java
  22. 56
    0
      src/main/java/com/xdf/creative/module/entity/InfoStore.java
  23. 64
    0
      src/main/java/com/xdf/creative/module/mapper/InfoRoleTypeMapper.java
  24. 53
    0
      src/main/java/com/xdf/creative/module/mapper/InfoStoreMapper.java
  25. 65
    0
      src/main/java/com/xdf/creative/module/service/InfoRoleTypeService.java
  26. 71
    0
      src/main/java/com/xdf/creative/module/service/InfoStoreService.java
  27. 1
    1
      src/main/java/com/xdf/creative/module/service/SysUserService.java
  28. 4
    1
      src/main/java/com/xdf/creative/module/service/impl/InfoContentServiceImpl.java
  29. 134
    0
      src/main/java/com/xdf/creative/module/service/impl/InfoRoleTypeServiceImpl.java
  30. 164
    0
      src/main/java/com/xdf/creative/module/service/impl/InfoStoreServiceImpl.java
  31. 12
    8
      src/main/java/com/xdf/creative/module/service/impl/SysUserServiceImpl.java
  32. 72
    17
      src/main/java/com/xdf/creative/shiro/filter/ConfigPathInterceptor.java
  33. 1
    0
      src/main/java/com/xdf/creative/shiro/jwt/JwtUtil.java
  34. 2
    1
      src/main/java/com/xdf/creative/util/file/UploadUtil.java
  35. 89
    0
      src/main/java/com/xdf/creative/util/image/ImageUtils.java
  36. 2
    3
      src/main/resources/application.properties
  37. 4
    2
      src/main/resources/application.yml
  38. 2
    0
      src/main/resources/logback-spring.xml
  39. 95
    75
      src/main/resources/mapper/InfoContentMapper.xml
  40. 65
    0
      src/main/resources/mapper/InfoRoleTypeMapper.xml
  41. 71
    0
      src/main/resources/mapper/InfoStoreMapper.xml
  42. 5
    0
      src/main/resources/mapper/InfoTypeMapper.xml
  43. 1
    1
      src/main/resources/mapper/SysPermissionMapper.xml
  44. 1
    1
      src/main/resources/mapper/SysUserMapper.xml

+ 12
- 0
pom.xml Zobrazit soubor

@@ -191,6 +191,18 @@
<version>3.2.5.RELEASE</version>
</dependency>

<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.3.0</version>
<exclusions>
<exclusion>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
</exclusion>
</exclusions>
</dependency>

</dependencies>



+ 2
- 0
src/main/java/com/xdf/creative/CreativeApplication.java Zobrazit soubor

@@ -7,6 +7,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.context.request.RequestContextListener;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@@ -19,6 +20,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableTransactionManagement
@SpringBootApplication
@ServletComponentScan
@EnableScheduling
public class CreativeApplication {

public static void main(String[] args) {

+ 4
- 2
src/main/java/com/xdf/creative/base/params/creative/InfoContentBackSearchQueryParam.java Zobrazit soubor

@@ -41,10 +41,10 @@ public class InfoContentBackSearchQueryParam extends QueryParam {
private Integer state;

@ApiModelProperty(value = "用户名")
private String username;
private String userName;

@ApiModelProperty(value = "昵称")
private String nickname;
private String nickName;

@ApiModelProperty(value = "是否置顶 0否 1是")
private Integer istop;
@@ -52,4 +52,6 @@ public class InfoContentBackSearchQueryParam extends QueryParam {
@ApiModelProperty(value = "上下状态 0 下线 1上线")
private Integer onlineType;

private Long userId;

}

+ 37
- 0
src/main/java/com/xdf/creative/base/params/creative/InfoRoleImpowerTypeQueryParam.java Zobrazit soubor

@@ -0,0 +1,37 @@
package com.xdf.creative.base.params.creative;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.xdf.creative.base.params.QueryParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.Date;
import java.util.List;

/**
* <p>
* 角色类型 查询参数对象
* </p>
*
* @author lgw
* @date 2020-04-02
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "InfoRoleTypeQueryParam对象", description = "角色类型查询参数")
public class InfoRoleImpowerTypeQueryParam extends QueryParam {
private static final long serialVersionUID = 1L;


private Long roleId;

@ApiModelProperty(value = "权限id集合")
private List<String> infoTypeList;


}

+ 47
- 0
src/main/java/com/xdf/creative/base/params/creative/InfoRoleTypeQueryParam.java Zobrazit soubor

@@ -0,0 +1,47 @@
package com.xdf.creative.base.params.creative;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.xdf.creative.base.params.QueryParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.Date;

/**
* <p>
* 角色类型 查询参数对象
* </p>
*
* @author lgw
* @date 2020-04-02
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "InfoRoleTypeQueryParam对象", description = "角色类型查询参数")
public class InfoRoleTypeQueryParam extends QueryParam {
private static final long serialVersionUID = 1L;


@ApiModelProperty(value = "主键id")
@TableId(value = "id", type = IdType.ID_WORKER)
private Long id;

@ApiModelProperty(value = "栏目主键id")
private Long infoTypeId;

@ApiModelProperty(value = "角色id")
private Long roleId;

@ApiModelProperty(value = "创建时间")
private Date createTime;

@ApiModelProperty(value = "修改时间")
private Date updateTime;


}

+ 62
- 0
src/main/java/com/xdf/creative/base/params/creative/InfoStoreAddParam.java Zobrazit soubor

@@ -0,0 +1,62 @@
package com.xdf.creative.base.params.creative;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.xdf.creative.base.params.QueryParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
* <p>
* 文件库 查询参数对象
* </p>
*
* @author lgw
* @date 2020-03-31
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "InfoStoreQueryParam对象", description = "文件库查询参数")
public class InfoStoreAddParam extends QueryParam {
private static final long serialVersionUID = 1L;


@ApiModelProperty(value = "主键id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;

@ApiModelProperty(value = "图片名称")
@NotBlank(message = "图片名称不能为空!")
private String name;

@ApiModelProperty(value = "图片地址")
@NotBlank(message = "图片地址不能为空!")
private String address;

@ApiModelProperty(value = "创建时间")
private Date createTime;

@ApiModelProperty(value = "上传人id")
private Long createUserId;

@ApiModelProperty(value = "资源类型 1、图片 2、文件")
@NotNull(message = "资源类型不能为空!")
private Integer type;

@ApiModelProperty(value = "文件类型")
@NotBlank(message = "文件类型不能为空!")
private String fileType;

@ApiModelProperty(value = "状态 0、不可用 1、可用")
private Integer state;


}

+ 59
- 0
src/main/java/com/xdf/creative/base/params/creative/InfoStoreQueryParam.java Zobrazit soubor

@@ -0,0 +1,59 @@
package com.xdf.creative.base.params.creative;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.xdf.creative.base.params.QueryParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.Date;

/**
* <p>
* 文件库 查询参数对象
* </p>
*
* @author lgw
* @date 2020-03-31
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "InfoStoreQueryParam对象", description = "文件库查询参数")
public class InfoStoreQueryParam extends QueryParam {
private static final long serialVersionUID = 1L;


@ApiModelProperty(value = "主键id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;

@ApiModelProperty(value = "图片名称")
private String name;

@ApiModelProperty(value = "图片地址")
private String address;

@ApiModelProperty(value = "开始创建时间")
private Date startCreateTime;

@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;

@ApiModelProperty(value = "上传人id")
private Long createUserId;

@ApiModelProperty(value = "资源类型 1、图片 2、文件")
private Integer type;

@ApiModelProperty(value = "文件类型")
private String fileType;

@ApiModelProperty(value = "状态 0、不可用 1、可用")
private Integer state;


}

+ 36
- 0
src/main/java/com/xdf/creative/base/params/creative/InfoStoreUrlEntityParam.java Zobrazit soubor

@@ -0,0 +1,36 @@
package com.xdf.creative.base.params.creative;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.xdf.creative.base.params.QueryParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
* <p>
* 文件库 查询参数对象
* </p>
*
* @author lgw
* @date 2020-03-31
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "InfoStoreQueryParam对象", description = "文件库查询参数")
public class InfoStoreUrlEntityParam {
private static final long serialVersionUID = 1L;

@ApiModelProperty(value = "图片编号")
private int number;

@ApiModelProperty(value = "图片路径")
private String url;

@ApiModelProperty(value = "图片类型")
private String type;


}

+ 37
- 0
src/main/java/com/xdf/creative/base/params/creative/InfoStoreUrlParam.java Zobrazit soubor

@@ -0,0 +1,37 @@
package com.xdf.creative.base.params.creative;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.xdf.creative.base.params.QueryParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.Date;
import java.util.List;

/**
* <p>
* 文件库 查询参数对象
* </p>
*
* @author lgw
* @date 2020-03-31
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "InfoStoreQueryParam对象", description = "文件库查询参数")
public class InfoStoreUrlParam extends QueryParam {
private static final long serialVersionUID = 1L;


private String filePath;

@ApiModelProperty(value = "图片地址")
private List<InfoStoreUrlEntityParam> urlList;


}

+ 3
- 0
src/main/java/com/xdf/creative/base/vo/creative/InfoContentWebAllQueryVo.java Zobrazit soubor

@@ -70,6 +70,9 @@ public class InfoContentWebAllQueryVo extends QueryParam {
@ApiModelProperty(value = "置顶时间")
private Date istopTime;

@ApiModelProperty(value = "终审时间")
private Date finalAuditTime;


@ApiModelProperty(value = "栏目类型id")
private String typeId;

+ 40
- 0
src/main/java/com/xdf/creative/base/vo/creative/InfoRoleTypeQueryVo.java Zobrazit soubor

@@ -0,0 +1,40 @@
package com.xdf.creative.base.vo.creative;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;

import java.util.Date;

/**
* <p>
* 角色类型 查询结果对象
* </p>
*
* @author lgw
* @date 2020-04-02
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "InfoRoleTypeQueryVo对象", description = "角色类型查询参数")
public class InfoRoleTypeQueryVo implements Serializable {
private static final long serialVersionUID = 1L;

@ApiModelProperty(value = "主键id")
private Long id;

@ApiModelProperty(value = "栏目主键id")
private Long infoTypeId;

@ApiModelProperty(value = "角色id")
private Long roleId;

@ApiModelProperty(value = "创建时间")
private Date createTime;

@ApiModelProperty(value = "修改时间")
private Date updateTime;

}

+ 49
- 0
src/main/java/com/xdf/creative/base/vo/creative/InfoStoreQueryVo.java Zobrazit soubor

@@ -0,0 +1,49 @@
package com.xdf.creative.base.vo.creative;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;

import java.util.Date;

/**
* <p>
* 文件库 查询结果对象
* </p>
*
* @author lgw
* @date 2020-03-31
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "InfoStoreQueryVo对象", description = "文件库查询参数")
public class InfoStoreQueryVo implements Serializable {
private static final long serialVersionUID = 1L;

@ApiModelProperty(value = "主键id")
private Long id;

@ApiModelProperty(value = "图片名称")
private String name;

@ApiModelProperty(value = "图片地址")
private String address;

@ApiModelProperty(value = "创建时间")
private Date createTime;

@ApiModelProperty(value = "上传人id")
private Long createUserId;

@ApiModelProperty(value = "资源类型 1、图片 2、文件")
private Integer type;

@ApiModelProperty(value = "文件类型")
private String fileType;

@ApiModelProperty(value = "状态 0、不可用 1、可用")
private Integer state;

}

+ 4
- 1
src/main/java/com/xdf/creative/config/CustomExceptionHandler.java Zobrazit soubor

@@ -2,6 +2,8 @@ package com.xdf.creative.config;

import java.io.IOException;

import com.xdf.creative.enums.ApiCode;
import com.xdf.creative.support.exception.SysLoginException;
import com.xdf.creative.util.page.ApiResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@@ -11,8 +13,9 @@ import org.springframework.web.multipart.MaxUploadSizeExceededException;
public class CustomExceptionHandler {
@ExceptionHandler(MaxUploadSizeExceededException.class)
public ApiResult uploadException(MaxUploadSizeExceededException e) throws IOException {
return ApiResult.fail("最大上传文件为1M,上传文件大小超出限制!");
return ApiResult.fail("最大上传文件为5M,上传文件大小超出限制!");
}



}

+ 94
- 0
src/main/java/com/xdf/creative/config/CustomScheduled.java Zobrazit soubor

@@ -0,0 +1,94 @@
package com.xdf.creative.config;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.Trigger;
import org.springframework.scheduling.TriggerContext;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.scheduling.support.CronTrigger;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

@Slf4j
@Getter
@Setter
@Configuration
public class CustomScheduled implements SchedulingConfigurer {

private String cron = "0 0 0 */1 * ?";

@Value("${upload_basePath}")
private String basePath;
@Value("${wx_basePath}")
private String wxPath;

public CustomScheduled() {
this.cron = cron;
}

@Override
public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
scheduledTaskRegistrar.addTriggerTask(doTask(), getTrigger());
}

/**
* 业务执行方法
*
* @return
*/

private Runnable doTask() {
return new Runnable() {
@Override
public void run() {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
Calendar calendar = Calendar.getInstance();//new一个Calendar类,把Date放进去
calendar.setTime(date);
//控制台打印的日期为明天日期,2019-06-11
//此时的日期为明天的日期,要实现昨天,日期应该减二
calendar.add(Calendar.DATE, -1);
String indexFileName = simpleDateFormat.format(calendar.getTime());
File file = new File(basePath+wxPath);//里面输入特定目录
File temp = null;
File[] filelist = file.listFiles();
for (int i = 0; i < filelist.length; i++) {
temp = filelist[i];
if (temp.getName().startsWith(indexFileName))//获得文件名,如果后缀为“”,这个你自己写,就删除文件
{
temp.delete();//删除文件
System.out.println();
}
}
log.error("后缀文件为"+indexFileName+"删除");
}
};
}


/**
* 业务触发器
*
* @return
*/

private Trigger getTrigger() {
return new Trigger() {
@Override
public Date nextExecutionTime(TriggerContext triggerContext) {
// 触发器
CronTrigger trigger = new CronTrigger(cron);
return trigger.nextExecutionTime(triggerContext);
}
};
}


}

+ 2
- 0
src/main/java/com/xdf/creative/enums/ApiCode.java Zobrazit soubor

@@ -35,6 +35,8 @@ public enum ApiCode {

REFRESH_TOKEN_ERROR(4410, "刷新令牌异常"),

REFRESH_TOKEN_SUCCESS(4411, "刷新令牌正常"),

FAIL(5500, "操作失败"),

LOGIN_EXCEPTION(4000, "登陆失败"),

+ 1
- 1
src/main/java/com/xdf/creative/enums/ServiceFileDirEnum.java Zobrazit soubor

@@ -26,7 +26,7 @@ public enum ServiceFileDirEnum {
SERVICE_FILE_DIR_PUBLIC_ACTIVITY(107, "activity"),

//政策导航
SERVICE_FILE_DIR_POLICY(108, "policy "),
SERVICE_FILE_DIR_POLICY(108, "policy"),

//专项资金
SERVICE_FILE_DIR_SUPPORT(110, "support"),

+ 2
- 2
src/main/java/com/xdf/creative/enums/StatusCode.java Zobrazit soubor

@@ -16,7 +16,7 @@ public enum StatusCode {
AUTH_UPDATE_VERIFY_ERROR(000003, "存在非法访问,请刷新后再试!"),
FORM_AUDIT_STATE_VERIFY(000004, "只能操作待审核的数据!"),
FORM_AUDIT_BACK_IDEA_VERIFY(000010,"退回意见不能为空!"),
FORM_UPDATE_STATE_VERIFY(000005, "只能操作草稿状态的数据!"),
FORM_UPDATE_STATE_VERIFY(000005, "只能操作草稿、退回状态的数据!"),
FORM_AUDIT_FINAL_AUDIT_PASS_VERIFY(000011,"只能操作终审通过的信息!"),
FORM_INFO_CONTENT_SORT_VERIFY(000012,"请输入排序号!"),
FORM_INFO_CONTENT_DELETE_VERIFY(000013,"存在信息非法删除!"),
@@ -34,7 +34,7 @@ public enum StatusCode {
SYS_USER_ROLE_DELETE(100003,"删除角色失败!"),
SYS_ROLE_PERMISSION_DELETE(100004,"删除角色权限关系失败!"),
SYS_ROLE_EXIST_NO(100005,"该角色不存在!"),
SYS_ROLE_PERMISSION_EXIST(100006,"未发现有效得URL!"),
SYS_ROLE_PERMISSION_EXIST(100006,"未发现有效资源!"),

SYS_USER_NAME_EXIST(101001,"当前用户名已存在!"),
SYS_USER_ROLE_VERIFY_EXIST(101002,"用户所选角色不存在!"),

+ 90
- 0
src/main/java/com/xdf/creative/module/controller/InfoRoleTypeController.java Zobrazit soubor

@@ -0,0 +1,90 @@
package com.xdf.creative.module.controller;

import com.xdf.creative.base.controller.BaseController;
import com.xdf.creative.base.params.IdParam;
import com.xdf.creative.base.params.creative.InfoRoleImpowerTypeQueryParam;
import com.xdf.creative.base.params.creative.InfoRoleTypeQueryParam;
import com.xdf.creative.base.vo.creative.InfoRoleTypeQueryVo;
import com.xdf.creative.module.entity.InfoRoleType;
import com.xdf.creative.module.service.InfoRoleTypeService;
import com.xdf.creative.util.page.ApiResult;
import com.xdf.creative.util.page.PageTool;
import com.xdf.creative.util.tree.TreeConfig;
import com.xdf.creative.util.tree.Utils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
* <p>
* 角色类型 前端控制器
* </p>
*
* @author lgw
* @since 2020-04-02
*/
@Slf4j
@RestController
@RequestMapping("/infoRoleType")
@Api("角色类型 API")
public class InfoRoleTypeController extends BaseController {

@Autowired
private InfoRoleTypeService infoRoleTypeService;


/**
* 角色授权资源类型
* @param infoRoleImpowerTypeQueryParam
* @return
* @throws Exception
*/
@PostMapping("/setTypeToRole")
@ApiOperation(value = "添加InfoRoleType对象", notes = "添加角色类型", response = ApiResult.class)
public ApiResult setTypeToRole(@Valid @RequestBody InfoRoleImpowerTypeQueryParam infoRoleImpowerTypeQueryParam) throws Exception {
return infoRoleTypeService.setTypeToRole(infoRoleImpowerTypeQueryParam);
}



/**
* 角色授权查询资源树
*/
@PostMapping("/impowerTypeTreeList")
@ApiOperation(value = "获取授权菜单列表", notes = "获取所有菜单列表", response = Object.class)
public ApiResult impowerTypeTreeList(@Valid @RequestBody IdParam idParam) throws Exception {
List<Object> list = infoRoleTypeService.impowerTypeTreeList(idParam.getId());
TreeConfig config = new TreeConfig("typeId", "typeParentId", "typeParentId", "0", "");
return ApiResult.ok(Utils.tree(list, config));
}



/**
* 获取当前用户查询资源树
*/
@PostMapping("/getCurrentTypeTreeList")
@ApiOperation(value = "获取当前用户拥有菜单列表", notes = "获取所有菜单列表", response = Object.class)
public ApiResult getCurrentTypeTreeList() throws Exception {
List<Object> list = infoRoleTypeService.getRoleTypeTreeList();
TreeConfig config = new TreeConfig("typeId", "typeParentId", "typeParentId", "0", "");
return ApiResult.ok(Utils.tree(list, config));
}








}


+ 156
- 0
src/main/java/com/xdf/creative/module/controller/InfoStoreController.java Zobrazit soubor

@@ -0,0 +1,156 @@
package com.xdf.creative.module.controller;

import com.xdf.creative.base.controller.BaseController;
import com.xdf.creative.base.params.IdParam;
import com.xdf.creative.base.params.creative.InfoStoreAddParam;
import com.xdf.creative.base.params.creative.InfoStoreQueryParam;
import com.xdf.creative.base.params.creative.InfoStoreUrlParam;
import com.xdf.creative.base.vo.creative.InfoStoreQueryVo;
import com.xdf.creative.module.entity.InfoStore;
import com.xdf.creative.module.service.InfoStoreService;
import com.xdf.creative.util.page.ApiResult;
import com.xdf.creative.util.page.PageTool;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
* <p>
* 文件库 前端控制器
* </p>
*
* @author lgw
* @since 2020-03-31
*/
@Slf4j
@RestController
@RequestMapping("/infoStore")
@Api("文件库 API")
public class InfoStoreController extends BaseController {

@Autowired
private InfoStoreService infoStoreService;


@Value("${upload_basePath}")
private String basePath;
@Value("${wx_basePath}")
private String wxPath;


/**
* 添加文件库
*/
@PostMapping("/addStore")
@ApiOperation(value = "添加InfoStore对象", notes = "添加文件库", response = ApiResult.class)
public ApiResult addStore(@Valid @RequestBody InfoStoreAddParam infoStoreAddParam) throws Exception {
return infoStoreService.addStore(infoStoreAddParam);
}





/**
* 停用图片
*/
@PostMapping("/delStore")
@ApiOperation(value = "添加InfoStore对象", notes = "添加文件库", response = ApiResult.class)
public ApiResult delStore(@Valid @RequestBody IdParam idParam) throws Exception {
return infoStoreService.delStore(idParam.getId());
}

/**
* 前台调用图片库
*/
@PostMapping("/getUserStorePage")
@ApiOperation(value = "获取InfoStore分页列表", notes = "文件库分页列表", response = InfoStoreQueryVo.class)
public ApiResult<PageTool<InfoStoreQueryVo>> getUserStorePage(@Valid @RequestBody InfoStoreQueryParam infoStoreQueryParam) throws Exception {
PageTool<InfoStoreQueryVo> pageList = infoStoreService.getUserStorePage(infoStoreQueryParam);
return ApiResult.ok(pageList);
}


/**
* 文件库分页列表
*/
@PostMapping("/getPageList")
@ApiOperation(value = "获取InfoStore分页列表", notes = "文件库分页列表", response = InfoStoreQueryVo.class)
public ApiResult<PageTool<InfoStoreQueryVo>> getInfoStorePageList(@Valid @RequestBody InfoStoreQueryParam infoStoreQueryParam) throws Exception {
PageTool<InfoStoreQueryVo> pageList = infoStoreService.getInfoStorePageList(infoStoreQueryParam);
return ApiResult.ok(pageList);
}


/**
* 前台调用图片库
*/
@PostMapping("/getUrlStort")
@ApiOperation(value = "获取InfoStore分页列表", notes = "文件库分页列表", response = InfoStoreQueryVo.class)
public ApiResult getUrlStort(@Valid @RequestBody InfoStoreUrlParam infoStoreUrlParam) throws Exception {
infoStoreUrlParam.setFilePath(basePath+wxPath);
return infoStoreService.getUrlStort(infoStoreUrlParam);
}












/**
* 添加文件库
*/
@PostMapping("/add")
@ApiOperation(value = "添加InfoStore对象", notes = "添加文件库", response = ApiResult.class)
public ApiResult<Boolean> addInfoStore(@Valid @RequestBody InfoStore infoStore) throws Exception {
boolean flag = infoStoreService.save(infoStore);
return ApiResult.result(flag);
}

/**
* 修改文件库
*/
@PostMapping("/update")
@ApiOperation(value = "修改InfoStore对象", notes = "修改文件库", response = ApiResult.class)
public ApiResult<Boolean> updateInfoStore(@Valid @RequestBody InfoStore infoStore) throws Exception {
boolean flag = infoStoreService.updateById(infoStore);
return ApiResult.result(flag);
}

/**
* 删除文件库
*/
@PostMapping("/delete")
@ApiOperation(value = "删除InfoStore对象", notes = "删除文件库", response = ApiResult.class)
public ApiResult<Boolean> deleteInfoStore(@Valid @RequestBody IdParam idParam) throws Exception {
boolean flag = infoStoreService.removeById(idParam.getId());
return ApiResult.result(flag);
}

/**
* 获取文件库
*/
@PostMapping("/info")
@ApiOperation(value = "获取InfoStore对象详情", notes = "查看文件库", response = InfoStoreQueryVo.class)
public ApiResult<InfoStoreQueryVo> getInfoStore(@Valid @RequestBody IdParam idParam) throws Exception {
InfoStoreQueryVo infoStoreQueryVo = infoStoreService.getInfoStoreById(idParam.getId());
return ApiResult.ok(infoStoreQueryVo);
}


}


+ 1
- 2
src/main/java/com/xdf/creative/module/controller/SysUserController.java Zobrazit soubor

@@ -58,8 +58,7 @@ public class SysUserController extends BaseController {
@PostMapping("/login")
@ApiOperation(value = "登陆", notes = "系统用户登陆", response = ApiResult.class)
public ApiResult login(@Valid @RequestBody LoginParam loginParam, HttpServletResponse response) throws Exception {
LoginSysUserTokenVo loginSysUserTokenVo = sysUserService.login(loginParam);
return ApiResult.ok(loginSysUserTokenVo, "登陆成功");
return sysUserService.login(loginParam);
}



+ 46
- 0
src/main/java/com/xdf/creative/module/entity/InfoRoleType.java Zobrazit soubor

@@ -0,0 +1,46 @@
package com.xdf.creative.module.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.xdf.creative.base.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.Date;

/**
* <p>
* 角色类型
* </p>
*
* @author lgw
* @since 2020-04-02
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "InfoRoleType对象", description = "角色类型")
public class InfoRoleType extends BaseEntity {

private static final long serialVersionUID = 1L;

@ApiModelProperty(value = "主键id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;

@ApiModelProperty(value = "栏目主键id")
private Long infoTypeId;

@ApiModelProperty(value = "角色id")
private Long roleId;

@ApiModelProperty(value = "创建时间")
private Date createTime;

@ApiModelProperty(value = "修改时间")
private Date updateTime;

}

+ 56
- 0
src/main/java/com/xdf/creative/module/entity/InfoStore.java Zobrazit soubor

@@ -0,0 +1,56 @@
package com.xdf.creative.module.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.xdf.creative.base.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.Date;

/**
* <p>
* 文件库
* </p>
*
* @author lgw
* @since 2020-03-31
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "InfoStore对象", description = "文件库")
public class InfoStore extends BaseEntity {

private static final long serialVersionUID = 1L;

@ApiModelProperty(value = "主键id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;

@ApiModelProperty(value = "图片名称")
private String name;

@ApiModelProperty(value = "图片地址")
private String address;

@ApiModelProperty(value = "创建时间")
private Date createTime;

@ApiModelProperty(value = "上传人id")
private Long createUserId;

@ApiModelProperty(value = "资源类型 1、图片 2、文件")
private Integer type;

@ApiModelProperty(value = "文件类型")
private String fileType;

@ApiModelProperty(value = "状态 0、不可用 1、可用")
private Integer state;

}

+ 64
- 0
src/main/java/com/xdf/creative/module/mapper/InfoRoleTypeMapper.java Zobrazit soubor

@@ -0,0 +1,64 @@
package com.xdf.creative.module.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xdf.creative.base.params.creative.InfoRoleTypeQueryParam;
import com.xdf.creative.base.vo.creative.InfoRoleTypeQueryVo;
import com.xdf.creative.module.entity.InfoRoleType;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.util.List;

/**
* <p>
* 角色类型 Mapper 接口
* </p>
*
* @author lgw
* @since 2020-04-02
*/
@Repository
public interface InfoRoleTypeMapper extends BaseMapper<InfoRoleType> {

/**
* 获取角色拥有的资源树
*
* @param userId 用户id
* @return
* @throws Exception
*/
List<Object> getRoleTypeTreeList(@Param("userId")Long userId) throws Exception;



/**
* 获取用户角色授权资源 树
*/
List<Object> impowerTypeTreeList(@Param("roleId") Long roleId) throws Exception;






/**
* 根据ID获取查询对象
*
* @param id
* @return
*/
InfoRoleTypeQueryVo getInfoRoleTypeById(Serializable id);

/**
* 获取分页对象
*
* @param page
* @param infoRoleTypeQueryParam
* @return
*/
IPage<InfoRoleTypeQueryVo> getInfoRoleTypePageList(@Param("page") Page page, @Param("param") InfoRoleTypeQueryParam infoRoleTypeQueryParam);

}

+ 53
- 0
src/main/java/com/xdf/creative/module/mapper/InfoStoreMapper.java Zobrazit soubor

@@ -0,0 +1,53 @@
package com.xdf.creative.module.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xdf.creative.base.params.creative.InfoStoreQueryParam;
import com.xdf.creative.base.vo.creative.InfoStoreQueryVo;
import com.xdf.creative.module.entity.InfoStore;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.io.Serializable;

/**
* <p>
* 文件库 Mapper 接口
* </p>
*
* @author lgw
* @since 2020-03-31
*/
@Repository
public interface InfoStoreMapper extends BaseMapper<InfoStore> {

/**
* 根据ID获取查询对象
*
* @param id
* @return
*/
InfoStoreQueryVo getInfoStoreById(Serializable id);

/**
* 后台获取分页对象
*
* @param page
* @param infoStoreQueryParam
* @return
*/
IPage<InfoStoreQueryVo> getInfoStorePageList(@Param("page") Page page, @Param("param") InfoStoreQueryParam infoStoreQueryParam);


/**
* 前端用户调用图片文件库
*
* @param page
* @param infoStoreQueryParam
* @return
*/
IPage<InfoStoreQueryVo> getUserStorePage(@Param("page") Page page, @Param("param") InfoStoreQueryParam infoStoreQueryParam);


}

+ 65
- 0
src/main/java/com/xdf/creative/module/service/InfoRoleTypeService.java Zobrazit soubor

@@ -0,0 +1,65 @@
package com.xdf.creative.module.service;

import com.xdf.creative.base.params.creative.InfoRoleImpowerTypeQueryParam;
import com.xdf.creative.base.params.creative.InfoRoleTypeQueryParam;
import com.xdf.creative.base.service.BaseService;
import com.xdf.creative.base.vo.creative.InfoRoleTypeQueryVo;
import com.xdf.creative.module.entity.InfoRoleType;
import com.xdf.creative.util.page.ApiResult;
import com.xdf.creative.util.page.PageTool;

import java.io.Serializable;
import java.util.List;

/**
* <p>
* 角色类型 服务类
* </p>
*
* @author lgw
* @since 2020-04-02
*/
public interface InfoRoleTypeService extends BaseService<InfoRoleType> {


/**
* 跟角色授权栏目类型
* @param infoRoleImpowerTypeQueryParam
* @return
* @throws Exception
*/
ApiResult setTypeToRole(InfoRoleImpowerTypeQueryParam infoRoleImpowerTypeQueryParam) throws Exception;


/**
*获取当前用户拥有的tree
* @return
* @throws Exception
*/
List<Object> getRoleTypeTreeList() throws Exception;

/**
* 获取角色授权栏目类型树
* @return
* @throws Exception
*/
List<Object> impowerTypeTreeList(Long roleId) throws Exception;


/**
* 根据ID获取查询对象
*
* @param id
* @return
*/
InfoRoleTypeQueryVo getInfoRoleTypeById(Serializable id) throws Exception;

/**
* 获取分页对象
*
* @param infoRoleTypeQueryParam
* @return
*/
PageTool<InfoRoleTypeQueryVo> getInfoRoleTypePageList(InfoRoleTypeQueryParam infoRoleTypeQueryParam) throws Exception;

}

+ 71
- 0
src/main/java/com/xdf/creative/module/service/InfoStoreService.java Zobrazit soubor

@@ -0,0 +1,71 @@
package com.xdf.creative.module.service;

import com.xdf.creative.base.params.creative.InfoStoreAddParam;
import com.xdf.creative.base.params.creative.InfoStoreQueryParam;
import com.xdf.creative.base.params.creative.InfoStoreUrlParam;
import com.xdf.creative.base.service.BaseService;
import com.xdf.creative.base.vo.creative.InfoStoreQueryVo;
import com.xdf.creative.module.entity.InfoStore;
import com.xdf.creative.util.page.ApiResult;
import com.xdf.creative.util.page.PageTool;

import java.io.Serializable;

/**
* <p>
* 文件库 服务类
* </p>
*
* @author lgw
* @since 2020-03-31
*/
public interface InfoStoreService extends BaseService<InfoStore> {

/**
* 添加文件库
* @param infoStoreAddParam
* @return
*/
ApiResult addStore(InfoStoreAddParam infoStoreAddParam);



/**
* 更改图片状态
* @param id
* @return
*/
ApiResult delStore(Serializable id);


/**
* 获取分页对象
*
* @param infoStoreQueryParam
* @return
*/
PageTool<InfoStoreQueryVo> getUserStorePage(InfoStoreQueryParam infoStoreQueryParam) throws Exception;



/**
* 根据ID获取查询对象
*
* @param id
* @return
*/
InfoStoreQueryVo getInfoStoreById(Serializable id) throws Exception;

/**
* 获取分页对象
*
* @param infoStoreQueryParam
* @return
*/
PageTool<InfoStoreQueryVo> getInfoStorePageList(InfoStoreQueryParam infoStoreQueryParam) throws Exception;



ApiResult getUrlStort(InfoStoreUrlParam infoStoreUrlParam);

}

+ 1
- 1
src/main/java/com/xdf/creative/module/service/SysUserService.java Zobrazit soubor

@@ -35,7 +35,7 @@ public interface SysUserService extends BaseService<SysUser> {
* @return
* @throws Exception
*/
LoginSysUserTokenVo login(LoginParam loginParam) throws Exception;
ApiResult login(LoginParam loginParam) throws Exception;


/**

+ 4
- 1
src/main/java/com/xdf/creative/module/service/impl/InfoContentServiceImpl.java Zobrazit soubor

@@ -367,7 +367,9 @@ public class InfoContentServiceImpl extends BaseServiceImpl<InfoContentMapper, I
if (null == infoContent) {
return ApiResult.error(StatusCode.FORM_SUBMIT_UPDATE_VERIFY);
}
if (!InfoStateTypeEnum.INFO_STATE_TYPE_DRAFT.getCode().equals(infoContent.getState())) {
if (!InfoStateTypeEnum.INFO_STATE_TYPE_DRAFT.getCode().equals(infoContent.getState())
&&!InfoStateTypeEnum.INFO_STATE_TYPE_FIRST_AUDIT_BACK.getCode().equals(infoContent.getState())
&&!InfoStateTypeEnum.INFO_STATE_TYPE_FINAL_AUDIT_BACK.getCode().equals(infoContent.getState())) {
return ApiResult.error(StatusCode.FORM_UPDATE_STATE_VERIFY);
}
infoContent.setSubmitTime(new Date());
@@ -557,6 +559,7 @@ public class InfoContentServiceImpl extends BaseServiceImpl<InfoContentMapper, I
*/
@Override
public PageTool<InfoContentBackSearchQueryVo> getInfoContentByAdd(InfoContentBackSearchQueryParam infoContentBackSearchQueryParam) throws Exception {
infoContentBackSearchQueryParam.setUserId(getUserId());
Page page = setPageParam(infoContentBackSearchQueryParam);
IPage<InfoContentBackSearchQueryVo> iPage = infoContentMapper.getInfoContentByAdd(page, infoContentBackSearchQueryParam);
return new PageTool(iPage);

+ 134
- 0
src/main/java/com/xdf/creative/module/service/impl/InfoRoleTypeServiceImpl.java Zobrazit soubor

@@ -0,0 +1,134 @@
package com.xdf.creative.module.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xdf.creative.base.params.creative.InfoRoleImpowerTypeQueryParam;
import com.xdf.creative.base.params.creative.InfoRoleTypeQueryParam;
import com.xdf.creative.base.service.impl.BaseServiceImpl;
import com.xdf.creative.base.vo.creative.InfoRoleTypeQueryVo;
import com.xdf.creative.base.vo.creative.SysRoleQueryVo;
import com.xdf.creative.enums.StatusCode;
import com.xdf.creative.module.entity.InfoRoleType;
import com.xdf.creative.module.entity.InfoType;
import com.xdf.creative.module.entity.SysRole;
import com.xdf.creative.module.entity.SysUser;
import com.xdf.creative.module.mapper.InfoRoleTypeMapper;
import com.xdf.creative.module.service.InfoRoleTypeService;
import com.xdf.creative.module.service.InfoTypeService;
import com.xdf.creative.module.service.SysRoleService;
import com.xdf.creative.module.service.SysUserService;
import com.xdf.creative.util.page.ApiResult;
import com.xdf.creative.util.page.PageTool;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.Date;
import java.util.List;


/**
* <p>
* 角色类型 服务实现类
* </p>
*
* @author lgw
* @since 2020-04-02
*/
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class InfoRoleTypeServiceImpl extends BaseServiceImpl<InfoRoleTypeMapper, InfoRoleType> implements InfoRoleTypeService {

@Autowired
private InfoRoleTypeMapper infoRoleTypeMapper;

@Autowired
private SysRoleService sysRoleService;

@Autowired
private InfoTypeService infoTypeService;

@Autowired
private SysUserService sysUserService;



/**
* 给角色授权新闻类型
* @param infoRoleImpowerTypeQueryParam
* @return
* @throws Exception
*/
@Override
public ApiResult setTypeToRole(InfoRoleImpowerTypeQueryParam infoRoleImpowerTypeQueryParam) throws Exception {
SysRole sysRole = sysRoleService.getById(infoRoleImpowerTypeQueryParam.getRoleId());
if(null ==sysRole){
return ApiResult.error(StatusCode.SYS_ROLE_EXIST_NO);
}
if(infoRoleImpowerTypeQueryParam.getInfoTypeList().isEmpty()){
return ApiResult.error(StatusCode.SYS_ROLE_PERMISSION_EXIST);
}
this.remove(new QueryWrapper<InfoRoleType>().eq("role_id",sysRole.getId()));

for (String typeId:infoRoleImpowerTypeQueryParam.getInfoTypeList()
) {
InfoType infoType = infoTypeService.getOne(new QueryWrapper<InfoType>().eq("type_id",typeId));
if(null!=infoType){
InfoRoleType infoRoleType = new InfoRoleType();
infoRoleType.setRoleId(sysRole.getId());
infoRoleType.setCreateTime(new Date());
infoRoleType.setUpdateTime(new Date());
infoRoleType.setInfoTypeId(infoType.getId());
this.saveOrUpdate(infoRoleType);
}
}
return ApiResult.ok();
}

/**
* 获取用户拥有的栏目类型树
* @return
* @throws Exception
*/
@Override
public List<Object> getRoleTypeTreeList() throws Exception {

SysUser sysUser = sysUserService.getById(getUserId());
if(null!=sysUser){
ApiResult.fail("当前用户已失效,请刷新后登录!");
}
return baseMapper.getRoleTypeTreeList(sysUser.getId());
}

/**
* 获取角色授权栏目类型树
* @return
* @throws Exception
*/
@Override
public List<Object> impowerTypeTreeList(Long roleId) throws Exception {
SysRole sysRole = sysRoleService.getById(roleId);
if(null==sysRole){
ApiResult.fail("所选角色不存在或已经删除,请刷新后再试!");
}
return baseMapper.impowerTypeTreeList(roleId);
}


@Override
public InfoRoleTypeQueryVo getInfoRoleTypeById(Serializable id) throws Exception {
return infoRoleTypeMapper.getInfoRoleTypeById(id);
}

@Override
public PageTool<InfoRoleTypeQueryVo> getInfoRoleTypePageList(InfoRoleTypeQueryParam infoRoleTypeQueryParam) throws Exception {
Page page = setPageParam(infoRoleTypeQueryParam);
IPage<InfoRoleTypeQueryVo> iPage = infoRoleTypeMapper.getInfoRoleTypePageList(page, infoRoleTypeQueryParam);
return new PageTool(iPage);
}

}

+ 164
- 0
src/main/java/com/xdf/creative/module/service/impl/InfoStoreServiceImpl.java Zobrazit soubor

@@ -0,0 +1,164 @@
package com.xdf.creative.module.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xdf.creative.base.params.creative.InfoStoreAddParam;
import com.xdf.creative.base.params.creative.InfoStoreQueryParam;
import com.xdf.creative.base.params.creative.InfoStoreUrlEntityParam;
import com.xdf.creative.base.params.creative.InfoStoreUrlParam;
import com.xdf.creative.base.service.impl.BaseServiceImpl;
import com.xdf.creative.base.vo.creative.InfoStoreQueryVo;
import com.xdf.creative.enums.StateEnum;
import com.xdf.creative.enums.StatusCode;
import com.xdf.creative.module.entity.InfoStore;
import com.xdf.creative.module.mapper.InfoStoreMapper;
import com.xdf.creative.module.service.InfoStoreService;
import com.xdf.creative.util.StringUtil;
import com.xdf.creative.util.UUIDUtil;
import com.xdf.creative.util.image.ImageUtils;
import com.xdf.creative.util.page.ApiResult;
import com.xdf.creative.util.page.PageTool;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
* <p>
* 文件库 服务实现类
* </p>
*
* @author lgw
* @since 2020-03-31
*/
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class InfoStoreServiceImpl extends BaseServiceImpl<InfoStoreMapper, InfoStore> implements InfoStoreService {

@Autowired
private InfoStoreMapper infoStoreMapper;

@Value("${wx_basePath}")
private String wxPath;


public static ArrayList<String> fileTypeList = new ArrayList<String>() {{
add("PDF");
add("DOC");
add("DOCX");
add("XLS");
add("XLSX");
add("PPT");
add("PPTX");
add("PNG");
add("JPG");
add("TXT");
}};

/**
* 增加文件到图片库
* @param infoStoreAddParam
* @return
*/
@Override
public ApiResult addStore(InfoStoreAddParam infoStoreAddParam) {
InfoStore infoStore = new InfoStore();
BeanUtils.copyProperties(infoStoreAddParam,infoStore);
infoStore.setCreateTime(new Date());
infoStore.setState(StateEnum.ENABLE.getKey());
infoStore.setCreateUserId(getUserId());
this.saveOrUpdate(infoStore);
return ApiResult.ok();
}

/**
* 把图片停用启用
* @param id
* @return
*/
@Override
public ApiResult delStore(Serializable id) {
InfoStore infoStore = this.getById(id);
if(null==infoStore){
return ApiResult.error(StatusCode.FORM_SUBMIT_UPDATE_VERIFY);
}
if(StateEnum.DISABLE.getKey().equals(infoStore.getState())){
infoStore.setState(StateEnum.ENABLE.getKey());
}else{
infoStore.setState(StateEnum.DISABLE.getKey());
}
this.saveOrUpdate(infoStore);
return ApiResult.ok();
}

/**
* 用户图片库调用列表
* @param infoStoreQueryParam
* @return
* @throws Exception
*/
@Override
public PageTool<InfoStoreQueryVo> getUserStorePage(InfoStoreQueryParam infoStoreQueryParam) throws Exception {
Page page = setPageParam(infoStoreQueryParam);
IPage<InfoStoreQueryVo> iPage = infoStoreMapper.getUserStorePage(page, infoStoreQueryParam);
return new PageTool(iPage);
}


@Override
public InfoStoreQueryVo getInfoStoreById(Serializable id) throws Exception {
return infoStoreMapper.getInfoStoreById(id);
}


/**
* 后台管理图片库列表
* @param infoStoreQueryParam
* @return
* @throws Exception
*/
@Override
public PageTool<InfoStoreQueryVo> getInfoStorePageList(InfoStoreQueryParam infoStoreQueryParam) throws Exception {
Page page = setPageParam(infoStoreQueryParam);
IPage<InfoStoreQueryVo> iPage = infoStoreMapper.getInfoStorePageList(page, infoStoreQueryParam);
return new PageTool(iPage);
}

@Override
public ApiResult getUrlStort(InfoStoreUrlParam infoStoreUrlParam) {
List<InfoStoreUrlEntityParam> fileList = new ArrayList<InfoStoreUrlEntityParam>();
Date dt = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String indexName = sdf.format(dt);
List<InfoStoreUrlEntityParam> urlList = infoStoreUrlParam.getUrlList();
for (InfoStoreUrlEntityParam infoStoreUrlEntityParam:urlList
) {
if(!StringUtil.isEmpty(infoStoreUrlEntityParam.getType())&&fileTypeList.contains(infoStoreUrlEntityParam.getType().toUpperCase())&&!StringUtil.isEmpty(infoStoreUrlParam.getFilePath())) {
String fileName = indexName + UUIDUtil.getUUID();
if (ImageUtils.readFileByUrl(infoStoreUrlParam.getFilePath(), fileName, infoStoreUrlEntityParam.getType(),
infoStoreUrlEntityParam.getUrl())) {
InfoStoreUrlEntityParam infoStoreUrlEntityParamNew = new InfoStoreUrlEntityParam();
infoStoreUrlEntityParamNew.setNumber(infoStoreUrlEntityParam.getNumber()).setUrl(
wxPath + fileName + "." + infoStoreUrlEntityParam.getType()).setType(
infoStoreUrlEntityParam.getType()
);
fileList.add(infoStoreUrlEntityParamNew);

}
}
}

return ApiResult.ok(fileList);
}

}

+ 12
- 8
src/main/java/com/xdf/creative/module/service/impl/SysUserServiceImpl.java Zobrazit soubor

@@ -84,19 +84,19 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>

/*登录*/
@Override
public LoginSysUserTokenVo login(LoginParam loginParam) throws Exception {
public ApiResult login(LoginParam loginParam) throws Exception {
// 校验验证码
String userName = loginParam.getUsername();
SysUser sysUser = getSysUserByUserName(userName);
if (sysUser == null) {
log.error("登陆失败,用户名不正确,loginParam:{}", loginParam);
this.loginFail(userName,loginParam.getPassword(),"登陆失败,用户名不正确!");
throw new SysLoginException(ApiCode.USERNAME_ERROR);
return ApiResult.fail(ApiCode.USERNAME_ERROR);
}
if (StateEnum.DISABLE.getKey().equals(sysUser.getState())) {
log.debug("登陆失败,用户不可用,loginParam:{}", loginParam);
this.loginFail(userName,loginParam.getPassword(),"登陆失败,用户不可用!");
throw new SysLoginException(ApiCode.USERNAME_ERROR);
return ApiResult.fail(ApiCode.USERNAME_ERROR);
}

String encryptPassword = PasswordUtil.encrypt(loginParam.getPassword(), sysUser.getSalt());
@@ -107,10 +107,10 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>

SysOrganizeQueryVo sysOrganizeQueryVo = sysOrganizeService.getSysOrganizeById(sysUser.getOrganizeId());
if (sysOrganizeQueryVo == null) {
throw new BusinessException("组织不存在");
return ApiResult.fail("组织不存在");
}
if (!StateEnum.ENABLE.getKey().equals(sysOrganizeQueryVo.getState())) {
throw new BusinessException("组织已禁用");
return ApiResult.fail("组织已禁用");
}
// 将系统用户对象转换成登陆用户对象
LoginSysUserVo loginSysUserVo = SysUserConvert.INSTANCE.sysUserToLoginSysUserVo(sysUser);
@@ -124,7 +124,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
List<SysRoleQueryVo> sysRoleQueryVoList = sysRoleService.getUserRoleByUserId(sysUser.getId());
if (CollectionUtil.isEmpty(sysRoleQueryVoList)) {
this.loginFail(userName,loginParam.getPassword(),"角色不存在!");
throw new BusinessException("角色不存在");
return ApiResult.fail("角色不存在");
}
sysRoleQueryVoList.stream().forEach(sysRoleQueryVo -> {
roleIdSet.add(sysRoleQueryVo.getId());
@@ -180,7 +180,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
loginSysUserTokenVo.setToken(token);
loginSysUserTokenVo.setLoginSysUserVo(loginSysUserVo);
this.loginSuccess(sysUser.getId());
return loginSysUserTokenVo;
return ApiResult.ok(loginSysUserTokenVo);
}

@Override
@@ -560,7 +560,11 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
sysAccountLog.setContent("登录账号:"+username+";密码:"+password+" 原因:"+nameValue);
sysAccountLog.setCreateTime(new Date());
//获取用户名
sysAccountLog.setUserId(getUserId());
// if(null==getUserId()) {
//
// }else{
// sysAccountLog.setUserId(getUserId());
// }
sysAccountLog.setType(LogTypeEnum.LOG_TYPE_FAIL.getCode());
//获取用户ip地址
sysAccountLog.setIp(IpUtil.getRequestIp());

+ 72
- 17
src/main/java/com/xdf/creative/shiro/filter/ConfigPathInterceptor.java Zobrazit soubor

@@ -4,17 +4,21 @@ import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.xdf.creative.base.vo.creative.OauthTokenQueryVo;
import com.xdf.creative.enums.ApiCode;
import com.xdf.creative.module.entity.OauthToken;
import com.xdf.creative.module.entity.SysUser;
import com.xdf.creative.module.service.OauthTokenService;
import com.xdf.creative.module.service.SysPermissionService;
import com.xdf.creative.module.service.SysUserService;
import com.xdf.creative.shiro.jwt.JwtProperties;
import com.xdf.creative.shiro.jwt.JwtUtil;
import com.xdf.creative.shiro.jwt.SaltUtil;
import com.xdf.creative.util.BeanUtil;
import com.xdf.creative.util.StringUtil;
import com.xdf.creative.util.page.ApiResult;
import org.apache.shiro.web.util.WebUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
@@ -24,6 +28,8 @@ import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.util.*;

/**
@@ -39,12 +45,14 @@ public class ConfigPathInterceptor implements HandlerInterceptor {
private SysUserService sysUserService;
@Autowired
private OauthTokenService oauthTokenService;
@Autowired
private JwtProperties jwtProperties;


@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String token = request.getHeader("Authorization");
if (null == token||StringUtil.isEmpty(token)) {
if (null == token||StringUtil.isEmpty(token)||token.length()<50) {
ApiResult result = new ApiResult();
result.setCode(ApiCode.TOKEN_INVALID.getCode());
result.setMsg(ApiCode.TOKEN_INVALID.getMsg());
@@ -79,13 +87,52 @@ public class ConfigPathInterceptor implements HandlerInterceptor {
public boolean verifyToken(String token,HttpServletRequest request, HttpServletResponse response) {
String requestUrl = request.getRequestURI();
ApiResult result = new ApiResult();
//token失效
//token失效 先检查是否存在 不存在则直接令牌过去重新登录
if (JwtUtil.isExpired(token)) {
log.error("令牌过期");
result.setCode(ApiCode.TOKEN_INVALID.getCode());
result.setMsg(ApiCode.TOKEN_INVALID.getMsg());
getResponseResult(response, result);
return false;
//先查token是否存在
OauthTokenQueryVo oauthTokenQueryVo =oauthTokenService.getOauthTokenByToken(token);
if(null==oauthTokenQueryVo){
log.error("令牌过期");
result.setCode(ApiCode.TOKEN_INVALID.getCode());
result.setMsg(ApiCode.TOKEN_INVALID.getMsg());
getResponseResult(response, result);
return false;
}else{

setJwtPropertiesBean();
if(new Date().getTime()-oauthTokenQueryVo.getUpdateTime().getTime()>jwtProperties.getExpireSecond()*1000){
result.setCode(ApiCode.TOKEN_INVALID.getCode());
result.setMsg(ApiCode.TOKEN_INVALID.getMsg());
getResponseResult(response, result);
return false;
}else{
return true;

}

// setJwtPropertiesBean();
// String oldToken = oauthTokenQueryVo.getAccessToken();
// Long userId = oauthTokenQueryVo.getUserId();
// SysUser sysUser = sysUserService.getById(userId);
// // 获取数据库中保存的盐值
// String newSalt = SaltUtil.getSalt(sysUser.getSalt(), jwtProperties);
// Long expireSecond = jwtProperties.getExpireSecond();
// String newToken = JwtUtil.generateToken(userId, sysUser.getUsername(), sysUser.getOrganizeId(), sysUser.getUserType(), newSalt, Duration.ofSeconds(expireSecond));
// log.error("令牌过期");
// oauthTokenQueryVo.setAccessToken(newToken);
// oauthTokenQueryVo.setExpireTime(JwtUtil.getExpireDate(newToken));
// OauthToken oauthToken = new OauthToken();
// BeanUtils.copyProperties(oauthTokenQueryVo,oauthToken);
// oauthTokenService.saveOrUpdate(oauthToken);
//
// result.setCode(ApiCode.REFRESH_TOKEN_SUCCESS.getCode());
// result.setMsg(ApiCode.REFRESH_TOKEN_SUCCESS.getMsg());
// result.setData(newToken);
// getResponseResult(response, result);
// return true;

}

}
String userName = JwtUtil.getUsername(token);
Long userId = JwtUtil.getUserId(token);
@@ -104,6 +151,12 @@ public class ConfigPathInterceptor implements HandlerInterceptor {
result.setMsg(ApiCode.TOKEN_INVALID.getMsg());
getResponseResult(response, result);
return false;
}else{
//更新更新时间
OauthToken oauthToken = new OauthToken();
BeanUtils.copyProperties(oauthTokenQueryVo,oauthToken);
oauthToken.setUpdateTime(new Date());
oauthTokenService.saveOrUpdate(oauthToken);
}
//根据用户名去数据库查询用户信息
SysUser user = null;
@@ -124,7 +177,7 @@ public class ConfigPathInterceptor implements HandlerInterceptor {
getResponseResult(response, result);
return false;
}
/* List<String> permissionList = Arrays.asList(oauthTokenQueryVo.getPermissions().trim().split(","));
List<String> permissionList = Arrays.asList(oauthTokenQueryVo.getPermissions().trim().split(","));
boolean permissionflag = false;
for (String permissionUrl:permissionList ) {
if(permissionUrl.contains(requestUrl)){
@@ -137,15 +190,9 @@ public class ConfigPathInterceptor implements HandlerInterceptor {
result.setMsg(ApiCode.NOT_PERMISSION.getMsg());
getResponseResult(response, result);
return false;
}*/

// if (!permissionList.contains(requestUrl)) {
// log.error("该用户没有权限访问"+requestUrl);
// result.setCode(ApiCode.NOT_PERMISSION.getCode());
// result.setMsg(ApiCode.NOT_PERMISSION.getMsg());
// getResponseResult(response, result);
// return false;
// }
}


return true;
}
/*
@@ -182,6 +229,14 @@ public class ConfigPathInterceptor implements HandlerInterceptor {
oauthTokenService = BeanUtil.getBean(OauthTokenService.class);
}
}

public void setJwtPropertiesBean() {
if (null == jwtProperties) {
jwtProperties = BeanUtil.getBean(JwtProperties.class);
}
}


}



+ 1
- 0
src/main/java/com/xdf/creative/shiro/jwt/JwtUtil.java Zobrazit soubor

@@ -223,6 +223,7 @@ public class JwtUtil {
return null;
}
return decodedJWT.getIssuedAt();

}

/**

+ 2
- 1
src/main/java/com/xdf/creative/util/file/UploadUtil.java Zobrazit soubor

@@ -81,7 +81,8 @@ public final class UploadUtil {
if (!saveDir.exists()) {
boolean flag = saveDir.mkdirs();
if (!flag) {
throw new RuntimeException("创建" + saveDir + "目录失败!");
log.error("创建" + saveDir + "目录失败!");

}
}
String originalFilename = multipartFile.getOriginalFilename();

+ 89
- 0
src/main/java/com/xdf/creative/util/image/ImageUtils.java Zobrazit soubor

@@ -0,0 +1,89 @@
package com.xdf.creative.util.image;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.*;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

public class ImageUtils {


private static Logger log = LoggerFactory.getLogger(ImageUtils.class);
public static void main(String[] args) throws Exception {
// String path ="https://mmbiz.qpic.cn/mmbiz_png/qdWB7wH8tTr9fREsrH8pjYA86OuqHoP2IAWiaicNW88AFWwQFALKb27tVFhIGHrWRNlD5dAtK07o6C4oe0t8ic15Q/640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1";

String path = "https://mmbiz.qpic.cn/mmbiz_jpg/mic9Ll6Oy4sP9xwic0EgKSSRfNmAAV9S0ukMicFFOxKThvRK1ejJY1Isz1EKhPOO3GWpbWsLS94HHib8e5Gm6Ir6hA/640?wx_fmt=jpeg&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1";
//new一个URL对象

}

public static boolean readFileByUrl(String filePath, String filename, String fileType, String path) {

URL url = null;
try {
url = new URL(path);
//打开链接
HttpURLConnection conn = null;
conn = (HttpURLConnection) url.openConnection();
//设置请求方式为"GET"
conn.setRequestMethod("GET");
//超时响应时间为5秒
conn.setConnectTimeout(5 * 1000);
//通过输入流获取图片数据
InputStream inStream = conn.getInputStream();
//得到图片的二进制数据,以二进制封装得到数据,具有通用性
byte[] data = readInputStream(inStream);
//new一个文件对象用来保存图片,默认保存当前工程根目录
File imageFile = new File(filePath+filename+"."+fileType);
//创建输出流
FileOutputStream outStream = new FileOutputStream(imageFile);
//写入数据
outStream.write(data);
//关闭输出流
outStream.close();
} catch (MalformedURLException e) {
e.printStackTrace();
log.error("获取网络图片URL初始化异常,地址:"+path);
return false;
} catch (IOException e) {
e.printStackTrace();
log.error("获取网络图片连接异常,地址:"+path);
return false;
} catch (Exception e) {
e.printStackTrace();
log.error("获取网络图文件输出流异常,地址:"+path);
return false;
}

return true;
}


/**
* 写入文件
*
* @param inStream
* @return
* @throws Exception
*/
public static byte[] readInputStream(InputStream inStream) throws Exception {
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
//创建一个Buffer字符串
byte[] buffer = new byte[1024];
//每次读取的字符串长度,如果为-1,代表全部读取完毕
int len = 0;
//使用一个输入流从buffer里把数据读取出来
while ((len = inStream.read(buffer)) != -1) {
//用输出流往buffer里写入数据,中间参数代表从哪个位置开始读,len代表读取的长度
outStream.write(buffer, 0, len);
}
//关闭输入流
inStream.close();
//把outStream里的数据写入内存
return outStream.toByteArray();
}

}

+ 2
- 3
src/main/resources/application.properties Zobrazit soubor

@@ -13,12 +13,11 @@ auth_skip_urls=\






#upload_basePath=/mnt/dfzx/nfs01/dfzx_creative/
upload_basePath=D:/xdf_image/xdf/

wx_basePath=wx/


#xss¹¥»÷À¹½Ø
xss.enabled=true

+ 4
- 2
src/main/resources/application.yml Zobrazit soubor

@@ -34,7 +34,7 @@ spring:
driver-class-name: com.mysql.jdbc.Driver
platform: mysql
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://192.168.1.101:3306/creative_db?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
url: jdbc:mysql://127.0.0.1:3306/creative_db?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
# url: jdbc:mysql://172.19.175.249:3306/creative_db?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: 123456
@@ -78,6 +78,7 @@ spring:
max-file-size: 5MB
max-request-size: 10MB


############################ JWT start #############################
spring-boot-plus:
jwt:
@@ -90,7 +91,7 @@ spring-boot-plus:
# 观众
audience: web
# 默认过期时间1小时,单位:秒
expire-second: 3600
expire-second: 7200
# 是否刷新token
refresh-token: true
# 刷新token的时间间隔,默认10分钟,单位:秒
@@ -118,3 +119,4 @@ mybatis-plus:
type-aliases-package: com.xdf.creative.module.entity
################################ mybatis-plus end ##################################



+ 2
- 0
src/main/resources/logback-spring.xml Zobrazit soubor

@@ -82,6 +82,8 @@

<!-- 解决SpringBootAdmin错误日志问题 -->
<logger name="org.apache.catalina.connector.CoyoteAdapter" level="OFF"/>
<logger name="com.xdf.creative.module.mapper" level="DEBUG"/>


<root level="INFO">
<appender-ref ref="CONSOLE"/>

+ 95
- 75
src/main/resources/mapper/InfoContentMapper.xml Zobrazit soubor

@@ -18,35 +18,35 @@
</sql>

<sql id="Base_If_Condition">
<if test="param.id !=null and param.id!=''">
and ${alias}.id=#{param.id}
</if>
<if test="param.title !=null and param.title!=''">
and ${alias}.title like CONCAT('%',#{param.title},'%')
</if>
<if test="param.state !=null and param.state!=''">
and ${alias}.state=#{param.state}
</if>
<if test="param.istop !=null and param.istop!=''">
and ${alias}.istop=#{param.istop}
</if>
<if test="param.onlineType !=null and param.onlineType!=''">
and ${alias}.online_type=#{param.onlineType}
</if>
<if test="param.id !=null and param.id!=''">
and ${alias}.id=#{param.id}
</if>
<if test="param.title !=null and param.title!=''">
and ${alias}.title like CONCAT('%',#{param.title},'%')
</if>
<if test="param.state !=null">
and ${alias}.state=#{param.state}
</if>
<if test="param.istop !=null">
and ${alias}.istop=#{param.istop}
</if>
<if test="param.onlineType !=null">
and ${alias}.online_type=#{param.onlineType}
</if>
</sql>

<sql id="Base_User_If_Condition">
<if test="param.userName !=null and param.userName!=''">
and ${alias}.username like CONCAT('%',#{param.userName},'%')
and ${alias}.username like CONCAT('%',#{param.userName},'%')
</if>
<if test="param.nickName !=null and param.nickName!=''">
and ${alias}.nickname like CONCAT('%',#{param.nickName},'%')
and ${alias}.nickname like CONCAT('%',#{param.nickName},'%')
</if>
</sql>

<sql id="Base_Type_If_Condition">
<if test="param.infoTypeId !=null and param.infoTypeId!=''">
and ${alias}.type_id like CONCAT('',#{param.infoTypeId},'%')
and ${alias}.type_id like CONCAT('',#{param.infoTypeId},'%')
</if>
</sql>

@@ -54,7 +54,9 @@
<select id="getHomePageInfo"
resultType="com.xdf.creative.base.vo.creative.InfoContentHomePageQueryVo"
parameterType="com.xdf.creative.base.params.creative.InfoContentHomePageQueryParam">
select a.id,a.title,a.final_audit_time,a.sort,a.image_url,a.istop,a.istop_time,b.type_id,b.info_name,c.hyperlink,a.content_type from info_content a
select
a.id,a.title,a.final_audit_time,a.sort,a.image_url,a.istop,a.istop_time,b.type_id,b.info_name,c.hyperlink,a.content_type
from info_content a
left join info_type b on a.info_type_id =b.id
left join info_detail c on a.foreign_id = c.foreign_id
where a.deleted=0 and a.online_type=1 and a.state = 3
@@ -62,74 +64,86 @@
and b.type_id like CONCAT('',#{param.typeId},'%')
</if>
order by a.istop DESC,a.sort
DESC,a.final_audit_time ASC LIMIT #{param.contentSize}
DESC,a.final_audit_time DESC LIMIT #{param.contentSize}
</select>


<select id="getSearchWebInfo"
resultType="com.xdf.creative.base.vo.creative.InfoContentWebSearchQueryVo"
parameterType="com.xdf.creative.base.params.creative.InfoContentWebSearchQueryParam">
select a.id,a.title,a.final_audit_time,a.image_url,a.sort,a.istop,a.istop_time,b.type_id,b.info_name,c.digest,c.hyperlink,a.content_type
from info_content a left join info_detail c on a.foreign_id = c.foreign_id left join info_type b on a.info_type_id =b.id where
a.deleted=0 and a.online_type=1 and a.state = 3
<!-- select a.id,a.title,a.final_audit_time,a.image_url,a.sort,a.istop,a.istop_time,b.type_id,b.info_name,c.digest,c.hyperlink,a.content_type
from info_content a left join info_detail c on a.foreign_id = c.foreign_id left join info_type b on a.info_type_id =b.id where
a.deleted=0 and a.online_type=1 and a.state = 3
<if test="param.typeId !=null and param.typeId!=''">
and b.type_id like CONCAT('',#{param.typeId},'%')
</if>
<if test="param.title !=null and param.title!=''">
and ( a.title like CONCAT('%',#{param.title},'%')
or c.digest like CONCAT('%',#{param.title},'%')
or c.content like CONCAT('%',#{param.title},'%')
)
</if>-->


select
a.id,a.title,a.final_audit_time,a.image_url,a.sort,a.istop,a.istop_time,b.type_id,b.info_name,c.digest,c.hyperlink,a.content_type
from info_content a left join info_detail c on a.foreign_id = c.foreign_id left join info_type b on
a.info_type_id =b.id where
a.deleted=0 and a.online_type=1 and a.state = 3
<if test="param.typeId !=null and param.typeId!=''">
and b.type_id like CONCAT('',#{param.typeId},'%')
</if>
<if test="param.title !=null and param.title!=''">
and ( a.title like CONCAT('%',#{param.title},'%')
or c.digest like CONCAT('%',#{param.title},'%')
or c.content like CONCAT('%',#{param.title},'%')
)
and a.title like CONCAT('%',#{param.title},'%')
</if>
union select
a.id,a.title,a.final_audit_time,a.image_url,a.sort,a.istop,a.istop_time,b.type_id,b.info_name,c.digest,c.hyperlink,a.content_type
from info_content a left join info_detail c on a.foreign_id = c.foreign_id left join info_type b on
a.info_type_id =b.id where
a.deleted=0 and a.online_type=1 and a.state = 3
<if test="param.typeId !=null and param.typeId!=''">
and b.type_id like CONCAT('',#{param.typeId},'%')
</if>
<if test="param.title !=null and param.title!=''">
and c.digest like CONCAT('%',#{param.title},'%')
</if>
order by a.istop DESC,a.sort DESC,a.final_audit_time ASC

union select
a.id,a.title,a.final_audit_time,a.image_url,a.sort,a.istop,a.istop_time,b.type_id,b.info_name,c.digest,c.hyperlink,a.content_type
from info_content a left join info_detail c on a.foreign_id = c.foreign_id left join info_type b on
a.info_type_id =b.id where
a.deleted=0 and a.online_type=1 and a.state = 3
<if test="param.typeId !=null and param.typeId!=''">
and b.type_id like CONCAT('',#{param.typeId},'%')
</if>

<!-- select * from ( select a.id,a.title,a.final_audit_time,a.sort,a.istop,a.istop_time,b.type_id,b.info_name,c.digest,c.hyperlink from info_content a
left join info_detail c on a.foreign_id = c.foreign_id left join info_type b on a.info_type_id =b.id where a.deleted=0 and a.online_type=1
<if test="param.typeId !=null and param.typeId!=''">
and b.type_id like CONCAT('%',#{param.typeId},'%')
</if>
<if test="param.title !=null and param.title!=''">
and a.title like CONCAT('%',#{param.title},'%')
</if>
union select a.id,a.title,a.final_audit_time,a.sort,a.istop,a.istop_time,b.type_id,b.info_name,c.digest,c.hyperlink from info_content a
left join info_detail c on a.foreign_id = c.foreign_id left join info_type b on a.info_type_id =b.id where a.deleted=0 and a.online_type=1
<if test="param.typeId !=null and param.typeId!=''">
and b.type_id like CONCAT('%',#{param.typeId},'%')
</if>
<if test="param.title !=null and param.title!=''">
and c.digest like CONCAT('%',#{param.title},'%')
</if>
union select a.id,a.title,a.final_audit_time,a.sort,a.istop,a.istop_time,b.type_id,b.info_name,c.digest,c.hyperlink from info_content a
left join info_detail c on a.foreign_id = c.foreign_id left join info_type b on a.info_type_id =b.id where a.deleted=0 and a.online_type=1
<if test="param.typeId !=null and param.typeId!=''">
and b.type_id like CONCAT('%',#{param.typeId},'%')
</if>
<if test="param.title !=null and param.title!=''">
and c.content like CONCAT('%',#{param.title},'%')
</if>
)a order by a.istop DESC,a.sort DESC,a.final_audit_time ASC-->
<if test="param.title !=null and param.title!=''">
and c.content like CONCAT('%',#{param.title},'%')
</if>

</select>

<select id="getInfoContentByAdd" resultType="com.xdf.creative.base.vo.creative.InfoContentBackSearchQueryVo"

<select id="getInfoContentByAdd" resultType="com.xdf.creative.base.vo.creative.InfoContentBackSearchQueryVo"
parameterType="com.xdf.creative.base.params.creative.InfoContentBackSearchQueryParam">
select
<include refid="Base_Column_List">
<property name="alias" value="a"/>
</include>,
</include>
,
<include refid="Base_User_Column_List">
<property name="alias" value="c"/>
</include>,
</include>
,
<include refid="Base_Type_Column_List">
<property name="alias" value="b"/>
</include>,
</include>
,
d.reason,d.back_time
from info_content a left join info_type b on a.info_type_id =b.id left join sys_user c on a.create_user = c.id
from (select m.* from info_content m where m.info_type_id in(select info_type_id from info_role_type where role_id in (select role_id from sys_user_role where user_id = #{param.userId})))a left join info_type b on a.info_type_id =b.id left join sys_user c on a.create_user = c.id
left join (select * from info_back order by back_time desc limit 1 )d on a.id =d.info_id
<where>
a.deleted = 0
a.deleted = 0
<include refid="Base_If_Condition">
<property name="alias" value="a"/>
</include>
@@ -141,25 +155,28 @@
</include>
</where>

</select>
order by a.create_time desc

</select>


<select id="getInfoContentByFirstAudit" resultType="com.xdf.creative.base.vo.creative.InfoContentBackSearchQueryVo"
<select id="getInfoContentByFirstAudit" resultType="com.xdf.creative.base.vo.creative.InfoContentBackSearchQueryVo"
parameterType="com.xdf.creative.base.params.creative.InfoContentBackSearchQueryParam">
select
<include refid="Base_Column_List">
<property name="alias" value="a"/>
</include>,
</include>
,
<include refid="Base_User_Column_List">
<property name="alias" value="c"/>
</include>,
</include>
,
<include refid="Base_Type_Column_List">
<property name="alias" value="b"/>
</include>
from info_content a left join info_type b on a.info_type_id =b.id left join sys_user c on a.create_user = c.id
<where>
a.deleted = 0 and a.state in(1,2,3,4,5)
a.deleted = 0 and a.state in(1,2,3,4,5)
<include refid="Base_If_Condition">
<property name="alias" value="a"/>
</include>
@@ -171,19 +188,21 @@
</include>
</where>

order by a.submit_time desc
</select>



<select id="getInfoContentByFinalAudit" resultType="com.xdf.creative.base.vo.creative.InfoContentBackSearchQueryVo"
<select id="getInfoContentByFinalAudit" resultType="com.xdf.creative.base.vo.creative.InfoContentBackSearchQueryVo"
parameterType="com.xdf.creative.base.params.creative.InfoContentBackSearchQueryParam">
select
<include refid="Base_Column_List">
<property name="alias" value="a"/>
</include>,
</include>
,
<include refid="Base_User_Column_List">
<property name="alias" value="c"/>
</include>,
</include>
,
<include refid="Base_Type_Column_List">
<property name="alias" value="b"/>
</include>
@@ -200,21 +219,23 @@
<property name="alias" value="b"/>
</include>
</where>
order by a.submit_time desc
</select>


<!-- 内容回收站列表-->
<!-- 内容回收站列表-->

<select id="getInfoContentByRecycle" resultType="com.xdf.creative.base.vo.creative.InfoContentRecycleSearchQueryVo"
<select id="getInfoContentByRecycle" resultType="com.xdf.creative.base.vo.creative.InfoContentRecycleSearchQueryVo"
parameterType="com.xdf.creative.base.params.creative.InfoContentBackSearchQueryParam">
select
<include refid="Base_Column_List">
<property name="alias" value="a"/>
</include>,
</include>
,
<include refid="Base_User_Column_List">
<property name="alias" value="c"/>
</include>,
</include>
,
<include refid="Base_Type_Column_List">
<property name="alias" value="b"/>
</include>
@@ -235,7 +256,6 @@
</select>



<!--根据ID查询-->
<select id="getInfoContentById" resultType="com.xdf.creative.base.vo.creative.InfoContentQueryVo">
select

+ 65
- 0
src/main/resources/mapper/InfoRoleTypeMapper.xml Zobrazit soubor

@@ -0,0 +1,65 @@
<?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.xdf.creative.module.mapper.InfoRoleTypeMapper">


<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, info_type_id, role_id, create_time, update_time
</sql>

<sql id="Base_If_Condition">
<where>
<if test="param.id !=null and param.id!=''">
and id=#{param.id}
</if>
<if test="param.infoTypeId !=null and param.infoTypeId!=''">
and info_type_id=#{param.infoTypeId}
</if>
<if test="param.roleId !=null and param.roleId!=''">
and role_id=#{param.roleId}
</if>
<if test="param.createTime !=null and param.createTime!=''">
and create_time=#{param.createTime}
</if>
<if test="param.updateTime !=null and param.updateTime!=''">
and update_time=#{param.updateTime}
</if>
</where>
</sql>


<!--获取角色拥有的类型tree下拉-->
<select id="getRoleTypeTreeList" resultType="com.xdf.creative.base.vo.creative.InfoTypeQueryVo">
select a.* from info_type a right join info_role_type b on a.id = b.info_type_id
where b.role_id in (select role_id from sys_user_role where user_id = #{userId}) order by a.type_id asc
</select>


<!--角色授权类型tree-->
<select id="impowerTypeTreeList" resultType="com.xdf.creative.base.vo.creative.InfoTypeQueryVo">

select a.*,case when ISNULL(b.info_type_id)=0 and LENGTH(trim(b.info_type_id))>0 then 'true' else 'false'
end as checked from info_type a left join (select distinct info_type_id from info_role_type where role_id = #{roleId})b on a.id =b.info_type_id order by a.type_id asc

</select>


<!--根据ID查询-->
<select id="getInfoRoleTypeById" resultType="com.xdf.creative.base.vo.creative.InfoRoleTypeQueryVo">
select
<include refid="Base_Column_List"/>
from info_role_type where id = #{id}
</select>

<!--分页查询-->
<select id="getInfoRoleTypePageList"
resultType="com.xdf.creative.base.vo.creative.InfoRoleTypeQueryVo"
parameterType="com.xdf.creative.base.params.creative.InfoRoleTypeQueryParam">
select
<include refid="Base_Column_List"/>
from info_role_type
<include refid="Base_If_Condition"/>
</select>

</mapper>

+ 71
- 0
src/main/resources/mapper/InfoStoreMapper.xml Zobrazit soubor

@@ -0,0 +1,71 @@
<?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.xdf.creative.module.mapper.InfoStoreMapper">


<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, name, address, create_time, create_user_id, type, file_type,state
</sql>

<sql id="Base_If_Condition">

<if test="param.id !=null and param.id!=''">
and id=#{param.id}
</if>
<if test="param.name !=null and param.name!=''">
and name like CONCAT('%',#{param.name},'%')
</if>

<if test="param.startCreateTime !=null and param.endCreateTime !=null ">
and create_time &gt;= #{param.startCreateTime} and create_time &lt;=#{param.endCreateTime}
</if>

<if test="param.type !=null and param.type!=''">
and type=#{param.type}
</if>
<if test="param.fileType !=null and param.fileType!=''">
and file_type like CONCAT('%',#{param.fileType},'%')
</if>

</sql>


<!--根据ID查询-->
<select id="getInfoStoreById" resultType="com.xdf.creative.base.vo.creative.InfoStoreQueryVo">
select
<include refid="Base_Column_List"/>
from info_store where id = #{id}
</select>

<!--分页查询-->
<select id="getInfoStorePageList"
resultType="com.xdf.creative.base.vo.creative.InfoStoreQueryVo"
parameterType="com.xdf.creative.base.params.creative.InfoStoreQueryParam">
select
<include refid="Base_Column_List"/>
from info_store
<where>

<include refid="Base_If_Condition"/>
</where>
</select>


<!--分页查询-->
<select id="getUserStorePage"
resultType="com.xdf.creative.base.vo.creative.InfoStoreQueryVo"
parameterType="com.xdf.creative.base.params.creative.InfoStoreQueryParam">
select
<include refid="Base_Column_List"/>
from info_store
<where>
state = 1
<include refid="Base_If_Condition"/>


</where>
</select>


</mapper>

+ 5
- 0
src/main/resources/mapper/InfoTypeMapper.xml Zobrazit soubor

@@ -58,6 +58,11 @@








<!--分页查询-->
<select id="getInfoTypePageList"
resultType="com.xdf.creative.base.vo.creative.InfoTypeQueryVo"

+ 1
- 1
src/main/resources/mapper/SysPermissionMapper.xml Zobrazit soubor

@@ -90,7 +90,7 @@
and sp.deleted = 0
) and state = 1
and deleted = 0
and type = 2
and (type = 2 or type = 1)
</select>



+ 1
- 1
src/main/resources/mapper/SysUserMapper.xml Zobrazit soubor

@@ -29,7 +29,7 @@
<if test="param.email !=null and param.email!=''">
and email like CONCAT('%',#{param.email},'%')
</if>
<if test="param.state !=null and param.state!=''">
<if test="param.state !=null">
and state=#{param.state}
</if>
<if test="param.gender !=null and param.gender!=''">

Načítá se…
Zrušit
Uložit