Commit d2d217ca authored by fangxinjiang's avatar fangxinjiang

导出记忆功能

parent 660d5ac5
package com.yifu.cloud.plus.v1.yifu.archives.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;
/**
* @Author fxj
* @Description 用户表格导入导出默认表头数据
* @Date 9:59 2022/9/20
* @Param
* @return
**/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("l_excel_head_for_io")
@Schema(description = "用户表格导入导出默认表头数据")
public class LExcelHeadForIo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
/**
* 配置名称
*/
@NotBlank(message = "配置名称不能为空")
@Length(max = 50, message = "配置名称不能超过20个字符")
@ExcelAttribute(name = "配置名称", isNotEmpty = true, errorInfo = "配置名称不能为空", maxLength = 20)
@Schema(description = "配置名称")
private String name;
/**
* 使用者
*/
@Length(max = 32, message = "使用者不能超过32个字符")
@ExcelAttribute(name = "使用者", isNotEmpty = true, errorInfo = "使用者不能为空", maxLength = 32)
@Schema(description = "使用者")
private String createUser;
/**
* 创建时间
*/
@ExcelAttribute(name = "创建时间")
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 使用标识
*/
@NotBlank(message = "使用标识不能为空")
@Length(max = 40, message = "使用标识不能超过40个字符")
@ExcelAttribute(name = "使用标识", isNotEmpty = true, errorInfo = "使用标识不能为空", maxLength = 40)
@Schema(description = "使用标识(建议传按钮的权限标识保证唯一)")
private String useCode;
/**
* 表头内容
*/
@NotBlank(message = "表头内容不能为空")
@ExcelAttribute(name = "表头内容", isNotEmpty = true, errorInfo = "表头内容不能为空")
@Schema(description = "表头内容", name = "excelHeadText")
private String excelHeadText;
/**
* 注释(一般填使用模块方便排查问题)
*/
@Length(max = 50, message = "注释")
@ExcelAttribute(name = "注释", maxLength = 50)
@Schema(description = "注释(一般填使用模块方便排查问题)")
private String remark;
}
package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.LExcelHeadForIo;
import com.yifu.cloud.plus.v1.yifu.archives.service.LExcelHeadForIoService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.time.LocalDateTime;
import java.util.List;
/**
* @Author fxj
* @Description 用户表格导入导出默认表头数据
* @Date 9:59 2022/9/20
* @Param
* @return
**/
@RestController
@AllArgsConstructor
@RequestMapping("/lexcelheadforio")
@Tag(name = "用户表格导入导出默认表头数据")
public class LExcelHeadForIoController {
private final LExcelHeadForIoService lExcelHeadForIoService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param lExcelHeadForIo 用户表格导入导出默认表头数据
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<LExcelHeadForIo>> getLExcelHeadForIoPage(Page<LExcelHeadForIo> page, LExcelHeadForIo lExcelHeadForIo) {
return new R<>(lExcelHeadForIoService.getLExcelHeadForIoPage(page, lExcelHeadForIo));
}
/**
* 通过id查询单条记录
*
* @param id
* @return R
*/
@Operation(description = "id查询")
@GetMapping("/{id}")
public R<LExcelHeadForIo> getById(@PathVariable("id") String id) {
return new R<>(lExcelHeadForIoService.getById(id));
}
/**
* 通过useCode查询本人配置
*
* @param useCode
* @return R
*/
@Operation(description = "通过useCode查询本人配置")
@GetMapping("/getOwnList/{useCode}")
public R<List<LExcelHeadForIo>> getOwnListByUseCode(@PathVariable("useCode") String useCode) {
YifuUser user = SecurityUtils.getUser();
return new R<>(lExcelHeadForIoService.list(Wrappers.<LExcelHeadForIo>lambdaQuery().eq(LExcelHeadForIo::getCreateUser, String.valueOf(user.getId())).eq(LExcelHeadForIo::getUseCode, useCode)));
}
/**
* 新增记录
*
* @param lExcelHeadForIo
* @return R
*/
@Operation(description = "新增 maxMun:最大配置项(不传默认3)")
@PostMapping
public R<Boolean> save(@Valid @RequestBody LExcelHeadForIo lExcelHeadForIo,Integer maxMun) {
YifuUser user = SecurityUtils.getUser();
if(null == maxMun){
maxMun = CommonConstants.dingleDigitIntArray[3];
}
lExcelHeadForIo.setCreateUser(String.valueOf(user.getId()));
lExcelHeadForIo.setCreateTime(LocalDateTime.now());
long count = lExcelHeadForIoService.count(Wrappers.<LExcelHeadForIo>lambdaQuery()
.eq(LExcelHeadForIo::getCreateUser, lExcelHeadForIo.getCreateUser())
.eq(LExcelHeadForIo::getUseCode, lExcelHeadForIo.getUseCode()));
if(maxMun <= count){
return R.failed("保存失败,配置项不能超过最大配置数".concat(String.valueOf(maxMun)));
}
return new R<>(lExcelHeadForIoService.save(lExcelHeadForIo));
}
/**
* 修改记录
*
* @param lExcelHeadForIo
* @return R
*/
@Operation(description = "修改(wxhr:lexcelheadforio_edit)")
@SysLog("修改用户表格导入导出默认表头数据")
@PutMapping
public R<Boolean> update(@RequestBody LExcelHeadForIo lExcelHeadForIo) {
if(Common.isEmpty(lExcelHeadForIo.getId())){
return R.failed("操作失败,id不能为空!");
}
LExcelHeadForIo eh = lExcelHeadForIoService.getById(lExcelHeadForIo.getId());
if(null == eh ){
return R.failed("操作失败,无此配置!");
}
YifuUser user = SecurityUtils.getUser();
if(String.valueOf(user.getId()).equals(eh.getCreateUser())){
lExcelHeadForIo.setCreateTime(null);
lExcelHeadForIo.setCreateUser(null);
return new R<>(lExcelHeadForIoService.updateById(lExcelHeadForIo));
}else{
return R.failed("操作失败,此配置不属于您,您无权修改!");
}
}
/**
* 通过id删除一条记录
*
* @param id
* @return R
*/
@Operation(description = "删除(wxhr:lexcelheadforio_del)")
@SysLog("删除用户表格导入导出默认表头数据")
@DeleteMapping("/{id}")
public R<Boolean> removeById(@PathVariable String id) {
LExcelHeadForIo eh = lExcelHeadForIoService.getById(id);
if(null == eh ){
return R.failed("数据库存着此配置,无需重复删除!");
}
YifuUser user = SecurityUtils.getUser();
if(String.valueOf(user.getId()).equals(eh.getCreateUser())){
return new R<>(lExcelHeadForIoService.removeById(id));
}else{
return R.failed("操作失败,此配置不属于您,您无权删除!");
}
}
}
package com.yifu.cloud.plus.v1.yifu.archives.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.yifu.cloud.plus.v1.yifu.archives.entity.LExcelHeadForIo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @Author fxj
* @Description 用户表格导入导出默认表头数据
* @Date 10:08 2022/9/20
* @Param
* @return
**/
@Mapper
public interface LExcelHeadForIoMapper extends BaseMapper<LExcelHeadForIo> {
/**
* 用户表格导入导出默认表头数据简单分页查询
* @param lExcelHeadForIo 用户表格导入导出默认表头数据
* @return
*/
IPage<LExcelHeadForIo> getLExcelHeadForIoPage(Page page, @Param("lExcelHeadForIo") LExcelHeadForIo lExcelHeadForIo);
}
package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.LExcelHeadForIo;
/**
* @Author fxj
* @Description 用户表格导入导出默认表头数据
* @Date 10:08 2022/9/20
* @Param
* @return
**/
public interface LExcelHeadForIoService extends IService<LExcelHeadForIo> {
/**
* 用户表格导入导出默认表头数据简单分页查询
*
* @param lExcelHeadForIo 用户表格导入导出默认表头数据
* @return
*/
IPage<LExcelHeadForIo> getLExcelHeadForIoPage(Page<LExcelHeadForIo> page, LExcelHeadForIo lExcelHeadForIo);
}
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
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.yifu.cloud.plus.v1.yifu.archives.entity.LExcelHeadForIo;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.LExcelHeadForIoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.LExcelHeadForIoService;
import org.springframework.stereotype.Service;
/**
* @Author fxj
* @Description 用户表格导入导出默认表头数据
* @Date 10:08 2022/9/20
* @Param
* @return
**/
@Service("lExcelHeadForIoService")
public class LExcelHeadForIoServiceImpl extends ServiceImpl<LExcelHeadForIoMapper, LExcelHeadForIo> implements LExcelHeadForIoService {
/**
* 用户表格导入导出默认表头数据简单分页查询
*
* @param lExcelHeadForIo 用户表格导入导出默认表头数据
* @return
*/
@Override
public IPage<LExcelHeadForIo> getLExcelHeadForIoPage(Page<LExcelHeadForIo> page, LExcelHeadForIo lExcelHeadForIo) {
return baseMapper.getLExcelHeadForIoPage(page, lExcelHeadForIo);
}
}
<?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.yifu.cloud.plus.v1.yifu.archives.mapper.LExcelHeadForIoMapper">
<resultMap id="lExcelHeadForIoMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.LExcelHeadForIo">
<id property="id" column="id"/>
<result property="createUser" column="create_user"/>
<result property="createTime" column="create_time"/>
<result property="useCode" column="use_code"/>
<result property="excelHeadText" column="excel_head_text"/>
<result property="remark" column="remark"/>
<result property="name" column="name"/>
</resultMap>
<sql id="Base_Column_List">
a.id,
a.create_user,
a.create_time,
a.use_code,
a.excel_head_text,
a.remark,
a.name
</sql>
<sql id="lExcelHeadForIo_where">
<if test="lExcelHeadForIo != null">
<if test="lExcelHeadForIo.id != null and lExcelHeadForIo.id.trim() != ''">
AND a.id = #{lExcelHeadForIo.id}
</if>
<if test="lExcelHeadForIo.createUser != null and lExcelHeadForIo.createUser.trim() != ''">
AND a.create_user = #{lExcelHeadForIo.createUser}
</if>
<if test="lExcelHeadForIo.createTime != null">
AND a.create_time = #{lExcelHeadForIo.createTime}
</if>
<if test="lExcelHeadForIo.useCode != null and lExcelHeadForIo.useCode.trim() != ''">
AND a.use_code = #{lExcelHeadForIo.useCode}
</if>
<if test="lExcelHeadForIo.excelHeadText != null and lExcelHeadForIo.excelHeadText.trim() != ''">
AND a.excel_head_text = #{lExcelHeadForIo.excelHeadText}
</if>
<if test="lExcelHeadForIo.remark != null and lExcelHeadForIo.remark.trim() != ''">
AND a.remark = #{lExcelHeadForIo.remark}
</if>
</if>
</sql>
<!--lExcelHeadForIo简单分页查询-->
<select id="getLExcelHeadForIoPage" resultMap="lExcelHeadForIoMap">
SELECT
<include refid="Base_Column_List"/>
FROM l_excel_head_for_io a
<where>
1=1
<include refid="lExcelHeadForIo_where"/>
</where>
</select>
</mapper>
...@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.social.entity.SysBaseSetInfo; import com.yifu.cloud.plus.v1.yifu.social.entity.SysBaseSetInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.SysPayProportion; import com.yifu.cloud.plus.v1.yifu.social.entity.SysPayProportion;
import com.yifu.cloud.plus.v1.yifu.social.service.SysBaseSetInfoService; import com.yifu.cloud.plus.v1.yifu.social.service.SysBaseSetInfoService;
...@@ -93,6 +94,31 @@ public class SysBaseSetInfoController { ...@@ -93,6 +94,31 @@ public class SysBaseSetInfoController {
return R.ok(baseSetInfo); return R.ok(baseSetInfo);
} }
/**
* 通过户名称查询基数设置表
*
* @param houseHoldName 户名称
* @param type 类型 0.社保 1.公积金
* @return R
*/
@Operation(summary = "通过户名称查询", description = "通过户名称查询:type(0.社保 1.公积金) houseHoldName(社保户或公积金名称)")
@GetMapping("/getBaseSetByParam")
public R<SysBaseSetInfo> getBaseSetByParam(@RequestParam(name = "houseHoldName") String houseHoldName,
@RequestParam(name = "type") String type) {
// 在用 非删除 最近创建的一条配置数据
SysBaseSetInfo baseSetInfo = sysBaseSetInfoService.getOne(Wrappers.<SysBaseSetInfo>query().lambda()
.eq(SysBaseSetInfo::getDepartName,houseHoldName).eq(SysBaseSetInfo::getBaseType,type)
.eq(SysBaseSetInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(SysBaseSetInfo::getStatus,CommonConstants.ZERO_STRING)
.orderByDesc(BaseEntity::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL));
if (null != baseSetInfo && CommonConstants.ONE_STRING.equals(baseSetInfo.getBaseType())){
baseSetInfo.setFundProList(sysPayProportionService.list(Wrappers.<SysPayProportion>query().lambda()
.eq(SysPayProportion::getSysBaseSetId,baseSetInfo.getId())));
}
return R.ok(baseSetInfo);
}
/** /**
* 新增基数设置表 * 新增基数设置表
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment