update 更改模块名称
This commit is contained in:
+171
@@ -0,0 +1,171 @@
|
||||
package com.jero.modules.collection.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.modules.collection.entity.OnlCgformCollection;
|
||||
import com.jero.modules.collection.service.IOnlCgformCollectionService;
|
||||
import com.jero.modules.document.controller.BussDocumentLibraryEOController;
|
||||
import com.jero.modules.phone.service.ISearchCenterService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 我的收藏
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="我的收藏")
|
||||
@RestController
|
||||
@RequestMapping("/collection/onlCgformCollection")
|
||||
@Slf4j
|
||||
public class OnlCgformCollectionController extends JeroController<OnlCgformCollection, IOnlCgformCollectionService> {
|
||||
@Autowired
|
||||
private IOnlCgformCollectionService onlCgformCollectionService;
|
||||
@Autowired
|
||||
BussDocumentLibraryEOController bussDocumentLibraryEOService;
|
||||
@Autowired
|
||||
private ISearchCenterService searchCenterService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-分页列表查询")
|
||||
@ApiOperation(value="我的收藏-分页列表查询", notes="我的收藏-分页列表查询")
|
||||
@PostMapping(value = "/page")
|
||||
public Result<?> queryPageList(@RequestBody Map<String,Object> params){
|
||||
IPage<OnlCgformCollection> pageList = onlCgformCollectionService.queryPageList(params);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-列表查询")
|
||||
@ApiOperation(value="我的收藏-列表查询", notes="我的收藏-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<OnlCgformCollection>> queryList(OnlCgformCollection onlCgformCollection) {
|
||||
List<OnlCgformCollection> list = onlCgformCollectionService.queryList(onlCgformCollection);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param onlCgformCollection
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-添加")
|
||||
@ApiOperation(value="我的收藏-添加", notes="我的收藏-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody OnlCgformCollection onlCgformCollection) {
|
||||
LambdaQueryWrapper<OnlCgformCollection> lambdaQueryWrapper= new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(OnlCgformCollection::getId,onlCgformCollection.getDocumentId())
|
||||
.eq(OnlCgformCollection::getDocumentId,onlCgformCollection.getDocumentId());
|
||||
int count=onlCgformCollectionService.count(lambdaQueryWrapper);
|
||||
if(count==0){
|
||||
onlCgformCollectionService.add(onlCgformCollection);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
else{
|
||||
return Result.error("该值不可重复添加,系统中已存在!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-通过id删除")
|
||||
@ApiOperation(value="我的收藏-通过id删除", notes="我的收藏-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
onlCgformCollectionService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-批量删除")
|
||||
@ApiOperation(value="我的收藏-批量删除", notes="我的收藏-批量删除")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.onlCgformCollectionService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-通过id查询")
|
||||
@ApiOperation(value="我的收藏-通过id查询", notes="我的收藏-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
OnlCgformCollection onlCgformCollection = onlCgformCollectionService.queryById(id);
|
||||
if(onlCgformCollection==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(onlCgformCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 表头中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-表头中英文切换")
|
||||
@ApiOperation(value="我的收藏-表头中英文切换", notes="我的收藏-表头中英文切换")
|
||||
@GetMapping(value = "/getHeader")
|
||||
public Result<List<Map<String, Object>>> getHeader(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
List<Map<String, Object>> list =onlCgformCollectionService.getHeader(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询条件中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-查询条件中英文切换")
|
||||
@ApiOperation(value="我的收藏-查询条件中英文切换", notes="我的收藏-查询条件中英文切换")
|
||||
@GetMapping(value = "/queryCondition")
|
||||
public Result<List<Map<String, Object>>> queryCondition(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
List<Map<String, Object>> list = onlCgformCollectionService.queryCondition(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
@AutoLog(value = "我的收藏-搜索-根据用户获取文档库订阅和收藏信息")
|
||||
@ApiOperation(value = "我的收藏-搜索-根据用户获取文档库订阅和收藏信息", notes = "我的收藏-搜索-根据用户获取文档库订阅和收藏信息")
|
||||
@GetMapping(value = "/getWdkCollectAndSubscribeInfoByUser")
|
||||
public Result<Map<String, Object>> getWdkCollectAndSubscribeInfoByUser(@RequestParam Map<String,Object> params) {
|
||||
return this.searchCenterService.getWdkCollectAndSubscribeInfoByUser(params);
|
||||
}
|
||||
}
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
package com.jero.modules.collection.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.modules.collection.entity.OnlCgformCollection;
|
||||
import com.jero.modules.collection.service.IOnlCgformCollectionService;
|
||||
import com.jero.modules.document.controller.BussDocumentLibraryEOController;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 我的收藏
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="我的收藏")
|
||||
@RestController
|
||||
@RequestMapping("/phone/collection/onlCgformCollection")
|
||||
@Slf4j
|
||||
public class PhoneOnlCgformCollectionController extends JeroController<OnlCgformCollection, IOnlCgformCollectionService> {
|
||||
@Autowired
|
||||
private IOnlCgformCollectionService onlCgformCollectionService;
|
||||
@Autowired
|
||||
BussDocumentLibraryEOController bussDocumentLibraryEOService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-分页列表查询")
|
||||
@ApiOperation(value="我的收藏-分页列表查询", notes="我的收藏-分页列表查询")
|
||||
@PostMapping(value = "/page")
|
||||
public Result<?> queryPageList(@RequestBody Map<String,Object> params){
|
||||
IPage<OnlCgformCollection> pageList = onlCgformCollectionService.queryPageList(params);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-列表查询")
|
||||
@ApiOperation(value="我的收藏-列表查询", notes="我的收藏-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<OnlCgformCollection>> queryList(OnlCgformCollection onlCgformCollection) {
|
||||
List<OnlCgformCollection> list = onlCgformCollectionService.queryList(onlCgformCollection);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param onlCgformCollection
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-添加")
|
||||
@ApiOperation(value="我的收藏-添加", notes="我的收藏-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody OnlCgformCollection onlCgformCollection) {
|
||||
LambdaQueryWrapper<OnlCgformCollection> lambdaQueryWrapper= new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(OnlCgformCollection::getId,onlCgformCollection.getDocumentId())
|
||||
.eq(OnlCgformCollection::getDocumentId,onlCgformCollection.getDocumentId());
|
||||
int count=onlCgformCollectionService.count(lambdaQueryWrapper);
|
||||
if(count==0){
|
||||
onlCgformCollectionService.add(onlCgformCollection);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
else{
|
||||
return Result.error("该值不可重复添加,系统中已存在!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-通过id删除")
|
||||
@ApiOperation(value="我的收藏-通过id删除", notes="我的收藏-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
onlCgformCollectionService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-批量删除")
|
||||
@ApiOperation(value="我的收藏-批量删除", notes="我的收藏-批量删除")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.onlCgformCollectionService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-通过id查询")
|
||||
@ApiOperation(value="我的收藏-通过id查询", notes="我的收藏-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
OnlCgformCollection onlCgformCollection = onlCgformCollectionService.queryById(id);
|
||||
if(onlCgformCollection==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(onlCgformCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 表头中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-表头中英文切换")
|
||||
@ApiOperation(value="我的收藏-表头中英文切换", notes="我的收藏-表头中英文切换")
|
||||
@GetMapping(value = "/getHeader")
|
||||
public Result<List<Map<String, Object>>> getHeader(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
List<Map<String, Object>> list =onlCgformCollectionService.getHeader(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询条件中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-查询条件中英文切换")
|
||||
@ApiOperation(value="我的收藏-查询条件中英文切换", notes="我的收藏-查询条件中英文切换")
|
||||
@GetMapping(value = "/queryCondition")
|
||||
public Result<List<Map<String, Object>>> queryCondition(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
List<Map<String, Object>> list = onlCgformCollectionService.queryCondition(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package com.jero.modules.collection.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 我的收藏
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("onl_cgform_collection")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="onl_cgform_collection对象", description="我的收藏")
|
||||
public class OnlCgformCollection implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**收藏人*/
|
||||
@ApiModelProperty(value = "收藏人")
|
||||
private String createBy;
|
||||
|
||||
/**收藏日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "收藏日期")
|
||||
private java.util.Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
|
||||
/**文档库id*/
|
||||
@Excel(name = "文档库id", width = 15, dictTable = "buss_document_library", dicText = "id", dicCode = "id")
|
||||
@Dict(dictTable = "buss_document_library", dicText = "id", dicCode = "id")
|
||||
@ApiModelProperty(value = "文档库id")
|
||||
private String documentId;
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.jero.modules.collection.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.modules.collection.entity.OnlCgformCollection;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 我的收藏
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface OnlCgformCollectionMapper extends BaseMapper<OnlCgformCollection> {
|
||||
|
||||
@Select("select * from buss_document_library as document LEFT JOIN onl_cgform_collection as collection\n" +
|
||||
" on document.id= collection.document_id;")
|
||||
List<OnlCgformCollection> queryListByDocumentId(@Param("document_id") String document_id);
|
||||
|
||||
IPage queryPageList(IPage page,@Param("params") Map<String, Object> params);
|
||||
|
||||
List<Map<String,Object>> infoList(@Param("params") Map<String, Object> params);
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
<?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.jero.modules.collection.mapper.OnlCgformCollectionMapper">
|
||||
<resultMap id="OnlCgformCollectionResultMap" type="com.jero.modules.collection.entity.OnlCgformCollection">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="document_id" property="documentId" />
|
||||
</resultMap>
|
||||
|
||||
<select id="queryPageList" resultType="hashmap">
|
||||
select
|
||||
occ.id,
|
||||
occ.create_time as createTime,
|
||||
occ.create_by as createBy,
|
||||
bdl.serial_number as serialNumber,
|
||||
bdl.title,
|
||||
bdl.state,
|
||||
occ.document_id as documentId
|
||||
from
|
||||
onl_cgform_collection occ
|
||||
right join buss_document_library bdl on occ.document_id = bdl.id
|
||||
where occ.create_by = #{params.createBy}
|
||||
<if test="params.serialNumber != null and params.serialNumber != ''">
|
||||
<!--搜索条件:编号;包含%,单独搜索-->
|
||||
<choose>
|
||||
<when test='params.serialNumber != null and params.serialNumber != "" and params.serialNumber.contains("%")'>
|
||||
and bdl.serial_number like '%1%%' escape '1'
|
||||
</when>
|
||||
<otherwise>
|
||||
and bdl.serial_number like concat(concat('%',#{params.serialNumber}),'%')
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<if test="params.title != null and params.title != ''">
|
||||
<!--搜索条件:标题;包含%,单独搜索-->
|
||||
<choose>
|
||||
<when test='params.title != null and params.title != "" and params.title.contains("%")'>
|
||||
and bdl.title like '%1%%' escape '1'
|
||||
</when>
|
||||
<otherwise>
|
||||
and bdl.title like concat(concat('%',#{params.title}),'%')
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<if test="params.state != null and params.state != '' ">
|
||||
and bdl.state in
|
||||
<foreach collection="params.state.split(',')" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="params.orderByField == 'serial_number' or params.orderByField == 'title'">
|
||||
order by CONVERT( ${params.orderByField} USING gbk) COLLATE gbk_chinese_ci
|
||||
|
||||
</if>
|
||||
<if test="params.orderByField == 'create_time'">
|
||||
order by occ.create_time
|
||||
</if>
|
||||
<if test="params.orderBy == 1">
|
||||
asc
|
||||
</if>
|
||||
<if test="params.orderBy == 2">
|
||||
desc
|
||||
</if>
|
||||
<if test="params.orderByField == null or params.orderByField == ''">
|
||||
order by occ.create_time desc
|
||||
</if>
|
||||
</select>
|
||||
<select id="infoList" parameterType="java.util.Map" resultType="hashmap">
|
||||
select
|
||||
occ.id,
|
||||
occ.create_time as createTime,
|
||||
occ.create_by as createBy,
|
||||
bdl.serial_number as serialNumber,
|
||||
bdl.title,
|
||||
bdl.state,
|
||||
occ.document_id as documentId
|
||||
from
|
||||
onl_cgform_collection occ
|
||||
right join buss_document_library bdl on occ.document_id = bdl.id
|
||||
where occ.create_by = #{params.createBy}
|
||||
<if test="params.serialNumber != null and params.serialNumber != ''">
|
||||
<!--搜索条件:编号;包含%,单独搜索-->
|
||||
<choose>
|
||||
<when test='params.serialNumber != null and params.serialNumber != "" and params.serialNumber.contains("%")'>
|
||||
and bdl.serial_number like '%1%%' escape '1'
|
||||
</when>
|
||||
<otherwise>
|
||||
and bdl.serial_number like concat(concat('%',#{params.serialNumber}),'%')
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<if test="params.title != null and params.title != ''">
|
||||
<!--搜索条件:标题;包含%,单独搜索-->
|
||||
<choose>
|
||||
<when test='params.title != null and params.title != "" and params.title.contains("%")'>
|
||||
and bdl.title like '%1%%' escape '1'
|
||||
</when>
|
||||
<otherwise>
|
||||
and bdl.title like concat(concat('%',#{params.title}),'%')
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<if test="params.state != null and params.state != '' ">
|
||||
and bdl.state in
|
||||
<foreach collection="params.state.split(',')" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
package com.jero.modules.collection.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.collection.entity.OnlCgformCollection;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 我的收藏
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IOnlCgformCollectionService extends IService<OnlCgformCollection> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param onlCgformCollection
|
||||
* @return
|
||||
*/
|
||||
void add(OnlCgformCollection onlCgformCollection);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
OnlCgformCollection queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<OnlCgformCollection> queryList(OnlCgformCollection onlCgformCollection);
|
||||
|
||||
/**
|
||||
* 列表表头中英文切换
|
||||
* @param flag
|
||||
* @param cut
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getHeader(String flag, String cut);
|
||||
|
||||
/**
|
||||
* 查询条件中英文切换
|
||||
* @param flag
|
||||
* @param cut
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> queryCondition(String flag, String cut);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
IPage<OnlCgformCollection> queryPageList(Map<String, Object> params);
|
||||
}
|
||||
+372
@@ -0,0 +1,372 @@
|
||||
package com.jero.modules.collection.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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.enums.LanguageEnum;
|
||||
import com.jero.common.constant.enums.YesOrNoEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
|
||||
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
|
||||
import com.jero.modules.collection.entity.OnlCgformCollection;
|
||||
import com.jero.modules.collection.mapper.OnlCgformCollectionMapper;
|
||||
import com.jero.modules.collection.service.IOnlCgformCollectionService;
|
||||
import com.jero.modules.document.enums.LawsStateEnum;
|
||||
import com.jero.modules.ocr.util.LineHumpUtil;
|
||||
import com.jero.modules.system.entity.SysDictItem;
|
||||
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 我的收藏
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class OnlCgformCollectionServiceImpl extends ServiceImpl<OnlCgformCollectionMapper, OnlCgformCollection> implements IOnlCgformCollectionService {
|
||||
@Autowired
|
||||
private OnlCgformFieldServiceImpl onlCgformFieldService;
|
||||
@Autowired
|
||||
OnlCgformCollectionMapper onlCgformCollectionMapper;
|
||||
@Autowired
|
||||
private SysDictItemServiceImpl sysDictItemServiceImpl;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param onlCgformCollection
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(OnlCgformCollection onlCgformCollection) {
|
||||
Date now = new Date();
|
||||
onlCgformCollection.setCreateTime(now);
|
||||
save(onlCgformCollection);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void deleteById(String id) {
|
||||
boolean checkData = checkData(id);
|
||||
if(!checkData){
|
||||
throw new JeroBootException("该用户没有权限!");
|
||||
}
|
||||
try {
|
||||
OnlCgformCollection onlCgformCollection = super.baseMapper.selectById(id);
|
||||
List<String> documentIdList = new ArrayList<>();
|
||||
documentIdList.add(onlCgformCollection.getDocumentId());
|
||||
|
||||
//删除订阅
|
||||
//deleteSubscribe(documentIdList);
|
||||
|
||||
removeById(id);
|
||||
}catch (Exception ex){
|
||||
log.error("取消收藏失败:" + ex.getMessage());
|
||||
throw new JeroBootException("取消收藏失败!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void deleteByIds(List<String> ids) {
|
||||
for (String id : ids) {
|
||||
boolean checkData = checkData(id);
|
||||
if(!checkData){
|
||||
throw new JeroBootException("该用户没有权限!");
|
||||
}
|
||||
}
|
||||
try {
|
||||
QueryWrapper<OnlCgformCollection> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(OnlCgformCollection::getId,ids);
|
||||
List<OnlCgformCollection> onlCgformCollections = super.baseMapper.selectList(queryWrapper);
|
||||
List<String> documentIdList = onlCgformCollections.stream().map(OnlCgformCollection::getDocumentId).distinct().collect(Collectors.toList());
|
||||
|
||||
//删除订阅
|
||||
//deleteSubscribe(documentIdList);
|
||||
|
||||
removeByIds(ids);
|
||||
}catch (Exception ex){
|
||||
log.error("批量取消收藏失败:" + ex.getMessage());
|
||||
throw new JeroBootException("批量取消收藏失败!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public OnlCgformCollection queryById(String id) {
|
||||
boolean checkData = checkData(id);
|
||||
if(!checkData){
|
||||
throw new JeroBootException("该用户没有权限!");
|
||||
}
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<OnlCgformCollection> queryList(OnlCgformCollection onlCgformCollection) {
|
||||
List<OnlCgformCollection> list = onlCgformCollectionMapper.queryListByDocumentId(onlCgformCollection.getDocumentId());
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表表头中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getHeader(String flag, String cut) {
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(flag);
|
||||
if (fieldList.size() != 0) {
|
||||
//过滤列表字段(is_show_list-->列表是否显示0否 1是) 过滤出需要的表头字段
|
||||
fieldList = fieldList.stream().filter(
|
||||
e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowList()))
|
||||
&& (
|
||||
e.getDbFieldEnName().equals("serial_number")||e.getDbFieldEnName().equals("title")
|
||||
||e.getDbFieldEnName().equals("state")
|
||||
)
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (OnlCgformField onlCgformField : fieldList) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if ("file_name".equals(onlCgformField.getDbFieldName())) {
|
||||
//跳转详情的标识
|
||||
map.put("click", "true");
|
||||
}
|
||||
//单独处理发布日期和标准实施日期
|
||||
if ("update_time".equals(onlCgformField.getDbFieldName())) {
|
||||
map.put("sort", "true");//列表排序标识
|
||||
}
|
||||
map.put("db_field_name", LineHumpUtil.lineToHump(onlCgformField.getDbFieldName()));//字段
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名
|
||||
} else {
|
||||
map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名
|
||||
}
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询条件中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> queryCondition(String flag, String cut) {
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(flag);
|
||||
if (fieldList.size() != 0) {
|
||||
//过滤出需要的搜索条件()
|
||||
fieldList = fieldList.stream().filter(
|
||||
e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsQuery()))
|
||||
&& (
|
||||
e.getDbFieldEnName().equals("serial_number")||e.getDbFieldEnName().equals("title")
|
||||
||e.getDbFieldEnName().equals("state")
|
||||
)
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (OnlCgformField onlCgformField : fieldList) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("field_show_type", onlCgformField.getFieldShowType());//类型(判断是下拉还是输入框,等等)
|
||||
map.put("dict_field", onlCgformField.getDictField()); //下拉类型的数据字典编码
|
||||
map.put("db_field_name", LineHumpUtil.lineToHump(onlCgformField.getDbFieldName()));//字段
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名
|
||||
} else {
|
||||
map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名
|
||||
}
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<OnlCgformCollection> queryPageList(Map<String, Object> params) {
|
||||
// params.put("orderByField","serial_number");
|
||||
// params.put("orderBy","1");
|
||||
if(ObjectUtils.isEmpty(params.get("orderByField"))){
|
||||
params.put("orderBy","");
|
||||
}
|
||||
Integer pageNo = Integer.parseInt(params.get("pageNo").toString());
|
||||
Integer pageSize = Integer.parseInt(params.get("pageSize").toString());
|
||||
IPage page = new Page(pageNo, pageSize);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
params.put("createBy",sysUser.getUsername());
|
||||
IPage result = new Page();
|
||||
//表头排序(状态单独处理)
|
||||
if(ObjectUtils.isNotEmpty(params.get("orderByField")) && "state".equals((String) params.get("orderByField"))){
|
||||
List<Map<String, Object>> infoList = onlCgformCollectionMapper.infoList(params);
|
||||
result = stateSort(params,pageNo,pageSize,result,infoList);
|
||||
}else{
|
||||
result = onlCgformCollectionMapper.queryPageList(page,params);
|
||||
}
|
||||
List<Map<String,Object>> records = result.getRecords();
|
||||
dataDispose(records,params);
|
||||
return result;
|
||||
}
|
||||
public IPage stateSort(Map<String, Object> parameter, int pageNo, int pageSize, IPage infoPage,List<Map<String, Object>> infoList) {
|
||||
List<Map<String,Object>> list = new LinkedList<>();
|
||||
//状态排序,需要特殊处理 现行,即将实施,草稿,被替代,废止
|
||||
if(ObjectUtils.isNotEmpty(parameter.get("orderByField")) && "state".equals((String) parameter.get("orderByField"))){
|
||||
List<Map<String, Object>> active = infoList.stream()
|
||||
.filter(e -> LawsStateEnum.ACTIVE.getValue().equals(e.get("state"))).collect(Collectors.toList());
|
||||
List<Map<String, Object>> theUpcoming = infoList.stream()
|
||||
.filter(e -> LawsStateEnum.THE_UPCOMING.getValue().equals(e.get("state"))).collect(Collectors.toList());
|
||||
List<Map<String, Object>> draft = infoList.stream()
|
||||
.filter(e -> LawsStateEnum.DRAFT.getValue().equals(e.get("state"))).collect(Collectors.toList());
|
||||
List<Map<String, Object>> beReplaced = infoList.stream()
|
||||
.filter(e -> LawsStateEnum.BE_REPLACED.getValue().equals(e.get("state"))).collect(Collectors.toList());
|
||||
List<Map<String, Object>> abolish = infoList.stream()
|
||||
.filter(e -> LawsStateEnum.ABOLISH.getValue().equals(e.get("state"))).collect(Collectors.toList());
|
||||
if ("1".equals((String) parameter.get("orderBy"))) {
|
||||
//正序
|
||||
list.addAll(active);
|
||||
list.addAll(theUpcoming);
|
||||
list.addAll(draft);
|
||||
list.addAll(beReplaced);
|
||||
list.addAll(abolish);
|
||||
|
||||
} else if ("2".equals((String) parameter.get("orderBy"))) {
|
||||
//倒序
|
||||
list.addAll(abolish);
|
||||
list.addAll(beReplaced);
|
||||
list.addAll(draft);
|
||||
list.addAll(theUpcoming);
|
||||
list.addAll(active);
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(list)){
|
||||
infoPage = getPages(pageNo, pageSize, list);
|
||||
}
|
||||
}
|
||||
return infoPage;
|
||||
}
|
||||
public IPage getPages(Integer currentPage, Integer pageSize, List<Map<String,Object>> list){
|
||||
IPage page =new Page();
|
||||
if(list==null){
|
||||
return null;
|
||||
}
|
||||
int size = list.size();
|
||||
if(pageSize > size){
|
||||
pageSize = size;
|
||||
}
|
||||
if(pageSize!=0){
|
||||
//求出最⼤页数,防⽌currentPage越界
|
||||
int maxPage = size % pageSize ==0? size / pageSize : size / pageSize +1;
|
||||
if(currentPage > maxPage){
|
||||
currentPage = maxPage;
|
||||
}
|
||||
}
|
||||
//当前页第⼀条数据的下标
|
||||
int curIdx = currentPage >1?(currentPage -1)* pageSize :0;
|
||||
List pageList =new ArrayList();
|
||||
//将当前页的数据放进pageList
|
||||
for(int i =0; i < pageSize && curIdx + i < size; i++){
|
||||
pageList.add(list.get(curIdx + i));
|
||||
}
|
||||
page.setCurrent(currentPage).setSize(pageSize).setTotal(list.size()).setRecords(pageList);
|
||||
return page;
|
||||
}
|
||||
|
||||
public void dataDispose(List<Map<String,Object>> datas, Map<String,Object> params){
|
||||
if(CollectionUtils.isNotEmpty(datas)){
|
||||
List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll();
|
||||
//获取所有文本状态数据字典
|
||||
List<SysDictItem> stateList = sysDictItems.stream()
|
||||
.filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals("state"))
|
||||
.collect(Collectors.toList());
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
|
||||
|
||||
String cut = (String) params.get("cut");
|
||||
for (Map<String, Object> data : datas) {
|
||||
Date createTime = (Date) data.get("createTime");
|
||||
data.put("createTime",sdf.format(createTime));
|
||||
String state = (String) data.get("state");
|
||||
for (SysDictItem sysDictItem : stateList) {
|
||||
if(StringUtils.equals(state,sysDictItem.getItemValue())){
|
||||
if(StringUtils.equals(cut, LanguageEnum.CN.getValue())){
|
||||
data.put("state",sysDictItem.getItemText());
|
||||
}else {
|
||||
data.put("state",sysDictItem.getEnName());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
//设置为已收藏
|
||||
data.put("collectFlag","1");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public boolean checkData(String id){
|
||||
boolean result = false;
|
||||
try {
|
||||
QueryWrapper<OnlCgformCollection> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(OnlCgformCollection::getId,id);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
queryWrapper.lambda().eq(OnlCgformCollection::getCreateBy,sysUser.getUsername());
|
||||
Integer integer = onlCgformCollectionMapper.selectCount(queryWrapper);
|
||||
if(integer>0){
|
||||
result = true;
|
||||
}
|
||||
}catch (Exception ex){
|
||||
log.error("验证我的收藏数据异常:" + ex.getMessage());
|
||||
throw new JeroBootException("验证我的收藏数据异常!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*public void deleteSubscribe(List<String> docIdList){
|
||||
try {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
QueryWrapper<OnlCgformSubscribe> deleteWarpper = new QueryWrapper<>();
|
||||
deleteWarpper.lambda().in(OnlCgformSubscribe::getDocumentId,docIdList);
|
||||
deleteWarpper.lambda().eq(OnlCgformSubscribe::getCreateBy,sysUser.getUsername());
|
||||
onlCgformSubscribeMapper.delete(deleteWarpper);
|
||||
}catch (Exception ex){
|
||||
log.error("删除订阅信息失败:" + ex.getMessage());
|
||||
throw new JeroBootException("删除订阅信息失败!");
|
||||
}
|
||||
}*/
|
||||
}
|
||||
Reference in New Issue
Block a user