Commit f8bbc62e authored by dahai's avatar dahai

添加数据统计

parent ee4a2d58
...@@ -26,8 +26,8 @@ public class MaterialManagementApi { ...@@ -26,8 +26,8 @@ public class MaterialManagementApi {
* @return * @return
*/ */
@RequestMapping("insertFilm") @RequestMapping("insertFilm")
public boolean insertFilm(@Param("totalCount")String totalCount, @Param("plasticFilmType")String plasticFilmType, @Param("note")String note){ public boolean insertFilm(@Param("totalCount")String totalCount, @Param("plasticFilmType")String plasticFilmType, @Param("note")String note, @Param("name")String name){
boolean result = materialManagementService.insertFilm(totalCount, plasticFilmType, note); boolean result = materialManagementService.insertFilm(totalCount, plasticFilmType, note,name);
return result; return result;
} }
...@@ -39,29 +39,68 @@ public class MaterialManagementApi { ...@@ -39,29 +39,68 @@ public class MaterialManagementApi {
* @return * @return
*/ */
@RequestMapping("insertCardBody") @RequestMapping("insertCardBody")
public boolean insertCardBody(@Param("cardType")String cardType,@Param("totalCount")String totalCount,@Param("note")String note){ public boolean insertCardBody(@Param("cardType")String cardType,@Param("totalCount")String totalCount,@Param("note")String note, @Param("name")String name){
boolean result = materialManagementService.insertCardBody(cardType, totalCount, note); boolean result = materialManagementService.insertCardBody(cardType, totalCount, note,name);
return result; return result;
} }
// /**
// * 查询耗材统计数据
// * @param beginDate
// * @param endDate
// * @return
// */
// @RequestMapping("selectMaterialManagement")
// public Map<String,Object> selectMaterialManagement(@Param("beginDate")String beginDate,@Param("endDate")String endDate,@Param("typeCode")String typeCode,@Param("name")String name){
// Map<String,Object> resultMap = new HashMap<>();
// List<CardBodyEntity> cardBodyEntities = materialManagementService.selectCardBody(replaceDate(beginDate),replaceDate(endDate));
// List<PlasticFilmEntity> plasticFilmEntities = materialManagementService.selectFilm(replaceDate(beginDate),replaceDate(endDate));
// String cardCount1 = materialManagementService.selectCardCount1(beginDate,endDate);
// String cardCount2 = materialManagementService.selectCardCount2(beginDate,endDate);
// String plasticFilmCount1=materialManagementService.selectFilmCount1(beginDate,endDate);
// String plasticFilmCount2=materialManagementService.selectFilmCount2(beginDate,endDate);
// resultMap.put("cardBody",cardBodyEntities);
// resultMap.put("cardCount1",cardCount1);
// resultMap.put("cardCount2",cardCount2);
// resultMap.put("plasticFilm",plasticFilmEntities);
// resultMap.put("plasticFilmCount1",plasticFilmCount1);
// resultMap.put("plasticFilmCount2",plasticFilmCount2);
// return resultMap;
//
// }
/** /**
* 查询耗材统计数据 * 查询卡机统计数据
* @param beginDate * @param beginDate
* @param endDate * @param endDate
* @return * @return
*/ */
@RequestMapping("selectMaterialManagement") @RequestMapping("selectCardBodyManagement")
public Map<String,Object> selectMaterialManagement(@Param("beginDate")String beginDate,@Param("endDate")String endDate){ public Map<String,Object> selectCardBodyManagement(@Param("beginDate")String beginDate,@Param("endDate")String endDate,@Param("typeCode")String typeCode,@Param("name")String name){
Map<String,Object> resultMap = new HashMap<>(); Map<String,Object> resultMap = new HashMap<>();
List<CardBodyEntity> cardBodyEntities = materialManagementService.selectCardBody(replaceDate(beginDate),replaceDate(endDate)); List<CardBodyEntity> cardBodyEntities = materialManagementService.selectCardBody(replaceDate(beginDate),replaceDate(endDate),typeCode,name);
List<PlasticFilmEntity> plasticFilmEntities = materialManagementService.selectFilm(replaceDate(beginDate),replaceDate(endDate)); String cardCount1 = materialManagementService.selectCardCount1(replaceDate(beginDate),replaceDate(endDate),typeCode,name);
String cardCount1 = materialManagementService.selectCardCount1(beginDate,endDate); String cardCount2 = materialManagementService.selectCardCount2(replaceDate(beginDate),replaceDate(endDate),typeCode,name);
String cardCount2 = materialManagementService.selectCardCount2(beginDate,endDate);
String plasticFilmCount1=materialManagementService.selectFilmCount1(beginDate,endDate);
String plasticFilmCount2=materialManagementService.selectFilmCount2(beginDate,endDate);
resultMap.put("cardBody",cardBodyEntities); resultMap.put("cardBody",cardBodyEntities);
resultMap.put("cardCount1",cardCount1); resultMap.put("cardCount1",cardCount1);
resultMap.put("cardCount2",cardCount2); resultMap.put("cardCount2",cardCount2);
return resultMap;
}
/**
* 查询膜统计数据
* @param beginDate
* @param endDate
* @return
*/
@RequestMapping("selectPlasticFilmManagement")
public Map<String,Object> selectPlasticFilmManagement(@Param("beginDate")String beginDate,@Param("endDate")String endDate,@Param("typeCode")String typeCode,@Param("name")String name){
Map<String,Object> resultMap = new HashMap<>();
List<PlasticFilmEntity> plasticFilmEntities = materialManagementService.selectFilm(replaceDate(beginDate),replaceDate(endDate),typeCode,name);
String plasticFilmCount1=materialManagementService.selectFilmCount1(replaceDate(beginDate),replaceDate(endDate),typeCode,name);
String plasticFilmCount2=materialManagementService.selectFilmCount2(replaceDate(beginDate),replaceDate(endDate),typeCode,name);
resultMap.put("plasticFilm",plasticFilmEntities); resultMap.put("plasticFilm",plasticFilmEntities);
resultMap.put("plasticFilmCount1",plasticFilmCount1); resultMap.put("plasticFilmCount1",plasticFilmCount1);
resultMap.put("plasticFilmCount2",plasticFilmCount2); resultMap.put("plasticFilmCount2",plasticFilmCount2);
...@@ -69,6 +108,9 @@ public class MaterialManagementApi { ...@@ -69,6 +108,9 @@ public class MaterialManagementApi {
} }
/** /**
* 去除字符串中中线 * 去除字符串中中线
* @param str * @param str
......
...@@ -2,17 +2,21 @@ package com.yxproject.start.entity; ...@@ -2,17 +2,21 @@ package com.yxproject.start.entity;
import javax.persistence.*; import javax.persistence.*;
import java.sql.Time; import java.sql.Time;
import java.util.Date;
import java.util.Objects; import java.util.Objects;
/**
* @auther zhangyusheng
* 2019/4/1 15:03
*/
@Entity @Entity
@Table(name = "CARD_BODY", schema = "YINGXIN", catalog = "") @Table(name = "CARD_BODY", schema = "YINGXIN", catalog = "")
public class CardBodyEntity { public class CardBodyEntity {
private long cardBodyId; private long cardBodyId;
private Date saveDate; private Time saveDate;
private Long cardType; private Long cardType;
private Long totalCount; private Long totalCount;
private String note; private String note;
private String name;
@Id @Id
@Column(name = "CARD_BODY_ID") @Column(name = "CARD_BODY_ID")
...@@ -26,11 +30,11 @@ public class CardBodyEntity { ...@@ -26,11 +30,11 @@ public class CardBodyEntity {
@Basic @Basic
@Column(name = "SAVE_DATE") @Column(name = "SAVE_DATE")
public Date getSaveDate() { public Time getSaveDate() {
return saveDate; return saveDate;
} }
public void setSaveDate(Date saveDate) { public void setSaveDate(Time saveDate) {
this.saveDate = saveDate; this.saveDate = saveDate;
} }
...@@ -64,6 +68,16 @@ public class CardBodyEntity { ...@@ -64,6 +68,16 @@ public class CardBodyEntity {
this.note = note; this.note = note;
} }
@Basic
@Column(name = "NAME")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
...@@ -73,11 +87,12 @@ public class CardBodyEntity { ...@@ -73,11 +87,12 @@ public class CardBodyEntity {
Objects.equals(saveDate, that.saveDate) && Objects.equals(saveDate, that.saveDate) &&
Objects.equals(cardType, that.cardType) && Objects.equals(cardType, that.cardType) &&
Objects.equals(totalCount, that.totalCount) && Objects.equals(totalCount, that.totalCount) &&
Objects.equals(note, that.note); Objects.equals(note, that.note) &&
Objects.equals(name, that.name);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(cardBodyId, saveDate, cardType, totalCount, note); return Objects.hash(cardBodyId, saveDate, cardType, totalCount, note, name);
} }
} }
...@@ -2,17 +2,21 @@ package com.yxproject.start.entity; ...@@ -2,17 +2,21 @@ package com.yxproject.start.entity;
import javax.persistence.*; import javax.persistence.*;
import java.sql.Time; import java.sql.Time;
import java.util.Date;
import java.util.Objects; import java.util.Objects;
/**
* @auther zhangyusheng
* 2019/4/1 15:04
*/
@Entity @Entity
@Table(name = "PLASTIC_FILM", schema = "YINGXIN", catalog = "") @Table(name = "PLASTIC_FILM", schema = "YINGXIN", catalog = "")
public class PlasticFilmEntity { public class PlasticFilmEntity {
private long plasticFilmId; private long plasticFilmId;
private Date saveDate; private Time saveDate;
private Long totalCount; private Long totalCount;
private Long plasticFilmType; private Long plasticFilmType;
private String note; private String note;
private String name;
@Id @Id
@Column(name = "PLASTIC_FILM_ID") @Column(name = "PLASTIC_FILM_ID")
...@@ -26,11 +30,11 @@ public class PlasticFilmEntity { ...@@ -26,11 +30,11 @@ public class PlasticFilmEntity {
@Basic @Basic
@Column(name = "SAVE_DATE") @Column(name = "SAVE_DATE")
public Date getSaveDate() { public Time getSaveDate() {
return saveDate; return saveDate;
} }
public void setSaveDate(Date saveDate) { public void setSaveDate(Time saveDate) {
this.saveDate = saveDate; this.saveDate = saveDate;
} }
...@@ -64,6 +68,16 @@ public class PlasticFilmEntity { ...@@ -64,6 +68,16 @@ public class PlasticFilmEntity {
this.note = note; this.note = note;
} }
@Basic
@Column(name = "NAME")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
...@@ -73,11 +87,12 @@ public class PlasticFilmEntity { ...@@ -73,11 +87,12 @@ public class PlasticFilmEntity {
Objects.equals(saveDate, that.saveDate) && Objects.equals(saveDate, that.saveDate) &&
Objects.equals(totalCount, that.totalCount) && Objects.equals(totalCount, that.totalCount) &&
Objects.equals(plasticFilmType, that.plasticFilmType) && Objects.equals(plasticFilmType, that.plasticFilmType) &&
Objects.equals(note, that.note); Objects.equals(note, that.note) &&
Objects.equals(name, that.name);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(plasticFilmId, saveDate, totalCount, plasticFilmType, note); return Objects.hash(plasticFilmId, saveDate, totalCount, plasticFilmType, note, name);
} }
} }
...@@ -13,30 +13,78 @@ import java.util.Map; ...@@ -13,30 +13,78 @@ import java.util.Map;
@Mapper @Mapper
public interface MaterialManagementMapper { public interface MaterialManagementMapper {
@Insert("INSERT INTO PLASTIC_FILM (TOTAL_COUNT,PLASTIC_FILM_TYPE,NOTE)VALUES(#{totalCount},#{plasticFilmType},#{note})") @Insert("INSERT INTO PLASTIC_FILM (TOTAL_COUNT,PLASTIC_FILM_TYPE,NOTE,name)VALUES(#{totalCount},#{plasticFilmType},#{note},#{name})")
public boolean insertFilm(@Param("totalCount")String totalCount,@Param("plasticFilmType")String plasticFilmType,@Param("note")String note); public boolean insertFilm(@Param("totalCount")String totalCount,@Param("plasticFilmType")String plasticFilmType,@Param("note")String note,@Param("name")String name);
@Select("select * from plastic_film where to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate}") @Select("<script>" +
public List<PlasticFilmEntity> selectFilm(@Param("beginDate") String beginDate,@Param("endDate")String endDate); "select * from plastic_film where to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate}" +
"<if test='name != null '>" +
" and name =#{name} " +
"</if>" +
"<if test='typeCode != 0 '>" +
" and typeCode =#{typeCode} " +
"</if>" +
"</script>")
public List<PlasticFilmEntity> selectFilm(@Param("beginDate") String beginDate,@Param("endDate")String endDate,@Param("typeCode")String typeCode,@Param("name")String name);
@Select("select sum(TOTAL_COUNT) PLASTIC_FILM_TYPE1 from plastic_film where to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate} and PLASTIC_FILM_TYPE=1 ") @Select("<script>" +
public String selectFilmCount1(@Param("beginDate") String beginDate,@Param("endDate")String endDate); "select sum(TOTAL_COUNT) PLASTIC_FILM_TYPE1 from plastic_film where to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate} and PLASTIC_FILM_TYPE=1 "+
"<if test='name != null '>" +
" and name =#{name} " +
"</if>" +
"<if test='typeCode != 0 '>" +
" and typeCode =#{typeCode} " +
"</if>" +
"</script>")
public String selectFilmCount1(@Param("beginDate") String beginDate,@Param("endDate")String endDate ,@Param("typeCode")String typeCode,@Param("name")String name);
@Select("select sum(TOTAL_COUNT) PLASTIC_FILM_TYPE1 from plastic_film where to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate} and PLASTIC_FILM_TYPE=2") @Select("<script>" +
public String selectFilmCount2(@Param("beginDate") String beginDate,@Param("endDate")String endDate); "select sum(TOTAL_COUNT) PLASTIC_FILM_TYPE1 from plastic_film where to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate} and PLASTIC_FILM_TYPE=2"+
"<if test='name != null '>" +
" and name =#{name} " +
"</if>" +
"<if test='typeCode != 0 '>" +
" and typeCode =#{typeCode} " +
"</if>" +
"</script>")
public String selectFilmCount2(@Param("beginDate") String beginDate,@Param("endDate")String endDate,@Param("typeCode")String typeCode,@Param("name")String name);
@Insert("INSERT INTO CARD_BODY (CARD_TYPE,TOTAL_COUNT,NOTE)VALUES(#{cardType},#{totalCount},#{note})") @Insert("INSERT INTO CARD_BODY (CARD_TYPE,TOTAL_COUNT,NOTE,name)VALUES(#{cardType},#{totalCount},#{note},#{name})")
public boolean insertCardBody(@Param("cardType")String cardType,@Param("totalCount")String totalCount,@Param("note")String note); public boolean insertCardBody(@Param("cardType")String cardType,@Param("totalCount")String totalCount,@Param("note")String note,@Param("name")String name);
@Select("select * from CARD_BODY where to_char(SAVE_DATE,'yyyyMMdd') between #{beginDate} and #{endDate}") @Select("<script>" +
public List<CardBodyEntity> selectCardBody(@Param("beginDate")String beginDate,@Param("endDate")String endDate); "select * from CARD_BODY where to_char(SAVE_DATE,'yyyyMMdd') between #{beginDate} and #{endDate}"+
"<if test='name != null '>" +
" and name =#{name} " +
"</if>" +
"<if test='typeCode != 0 '>" +
" and typeCode =#{typeCode} " +
"</if>" +
"</script>")
public List<CardBodyEntity> selectCardBody(@Param("beginDate")String beginDate,@Param("endDate")String endDate,@Param("typeCode")String typeCode,@Param("name")String name);
@Select("select sum(TOTAL_COUNT) cardType1 from CARD_BODY where to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate} and CARD_TYPE=1") @Select("<script>" +
public String selectCardCount1(@Param("beginDate")String beginDate,@Param("endDate")String endDate); "select sum(TOTAL_COUNT) cardType1 from CARD_BODY where to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate} and CARD_TYPE=1"+
"<if test='name != null '>" +
" and name =#{name} " +
"</if>" +
"<if test='typeCode != 0 '>" +
" and typeCode =#{typeCode} " +
"</if>" +
"</script>")
public String selectCardCount1(@Param("beginDate")String beginDate,@Param("endDate")String endDate,@Param("typeCode")String typeCode,@Param("name")String name);
@Select("select sum(TOTAL_COUNT) cardType2 from CARD_BODY where to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate} and CARD_TYPE=2") @Select("<script>" +
public String selectCardCount2(@Param("beginDate")String beginDate,@Param("endDate")String endDate); "select sum(TOTAL_COUNT) cardType2 from CARD_BODY where to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate} and CARD_TYPE=2"+
"<if test='name != null '>" +
" and name =#{name} " +
"</if>" +
"<if test='typeCode != 0 '>" +
" and typeCode =#{typeCode} " +
"</if>" +
"</script>")
public String selectCardCount2(@Param("beginDate")String beginDate,@Param("endDate")String endDate,@Param("typeCode")String typeCode,@Param("name")String name);
} }
...@@ -10,21 +10,21 @@ import java.util.Map; ...@@ -10,21 +10,21 @@ import java.util.Map;
public interface MaterialManagementService { public interface MaterialManagementService {
public boolean insertFilm( @Param("totalCount")String totalCount, @Param("plasticFilmType")String plasticFilmType, @Param("note")String note); public boolean insertFilm( @Param("totalCount")String totalCount, @Param("plasticFilmType")String plasticFilmType, @Param("note")String note,String name);
public List<PlasticFilmEntity> selectFilm(@Param("beginDate") String beginDate, @Param("endDate")String endDate); public List<PlasticFilmEntity> selectFilm(@Param("beginDate") String beginDate, @Param("endDate")String endDate,String typeCode, String name);
public boolean insertCardBody(@Param("cardType")String cardType,@Param("totalCount")String totalCount,@Param("note")String note); public boolean insertCardBody(@Param("cardType")String cardType,@Param("totalCount")String totalCount,@Param("note")String note,String name);
public List<CardBodyEntity> selectCardBody(@Param("beginDate")String beginDate, @Param("endDate")String endDate); public List<CardBodyEntity> selectCardBody(@Param("beginDate")String beginDate, @Param("endDate")String endDate,String typeCode, String name);
public String selectFilmCount1(@Param("beginDate") String beginDate,@Param("endDate")String endDate); public String selectFilmCount1(@Param("beginDate") String beginDate,@Param("endDate")String endDate,String typeCode, String name);
public String selectFilmCount2(@Param("beginDate") String beginDate,@Param("endDate")String endDate); public String selectFilmCount2(@Param("beginDate") String beginDate,@Param("endDate")String endDate,String typeCode, String name);
public String selectCardCount1(@Param("beginDate")String beginDate,@Param("endDate")String endDate); public String selectCardCount1(@Param("beginDate")String beginDate,@Param("endDate")String endDate,String typeCode, String name);
public String selectCardCount2(@Param("beginDate")String beginDate,@Param("endDate")String endDate); public String selectCardCount2(@Param("beginDate")String beginDate,@Param("endDate")String endDate,String typeCode, String name);
} }
...@@ -16,50 +16,50 @@ public class MaterialManagementServiceImpl implements MaterialManagementService ...@@ -16,50 +16,50 @@ public class MaterialManagementServiceImpl implements MaterialManagementService
@Autowired @Autowired
private MaterialManagementMapper materialManagementMapper; private MaterialManagementMapper materialManagementMapper;
@Override @Override
public boolean insertFilm( String totalCount, String plasticFilmType, String note) { public boolean insertFilm( String totalCount, String plasticFilmType, String note,String name) {
materialManagementMapper.insertFilm(totalCount,plasticFilmType,note); materialManagementMapper.insertFilm(totalCount,plasticFilmType,note,name);
return true; return true;
} }
@Override @Override
public List<PlasticFilmEntity> selectFilm(String beginDate, String endDate) { public List<PlasticFilmEntity> selectFilm(String beginDate, String endDate,String typeCode, String name) {
List<PlasticFilmEntity> resultList = materialManagementMapper.selectFilm(beginDate, endDate); List<PlasticFilmEntity> resultList = materialManagementMapper.selectFilm(beginDate, endDate,typeCode,name);
return resultList; return resultList;
} }
@Override @Override
public boolean insertCardBody( String cardType, String totalCount, String note) { public boolean insertCardBody( String cardType, String totalCount, String note,String name) {
materialManagementMapper.insertCardBody(cardType,totalCount,note); materialManagementMapper.insertCardBody(cardType,totalCount,note,name);
return true; return true;
} }
@Override @Override
public List<CardBodyEntity> selectCardBody(String beginDate, String endDate) { public List<CardBodyEntity> selectCardBody(String beginDate, String endDate,String typeCode, String name) {
List<CardBodyEntity> resultList = materialManagementMapper.selectCardBody(beginDate, endDate); List<CardBodyEntity> resultList = materialManagementMapper.selectCardBody(beginDate, endDate, typeCode, name);
return resultList; return resultList;
} }
@Override @Override
public String selectFilmCount1(String beginDate, String endDate) { public String selectFilmCount1(String beginDate, String endDate,String typeCode, String name) {
String result = materialManagementMapper.selectFilmCount1(beginDate, endDate); String result = materialManagementMapper.selectFilmCount1(beginDate, endDate,typeCode,name);
return result; return result;
} }
@Override @Override
public String selectFilmCount2(String beginDate, String endDate) { public String selectFilmCount2(String beginDate, String endDate,String typeCode, String name) {
String result = materialManagementMapper.selectFilmCount2(beginDate, endDate); String result = materialManagementMapper.selectFilmCount2(beginDate, endDate,typeCode,name);
return result; return result;
} }
@Override @Override
public String selectCardCount1(String beginDate, String endDate) { public String selectCardCount1(String beginDate, String endDate,String typeCode, String name) {
String result = materialManagementMapper.selectCardCount1(beginDate, endDate); String result = materialManagementMapper.selectCardCount1(beginDate, endDate,typeCode,name);
return result; return result;
} }
@Override @Override
public String selectCardCount2(String beginDate, String endDate) { public String selectCardCount2(String beginDate, String endDate,String typeCode, String name) {
String result = materialManagementMapper.selectCardCount2(beginDate, endDate); String result = materialManagementMapper.selectCardCount2(beginDate, endDate,typeCode,name);
return result; return result;
} }
......
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