添加字段继承原来字段 统计原来销售合同总数和
package com.lzy.framework.web.page;
import com.lzy.project.project.domain.vo.ProjectXmshtXhzjVo;
import lombok.Data;
import java.io.Serializable;
@Data
public class TableDataInfoXS extends TableDataInfo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 销售合同 总计
*/
private ProjectXmshtXhzjVo projectXmshtXhzjVo;
}
mapper接口
ProjectXmshtXhzjVo SelectXmxshtCount(ProjectXmxsht projectXmxsht);
统计和的xml文件
<select id="SelectXmxshtCount" parameterType="ProjectXmxsht" resultType="ProjectXmshtXhzjVo">
select count(1) as htzj,
IFNULL(SUM(htje), 0) as htjezj,
IFNULL(SUM(ysje), 0) as ysjezj,
IFNULL(SUM(ysjei), 0) as ysjeizj
from project_xmxsht
<where>
ly = 'OA'
AND(sfyx is null OR sfyx = '0')
<if test="sjid != null ">and sjid = #{sjid}</if>
<if test="htxmmc != null and htxmmc != ''">and htxmmc like concat('%', #{htxmmc}, '%')</if>
<if test="htkhmc != null and htkhmc != ''">and htkhmc like concat('%', #{htkhmc}, '%')</if>
<if test="htje != null and htje != ''">and htje = #{htje}</if>
<if test="ysje != null and ysje != ''">and ysje = #{ysje}</if>
<if test="ysjei != null and ysjei != ''">and ysjei = #{ysjei}</if>
<if test="ykfp != null and ykfp != ''">and ykfp = #{ykfp}</if>
<if test="qdrq != null and qdrq != ''">and qdrq = #{qdrq}</if>
<if test="htlb != null and htlb != ''">and htlb = #{htlb}</if>
<if test="xmlx != null and xmlx != ''">and xmlx = #{xmlx}</if>
<if test="wfqygs != null and wfqygs != ''">and wfqygs = #{wfqygs}</if>
<if test="addUser != null ">and add_user = #{addUser}</if>
<if test="addTime != null and addTime != ''">and add_time = #{addTime}</if>
<if test="updateUser != null ">and update_user = #{updateUser}</if>
</where>
</select>
service接口
/**
总记录数 总计 sum总计
*/
ProjectXmshtXhzjVo selectProjectXmxshtCount (ProjectXmxsht projectXmxsht);
实现类
/**
* 总记录数 总计
*
* @param
*/
@Override
public ProjectXmshtXhzjVo selectProjectXmxshtCount(ProjectXmxsht projectXmxsht) {
return projectXmxshtMapper.SelectXmxshtCount(projectXmxsht);
}
调用srvice的controller
/**
* 查询天诚项目-销售及售后合同列表
*/
@GetMapping("/list")
public TableDataInfoXS list(ProjectXmxsht projectXmxsht) {
startPage();
List<ProjectXmxsht> list = projectXmxshtService.selectProjectXmxshtList(projectXmxsht);
ProjectXmshtXhzjVo projectXmxshtCount = projectXmxshtService.selectProjectXmxshtCount(projectXmxsht);
return getDataTableXs(list,projectXmxshtCount);
}
返回给前端的base、controller
/**
* 响应请求分页数据
*/
@SuppressWarnings({"rawtypes", "unchecked"})
protected TableDataInfo getDataTable(List<?> list) {
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(list);
rspData.setTotal(new PageInfo(list).getTotal());
return rspData;
}
/**
* 响应请求总记录数+合同金额+销售合同
*/
@SuppressWarnings({"rawtypes", "unchecked"})
protected TableDataInfoXS getDataTableXs(List<?> list, ProjectXmshtXhzjVo projectXmshtXhzjVo) {
TableDataInfoXS rspData = new TableDataInfoXS();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(list);
rspData.setProjectXmshtXhzjVo(projectXmshtXhzjVo);
return rspData;
}
/**
* 响应请求总记录+数采购合同
*/
@SuppressWarnings({"rawtypes", "unchecked"})
protected TableDataInfoCG getDataTableCG(List<?> list, ProjectXmshtzjVo projectXmshtzjVo) {
TableDataInfoCG rspData = new TableDataInfoCG();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(list);
rspData.setProjectXmshtzjVo(projectXmshtzjVo);
return rspData;
}