Commit c22f40fa authored by frank.xa.zhang's avatar frank.xa.zhang

add report config api template

parent 5a08ef3b
This diff is collapsed.
rem see http://www.mybatis.org/generator/running/runningFromCmdLine.html
cd /d %~dp0
call java -classpath .;./* org.mybatis.generator.api.ShellRunner -configfile generatorConfig.xml -overwrite -verbose -tables CellTemplateConfig
call java -classpath .;./* org.mybatis.generator.api.ShellRunner -configfile generatorConfig.xml -overwrite -verbose -tables TemplateFormula
echo @@@@@@@@@@@ DONE @@@@@@@@@@@
pause
package pwc.taxtech.atms.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.dto.TemplateDto;
import pwc.taxtech.atms.service.TemplateService;
import java.util.Collections;
import java.util.List;
@RestController
@RequestMapping(value = "api/v1/template")
public class TemplateController {
private static final Logger logger = LoggerFactory.getLogger(AccountController.class);
@Autowired
TemplateService templateService;
//todo:
//[Route("getTemplateJson")]
// [HttpGet]
......@@ -14,10 +27,18 @@ public class TemplateController {
// return this.Ok(templateService.GetTemplateJson(templateID));
// }
// [Route("get")]
// [HttpGet]
// public IHttpActionResult get(string templateGroupID, int? reportType)
// {
// return this.Ok(this.templateService.Get(templateGroupID, reportType));
// }
@RequestMapping(value = "get", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody
List<TemplateDto> get(@RequestParam String templateGroupID, @RequestParam Integer reportType) {
if (StringUtils.isEmpty(templateGroupID)) {
return Collections.emptyList();
}
try {
return templateService.get(templateGroupID, reportType);
} catch (Exception e) {
logger.error("GetCellConfigList", e);
}
return Collections.emptyList();
}
}
package pwc.taxtech.atms.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entitiy.TemplateFormula;
import pwc.taxtech.atms.entitiy.TemplateFormulaExample;
@Mapper
public interface TemplateFormulaMapper extends MyMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TemplateFormula
*
* @mbg.generated
*/
long countByExample(TemplateFormulaExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TemplateFormula
*
* @mbg.generated
*/
int deleteByExample(TemplateFormulaExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TemplateFormula
*
* @mbg.generated
*/
int deleteByPrimaryKey(String ID);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TemplateFormula
*
* @mbg.generated
*/
int insert(TemplateFormula record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TemplateFormula
*
* @mbg.generated
*/
int insertSelective(TemplateFormula record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TemplateFormula
*
* @mbg.generated
*/
List<TemplateFormula> selectByExampleWithRowbounds(TemplateFormulaExample example, RowBounds rowBounds);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TemplateFormula
*
* @mbg.generated
*/
List<TemplateFormula> selectByExample(TemplateFormulaExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TemplateFormula
*
* @mbg.generated
*/
TemplateFormula selectByPrimaryKey(String ID);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TemplateFormula
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") TemplateFormula record, @Param("example") TemplateFormulaExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TemplateFormula
*
* @mbg.generated
*/
int updateByExample(@Param("record") TemplateFormula record, @Param("example") TemplateFormulaExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TemplateFormula
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(TemplateFormula record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TemplateFormula
*
* @mbg.generated
*/
int updateByPrimaryKey(TemplateFormula record);
}
\ No newline at end of file
package pwc.taxtech.atms.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entitiy.Template;
import pwc.taxtech.atms.entitiy.TemplateExample;
@Mapper
public interface TemplateMapper extends MyMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table Template
*
* @mbg.generated
*/
long countByExample(TemplateExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table Template
*
* @mbg.generated
*/
int deleteByExample(TemplateExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table Template
*
* @mbg.generated
*/
int deleteByPrimaryKey(String ID);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table Template
*
* @mbg.generated
*/
int insert(Template record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table Template
*
* @mbg.generated
*/
int insertSelective(Template record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table Template
*
* @mbg.generated
*/
List<Template> selectByExampleWithRowbounds(TemplateExample example, RowBounds rowBounds);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table Template
*
* @mbg.generated
*/
List<Template> selectByExample(TemplateExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table Template
*
* @mbg.generated
*/
Template selectByPrimaryKey(String ID);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table Template
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") Template record, @Param("example") TemplateExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table Template
*
* @mbg.generated
*/
int updateByExample(@Param("record") Template record, @Param("example") TemplateExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table Template
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(Template record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table Template
*
* @mbg.generated
*/
int updateByPrimaryKey(Template record);
}
\ No newline at end of file
package pwc.taxtech.atms.dto;
public class CellTemplateDto {
private String ID;
private String reportTemplateID;
private int rowIndex;
private String rowName;
private int columnIndex;
private String columnName;
private String comment;
private String copyFromID;
private Integer dataType;
private Integer isReadOnly;
/**
* 单元格的值(从Excel导入的单元格数据)
*/
private String CellValue;
public CellTemplateDto() {
}
public String getID() {
return ID;
}
public void setID(String ID) {
this.ID = ID;
}
public String getReportTemplateID() {
return reportTemplateID;
}
public void setReportTemplateID(String reportTemplateID) {
this.reportTemplateID = reportTemplateID;
}
public int getRowIndex() {
return rowIndex;
}
public void setRowIndex(int rowIndex) {
this.rowIndex = rowIndex;
}
public String getRowName() {
return rowName;
}
public void setRowName(String rowName) {
this.rowName = rowName;
}
public int getColumnIndex() {
return columnIndex;
}
public void setColumnIndex(int columnIndex) {
this.columnIndex = columnIndex;
}
public String getColumnName() {
return columnName;
}
public void setColumnName(String columnName) {
this.columnName = columnName;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public String getCopyFromID() {
return copyFromID;
}
public void setCopyFromID(String copyFromID) {
this.copyFromID = copyFromID;
}
public Integer getDataType() {
return dataType;
}
public void setDataType(Integer dataType) {
this.dataType = dataType;
}
public Integer getIsReadOnly() {
return isReadOnly;
}
public void setIsReadOnly(Integer isReadOnly) {
this.isReadOnly = isReadOnly;
}
}
package pwc.taxtech.atms.dto;
import java.util.Date;
import java.util.List;
public final class TemplateDto {
private String ID;
private String name;
private String path;
private Integer reportType;
private String templateGroupID;
private Date createTime;
private Date updateTime;
private String parentID;
private String templateName;
private int orderIndex;
private String code;
private boolean isSystemType;
private boolean isActiveAssociation;
/**
* 单元格的配置信息
*/
private List<CellTemplateDto> cellTemplateDtos;
/**
* validate msg
*/
private String validateMsg;
public String getID() {
return ID;
}
public void setID(String ID) {
this.ID = ID;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public Integer getReportType() {
return reportType;
}
public void setReportType(Integer reportType) {
this.reportType = reportType;
}
public String getTemplateGroupID() {
return templateGroupID;
}
public void setTemplateGroupID(String templateGroupID) {
this.templateGroupID = templateGroupID;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getParentID() {
return parentID;
}
public void setParentID(String parentID) {
this.parentID = parentID;
}
public String getTemplateName() {
return templateName;
}
public void setTemplateName(String templateName) {
this.templateName = templateName;
}
public int getOrderIndex() {
return orderIndex;
}
public void setOrderIndex(int orderIndex) {
this.orderIndex = orderIndex;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public boolean isSystemType() {
return isSystemType;
}
public void setSystemType(boolean systemType) {
isSystemType = systemType;
}
public boolean isActiveAssociation() {
return isActiveAssociation;
}
public void setActiveAssociation(boolean activeAssociation) {
isActiveAssociation = activeAssociation;
}
public List<CellTemplateDto> getCellTemplateDtos() {
return cellTemplateDtos;
}
public void setCellTemplateDtos(List<CellTemplateDto> cellTemplateDtos) {
this.cellTemplateDtos = cellTemplateDtos;
}
public String getValidateMsg() {
return validateMsg;
}
public void setValidateMsg(String validateMsg) {
this.validateMsg = validateMsg;
}
}
This diff is collapsed.
package pwc.taxtech.atms.service;
import pwc.taxtech.atms.dto.TemplateDto;
import java.util.List;
public interface TemplateService {
/**
* @param 模板组ID
* @param 报表类型
* @return 模板DTO 列表
*/
List<TemplateDto> get(String templateGroupID, Integer reportType);
}
......@@ -117,4 +117,8 @@ public class AbstractService {
protected CellTemplateMapper cellTemplateMapper;
@Autowired
protected CellTemplateConfigMapper cellTemplateConfigMapper;
@Autowired
protected TemplateMapper templateMapper;
@Autowired
protected TemplateFormulaMapper templateFormulaMapper;
}
package pwc.taxtech.atms.service.impl;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.dto.TemplateDto;
import pwc.taxtech.atms.entitiy.Template;
import pwc.taxtech.atms.entitiy.TemplateExample;
import pwc.taxtech.atms.service.TemplateService;
import java.util.ArrayList;
import java.util.List;
@Service
public class TemplateServiceImpl extends AbstractService implements TemplateService {
@Override
public List<TemplateDto> get(String templateGroupID, Integer reportType) {
TemplateExample example = new TemplateExample();
TemplateExample.Criteria criteria = example.createCriteria().andTemplateGroupIDEqualTo(templateGroupID);
if (reportType != null) {
criteria.andReportTypeEqualTo(reportType.intValue());
}
example.setOrderByClause("OrderIndex asc");
List<Template> templates = templateMapper.selectByExample(example);
List<TemplateDto> templateDtos = new ArrayList<>();
for (Template template : templates) {
TemplateDto dto = new TemplateDto();
CommonUtils.copyProperties(template, dto);
templateDtos.add(dto);
}
return templateDtos;
}
}
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