新增项目报工
This commit is contained in:
@@ -2,9 +2,11 @@ package com.ruoyi.common.core.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
@@ -39,6 +41,8 @@ public class BaseEntity implements Serializable {
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
@@ -51,6 +55,8 @@ public class BaseEntity implements Serializable {
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.ruoyi.oa.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import com.ruoyi.common.core.validate.QueryGroup;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.oa.domain.vo.OaProjectReportVo;
|
||||
import com.ruoyi.oa.domain.bo.OaProjectReportBo;
|
||||
import com.ruoyi.oa.service.IOaProjectReportService;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 项目报工
|
||||
*
|
||||
* @author hdka
|
||||
* @date 2025-06-16
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/oa/projectReport")
|
||||
public class OaProjectReportController extends BaseController {
|
||||
|
||||
private final IOaProjectReportService iOaProjectReportService;
|
||||
|
||||
/**
|
||||
* 查询项目报工列表
|
||||
*/
|
||||
@SaCheckPermission("oa:projectReport:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<OaProjectReportVo> list(OaProjectReportBo bo, PageQuery pageQuery) {
|
||||
return iOaProjectReportService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出项目报工列表
|
||||
*/
|
||||
@SaCheckPermission("oa:projectReport:export")
|
||||
@Log(title = "项目报工", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(OaProjectReportBo bo, HttpServletResponse response) {
|
||||
List<OaProjectReportVo> list = iOaProjectReportService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "项目报工", OaProjectReportVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目报工详细信息
|
||||
*
|
||||
* @param reportId 主键
|
||||
*/
|
||||
@SaCheckPermission("oa:projectReport:query")
|
||||
@GetMapping("/{reportId}")
|
||||
public R<OaProjectReportVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long reportId) {
|
||||
return R.ok(iOaProjectReportService.queryById(reportId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增项目报工
|
||||
*/
|
||||
@SaCheckPermission("oa:projectReport:add")
|
||||
@Log(title = "项目报工", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody OaProjectReportBo bo) {
|
||||
return toAjax(iOaProjectReportService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目报工
|
||||
*/
|
||||
@SaCheckPermission("oa:projectReport:edit")
|
||||
@Log(title = "项目报工", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody OaProjectReportBo bo) {
|
||||
return toAjax(iOaProjectReportService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除项目报工
|
||||
*
|
||||
* @param reportIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("oa:projectReport:remove")
|
||||
@Log(title = "项目报工", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{reportIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] reportIds) {
|
||||
return toAjax(iOaProjectReportService.deleteWithValidByIds(Arrays.asList(reportIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.oa.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 项目报工对象 oa_project_report
|
||||
*
|
||||
* @author hdka
|
||||
* @date 2025-06-16
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("oa_project_report")
|
||||
public class OaProjectReport extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键 ID
|
||||
*/
|
||||
@TableId(value = "report_id")
|
||||
private Long reportId;
|
||||
/**
|
||||
* 经办人
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 工作地点
|
||||
*/
|
||||
private String workPlace;
|
||||
/**
|
||||
* 项目 ID
|
||||
*/
|
||||
private Long projectId;
|
||||
/**
|
||||
* 报工内容
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 删除标志 (0 正常, 1 删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否出差
|
||||
*/
|
||||
private Long isTrip;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.ruoyi.oa.domain.bo;
|
||||
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 项目报工业务对象 oa_project_report
|
||||
*
|
||||
* @author hdka
|
||||
* @date 2025-06-16
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class OaProjectReportBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键 ID
|
||||
*/
|
||||
private Long reportId;
|
||||
|
||||
/**
|
||||
* 经办人
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 工作地点
|
||||
*/
|
||||
private String workPlace;
|
||||
|
||||
/**
|
||||
* 项目 ID
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 报工内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否出差
|
||||
*/
|
||||
private Long isTrip;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 项目编号
|
||||
*/
|
||||
private String projectNum;
|
||||
|
||||
/**
|
||||
* 项目代号
|
||||
*/
|
||||
private String projectCode;
|
||||
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.ruoyi.oa.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.ruoyi.common.annotation.ExcelDictFormat;
|
||||
import com.ruoyi.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 项目报工视图对象 oa_project_report
|
||||
*
|
||||
* @author hdka
|
||||
* @date 2025-06-16
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class OaProjectReportVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键 ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键 ID")
|
||||
private Long reportId;
|
||||
|
||||
/**
|
||||
* 经办人
|
||||
*/
|
||||
@ExcelProperty(value = "经办人")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 经办人姓名
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 工作地点
|
||||
*/
|
||||
@ExcelProperty(value = "工作地点")
|
||||
private String workPlace;
|
||||
|
||||
/**
|
||||
* 项目 ID
|
||||
*/
|
||||
@ExcelProperty(value = "项目 ID")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 项目编号
|
||||
*/
|
||||
private String projectNum;
|
||||
|
||||
/**
|
||||
* 项目代号
|
||||
*/
|
||||
private String projectCode;
|
||||
|
||||
/**
|
||||
* 报工内容
|
||||
*/
|
||||
@ExcelProperty(value = "报工内容")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否出差
|
||||
*/
|
||||
private Long isTrip;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.ruoyi.oa.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.oa.domain.OaProjectReport;
|
||||
import com.ruoyi.oa.domain.vo.OaProjectReportVo;
|
||||
import com.ruoyi.common.core.mapper.BaseMapperPlus;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 项目报工Mapper接口
|
||||
*
|
||||
* @author hdka
|
||||
* @date 2025-06-16
|
||||
*/
|
||||
public interface OaProjectReportMapper extends BaseMapperPlus<OaProjectReportMapper, OaProjectReport, OaProjectReportVo> {
|
||||
|
||||
Page<OaProjectReportVo> selectVoPagePlus(@Param("build") Page<Object> build, @Param(Constants.WRAPPER) QueryWrapper<OaProjectReport> lqw);
|
||||
|
||||
OaProjectReportVo selectVoByIdPlus(@Param("reportId") Long reportId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.ruoyi.oa.service;
|
||||
|
||||
import com.ruoyi.oa.domain.OaProjectReport;
|
||||
import com.ruoyi.oa.domain.vo.OaProjectReportVo;
|
||||
import com.ruoyi.oa.domain.bo.OaProjectReportBo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目报工Service接口
|
||||
*
|
||||
* @author hdka
|
||||
* @date 2025-06-16
|
||||
*/
|
||||
public interface IOaProjectReportService {
|
||||
|
||||
/**
|
||||
* 查询项目报工
|
||||
*/
|
||||
OaProjectReportVo queryById(Long reportId);
|
||||
|
||||
/**
|
||||
* 查询项目报工列表
|
||||
*/
|
||||
TableDataInfo<OaProjectReportVo> queryPageList(OaProjectReportBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询项目报工列表
|
||||
*/
|
||||
List<OaProjectReportVo> queryList(OaProjectReportBo bo);
|
||||
|
||||
/**
|
||||
* 新增项目报工
|
||||
*/
|
||||
Boolean insertByBo(OaProjectReportBo bo);
|
||||
|
||||
/**
|
||||
* 修改项目报工
|
||||
*/
|
||||
Boolean updateByBo(OaProjectReportBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除项目报工信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.ruoyi.oa.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.oa.domain.bo.OaProjectReportBo;
|
||||
import com.ruoyi.oa.domain.vo.OaProjectReportVo;
|
||||
import com.ruoyi.oa.domain.OaProjectReport;
|
||||
import com.ruoyi.oa.mapper.OaProjectReportMapper;
|
||||
import com.ruoyi.oa.service.IOaProjectReportService;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 项目报工Service业务层处理
|
||||
*
|
||||
* @author hdka
|
||||
* @date 2025-06-16
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class OaProjectReportServiceImpl implements IOaProjectReportService {
|
||||
|
||||
private final OaProjectReportMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询项目报工
|
||||
*/
|
||||
@Override
|
||||
public OaProjectReportVo queryById(Long reportId){
|
||||
return baseMapper.selectVoByIdPlus(reportId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询项目报工列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<OaProjectReportVo> queryPageList(OaProjectReportBo bo, PageQuery pageQuery) {
|
||||
QueryWrapper<OaProjectReport> lqw = buildQueryWrapper(bo);
|
||||
Page<OaProjectReportVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询项目报工列表
|
||||
*/
|
||||
@Override
|
||||
public List<OaProjectReportVo> queryList(OaProjectReportBo bo) {
|
||||
QueryWrapper<OaProjectReport> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private QueryWrapper<OaProjectReport> buildQueryWrapper(OaProjectReportBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
QueryWrapper<OaProjectReport> lqw = Wrappers.query();
|
||||
lqw.eq(bo.getUserId()!=null, "opr.user_id", bo.getUserId());
|
||||
|
||||
lqw.eq(bo.getProjectId() != null, "opr.project_id", bo.getProjectId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getNickName()), "su.nick_name", bo.getNickName());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getProjectNum()), "op.project_num", bo.getProjectNum());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getProjectCode()), "op.project_code", bo.getProjectCode());
|
||||
lqw.eq(bo.getDeptId()!=null, "su.dept_id", bo.getDeptId());
|
||||
if (bo.getCreateTime() != null) {
|
||||
LocalDateTime start = bo.getCreateTime() // LocalDateTime / Date 都行
|
||||
.toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate() // 先取日期
|
||||
.atStartOfDay(); // 00:00:00
|
||||
LocalDateTime end = start.plusDays(1); // 下一天 00:00:00
|
||||
|
||||
lqw.ge("opr.create_time", start)
|
||||
.lt("opr.create_time", end); // [start, end)
|
||||
}
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增项目报工
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(OaProjectReportBo bo) {
|
||||
OaProjectReport add = BeanUtil.toBean(bo, OaProjectReport.class);
|
||||
validEntityBeforeSave(add);
|
||||
add.setUserId(LoginHelper.getUserId());
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setReportId(add.getReportId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目报工
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(OaProjectReportBo bo) {
|
||||
OaProjectReport update = BeanUtil.toBean(bo, OaProjectReport.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(OaProjectReport entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除项目报工
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,6 @@ public class SysOssAclServiceImpl extends ServiceImpl<SysOssAclMapper, SysOssAcl
|
||||
|
||||
/* 3. 批量查询用户表 */
|
||||
List<SysUser> users = userMapper.selectBatchIds(userIds);
|
||||
System.out.println(users);
|
||||
/* 4. 转成 DTO */
|
||||
return users.stream().map(u -> {
|
||||
SysUserVo dto = new SysUserVo();
|
||||
|
||||
@@ -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.ruoyi.oa.mapper.OaProjectReportMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.oa.domain.OaProjectReport" id="OaProjectReportResult">
|
||||
<result property="reportId" column="report_id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="workPlace" column="work_place"/>
|
||||
<result property="projectId" column="project_id"/>
|
||||
<result property="content" column="content"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
<select id="selectVoPagePlus" resultType="com.ruoyi.oa.domain.vo.OaProjectReportVo">
|
||||
select opr.report_id,
|
||||
opr.user_id,
|
||||
is_trip,
|
||||
work_place,
|
||||
opr.project_id,
|
||||
content,
|
||||
opr.create_time,
|
||||
opr.create_by,
|
||||
opr.update_time,
|
||||
opr.update_by,
|
||||
opr.del_flag,
|
||||
opr.remark,
|
||||
op.project_name,
|
||||
op.project_num,
|
||||
op.project_code,
|
||||
su.nick_name,
|
||||
sd.dept_name
|
||||
from oa_project_report opr
|
||||
left join sys_oa_project op on opr.project_id = op.project_id
|
||||
left join sys_user su on su.user_id = opr.user_id
|
||||
left join sys_dept sd on su.dept_id = sd.dept_id
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
<select id="selectVoByIdPlus" resultType="com.ruoyi.oa.domain.vo.OaProjectReportVo">
|
||||
select opr.report_id,
|
||||
opr.user_id,
|
||||
is_trip,
|
||||
work_place,
|
||||
opr.project_id,
|
||||
content,
|
||||
opr.create_time,
|
||||
opr.create_by,
|
||||
opr.update_time,
|
||||
opr.update_by,
|
||||
opr.del_flag,
|
||||
opr.remark,
|
||||
op.project_name,
|
||||
op.project_num,
|
||||
op.project_code,
|
||||
su.nick_name,
|
||||
sd.dept_name
|
||||
from oa_project_report opr
|
||||
left join sys_oa_project op on opr.project_id = op.project_id
|
||||
left join sys_user su on su.user_id = opr.user_id
|
||||
left join sys_dept sd on su.dept_id = sd.dept_id
|
||||
where report_id = #{reportId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -142,26 +142,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 3. 指定日期的入库量 -->
|
||||
<!-- 3. 指定日期的入库量(单位统一为米/kg 并取整) -->
|
||||
<select id="selectInboundOn" resultType="long">
|
||||
SELECT IFNULL(SUM(d.amount),0)
|
||||
SELECT
|
||||
IFNULL(
|
||||
SUM(
|
||||
CASE
|
||||
WHEN w.unit IN ('cm','厘米')
|
||||
THEN FLOOR(d.amount / 100) -- 厘米→米,并去小数
|
||||
WHEN w.unit IN ('g','克')
|
||||
THEN FLOOR(d.amount / 1000) -- 克→千克,并去小数
|
||||
ELSE
|
||||
FLOOR(d.amount) -- 其他单位,也取整
|
||||
END
|
||||
)
|
||||
, 0)
|
||||
FROM sys_oa_warehouse_detail d
|
||||
JOIN sys_oa_warehouse_master m
|
||||
ON d.master_id = m.master_id
|
||||
JOIN sys_oa_warehouse w
|
||||
ON d.warehouse_id = w.id
|
||||
JOIN sys_oa_warehouse_master m ON d.master_id = m.master_id
|
||||
JOIN sys_oa_warehouse w ON d.warehouse_id = w.id
|
||||
<where>
|
||||
m.del_flag = 0
|
||||
and d.del_flag = 0
|
||||
and m.type = 1
|
||||
AND d.del_flag = 0
|
||||
AND m.type = 1
|
||||
<!-- 当日 -->
|
||||
<if test="f.endTime != null">
|
||||
AND DATE(m.sign_time) = DATE(#{f.endTime})
|
||||
</if>
|
||||
<!-- 物料名/品牌/供应商 -->
|
||||
<if test="f.name != null and f.name != ''">
|
||||
AND w.name LIKE CONCAT('%',#{f.name},'%')
|
||||
AND w.name LIKE CONCAT('%',#{f.name},'%')
|
||||
</if>
|
||||
<if test="f.brand != null and f.brand != ''">
|
||||
AND w.brand LIKE CONCAT('%',#{f.brand},'%')
|
||||
@@ -172,47 +181,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 4. 指定日期的出库量 -->
|
||||
<!-- 4. 指定日期的出库量(同上) -->
|
||||
<select id="selectOutboundOn"
|
||||
parameterType="com.ruoyi.oa.domain.dto.SummaryFilterDTO"
|
||||
resultType="long">
|
||||
SELECT IFNULL(SUM(d.amount),0)
|
||||
SELECT
|
||||
IFNULL(
|
||||
SUM(
|
||||
CASE
|
||||
WHEN w.unit IN ('cm','厘米')
|
||||
THEN FLOOR(d.amount / 100)
|
||||
WHEN w.unit IN ('g','克')
|
||||
THEN FLOOR(d.amount / 1000)
|
||||
ELSE
|
||||
FLOOR(d.amount)
|
||||
END
|
||||
)
|
||||
, 0)
|
||||
FROM sys_oa_warehouse_detail d
|
||||
JOIN sys_oa_warehouse_master m
|
||||
ON d.master_id = m.master_id
|
||||
JOIN sys_oa_warehouse w
|
||||
ON d.warehouse_id = w.id
|
||||
JOIN sys_oa_warehouse_master m ON d.master_id = m.master_id
|
||||
JOIN sys_oa_warehouse w ON d.warehouse_id = w.id
|
||||
<where>
|
||||
m.del_flag = 0
|
||||
AND d.del_flag = 0
|
||||
AND m.type = 0
|
||||
AND m.type = 0
|
||||
<!-- “当日”条件,用 endTime 对比 -->
|
||||
<if test="f.endTime != null">
|
||||
AND DATE(m.sign_time) = DATE(#{f.endTime})
|
||||
</if>
|
||||
|
||||
<!-- 可选的物料名过滤 -->
|
||||
<!-- 可选过滤 -->
|
||||
<if test="f.name != null and f.name != ''">
|
||||
AND w.name LIKE CONCAT('%',#{f.name},'%')
|
||||
AND w.name LIKE CONCAT('%',#{f.name},'%')
|
||||
</if>
|
||||
<!-- 可选品牌过滤 -->
|
||||
<if test="f.brand != null and f.brand != ''">
|
||||
AND w.brand LIKE CONCAT('%',#{f.brand},'%')
|
||||
</if>
|
||||
<!-- 可选供应商过滤 -->
|
||||
<if test="f.supplier != null and f.supplier != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM sys_oa_warehouse_task t
|
||||
JOIN sys_oa_warehouse_master m2
|
||||
ON t.master_id = m2.master_id
|
||||
JOIN sys_oa_warehouse_master m2 ON t.master_id = m2.master_id
|
||||
WHERE t.warehouse_id = w.id
|
||||
AND m2.sign_user = #{f.supplier}
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 5. 指定日期的预警数 -->
|
||||
<select id="selectWarningOn" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
|
||||
Reference in New Issue
Block a user