Commit 6cc85104 authored by 张森's avatar 张森

演练场景相关API开发

parent 591608fb
package com.yeejoin.amos.fas.dao.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@Data
@Entity
@Table(name = "c_plan_report")
public class PlanReport extends BasicEntity {
@TableName("c_plan_report")
public class PlanReport extends BaseEntity {
private static final long serialVersionUID = 1L;
@Column(name = "batch_no")
@TableField("batch_no")
private String batchNo;
@Column(name = "report_url")
@TableField("report_url")
private String reportUrl;
@Column(name = "title")
@TableField("title")
private String title;
@Column(name = "create_date")
private Date createDate;
@Column(name = "address")
@TableField("address")
private String address;
@Column(name = "compere")
@TableField("compere")
private String compere;
@Column(name = "attend_person")
@TableField("attend_person")
private String attendPerson;
@Column(name = "drill_topic")
@TableField("drill_topic")
private String drillTopic;
@Column(name = "handle_process")
@TableField("handle_process")
private String handleProcess;
@Column(name = "drill_summary")
@TableField("drill_summary")
private String drillSummary;
@Column(name = "examine_result")
@TableField("examine_result")
private String examineResult;
@TableField("biz_org_name")
......@@ -52,4 +45,25 @@ public class PlanReport extends BasicEntity {
@TableField("biz_org_code")
private String bizOrgCode;
@TableField("drill_type")
private String drillType;
@TableField("drill_equip")
private String drillEquip;
@TableField(exist = false)
private Integer pageNumber;
@TableField(exist = false)
private Integer pageSize;
@TableField(exist = false)
private String startDate;
@TableField(exist = false)
private String endDate;
@TableField(exist = false)
private String equipName;
}
package com.yeejoin.amos.fas.business.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.business.dao.mapper.PlanReportMapper;
import com.yeejoin.amos.fas.business.service.intfc.IPlanReportService;
import com.yeejoin.amos.fas.business.vo.ReginParams;
import com.yeejoin.amos.fas.config.Permission;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.dao.entity.PlanReport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping(value = "/planReport")
@Api(tags = "演练报告API")
public class PlanReportController {
public class PlanReportController extends BaseController {
@Autowired
PlanReportMapper planReportMapper;
@Autowired
IPlanReportService iPlanReportService;
/**
* 保存站端信息
*/
@Permission
@ApiOperation(value = "保存API", notes = "保存API")
@PostMapping(value = "/save")
public CommonResponse saveStation(@RequestBody PlanReport planReport) {
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = reginParams.getCompany().getOrgCode();
String bizOrgName = reginParams.getCompany().getCompanyName();
planReport.setBizOrgCode(bizOrgCode);
planReport.setBizOrgName(bizOrgName);
planReport.setCreateDate(new Date());
planReportMapper.saveInfo(planReport);
return CommonResponseUtil.success(planReport);
}
/**
* 保存站端信息
*/
@Permission
@ApiOperation(value = "删除API", notes = "删除API")
@PostMapping(value = "/deleteById")
public CommonResponse deleteById(@RequestParam(value = "id") Long id) {
planReportMapper.deleteById(id);
return CommonResponseUtil.success();
}
/**
* 保存站端信息
*/
@Permission
@ApiOperation(value = "详情API", notes = "详情API")
@GetMapping(value = "/getById")
public CommonResponse getById(@RequestParam(value = "id") Long id) {
PlanReport planReport = planReportMapper.getById(id);
return CommonResponseUtil.success(planReport);
}
/**
* 保存站端信息
*/
@Permission
@ApiOperation(value = "分页查询", notes = "分页查询")
@PostMapping(value = "/getByPage")
public CommonResponse getByPage(@RequestBody PlanReport planReport) {
Page<PlanReport> resultPage = iPlanReportService.getByPage(planReport);
return CommonResponseUtil.success(resultPage);
}
}
package com.yeejoin.amos.fas.business.dao.mapper;
public interface PlanReportMapper extends BaseMapper {
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.fas.dao.entity.PlanReport;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface PlanReportMapper extends BaseMapper<PlanReport> {
void saveInfo(PlanReport dto);
void deleteById(@Param("id") Long id);
Integer getByCount(PlanReport planReport);
List<PlanReport> getByPage(PlanReport planReport);
PlanReport getById(@Param("id") Long id);
}
package com.yeejoin.amos.fas.business.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.fas.business.dao.mapper.PlanReportMapper;
import com.yeejoin.amos.fas.business.service.intfc.IPlanReportService;
import com.yeejoin.amos.fas.dao.entity.PlanReport;
import org.springframework.stereotype.Service;
@Service
public class PlanReportServiceImpl implements IPlanReportService {
public class PlanReportServiceImpl extends ServiceImpl<PlanReportMapper, PlanReport> implements IPlanReportService{
@Override
public Page<PlanReport> getByPage(PlanReport planReport) {
Page<PlanReport> objectPage = new Page<>(planReport.getPageNumber(), planReport.getPageSize());
planReport.setPageNumber((planReport.getPageNumber() - 1) * planReport.getPageSize());
Integer count = this.baseMapper.getByCount(planReport);
if (count > 0) {
objectPage.setRecords(this.baseMapper.getByPage(planReport));
objectPage.setTotal(count);
}
return objectPage;
}
}
package com.yeejoin.amos.fas.business.service.intfc;
public interface IPlanReportService {
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.fas.dao.entity.PlanReport;
public interface IPlanReportService extends IService<PlanReport> {
Page<PlanReport> getByPage(PlanReport planReport);
}
<?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.yeejoin.amos.fas.business.dao.mapper.PlanReportMapper">
<insert id="saveInfo">
INSERT INTO `c_plan_report` (
`id`,
`batch_no`,
`report_url`,
`title`,
`create_date`,
`address`,
`compere`,
`attend_person`,
`drill_topic`,
`handle_process`,
`drill_summary`,
`examine_result`,
`biz_org_name`,
`biz_org_code`,
`drill_type`,
`drill_equip`
)
VALUES
(
#{id},#{batchNo},#{reportUrl},#{title},#{createDate},#{address},#{compere},#{attendPerson},#{drillTopic},#{handleProcess},#{drillSummary},#{examineResult},#{bizOrgName}, #{bizOrgCode}, #{drillType},#{drillEquip}
)
</insert>
<delete id="deleteById">
delete from c_plan_report where id = #{id}
</delete>
<select id="getByCount" resultType="java.lang.Integer">
SELECT
count( 1 )
FROM
c_plan_report a
LEFT JOIN f_equipment b on b.id = a.drill_equip
<where>
<if test="drillEquip != null and drillEquip != ''">
a.drill_equip = #{drillEquip}
</if>
<if test="drillType != null and drillType != ''">
AND a.drill_type = #{drillType}
</if>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND a.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
<if test="startDate != null and startDate != ''">
AND a.create_date >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
AND #{endDate} >= a.create_date
</if>
</where>
</select>
<select id="getByPage" resultType="com.yeejoin.amos.fas.dao.entity.PlanReport">
SELECT
a.*,
b.name as equipName
FROM
c_plan_report a
left join f_equipment b on b.id = a.drill_equip
<where>
<if test="drillEquip != null and drillEquip != ''">
a.drill_equip = #{drillEquip}
</if>
<if test="drillType != null and drillType != ''">
AND a.drill_type = #{drillType}
</if>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND a.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
<if test="startDate != null and startDate != ''">
AND a.create_date >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
AND #{endDate} >= a.create_date
</if>
</where>
order by a.create_date desc
LIMIT #{pageNumber},#{pageSize}
</select>
<select id="getById" resultType="com.yeejoin.amos.fas.dao.entity.PlanReport">
select * from c_plan_report where id = #{id}
</select>
</mapper>
\ No newline at end of file
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