Compare commits
No commits in common. "026067f5f63b8095c51ae4756cf529bbf475e5bf" and "c65f5ac7935e6ac02569598d860a80101ed86492" have entirely different histories.
026067f5f6
...
c65f5ac793
@ -1,18 +1,12 @@
|
|||||||
package cn.iocoder.yudao.module.archives.controller.admin;
|
package cn.iocoder.yudao.module.archives.controller.admin;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
||||||
import cn.iocoder.yudao.module.archives.entity.Archives;
|
|
||||||
import cn.iocoder.yudao.module.archives.service.ArchivesService;
|
import cn.iocoder.yudao.module.archives.service.ArchivesService;
|
||||||
import cn.iocoder.yudao.module.archives.vo.ArchivesReqVO;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 档案表 控制层
|
* 档案表 控制层
|
||||||
* @author 小李
|
* @author 小李
|
||||||
@ -25,47 +19,4 @@ public class ArchivesController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ArchivesService archivesService;
|
private ArchivesService archivesService;
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增或修改 档案表
|
|
||||||
* @author 小李
|
|
||||||
* @date 10:42 2024/8/29
|
|
||||||
* @param archivesReqVO 请求对象
|
|
||||||
**/
|
|
||||||
@PostMapping("/update")
|
|
||||||
@Operation(summary = "新增/修改企业管理-档案表")
|
|
||||||
public CommonResult updateArchives(@RequestBody ArchivesReqVO archivesReqVO){
|
|
||||||
archivesService.updateArchives(archivesReqVO);
|
|
||||||
return CommonResult.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询 档案表
|
|
||||||
* @author 小李
|
|
||||||
* @date 11:08 2024/8/29
|
|
||||||
* @param archivesReqVO 查询条件
|
|
||||||
* @param pageNo 页码
|
|
||||||
* @param pageSize 条数
|
|
||||||
**/
|
|
||||||
@GetMapping("/list")
|
|
||||||
@Operation(summary = "分页查企业管理-档案表")
|
|
||||||
public CommonResult queryArchivesPage(ArchivesReqVO archivesReqVO,
|
|
||||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
|
||||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){
|
|
||||||
Page<Archives> page = new Page<>(pageNo, pageSize);
|
|
||||||
return success(archivesService.queryArchivesPage(archivesReqVO, page));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除 档案表
|
|
||||||
* @author 小李
|
|
||||||
* @date 14:14 2024/8/29
|
|
||||||
* @param id 记录ID
|
|
||||||
**/
|
|
||||||
@DeleteMapping("/remove/{id}")
|
|
||||||
@Operation(summary = "删除企业管理-档案表")
|
|
||||||
public CommonResult removeArchivesById(@PathVariable String id){
|
|
||||||
archivesService.removeArchivesById(id);
|
|
||||||
return CommonResult.ok();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,7 +74,4 @@ public class Archives extends TenantBaseDO {
|
|||||||
* 部门id(system_dept表中的id)
|
* 部门id(system_dept表中的id)
|
||||||
*/
|
*/
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
/** 备注 */
|
|
||||||
private String remark;
|
|
||||||
}
|
}
|
||||||
@ -1,12 +1,8 @@
|
|||||||
package cn.iocoder.yudao.module.archives.mapper;
|
package cn.iocoder.yudao.module.archives.mapper;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.archives.entity.Archives;
|
import cn.iocoder.yudao.module.archives.entity.Archives;
|
||||||
import cn.iocoder.yudao.module.archives.vo.ArchivesReqVO;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 针对表【company_archives(档案表)】的数据库操作Mapper
|
* 针对表【company_archives(档案表)】的数据库操作Mapper
|
||||||
@ -15,6 +11,4 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
**/
|
**/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ArchivesMapper extends BaseMapper<Archives> {
|
public interface ArchivesMapper extends BaseMapper<Archives> {
|
||||||
|
|
||||||
IPage<Archives> queryArchivesPage(@Param("map") ArchivesReqVO archivesReqVO, Page<Archives> page);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.archives.service;
|
package cn.iocoder.yudao.module.archives.service;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.archives.entity.Archives;
|
import cn.iocoder.yudao.module.archives.entity.Archives;
|
||||||
import cn.iocoder.yudao.module.archives.vo.ArchivesReqVO;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12,28 +9,4 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
* @date 20:13 2024/8/28
|
* @date 20:13 2024/8/28
|
||||||
**/
|
**/
|
||||||
public interface ArchivesService extends IService<Archives> {
|
public interface ArchivesService extends IService<Archives> {
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增或修改 档案表
|
|
||||||
* @author 小李
|
|
||||||
* @date 10:42 2024/8/29
|
|
||||||
* @param archivesReqVO 请求对象
|
|
||||||
**/
|
|
||||||
void updateArchives(ArchivesReqVO archivesReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询 档案表
|
|
||||||
* @author 小李
|
|
||||||
* @date 11:08 2024/8/29
|
|
||||||
* @param archivesReqVO 查询条件
|
|
||||||
**/
|
|
||||||
IPage<Archives> queryArchivesPage(ArchivesReqVO archivesReqVO, Page<Archives> page);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除 档案表
|
|
||||||
* @author 小李
|
|
||||||
* @date 14:14 2024/8/29
|
|
||||||
* @param id 记录ID
|
|
||||||
**/
|
|
||||||
void removeArchivesById(String id);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,21 +1,11 @@
|
|||||||
package cn.iocoder.yudao.module.archives.service.impl;
|
package cn.iocoder.yudao.module.archives.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import cn.iocoder.yudao.module.archives.entity.Archives;
|
import cn.iocoder.yudao.module.archives.entity.Archives;
|
||||||
import cn.iocoder.yudao.module.archives.mapper.ArchivesMapper;
|
import cn.iocoder.yudao.module.archives.mapper.ArchivesMapper;
|
||||||
import cn.iocoder.yudao.module.archives.service.ArchivesService;
|
import cn.iocoder.yudao.module.archives.service.ArchivesService;
|
||||||
import cn.iocoder.yudao.module.archives.vo.ArchivesReqVO;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 档案表 服务实现类
|
* 档案表 服务实现类
|
||||||
* @author 小李
|
* @author 小李
|
||||||
@ -23,58 +13,4 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
|
|||||||
**/
|
**/
|
||||||
@Service
|
@Service
|
||||||
public class ArchivesServiceImpl extends ServiceImpl<ArchivesMapper, Archives> implements ArchivesService {
|
public class ArchivesServiceImpl extends ServiceImpl<ArchivesMapper, Archives> implements ArchivesService {
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增或修改 档案表
|
|
||||||
* @author 小李
|
|
||||||
* @date 10:42 2024/8/29
|
|
||||||
* @param archivesReqVO 请求对象
|
|
||||||
**/
|
|
||||||
@Override
|
|
||||||
public void updateArchives(ArchivesReqVO archivesReqVO){
|
|
||||||
// 新增
|
|
||||||
if (ObjectUtil.isEmpty(archivesReqVO.getId())){
|
|
||||||
// 判断档案名是否重复
|
|
||||||
List<Archives> archives = baseMapper.selectList(new LambdaQueryWrapper<Archives>().eq(Archives::getArchivesCode, archivesReqVO.getArchivesCode()));
|
|
||||||
if (CollectionUtil.isNotEmpty(archives)){
|
|
||||||
throw exception0(500, "档案名重复");
|
|
||||||
}
|
|
||||||
baseMapper.insert(archivesReqVO);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 修改
|
|
||||||
// 判断档案名是否合法
|
|
||||||
// 如果有,判断id是否一致,不一致就是重复,其他情况皆可执行
|
|
||||||
List<Archives> archives = baseMapper.selectList(new LambdaQueryWrapper<Archives>().eq(Archives::getArchivesCode, archivesReqVO.getArchivesCode()));
|
|
||||||
// 用&&短路的特性去判断,少写点代码
|
|
||||||
// get 0有些不合理,理论上讲是不会有多条的,概率小,改一下名字就行
|
|
||||||
Boolean flag = CollectionUtil.isNotEmpty(archives) && !archives.get(0).getId().equals(archivesReqVO.getId());
|
|
||||||
if (flag){
|
|
||||||
throw exception0(500, "档案名重复");
|
|
||||||
}
|
|
||||||
baseMapper.updateById(archivesReqVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询 档案表
|
|
||||||
* @author 小李
|
|
||||||
* @date 11:08 2024/8/29
|
|
||||||
* @param archivesReqVO 查询条件
|
|
||||||
**/
|
|
||||||
@Override
|
|
||||||
public IPage<Archives> queryArchivesPage(ArchivesReqVO archivesReqVO, Page<Archives> page){
|
|
||||||
return baseMapper.queryArchivesPage(archivesReqVO, page);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除 档案表
|
|
||||||
* @author 小李
|
|
||||||
* @date 14:14 2024/8/29
|
|
||||||
* @param id 记录ID
|
|
||||||
**/
|
|
||||||
@Override
|
|
||||||
public void removeArchivesById(String id){
|
|
||||||
baseMapper.deleteById(id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.archives.vo;
|
package cn.iocoder.yudao.module.archives.vo;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.archives.entity.Archives;
|
import cn.iocoder.yudao.module.archives.entity.Archives;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 档案表 请求VO
|
* 档案表 请求VO
|
||||||
@ -16,8 +10,4 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
|||||||
**/
|
**/
|
||||||
@Data
|
@Data
|
||||||
public class ArchivesReqVO extends Archives {
|
public class ArchivesReqVO extends Archives {
|
||||||
|
|
||||||
@Schema(description = "合同日期查询范围")
|
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
|
||||||
private Date[] queryDateArray;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,34 +15,14 @@
|
|||||||
<result property="signTime" column="sign_time" jdbcType="TIMESTAMP"/>
|
<result property="signTime" column="sign_time" jdbcType="TIMESTAMP"/>
|
||||||
<result property="expireTime" column="expire_time" jdbcType="TIMESTAMP"/>
|
<result property="expireTime" column="expire_time" jdbcType="TIMESTAMP"/>
|
||||||
<result property="deptId" column="dept_id" jdbcType="BIGINT"/>
|
<result property="deptId" column="dept_id" jdbcType="BIGINT"/>
|
||||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_SQL">
|
<sql id="Base_SQL">
|
||||||
select id,
|
id,data_id,archives_name,
|
||||||
data_id,
|
archives_type,archives_physics_url,archives_urls,
|
||||||
archives_name,
|
archives_code,sign_time,expire_time,
|
||||||
archives_type,
|
dept_id,tenant_id,deleted,
|
||||||
archives_physics_url,
|
creator,create_time,updater,
|
||||||
archives_urls,
|
update_time
|
||||||
archives_code,
|
|
||||||
sign_time,
|
|
||||||
expire_time,
|
|
||||||
dept_id,
|
|
||||||
remark
|
|
||||||
from company_archives ca
|
|
||||||
where deleted = '0'
|
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="queryArchivesPage" resultMap="BaseResultMap">
|
|
||||||
<include refid="Base_SQL" />
|
|
||||||
and ca.data_id = #{map.dataId}
|
|
||||||
<if test="map.archivesName != null and map.archivesName != ''">
|
|
||||||
and (ca.archives_name like concat('%', #{map.archivesName}, '%'))
|
|
||||||
</if>
|
|
||||||
<if test="map.queryDateArray != null and map.queryDateArray.length > 0">
|
|
||||||
and (ca.sign_time >= #{map.queryDateArray[0]} and ca.expire_time <= #{map.queryDateArray[1]})
|
|
||||||
</if>
|
|
||||||
order by ca.create_time desc
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue
Block a user