资料中心

This commit is contained in:
zhaokaiyao@91isoft.com
2021-12-14 17:09:05 +08:00
parent 36568f8c19
commit 5eeb60b7f3
11 changed files with 473 additions and 8 deletions
@@ -18,13 +18,13 @@ public class CodeGen {
private static final String PACKAGE_PATH="/adc-da-slrs/src/main";
private static final String AUTHOR="super_liu";
private static final String AUTHOR="zhaokaiyao";
private static final String DB_IP="127.0.0.1:3306/foton_slrs_test";
private static final String DB_IP="123.56.177.15:3306/foton_slrs_test2";
private static final String DB_USER="root";
private static final String DB_PWD="root";
private static final String DB_PWD="RsLDRj3dXtSwYjBI";
/**
@@ -0,0 +1,92 @@
package com.adc.da.slrs.fileMaterialCenter.controller;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.fileMaterialCenter.entity.FileMaterialPage;
import com.adc.da.slrs.fileMaterialCenter.service.IFileMaterialService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.adc.da.slrs.fileMaterialCenter.entity.FileMaterial;
import io.swagger.annotations.Api;
import com.adc.da.base.web.BaseController;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author zhaokaiyao
* @since 2021-12-14
*/
@RestController
@Api(description = "资料中心")
@RequestMapping("/fileMaterialCenter/file-material")
public class FileMaterialController extends BaseController<FileMaterial> {
@Autowired
IFileMaterialService iFileMaterialService;
@PostMapping
@ApiOperation("新增文件资料组")
public ResponseMessage addFileMaterial(FileMaterial material){
boolean save = iFileMaterialService.save(material);
return Result.success(save);
}
@DeleteMapping
@ApiOperation("删除文件资料组")
public ResponseMessage deleteMaterial(String id){
List<String> idList = Arrays.asList(id.split(id));
boolean b = iFileMaterialService.removeByIds(idList);
return Result.success(b);
}
@GetMapping
@ApiOperation("查询文件资料组")
public ResponseMessage<IPage<FileMaterial>> getFileMaterial(FileMaterialPage queryPage){
IPage<FileMaterial> fileMaterial = iFileMaterialService.getFileMaterial(queryPage);
return Result.success(fileMaterial);
}
@PutMapping
@ApiOperation("修改文件资料组")
public ResponseMessage updateFileMaterial(FileMaterial fileMaterial){
boolean b = iFileMaterialService.updateById(fileMaterial);
return Result.success(b);
}
@GetMapping("/type")
@ApiOperation("获取类型")
public ResponseMessage<List<String>> getFileMaterialType(){
List<String> fileMaterialType = iFileMaterialService.getFileMaterialType();
return Result.success(fileMaterialType);
}
@PutMapping("/topping")
@ApiModelProperty("置顶")
public ResponseMessage topping(String id){
int topping = iFileMaterialService.topping(id);
return Result.success(topping);
}
}
@@ -0,0 +1,19 @@
package com.adc.da.slrs.fileMaterialCenter.dao;
import com.adc.da.slrs.fileMaterialCenter.entity.FileMaterial;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* Mapper 接口
* </p>
*
* @author zhaokaiyao
* @since 2021-12-14
*/
public interface FileMaterialDao extends BaseMapper<FileMaterial> {
int topping(@Param("id") String id);
}
@@ -0,0 +1,61 @@
package com.adc.da.slrs.fileMaterialCenter.entity;
import com.adc.da.base.entity.BaseEntity;
import java.time.LocalDateTime;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.Tag;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author zhaokaiyao
* @since 2021-12-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="FileMaterial对象", description="")
public class FileMaterial extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId
@ApiModelProperty(value = "主键")
private String id;
@ApiModelProperty(value = "类型")
@TableField("data_type")
private String dataType;
@ApiModelProperty(value = "标题")
@TableField("data_title")
private String dataTitle;
@ApiModelProperty(value = "上传时间")
@TableField("data_upload_time")
private Date dataUploadTime;
@ApiModelProperty(value = "文件id")
@TableField("attach_file_id")
private String attachFileId;
@ApiModelProperty(value = "点击量")
@TableField("click_count")
private Integer clickCount;
@ApiModelProperty(value = "置顶")
@TableField("is_top")
private Integer isTop;
}
@@ -0,0 +1,23 @@
package com.adc.da.slrs.fileMaterialCenter.entity;
import lombok.Data;
/**
* @author zhaokaiyao
*/
@Data
public class FileMaterialPage {
private String dataTitle;
private String dataType;
private String startDataUploadTime;
private String endDataUploadTime;
private Integer page;
private Integer pageSize;
}
@@ -0,0 +1,44 @@
package com.adc.da.slrs.fileMaterialCenter.service;
import com.adc.da.slrs.fileMaterialCenter.entity.FileMaterial;
import com.adc.da.slrs.fileMaterialCenter.entity.FileMaterialPage;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import javafx.scene.paint.Material;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author zhaokaiyao
* @since 2021-12-14
*/
public interface IFileMaterialService extends IService<FileMaterial> {
/**
* 查询文件资料组
* @param queryPage
* @return
*/
IPage<FileMaterial> getFileMaterial(FileMaterialPage queryPage);
/**
* 获取类型
* @return
*/
List<String> getFileMaterialType();
/**
* 置顶
* @param id
* @return
*/
int topping(String id);
}
@@ -0,0 +1,71 @@
package com.adc.da.slrs.fileMaterialCenter.service.impl;
import com.adc.da.slrs.fileMaterialCenter.entity.FileMaterial;
import com.adc.da.slrs.fileMaterialCenter.dao.FileMaterialDao;
import com.adc.da.slrs.fileMaterialCenter.entity.FileMaterialPage;
import com.adc.da.slrs.fileMaterialCenter.service.IFileMaterialService;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.management.Query;
import java.text.SimpleDateFormat;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author zhaokaiyao
* @since 2021-12-14
*/
@Service
public class FileMaterialServiceImpl extends ServiceImpl<FileMaterialDao, FileMaterial> implements IFileMaterialService {
@Autowired
FileMaterialDao fileMaterialDao;
@Override
public IPage<FileMaterial> getFileMaterial(FileMaterialPage queryPage) {
QueryWrapper<FileMaterial> queryWrapper = new QueryWrapper<>();
if (queryPage.getDataType()!=null){
queryWrapper.eq("data_type",queryPage.getDataTitle());
}
if (queryPage.getDataTitle()!=null){
queryWrapper.like("data_title",queryPage.getDataTitle());
}
if (queryPage.getStartDataUploadTime()!=null && queryPage.getEndDataUploadTime()!=null){
String strDateFormat = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
queryWrapper.between("data_upload_time",
sdf.format(queryPage.getStartDataUploadTime()),
sdf.format(queryPage.getEndDataUploadTime()));
}
return this.page(new Page<>(queryPage.getPage(),queryPage.getPageSize()),queryWrapper);
}
@Override
public List<String> getFileMaterialType() {
QueryWrapper<FileMaterial> queryWrapper = new QueryWrapper<>();
queryWrapper.select("data_type");
return this.listObjs(queryWrapper, item -> item.toString());
}
@Override
public int topping(String id) {
return fileMaterialDao.topping(id);
}
}
@@ -194,6 +194,8 @@ public class SarLawsStandInfoController extends BaseController<SarLawsStandInfo>
@GetMapping(value = "/exportStandardsInfoExcel")
public void exportStandardsInfoExcel(String exportContent, String exportType, String exportName,String userId, HttpServletResponse response,
HttpServletRequest request) throws Exception {
List<SarLawsStandInfo> data = sarLawsInfoEOService.getExportData(exportType,exportContent,userId);
OutputStream os = null;
Workbook workbook = null;
try {
@@ -204,7 +206,7 @@ public class SarLawsStandInfoController extends BaseController<SarLawsStandInfo>
"attachment; filename=" + ReadExcel.encodeFileName(exportName+".xlsx",request));
response.setContentType("application/force-download");
// 导出所有数据
List<SarLawsStandInfo> data = sarLawsInfoEOService.getExportData(exportType,exportContent,userId);
// List<SarLawsStandInfo> data = sarLawsInfoEOService.getExportData(exportType,exportContent,userId);
workbook = LawsStandExportUtil.exportDatas(data);
os = response.getOutputStream();
@@ -0,0 +1,19 @@
<?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.adc.da.slrs.fileMaterialCenter.dao.FileMaterialDao">
<update id="topping">
UPDATE file_material
SET is_top = (
(
SELECT
Max(is_top)
FROM
(SELECT * FROM file_material) AS x
) + 1
)
WHERE
id = #{id}
</update>
</mapper>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.adc.da.slrs.fileMaterialCerter.dao.MaterialDao">
</mapper>
@@ -283,7 +283,7 @@
parameterType="com.adc.da.slrs.sarLawsStandInfo.entity.SarLawsStandInfoPage">
select
DISTINCT SAR_LAWS_STAND_INFO.ID,
SAR_LAWS_STAND_INFO.LAWS_TYPE,
laws_type_show.DIC_TYPE_NAME as LAWS_TYPE,
SAR_LAWS_STAND_INFO.LAWS_NUMBER,
SAR_LAWS_STAND_INFO.LAWS_NAME,
SAR_LAWS_STAND_INFO.LAWS_EN_NAME,
@@ -293,8 +293,8 @@
SAR_LAWS_STAND_INFO.COMMENT_CYCLE_START,
SAR_LAWS_STAND_INFO.COMMENT_CYCLE_END,
SAR_LAWS_STAND_INFO.LAWS_TEXT_STATE,
SAR_LAWS_STAND_INFO.LAWS_SYQY,
SAR_LAWS_STAND_INFO.LAWS_SYCX,
laws_sycx_show.DIC_TYPE_NAME as LAWS_SYCX,
laws_syqy_show.DIC_TYPE_NAME as LAWS_SYQY,
SAR_LAWS_STAND_INFO.IS_RELATE_ACCESS,
SAR_LAWS_STAND_INFO.LAWS_YEAR,
SAR_LAWS_STAND_INFO.LAWS_NOTISYNC_NUM,
@@ -305,7 +305,7 @@
SAR_LAWS_STAND_INFO.MODIFY_TIME,
dicstandTextStatus.DIC_TYPE_NAME AS standStatusShow
from SAR_LAWS_STAND_INFO
<include refid="SarStandardsInfo_in_left"/>
<include refid="export_condition"/>
order by
<if test='orderByA != null and orderByA != "" and order1 != null and order1 != ""'>
${orderByA} ${order1},
@@ -313,4 +313,133 @@
SAR_LAWS_STAND_INFO.id
</select>
<sql id="export_condition">
left join SAR_LAWS_MENU ON SAR_LAWS_STAND_INFO.id = SAR_LAWS_MENU.laws_id
LEFT JOIN TS_DICTYPE dicstandTextStatus ON (
dicstandTextStatus.dic_type_code = SAR_LAWS_STAND_INFO.LAWS_TEXT_STATE
AND dicstandTextStatus.dic_id IS NOT NULL
AND dicstandTextStatus.valid_flag = 0
)
<!--适用车型-->
LEFT JOIN TS_DICTYPE laws_sycx_show ON (
dicstandTextStatus.dic_type_code = SAR_LAWS_STAND_INFO.LAWS_SYCX
AND dicstandTextStatus.dic_id IS NOT NULL
AND dicstandTextStatus.valid_flag = 0
)
<!--适用区域-->
LEFT JOIN TS_DICTYPE laws_syqy_show ON (
dicstandTextStatus.dic_type_code = SAR_LAWS_STAND_INFO.LAWS_SYQY
AND dicstandTextStatus.dic_id IS NOT NULL
AND dicstandTextStatus.valid_flag = 0
)
<!--政策分类-->
LEFT JOIN TS_DICTYPE laws_type_show ON (
dicstandTextStatus.dic_type_code = SAR_LAWS_STAND_INFO.LAWS_TYPE
AND dicstandTextStatus.dic_id IS NOT NULL
AND dicstandTextStatus.valid_flag = 0
)
left join SAR_LAWS_ATTR_INFO on (SAR_LAWS_ATTR_INFO.LAWS_ID = SAR_LAWS_STAND_INFO.id and SAR_LAWS_ATTR_INFO.valid_flag=0)
where 1=1 and SAR_LAWS_STAND_INFO.valid_flag=0
<trim suffixOverrides=",">
<!-- 基本搜索项 -->
<if test="lawsType != null and lawsType != ''">
and SAR_LAWS_STAND_INFO.LAWS_TYPE like concat(concat('%',#{lawsType}),'%')
</if>
<if test="lawsNumber != null and lawsNumber != ''">
and SAR_LAWS_STAND_INFO.LAWS_NUMBER like concat(concat('%',#{lawsNumber}),'%')
</if>
<if test="numberName != null and numberName != ''">
and (LAWS_NAME like concat(concat('%',#{numberName}),'%')
or SAR_LAWS_STAND_INFO.LAWS_EN_NAME like concat(concat('%',#{numberName}),'%'))
</if>
<if test="lawsName != null and lawsName != ''">
and LAWS_NAME like concat(concat('%',#{lawsName}),'%')
</if>
<if test="lawsEnName != null and lawsEnName != ''">
and SAR_LAWS_STAND_INFO.LAWS_EN_NAME like concat(concat('%',#{lawsEnName}),'%')
</if>
<if test="lawsNo != null and lawsNo != ''">
and SAR_LAWS_STAND_INFO.LAWS_NO like concat(concat('%',#{lawsNo}),'%')
</if>
<if test="issueTime != null and issueTime != ''">
and DATE_FORMAT(SAR_LAWS_STAND_INFO.ISSUE_TIME,'%Y-%m-%d') = #{issueTime}
</if>
<if test="issueCompany != null and issueCompany != ''">
and SAR_LAWS_STAND_INFO.ISSUE_COMPANY like concat(concat('%',#{issueCompany}),'%')
</if>
<if test="commentCycleStart != null and commentCycleStart != ''">
and DATE_FORMAT(SAR_LAWS_STAND_INFO.COMMENT_CYCLE_START ,'%Y-%m-%d') = DATE_FORMAT(#{commentCycleStart},'%Y-%m-%d')
</if>
<if test="commentCycleEnd != null and commentCycleEnd != ''">
and DATE_FORMAT(SAR_LAWS_STAND_INFO.COMMENT_CYCLE_END ,'%Y-%m-%d') = DATE_FORMAT(#{commentCycleEnd},'%Y-%m-%d')
</if>
<if test="lawsTextState != null and lawsTextState != ''">
and SAR_LAWS_STAND_INFO.LAWS_TEXT_STATE = #{lawsTextState}
</if>
<if test="lawsSyqy != null and lawsSyqy != ''">
and FIND_IN_SET(#{lawsSyqy},SAR_LAWS_STAND_INFO.LAWS_SYQY)
</if>
<if test="lawsSycx != null and lawsSycx != ''">
and FIND_IN_SET(#{lawsSycx},SAR_LAWS_STAND_INFO.LAWS_SYCX)
</if>
<if test="isRelateAccess != null and isRelateAccess != ''">
and SAR_LAWS_STAND_INFO.IS_RELATE_ACCESS = #{isRelateAccess}
</if>
<if test="lawsYear != null and lawsYear != ''">
and SAR_LAWS_STAND_INFO.LAWS_YEAR like concat(concat('%',#{lawsYear}),'%')
</if>
<if test="lawsNotisyncNum != null and lawsNotisyncNum != ''">
and SAR_LAWS_STAND_INFO.LAWS_NOTISYNC_NUM like concat(concat('%',#{lawsNotisyncNum}),'%')
</if>
<if test="lawsBulletin != null and lawsBulletin != ''">
and SAR_LAWS_STAND_INFO.LAWS_BULLETIN like concat(concat('%',#{lawsBulletin}),'%')
</if>
<if test="lawsLabel != null and lawsLabel != ''">
and SAR_LAWS_STAND_INFO.LAWS_LABEL like concat(concat('%',#{lawsLabel}),'%')
</if>
<if test="lawsRemark != null and lawsRemark != ''">
and SAR_LAWS_STAND_INFO.LAWS_REMARK like concat(concat('%',#{lawsRemark}),'%')
</if>
<!-- 国家、地区 -->
<if test="country != null and country != ''">
and SAR_LAWS_STAND_INFO.country = #{country}
</if>
<!-- 目录判断 -->
<if test="menuId != null and menuId !='nomenu' and menuAllChildrenIdList != null">
and SAR_LAWS_MENU.MENU_ID in
<foreach collection="menuAllChildrenIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<!-- 新修改需求,根据角色查询有权限的菜单数据-->
<if test="menuRoleList != null">
and SAR_LAWS_MENU.MENU_ID in
<foreach collection="menuRoleList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<!-- 导出数据过程中,选择的id -->
<if test="idlist != null">
and SAR_LAWS_STAND_INFO.id in
<foreach collection="idlist" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="collectMenuId != null and collectMenuId != ''">
and SAR_LAWS_STAND_INFO.id in (
select COLLECT_RES_ID from TS_PERSON_COLLECT where TS_PERSON_COLLECT.VALID_FLAG=0
and (collect_type='INLAND_STAND' or collect_type='FOREIGN_STAND')
and TS_PERSON_COLLECT.user_id=#{userId}
)
</if>
<if test="advanceSearchStr != null and advanceSearchStr != ''">
and (${advanceSearchStr})
</if>
</trim>
</sql>
</mapper>