Commit e4227e8a authored by 朱翔's avatar 朱翔
Browse files

报表模板接口

parent 0de680ec
package com.ruzhoukj.sms.controller;
import com.platform.controller.BaseController;
import com.platform.model.resp.Result;
import com.platform.page.TableDataInfo;
import com.platform.utils.DozerUtils;
import com.ruzhoukj.sms.model.dto.ReportDataInfoDTO;
import com.ruzhoukj.sms.model.vo.ReportDataInfoVO;
import com.ruzhoukj.sms.service.ReportDataInfoService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @Author:zhuxiang
* @Package:com.ruzhoukj.sms.controller
* @Project:OA
* @name:ReporDataInfoController
* @Date:2025/2/20 17:05
* @Filename:ReporDataInfoController
*/
@Api(tags = "报表数据")
@RestController
@RequestMapping("/report/data")
public class ReportDataInfoController extends BaseController {
@Resource
private ReportDataInfoService reportDataInfoService;
@PostMapping("/page")
public TableDataInfo page(@RequestBody ReportDataInfoDTO reportDataInfoDTO){
startPage(reportDataInfoDTO.getPageNum(),reportDataInfoDTO.getPageSize());
return getDataTable(reportDataInfoService.queryList(reportDataInfoDTO));
}
@GetMapping("/{id}")
public Result<ReportDataInfoVO> getInfo(@PathVariable String id){
return Result.data(DozerUtils.convertBean(reportDataInfoService.getById(id),ReportDataInfoVO.class));
}
}
...@@ -2,8 +2,12 @@ package com.ruzhoukj.sms.dao; ...@@ -2,8 +2,12 @@ package com.ruzhoukj.sms.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruzhoukj.sms.entity.ReportDataInfoEntity; import com.ruzhoukj.sms.entity.ReportDataInfoEntity;
import com.ruzhoukj.sms.model.dto.ReportDataInfoDTO;
import com.ruzhoukj.sms.model.vo.ReportDataInfoVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* @Author:zhuxiang * @Author:zhuxiang
* @Package:com.ruzhoukj.sms.dao * @Package:com.ruzhoukj.sms.dao
...@@ -14,4 +18,5 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -14,4 +18,5 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface ReportDataInfoMapper extends BaseMapper<ReportDataInfoEntity> { public interface ReportDataInfoMapper extends BaseMapper<ReportDataInfoEntity> {
List<ReportDataInfoVO> queryList(ReportDataInfoDTO reportDataInfoDTO);
} }
...@@ -32,4 +32,13 @@ public class ReportDataInfoEntity { ...@@ -32,4 +32,13 @@ public class ReportDataInfoEntity {
@TableField("template_id") @TableField("template_id")
private String templateId; private String templateId;
@TableField("user_id")
private String userId;
@TableField("year")
private Integer year;
@TableField("month")
private Integer month;
} }
package com.ruzhoukj.sms.model.dto;
import com.ruzhoukj.sms.entity.ReportDataInfoEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @Author:zhuxiang
* @Package:com.ruzhoukj.sms.model.dto
* @Project:OA
* @name:ReportDataInfoDTO
* @Date:2025/2/20 17:19
* @Filename:ReportDataInfoDTO
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class ReportDataInfoDTO extends ReportDataInfoEntity {
private Integer pageNum;
private Integer pageSize;
}
package com.ruzhoukj.sms.model.vo;
import com.ruzhoukj.sms.entity.ReportDataInfoEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @Author:zhuxiang
* @Package:com.ruzhoukj.sms.model.vo
* @Project:OA
* @name:ReportDataInfoVO
* @Date:2025/2/20 17:25
* @Filename:ReportDataInfoVO
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class ReportDataInfoVO extends ReportDataInfoEntity {
@ApiModelProperty(value = "用户名")
private String userName;
}
...@@ -2,6 +2,10 @@ package com.ruzhoukj.sms.service; ...@@ -2,6 +2,10 @@ package com.ruzhoukj.sms.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruzhoukj.sms.entity.ReportDataInfoEntity; import com.ruzhoukj.sms.entity.ReportDataInfoEntity;
import com.ruzhoukj.sms.model.dto.ReportDataInfoDTO;
import com.ruzhoukj.sms.model.vo.ReportDataInfoVO;
import java.util.List;
/** /**
* @Author:zhuxiang * @Author:zhuxiang
...@@ -12,4 +16,5 @@ import com.ruzhoukj.sms.entity.ReportDataInfoEntity; ...@@ -12,4 +16,5 @@ import com.ruzhoukj.sms.entity.ReportDataInfoEntity;
* @Filename:ReportDataInfoService * @Filename:ReportDataInfoService
*/ */
public interface ReportDataInfoService extends IService<ReportDataInfoEntity> { public interface ReportDataInfoService extends IService<ReportDataInfoEntity> {
List<ReportDataInfoVO> queryList(ReportDataInfoDTO reportDataInfoDTO);
} }
...@@ -3,9 +3,13 @@ package com.ruzhoukj.sms.service.impl; ...@@ -3,9 +3,13 @@ package com.ruzhoukj.sms.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruzhoukj.sms.dao.ReportDataInfoMapper; import com.ruzhoukj.sms.dao.ReportDataInfoMapper;
import com.ruzhoukj.sms.entity.ReportDataInfoEntity; import com.ruzhoukj.sms.entity.ReportDataInfoEntity;
import com.ruzhoukj.sms.model.dto.ReportDataInfoDTO;
import com.ruzhoukj.sms.model.vo.ReportDataInfoVO;
import com.ruzhoukj.sms.service.ReportDataInfoService; import com.ruzhoukj.sms.service.ReportDataInfoService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* @Author:zhuxiang * @Author:zhuxiang
* @Package:com.ruzhoukj.sms.service.impl * @Package:com.ruzhoukj.sms.service.impl
...@@ -16,4 +20,8 @@ import org.springframework.stereotype.Service; ...@@ -16,4 +20,8 @@ import org.springframework.stereotype.Service;
*/ */
@Service @Service
public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoMapper, ReportDataInfoEntity> implements ReportDataInfoService { public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoMapper, ReportDataInfoEntity> implements ReportDataInfoService {
@Override
public List<ReportDataInfoVO> queryList(ReportDataInfoDTO reportDataInfoDTO) {
return baseMapper.queryList(reportDataInfoDTO);
}
} }
<?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.ruzhoukj.sms.dao.ReportDataInfoMapper">
<select id="queryList" resultType="com.ruzhoukj.sms.model.vo.ReportDataInfoVO">
select
rdi.name name,
u.name userName,
rdi.id id,
rdi.user_id userId,
rdi.year year,
rdi.month month
from
report_data_info rdi
left join user u on
rdi.user_id = u.id
left join
report_data_and_user rdau on
rdi.id = rdau.report_data_info_id
where
rdi.user_id = #{userId}
or
rdau.user_id = #{userId}
</select>
</mapper>
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