Commit e6d16cc0 by wxh

合并分支内容

parents 7e49db77 7a8c3171
package com.orhon.smartcampus.material;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import graphql.servlet.config.ObjectMapperConfigurer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate;
......
......@@ -48,6 +48,9 @@ public class SpringBootStart {
// public final static String SCHEMA_STUDENT = "graphql/student.graphqls";
// public final static String SCHEMA_ECLASS = "graphql/eclass.graphqls";
public final static String SCHEMA_MATERIAL = "graphql/material.graphqls";
public final static String SCHEMA_SITE = "graphql/site.graphqls";
public final static String SCHEMA_ROOM = "graphql/room.graphqls";
public final static String SCHEMA_FLOOR = "graphql/floor.graphqls";
// public final static String SCHEMA_SCHOOLBASEINFO= "graphql/schoolbaseinfo.graphqls";
// public final static String SCHEMA_SYSTEMCTL= "graphql/systemctl.graphqls";
// public final static String SCHEMA_STATISTICS= "graphql/teacherstatistics.graphqls";
......@@ -89,7 +92,7 @@ public class SpringBootStart {
* 定义schema文件列表...
*/
protected String[] getSchemas(){
return new String[]{SCHEMA_ROOT , SCHEMA_BASIC ,SCHEMA_MATERIAL};
return new String[]{SCHEMA_ROOT , SCHEMA_BASIC ,SCHEMA_MATERIAL,SCHEMA_SITE,SCHEMA_ROOM,SCHEMA_FLOOR};
//return new String[]{SCHEMA_ROOT , SCHEMA_BASIC ,SCHEMA_USER , SCHEMA_TEACHER ,SCHEMA_STUDENT, SCHEMA_ECLASS,SCHEMA_MATERIAL, SCHEMA_SCHOOLBASEINFO,SCHEMA_SYSTEMCTL,SCHEMA_STATISTICS };
}
......
package com.orhon.smartcampus.material.modules.management.dao;
import com.orhon.smartcampus.material.basicComponents.baseDao.BaseDaoImpl;
import com.orhon.smartcampus.material.modules.management.entity.Buildings;
import org.springframework.stereotype.Component;
@Component
public class BuildingsDao extends BaseDaoImpl<Buildings> {
}
package com.orhon.smartcampus.material.modules.management.dao;
import com.orhon.smartcampus.material.basicComponents.baseDao.BaseDaoImpl;
import com.orhon.smartcampus.material.modules.management.entity.FloorEntity;
import com.orhon.smartcampus.material.modules.management.entity.GoodsClassify;
import org.springframework.stereotype.Component;
@Component
public class FloorDao extends BaseDaoImpl<FloorEntity> {
}
package com.orhon.smartcampus.material.modules.management.dao;
import com.orhon.smartcampus.material.basicComponents.baseDao.BaseDaoImpl;
import com.orhon.smartcampus.material.modules.management.entity.GoodsManage;
import org.springframework.stereotype.Component;
@Component
public class GoodsManageDao extends BaseDaoImpl<GoodsManage> {
}
package com.orhon.smartcampus.material.modules.management.dao;
import com.orhon.smartcampus.material.basicComponents.baseDao.BaseDaoImpl;
import com.orhon.smartcampus.material.modules.management.entity.RoomEntity;
import com.orhon.smartcampus.material.modules.management.entity.RootEntity;
import org.springframework.stereotype.Component;
@Component
public class RoomDao extends BaseDaoImpl<RoomEntity> {
}
package com.orhon.smartcampus.material.modules.management.dao;
import com.orhon.smartcampus.material.basicComponents.baseDao.BaseDaoImpl;
import com.orhon.smartcampus.material.modules.base.gqlModel.GQLPageParam;
import com.orhon.smartcampus.material.modules.base.mm.EnvArgsMapper;
import com.orhon.smartcampus.material.modules.management.entity.RootEntity;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.springframework.stereotype.Component;
@Component
public class RootDao extends BaseDaoImpl<RootEntity> {
}
package com.orhon.smartcampus.material.modules.management.dao;
import com.orhon.smartcampus.material.basicComponents.baseDao.BaseDaoImpl;
import com.orhon.smartcampus.material.modules.management.entity.Buildings;
import com.orhon.smartcampus.material.modules.management.entity.Unit;
import org.springframework.stereotype.Component;
@Component
public class UnitDao extends BaseDaoImpl<Unit> {
}
package com.orhon.smartcampus.material.modules.management.entity;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.util.Date;
@Setter
@Getter
@EqualsAndHashCode
@Entity
@Table(name = "material_buildings", schema = "material", catalog = "")
public class Buildings {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false)
private Long id;
@Column(name = "buildings_name", nullable = false)
private String buildings_name;
@Column(name = "site_id", nullable = false)
private Integer site_id;
@Column(name = "buildings_units", nullable = false)
private Integer buildings_units;
@Column(name = "buildings_head", nullable = false)
private String buildings_head;
@Column(name = "buildings_introduce", nullable = false)
private String buildings_introduce;
@Column(name = "buildings_status", nullable = false)
private Integer buildings_status;
@Column(name = "add_id", nullable = false)
private String add_id;
@Column(name = "created_at", nullable = false)
private Date created_at;
@Column(name = "updated_at", nullable = false)
private Date updated_at;
// @ManyToOne
// @JoinColumn(name = "unit_id", referencedColumnName = "id")
// @Where(clause = "ISNULL(deleted_at)")
// @NotFound(action= NotFoundAction.IGNORE)
// private Unit materialUnitByUnitId;
//
// @ManyToOne
// @JoinColumn(name = "school_id", referencedColumnName = "id")
// @Where(clause = "ISNULL(deleted_at)")
// @NotFound(action=NotFoundAction.IGNORE)
// private Schools baseSchoolsBySchoolId;
}
package com.orhon.smartcampus.material.modules.management.entity;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.util.Date;
@Setter
@Getter
@EqualsAndHashCode
@Entity
@Table(name = "material_floor", schema = "material", catalog = "")
public class FloorEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "unit_id", nullable = false)
private Integer unit_id;
@Column(name = "floor_name", nullable = false)
private String floor_name;
@Column(name = "floor_head", nullable = false)
private String floor_head;
@Column(name = "floor_status", nullable = false)
private Integer floor_status;
@Column(name = "add_id", nullable = false)
private String add_id;
@Column(name = "created_at", nullable = false)
private Date created_at;
@Column(name = "updated_at", nullable = false)
private Date updated_at;
}
......@@ -17,14 +17,18 @@ public class GoodsClassify {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false)
private Long id;
@Column(name = "parent_id", nullable = false)
private Integer parent_id;
@Column(name = "classify_name", nullable = false)
private String classify_name;
@Column(name = "classify_status", nullable = false)
private Integer classify_status;
@Column(name = "classify_campus_id", nullable = false)
private String classify_campus_id;
@Column(name = "classify_userid", nullable = false)
private String classify_userid;
@Column(name = "sort_order", nullable = false)
private Integer sort_order;
@Column(name = "school_id", nullable = false)
private String school_id;
@Column(name = "add_id", nullable = false)
private String add_id;
@Column(name = "created_at", nullable = false)
private Date created_at;
@Column(name = "updated_at", nullable = false)
......
package com.orhon.smartcampus.material.modules.management.entity;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.util.Date;
@Setter
@Getter
@EqualsAndHashCode
@Entity
@Table(name = "material_goods", schema = "material", catalog = "")
public class GoodsManage {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false)
private Long id;
@Column(name = "classify_id", nullable = false)
private Integer classify_id;
@Column(name = "goods_name", nullable = false)
private String goods_name;
@Column(name = "main_image", nullable = false)
private String main_image;
@Column(name = "sub_images", nullable = false)
private String sub_images;
@Column(name = "goods_price", nullable = false)
private String goods_price;
@Column(name = "goods_number", nullable = false)
private String goods_number;
@Column(name = "goods_stock", nullable = false)
private Integer goods_stock;
@Column(name = "goods_note", nullable = false)
private String goods_note;
@Column(name = "good_status", nullable = false)
private Integer good_status;
@Column(name = "add_id", nullable = false)
private String add_id;
@Column(name = "employ_time", nullable = false)
private String employ_time;
@Column(name = "employ_department", nullable = false)
private String employ_department;
@Column(name = "created_at", nullable = false)
private Date created_at;
@Column(name = "updated_at", nullable = false)
private Date updated_at;
// @ManyToOne
// @JoinColumn(name = "unit_id", referencedColumnName = "id")
// @Where(clause = "ISNULL(deleted_at)")
// @NotFound(action= NotFoundAction.IGNORE)
// private Unit materialUnitByUnitId;
//
// @ManyToOne
// @JoinColumn(name = "school_id", referencedColumnName = "id")
// @Where(clause = "ISNULL(deleted_at)")
// @NotFound(action=NotFoundAction.IGNORE)
// private Schools baseSchoolsBySchoolId;
}
package com.orhon.smartcampus.material.modules.management.entity;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.util.Date;
@Setter
@Getter
@EqualsAndHashCode
@Entity
@Table(name = "material_floor", schema = "material", catalog = "")
public class RoomEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "floor_id", nullable = false)
private Integer floor_id;
@Column(name = "room_head", nullable = false)
private String room_head;
@Column(name = "room_key", nullable = false)
private Integer room_key;
@Column(name = "room_number", nullable = false)
private Integer room_number;
@Column(name = "room_name", nullable = false)
private String room_name;
@Column(name = "room_status", nullable = false)
private Integer room_status;
@Column(name = "add_id", nullable = false)
private String add_id;
@Column(name = "created_at", nullable = false)
private Date created_at;
@Column(name = "updated_at", nullable = false)
private Date updated_at;
}
package com.orhon.smartcampus.material.modules.management.entity;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.util.Date;
@Setter
@Getter
@EqualsAndHashCode
@Entity
@Table(name = "material_site", schema = "material", catalog = "")
public class RootEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "parent_id", nullable = false)
private Integer parent_id;
@Column(name = "site_name", nullable = false)
private String site_name;
@Column(name = "site_status", nullable = false)
private String site_status;
@Column(name = "sort_order", nullable = false)
private Integer sort_order;
@Column(name = "school_id", nullable = false)
private String school_id;
@Column(name = "add_id", nullable = false)
private String add_id;
@Column(name = "created_at", nullable = false)
private Date created_at;
@Column(name = "updated_at", nullable = false)
private Date updated_at;
}
package com.orhon.smartcampus.material.modules.management.entity;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.util.Date;
@Setter
@Getter
@EqualsAndHashCode
@Entity
@Table(name = "material_unit", schema = "material", catalog = "")
public class Unit {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false)
private Long id;
@Column(name = "building_id", nullable = false)
private Integer building_id;
@Column(name = "unit_name", nullable = false)
private String unit_name;
@Column(name = "unit_head", nullable = false)
private String unit_head;
@Column(name = "floor_status", nullable = false)
private String floor_status;
@Column(name = "floor_start", nullable = false)
private Integer floor_start;
@Column(name = "floor_end", nullable = false)
private Integer floor_end;
@Column(name = "add_id", nullable = false)
private String add_id;
@Column(name = "created_at", nullable = false)
private Date created_at;
@Column(name = "updated_at", nullable = false)
private Date updated_at;
// @ManyToOne
// @JoinColumn(name = "unit_id", referencedColumnName = "id")
// @Where(clause = "ISNULL(deleted_at)")
// @NotFound(action= NotFoundAction.IGNORE)
// private Unit materialUnitByUnitId;
//
// @ManyToOne
// @JoinColumn(name = "school_id", referencedColumnName = "id")
// @Where(clause = "ISNULL(deleted_at)")
// @NotFound(action=NotFoundAction.IGNORE)
// private Schools baseSchoolsBySchoolId;
}
package com.orhon.smartcampus.material.modules.management.fetcher;
import com.orhon.smartcampus.material.basicComponents.Result;
import com.orhon.smartcampus.material.modules.base.gqlModel.GQLPageParam;
import com.orhon.smartcampus.material.modules.base.mm.EnvArgsMapper;
import com.orhon.smartcampus.material.modules.management.dao.BuildingsDao;
import com.orhon.smartcampus.material.modules.management.dao.GoodsManageDao;
import com.orhon.smartcampus.material.modules.management.entity.Buildings;
import com.orhon.smartcampus.material.modules.management.entity.GoodsManage;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLBuildings;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLGoodsManage;
import com.orhon.smartcampus.material.modules.management.mm.BuildingsMapper;
import com.orhon.smartcampus.material.modules.management.mm.GoodsManageMapper;
import com.orhon.smartcampus.material.utils.ObjectToMap;
import com.orhon.smartcampus.material.utils.Util;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
@Component
public class BuildingsListFetcher implements DataFetcher {
@Autowired
BuildingsDao buildingsDao;
@Override
public Object get(DataFetchingEnvironment env) throws Exception {
// + schoolId
String hql = "from Buildings";
GQLPageParam page = EnvArgsMapper.MAPPER.fromArgs(env);
if (env.containsArgument("condition")) {
HashMap<String, Object> map = ObjectToMap.to(env.getArgument("condition"));
if (map.get("id") != null) {
hql += "and id " + Util.decide(map.get("id"));
}
if (map.get("buildings_name") != null) {
hql += "and buildings_name " + Util.decide(map.get("buildings_name"));
}
if (map.get("buildings_status") != null) {
hql += "and buildings_status " + Util.decide(map.get("buildings_status"));
}
}
List<Buildings> list = buildingsDao.find(hql, null, page.getPage(), page.getLimit());
List<GQLBuildings> gqlGoodsClassifies = BuildingsMapper.MAPPER.toBuildingsList(list);
Long total = 0L;
if (env.getSelectionSet().contains("total")) {
total = buildingsDao.getTotalCount(hql);
}
return Result.ok().put("data", gqlGoodsClassifies).put("total", total);
}
}
......@@ -47,28 +47,6 @@ public class GoodsClassifyListFetcher implements DataFetcher {
List<GoodsClassify> list = goodsClassifyDao.find(hql,null,page.getPage(),page.getLimit());
// GQLGoodsClassify gqlGoodsClassify = null;
// if (env.getSelectionSet().contains("data/classify")){
// GoodsClassify goodsClassify = item.getBaseSchoolsBySchoolId();
// GgqlSchool = SchoolMapper.MAPPER.toSchool(schools);
// }
//
// GQLUnit gqlUnit=null;
// if (env.getSelectionSet().contains("data/unit")){
// Unit unit = item.getMaterialUnitByUnitId();
// gqlUnit = UnitMapper.MAPPER.toUnit(unit);
// }
//
// GQL floor = FloorMapper.MAPPER.toFloor(item);
// floor.setSchool(GgqlSchool);
// floor.setUnit(gqlUnit);
// GQLFloor.add(floor);
// List<GQLGoodsClassify> GQLFloor = new ArrayList<>();
//
// for (GQLGoodsClassify item : list) {
// // GQLGoodsClassify gqlGoodsClassify = GoodsClassifyMapper.MAPPER.toGoodsClassifyList(item);
// // GQLFloor.add(gqlGoodsClassify);
// }
List<GQLGoodsClassify> gqlGoodsClassifies = GoodsClassifyMapper.MAPPER.toGoodsClassifyList(list);
Long total = 0L;
if (env.getSelectionSet().contains("total")){
......
package com.orhon.smartcampus.material.modules.management.fetcher;
import com.orhon.smartcampus.material.basicComponents.Result;
import com.orhon.smartcampus.material.modules.base.gqlModel.GQLPageParam;
import com.orhon.smartcampus.material.modules.base.mm.EnvArgsMapper;
import com.orhon.smartcampus.material.modules.management.dao.GoodsManageDao;
import com.orhon.smartcampus.material.modules.management.entity.GoodsManage;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLGoodsManage;
import com.orhon.smartcampus.material.modules.management.mm.GoodsClassifyMapper;
import com.orhon.smartcampus.material.modules.management.mm.GoodsManageMapper;
import com.orhon.smartcampus.material.utils.ObjectToMap;
import com.orhon.smartcampus.material.utils.Util;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
@Component
public class GoodsManageListFetcher implements DataFetcher {
@Autowired
GoodsManageDao goodsManageDao;
@Override
public Object get(DataFetchingEnvironment env) throws Exception {
// + schoolId
String hql = "from GoodsManage";
GQLPageParam page = EnvArgsMapper.MAPPER.fromArgs(env);
if(env.containsArgument("condition")) {
HashMap<String,Object> map = ObjectToMap.to(env.getArgument("condition"));
if(map.get("id")!=null) {
hql += "and id " + Util.decide(map.get("id"));
}
if(map.get("goods_name")!=null) {
hql += "and goods_name " + Util.decide(map.get("goods_name"));
}
if(map.get("good_status")!=null) {
hql += "and good_status " + Util.decide(map.get("good_status"));
}
}
List<GoodsManage> list = goodsManageDao.find(hql,null,page.getPage(),page.getLimit());
List<GQLGoodsManage> gqlGoodsClassifies = GoodsManageMapper.MAPPER.toGoodsManageList(list);
Long total = 0L;
if (env.getSelectionSet().contains("total")){
total = goodsManageDao.getTotalCount(hql);
}
return Result.ok().put("data", gqlGoodsClassifies).put("total", total);
}
}
package com.orhon.smartcampus.material.modules.management.fetcher;
import com.orhon.smartcampus.material.modules.management.mutation.AddFloorMutation;
import com.orhon.smartcampus.material.modules.management.mutation.AddGoodsClassifyMutation;
import com.orhon.smartcampus.material.modules.management.mutation.AddRoomMutation;
import com.orhon.smartcampus.material.modules.management.mutation.AddRootSiteMutation;
import graphql.schema.idl.RuntimeWiring;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -16,103 +19,60 @@ public class MaterialFetchersLoader {
@Autowired
GoodsClassifyFetcher goodsClassifyFetcher;
//
// @Autowired
// AddRoomMutation addRoomMutation;
//
// @Autowired
// DeleteRoomMutation deleteRoomMutation;
//
// @Autowired
// AddFloorMutation addFloorMutation;
//
// @Autowired
// DeleteFloorMutation deleteFloorMutation;
//
// @Autowired
// AddUnitMutation addUnitMutation;
//
// @Autowired
// DeleteUnitMutation deleteUnitMutation;
//
//
// @Autowired
// AddBuildingMutation addBuildingMutation;
//
// @Autowired
// DeleteBuildingMutation deleteBuildingMutation;
//
// @Autowired
// AddSiteMutation addSiteMutation;
//
// @Autowired
// DeleteSiteMutation deleteSiteMutation;
//
// @Autowired
// AddCampusMutation addCampusMutation;
//
// @Autowired
// DeleteCampusMutation deleteCampusMutation;
//
//
// @Autowired
// BuildingFetcher buildingFetcher;
// @Autowired
// BuildingListFetcher buildingListFetcher;
//
// @Autowired
// CampusFetcher campusFetcher;
// @Autowired
// CampusListFetcher campusListFetcher;
//
// @Autowired
// FloorFetcher floorFetcher;
// @Autowired
// FloorListFetcher floorListFetcher;
//
// @Autowired
// RoomFetcher roomFetcher;
// @Autowired
// RoomListFetcher roomListFetcher;
//
// @Autowired
// SiteFetcher siteFetcher;
// @Autowired
// SiteListFetcher siteListFetcher;
//
// @Autowired
// UnitFetcher unitFetcher;
// @Autowired
// UnitListFetcher unitListFetcher;
@Autowired
GoodsManageListFetcher goodsManageListFetcher;
@Autowired
BuildingsListFetcher buildingsListFetcher;
@Autowired
AddRootSiteMutation addRootSiteMutation;
@Autowired
RootBeanFetcher rootBeanFetcher;
@Autowired
SiteListFetcher siteListFetcher;
@Autowired
AddRoomMutation addRoomMutation;
@Autowired
SeleRoomListFetcher seleRoomListFetcher;
@Autowired
SeleRoomOnceFetcher roomOnceFetcher;
@Autowired
AddFloorMutation addFloorMutation;
@Autowired
SeleFloorOnceFetcher seleFloorOnceFetcher;
@Autowired
SeleFloorListFetcher seleFloorListFetcher;
public void LoadFetchers(RuntimeWiring.Builder builder){
builder.type("Query" , t->t.dataFetcher("GoodsClassify" , goodsClassifyFetcher));
builder.type("Query" , t->t.dataFetcher("GoodsClassifys" , goodsClassifyListFetcher));
// builder.type("Query" , t->t.dataFetcher("Buildings" , buildingListFetcher));
// builder.type("Query" , t->t.dataFetcher("Building" , buildingFetcher));
// builder.type("Query" , t->t.dataFetcher("Campuses" , campusListFetcher));
// builder.type("Query" , t->t.dataFetcher("Campus" , campusFetcher));
// builder.type("Query" , t->t.dataFetcher("Floors" , floorListFetcher));
// builder.type("Query" , t->t.dataFetcher("Rooms" , roomListFetcher));
// builder.type("Query" , t->t.dataFetcher("Room" , roomFetcher));
// builder.type("Query" , t->t.dataFetcher("Sites" , siteListFetcher));
// builder.type("Query" , t->t.dataFetcher("Site" , siteFetcher));
// builder.type("Query" , t->t.dataFetcher("Units" , unitListFetcher));
// builder.type("Query" , t->t.dataFetcher("Unit" , unitFetcher));
// builder.type("Mutation" , t->t.dataFetcher("addRoom" , addRoomMutation));
// builder.type("Mutation" , t->t.dataFetcher("deleteRoom" , deleteRoomMutation));
builder.type("Mutation" , t->t.dataFetcher("addGoodsClassify" , addGoodsClassifyMutation));
// builder.type("Mutation" , t->t.dataFetcher("deleteFloor" , deleteFloorMutation));
// builder.type("Mutation" , t->t.dataFetcher("addUnit" , addUnitMutation));
// builder.type("Mutation" , t->t.dataFetcher("deleteUnit" , deleteUnitMutation));
// builder.type("Mutation" , t->t.dataFetcher("addBuilding" , addBuildingMutation));
// builder.type("Mutation" , t->t.dataFetcher("deleteBuilding" , deleteBuildingMutation));
// builder.type("Mutation" , t->t.dataFetcher("addSite" , addSiteMutation));
// builder.type("Mutation" , t->t.dataFetcher("deleteSite" , deleteSiteMutation));
// builder.type("Mutation" , t->t.dataFetcher("addCampus" , addCampusMutation));
// builder.type("Mutation" , t->t.dataFetcher("deleteCampus" , deleteCampusMutation));
builder.type("Query" , t->t.dataFetcher("GoodsManages" , goodsManageListFetcher));
builder.type("Query" , t->t.dataFetcher("BuildingsList" , buildingsListFetcher));
builder.type("Query" , t->t.dataFetcher("SeleSite" , rootBeanFetcher));
builder.type("Query" , t->t.dataFetcher("SeleSites" , siteListFetcher));
builder.type("Query" , t->t.dataFetcher("SeleRoom" ,roomOnceFetcher ));
builder.type("Query" , t->t.dataFetcher("SeleRooms" , seleRoomListFetcher));
builder.type("Query" , t->t.dataFetcher("SeleFloor" , seleFloorOnceFetcher));
builder.type("Query" , t->t.dataFetcher("SeleFloors" , seleFloorListFetcher));
builder.type("Mutation" , t->t.dataFetcher("addMaterialRoomAdds" , addRoomMutation));
builder.type("Mutation" , t->t.dataFetcher("addMaterialSiteAdds" , addRootSiteMutation));
builder.type("Mutation" , t->t.dataFetcher("addGoodsClassify" , addGoodsClassifyMutation));
builder.type("Mutation" , t->t.dataFetcher("addMaterialFloorAdds" , addFloorMutation));
builder.type("Mutation" , t->t.dataFetcher("addGoodsClassify" , addGoodsClassifyMutation));
builder.type("Mutation" , t->t.dataFetcher("addGoodsManage" , goodsManageListFetcher));
builder.type("Mutation" , t->t.dataFetcher("addBuildings" , buildingsListFetcher));
}
......
package com.orhon.smartcampus.material.modules.management.fetcher;
import com.orhon.smartcampus.material.modules.management.dao.GoodsClassifyDao;
import com.orhon.smartcampus.material.modules.management.dao.RootDao;
import com.orhon.smartcampus.material.modules.management.entity.GoodsClassify;
import com.orhon.smartcampus.material.modules.management.entity.RootEntity;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLGoodsClassify;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLRootBeans;
import com.orhon.smartcampus.material.modules.management.mm.GoodsClassifyMapper;
import com.orhon.smartcampus.material.modules.management.mm.RootBeanMapper;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class RootBeanFetcher implements DataFetcher {
@Autowired
RootDao rootDao;
@Override
public Object get(DataFetchingEnvironment env) throws Exception {
// + schoolId
String hql = "from RootEntity";
RootEntity item = rootDao.findId(hql, null);
if(item!=null) {
GQLRootBeans goodsClassify = RootBeanMapper.MAPPER.toRootsClassify(item);
return goodsClassify;
}
return null;
}
}
package com.orhon.smartcampus.material.modules.management.fetcher;
import com.orhon.smartcampus.material.basicComponents.Result;
import com.orhon.smartcampus.material.modules.base.gqlModel.GQLPageParam;
import com.orhon.smartcampus.material.modules.base.mm.EnvArgsMapper;
import com.orhon.smartcampus.material.modules.management.dao.FloorDao;
import com.orhon.smartcampus.material.modules.management.dao.RoomDao;
import com.orhon.smartcampus.material.modules.management.entity.FloorEntity;
import com.orhon.smartcampus.material.modules.management.entity.RoomEntity;
import com.orhon.smartcampus.material.modules.management.gqlModel.FloorGqlModel;
import com.orhon.smartcampus.material.modules.management.gqlModel.RoomGqlModel;
import com.orhon.smartcampus.material.modules.management.mm.FloorMapper;
import com.orhon.smartcampus.material.modules.management.mm.RoomMapper;
import com.orhon.smartcampus.material.utils.ObjectToMap;
import com.orhon.smartcampus.material.utils.Util;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
@Component
public class SeleFloorListFetcher implements DataFetcher {
@Autowired
FloorDao floorDao;
@Override
public Object get(DataFetchingEnvironment env) throws Exception {
// + schoolId
String hql = "from FloorEntity";
GQLPageParam page = EnvArgsMapper.MAPPER.fromArgs(env);
if(env.containsArgument("condition")) {
HashMap<String,Object> map = ObjectToMap.to(env.getArgument("condition"));
if(map.get("id")!=null) {
hql += "and id " + Util.decide(map.get("id"));
}
if(map.get("floor_name")!=null) {
hql += "and floor_name " + Util.decide(map.get("unit_id"));
}
if(map.get("floor_status")!=null) {
hql += "and floor_status " + Util.decide(map.get("floor_number"));
}
}
List<FloorEntity> list = floorDao.find(hql,null,page.getPage(),page.getLimit());
List<FloorGqlModel> gqlGoodsClassifies = FloorMapper.MAPPER.toFloorList(list);
Long total = 0L;
if (env.getSelectionSet().contains("total")){
total = floorDao.getTotalCount(hql);
}
return Result.ok().put("data", gqlGoodsClassifies).put("total", total);
}
}
package com.orhon.smartcampus.material.modules.management.fetcher;
import com.orhon.smartcampus.material.modules.management.dao.FloorDao;
import com.orhon.smartcampus.material.modules.management.dao.RoomDao;
import com.orhon.smartcampus.material.modules.management.entity.FloorEntity;
import com.orhon.smartcampus.material.modules.management.entity.RoomEntity;
import com.orhon.smartcampus.material.modules.management.gqlModel.FloorGqlModel;
import com.orhon.smartcampus.material.modules.management.gqlModel.RoomGqlModel;
import com.orhon.smartcampus.material.modules.management.mm.FloorMapper;
import com.orhon.smartcampus.material.modules.management.mm.RoomMapper;
import com.sun.scenario.effect.Flood;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class SeleFloorOnceFetcher implements DataFetcher {
@Autowired
FloorDao floorDao;
@Override
public Object get(DataFetchingEnvironment environment) throws Exception {
String hql = "from RoomEntity";
FloorEntity item = floorDao.findId(hql, null);
if(item!=null) {
FloorGqlModel floorGqlModel = FloorMapper.MAPPER.toFloorModel(item);
return floorGqlModel;
}
return null;
}
}
package com.orhon.smartcampus.material.modules.management.fetcher;
import com.orhon.smartcampus.material.basicComponents.Result;
import com.orhon.smartcampus.material.modules.base.gqlModel.GQLPageParam;
import com.orhon.smartcampus.material.modules.base.mm.EnvArgsMapper;
import com.orhon.smartcampus.material.modules.management.dao.GoodsClassifyDao;
import com.orhon.smartcampus.material.modules.management.dao.RoomDao;
import com.orhon.smartcampus.material.modules.management.entity.GoodsClassify;
import com.orhon.smartcampus.material.modules.management.entity.RoomEntity;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLGoodsClassify;
import com.orhon.smartcampus.material.modules.management.gqlModel.RoomGqlModel;
import com.orhon.smartcampus.material.modules.management.mm.GoodsClassifyMapper;
import com.orhon.smartcampus.material.modules.management.mm.RoomMapper;
import com.orhon.smartcampus.material.utils.ObjectToMap;
import com.orhon.smartcampus.material.utils.Util;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
@Component
public class SeleRoomListFetcher implements DataFetcher {
@Autowired
RoomDao roomDao;
@Override
public Object get(DataFetchingEnvironment env) throws Exception {
// + schoolId
String hql = "from RoomEntity";
GQLPageParam page = EnvArgsMapper.MAPPER.fromArgs(env);
if(env.containsArgument("condition")) {
HashMap<String,Object> map = ObjectToMap.to(env.getArgument("condition"));
if(map.get("id")!=null) {
hql += "and id " + Util.decide(map.get("id"));
}
if(map.get("room_name")!=null) {
hql += "and room_name " + Util.decide(map.get("unit_id"));
}
if(map.get("room_status")!=null) {
hql += "and room_status " + Util.decide(map.get("room_head"));
}
}
List<RoomEntity> list = roomDao.find(hql,null,page.getPage(),page.getLimit());
List<RoomGqlModel> gqlGoodsClassifies = RoomMapper.MAPPER.toRoomList(list);
Long total = 0L;
if (env.getSelectionSet().contains("total")){
total = roomDao.getTotalCount(hql);
}
return Result.ok().put("data", gqlGoodsClassifies).put("total", total);
}
}
package com.orhon.smartcampus.material.modules.management.fetcher;
import com.orhon.smartcampus.material.modules.management.dao.RoomDao;
import com.orhon.smartcampus.material.modules.management.dao.RootDao;
import com.orhon.smartcampus.material.modules.management.entity.RoomEntity;
import com.orhon.smartcampus.material.modules.management.entity.RootEntity;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLRootBeans;
import com.orhon.smartcampus.material.modules.management.gqlModel.RoomGqlModel;
import com.orhon.smartcampus.material.modules.management.mm.RoomMapper;
import com.orhon.smartcampus.material.modules.management.mm.RootBeanMapper;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class SeleRoomOnceFetcher implements DataFetcher {
@Autowired
RoomDao roomDao;
@Override
public Object get(DataFetchingEnvironment environment) throws Exception {
String hql = "from RoomEntity";
RoomEntity item = roomDao.findId(hql, null);
if(item!=null) {
RoomGqlModel goodsClassify = RoomMapper.MAPPER.toRoomModel(item);
return goodsClassify;
}
return null;
}
}
package com.orhon.smartcampus.material.modules.management.fetcher;
import com.orhon.smartcampus.material.basicComponents.Result;
import com.orhon.smartcampus.material.modules.base.gqlModel.GQLPageParam;
import com.orhon.smartcampus.material.modules.base.mm.EnvArgsMapper;
import com.orhon.smartcampus.material.modules.management.dao.GoodsClassifyDao;
import com.orhon.smartcampus.material.modules.management.dao.RootDao;
import com.orhon.smartcampus.material.modules.management.entity.GoodsClassify;
import com.orhon.smartcampus.material.modules.management.entity.RootEntity;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLGoodsClassify;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLRootBeans;
import com.orhon.smartcampus.material.modules.management.inputMapper.RootInputMapper;
import com.orhon.smartcampus.material.modules.management.mm.GoodsClassifyMapper;
import com.orhon.smartcampus.material.modules.management.mm.RootBeanMapper;
import com.orhon.smartcampus.material.utils.ObjectToMap;
import com.orhon.smartcampus.material.utils.Util;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
@Component
public class SiteListFetcher implements DataFetcher {
@Autowired
RootDao rootDao;
@Override
public Object get(DataFetchingEnvironment env) throws Exception {
// + schoolId
String hql = "from RootEntity";
GQLPageParam page = EnvArgsMapper.MAPPER.fromArgs(env);
if(env.containsArgument("condition")) {
HashMap<String,Object> map = ObjectToMap.to(env.getArgument("condition"));
if(map.get("id")!=null) {
hql += "and id " + Util.decide(map.get("id"));
}
if(map.get("site_name")!=null) {
hql += "and site_name " + Util.decide(map.get("site_name"));
}
if(map.get("site_status")!=null) {
hql += "and site_status " + Util.decide(map.get("site_status"));
}
}
List<RootEntity> list = rootDao.find(hql,null,page.getPage(),page.getLimit());
// GQLGoodsClassify gqlGoodsClassify = null;
// if (env.getSelectionSet().contains("data/classify")){
// GoodsClassify goodsClassify = item.getBaseSchoolsBySchoolId();
// GgqlSchool = SchoolMapper.MAPPER.toSchool(schools);
// }
//
// GQLUnit gqlUnit=null;
// if (env.getSelectionSet().contains("data/unit")){
// Unit unit = item.getMaterialUnitByUnitId();
// gqlUnit = UnitMapper.MAPPER.toUnit(unit);
// }
//
// GQL floor = FloorMapper.MAPPER.toFloor(item);
// floor.setSchool(GgqlSchool);
// floor.setUnit(gqlUnit);
// GQLFloor.add(floor);
// List<GQLGoodsClassify> GQLFloor = new ArrayList<>();
//
// for (GQLGoodsClassify item : list) {
// // GQLGoodsClassify gqlGoodsClassify = GoodsClassifyMapper.MAPPER.toGoodsClassifyList(item);
// // GQLFloor.add(gqlGoodsClassify);
// }
List<GQLRootBeans> gqlGoodsClassifies = RootBeanMapper.MAPPER.toRootList(list);
Long total = 0L;
if (env.getSelectionSet().contains("total")){
total = rootDao.getTotalCount(hql);
}
return Result.ok().put("data", gqlGoodsClassifies).put("total", total);
}
}
package com.orhon.smartcampus.material.modules.management.fetcher;
import com.orhon.smartcampus.material.basicComponents.Result;
import com.orhon.smartcampus.material.modules.base.gqlModel.GQLPageParam;
import com.orhon.smartcampus.material.modules.base.mm.EnvArgsMapper;
import com.orhon.smartcampus.material.modules.management.dao.UnitDao;
import com.orhon.smartcampus.material.modules.management.entity.Unit;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLUnit;
import com.orhon.smartcampus.material.modules.management.mm.UnitMapper;
import com.orhon.smartcampus.material.utils.ObjectToMap;
import com.orhon.smartcampus.material.utils.Util;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
@Component
public class UnitListFetcher implements DataFetcher {
@Autowired
UnitDao unitDao;
@Override
public Object get(DataFetchingEnvironment env) throws Exception {
// + schoolId
String hql = "from Unit";
GQLPageParam page = EnvArgsMapper.MAPPER.fromArgs(env);
if (env.containsArgument("condition")) {
HashMap<String, Object> map = ObjectToMap.to(env.getArgument("condition"));
if (map.get("id") != null) {
hql += "and id " + Util.decide(map.get("id"));
}
if (map.get("building_id") != null) {
hql += "and building_id " + Util.decide(map.get("building_id"));
}
if (map.get("floor_status") != null) {
hql += "and floor_status " + Util.decide(map.get("floor_status"));
}
}
List<Unit> list = unitDao.find(hql, null, page.getPage(), page.getLimit());
List<GQLUnit> gqlGoodsClassifies = UnitMapper.MAPPER.toUnitList(list);
Long total = 0L;
if (env.getSelectionSet().contains("total")) {
total = unitDao.getTotalCount(hql);
}
return Result.ok().put("data", gqlGoodsClassifies).put("total", total);
}
}
package com.orhon.smartcampus.material.modules.management.gqlInputModel;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.Date;
@Data
public class GQLBuildingsInput {
private Long id;
private String buildings_name;
private Integer site_id;
private Integer buildings_units;
private String buildings_head;
private String buildings_introduce;
private Integer buildings_status;
private String add_id;
}
package com.orhon.smartcampus.material.modules.management.gqlInputModel;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.Date;
@Data
public class GQLFloorInput {
private Long id;
private Integer unit_id;
private String floor_name;
private String floor_head;
private Integer floor_status;
private String add_id;
}
......@@ -2,18 +2,16 @@ package com.orhon.smartcampus.material.modules.management.gqlInputModel;
import lombok.Data;
import java.util.Date;
@Data
public class GQLGoodsClassifyInput {
private Long id;
private Integer parent_id;
private String classify_name;
private Integer classify_status;
private String classify_campus_id;
private String classify_userid;
private Integer sort_order;
private String school_id;
private String add_id;
}
package com.orhon.smartcampus.material.modules.management.gqlInputModel;
import lombok.Data;
@Data
public class GQLGoodsManageInput {
private Long id;
private Integer classify_id;
private String goods_name;
private String main_image;
private String sub_images;
private String goods_price;
private String goods_number;
private Integer goods_stock;
private String goods_note;
private Integer good_status;
private String add_id;
private String employ_time;
private String employ_department;
}
package com.orhon.smartcampus.material.modules.management.gqlInputModel;
import lombok.Data;
@Data
public class GQLRoomInput {
private Long id;
private Integer floor_id;
private String room_head;
private Integer room_key;
private Integer room_number;
private String room_name;
private Integer room_status;
private String add_id;
}
package com.orhon.smartcampus.material.modules.management.gqlInputModel;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.Date;
@Data
public class GQLRootInput {
private Long id;
private Integer parent_id;
private String site_name;
private String site_status;
private Integer sort_order;
private String school_id;
private String add_id;
}
package com.orhon.smartcampus.material.modules.management.gqlInputModel;
import lombok.Data;
@Data
public class GQLUnitInput {
private Long id;
private Integer building_id;
private String unit_name;
private String unit_head;
private String floor_status;
private Integer floor_start;
private Integer floor_end;
private String add_id;
}
package com.orhon.smartcampus.material.modules.management.gqlModel;
import lombok.Data;
import java.util.Date;
@Data
public class FloorGqlModel {
private Long id;
private Integer unit_id;
private String floor_name;
private String floor_head;
private Integer floor_status;
private String add_id;
private Date created_at;
private Date updated_at;
}
package com.orhon.smartcampus.material.modules.management.gqlModel;
import lombok.Data;
import java.util.Date;
@Data
public class GQLBuildings {
private Long id;
private String buildings_name;
private Integer site_id;
private Integer buildings_units;
private String buildings_head;
private String buildings_introduce;
private Integer buildings_status;
private String add_id;
private Date created_at;
private Date updated_at;
}
......@@ -2,15 +2,21 @@ package com.orhon.smartcampus.material.modules.management.gqlModel;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.Date;
@Data
public class GQLGoodsClassify {
private Long id;
private Integer parent_id;
private String classify_name;
private Integer classify_status;
private String classify_campus_id;
private String classify_userid;
private Integer sort_order;
private String school_id;
private String add_id;
private Date created_at;
private Date updated_at;
}
package com.orhon.smartcampus.material.modules.management.gqlModel;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.Date;
@Data
public class GQLGoodsManage {
private Long id;
private Integer classify_id;
private String goods_name;
private String main_image;
private String sub_images;
private String goods_price;
private String goods_number;
private Integer goods_stock;
private String goods_note;
private Integer good_status;
private String add_id;
private String employ_time;
private String employ_department;
private Date created_at;
private Date updated_at;
}
package com.orhon.smartcampus.material.modules.management.gqlModel;
import lombok.Data;
import java.util.Date;
@Data
public class GQLRootBeans {
private Long id;
private Integer parent_id;
private String site_name;
private String site_status;
private Integer sort_order;
private String school_id;
private String add_id;
private Date created_at;
private Date updated_at;
}
package com.orhon.smartcampus.material.modules.management.gqlModel;
import lombok.Data;
import java.util.Date;
@Data
public class GQLUnit {
private Long id;
private Integer building_id;
private String unit_name;
private String unit_head;
private String floor_status;
private Integer floor_start;
private Integer floor_end;
private String add_id;
private Date created_at;
private Date updated_at;
}
package com.orhon.smartcampus.material.modules.management.gqlModel;
import lombok.Data;
import javax.persistence.Column;
import java.util.Date;
@Data
public class RoomGqlModel {
private Long id;
private Integer floor_id;
private String room_head;
private Integer room_key;
private Integer room_number;
private String room_name;
private Integer room_status;
private String add_id;
private Date created_at;
private Date updated_at;
}
package com.orhon.smartcampus.material.modules.management.inputMapper;
import com.alibaba.fastjson.JSON;
import com.orhon.smartcampus.material.basicComponents.ConvertHelper;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLBuildingsInput;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLGoodsManageInput;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.Map;
@Mapper(uses = {
ConvertHelper.class
})
public interface BuildingsInputMapper {
BuildingsInputMapper MAPPER = Mappers.getMapper(BuildingsInputMapper.class);
default GQLBuildingsInput mapInput(final Map map){
String json = JSON.toJSONString(map);
GQLBuildingsInput input = JSON.parseObject(json , GQLBuildingsInput.class);
return input;
}
}
package com.orhon.smartcampus.material.modules.management.inputMapper;
import com.alibaba.fastjson.JSON;
import com.orhon.smartcampus.material.basicComponents.ConvertHelper;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLFloorInput;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLRoomInput;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.Map;
@Mapper(uses = {
ConvertHelper.class
})
public interface FloomInputMapper {
FloomInputMapper MAPPER = Mappers.getMapper(FloomInputMapper.class);
default GQLFloorInput mapInput(final Map map){
String json = JSON.toJSONString(map);
GQLFloorInput input = JSON.parseObject(json , GQLFloorInput.class);
return input;
}
}
package com.orhon.smartcampus.material.modules.management.inputMapper;
import com.alibaba.fastjson.JSON;
import com.orhon.smartcampus.material.basicComponents.ConvertHelper;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLGoodsClassifyInput;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLGoodsManageInput;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.Map;
@Mapper(uses = {
ConvertHelper.class
})
public interface GoodsManageInputMapper {
GoodsManageInputMapper MAPPER = Mappers.getMapper(GoodsManageInputMapper.class);
default GQLGoodsManageInput mapInput(final Map map){
String json = JSON.toJSONString(map);
GQLGoodsManageInput input = JSON.parseObject(json , GQLGoodsManageInput.class);
return input;
}
}
package com.orhon.smartcampus.material.modules.management.inputMapper;
import com.alibaba.fastjson.JSON;
import com.orhon.smartcampus.material.basicComponents.ConvertHelper;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLRoomInput;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLRootBeans;
import com.orhon.smartcampus.material.modules.management.gqlModel.RoomGqlModel;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.Map;
@Mapper(uses = {
ConvertHelper.class
})
public interface RoomInputMapper {
RoomInputMapper MAPPER = Mappers.getMapper(RoomInputMapper.class);
default GQLRoomInput mapInput(final Map map){
String json = JSON.toJSONString(map);
GQLRoomInput input = JSON.parseObject(json , GQLRoomInput.class);
return input;
}
}
package com.orhon.smartcampus.material.modules.management.inputMapper;
import com.alibaba.fastjson.JSON;
import com.orhon.smartcampus.material.basicComponents.ConvertHelper;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLGoodsClassifyInput;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLRootBeans;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.Map;
@Mapper(uses = {
ConvertHelper.class
})
public interface RootInputMapper {
RootInputMapper MAPPER = Mappers.getMapper(RootInputMapper.class);
default GQLRootBeans mapInput(final Map map){
String json = JSON.toJSONString(map);
GQLRootBeans input = JSON.parseObject(json , GQLRootBeans.class);
return input;
}
}
package com.orhon.smartcampus.material.modules.management.inputMapper;
import com.alibaba.fastjson.JSON;
import com.orhon.smartcampus.material.basicComponents.ConvertHelper;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLUnitInput;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.Map;
@Mapper(uses = {
ConvertHelper.class
})
public interface UnitInputMapper {
UnitInputMapper MAPPER = Mappers.getMapper(UnitInputMapper.class);
default GQLUnitInput mapInput(final Map map){
String json = JSON.toJSONString(map);
GQLUnitInput input = JSON.parseObject(json , GQLUnitInput.class);
return input;
}
}
package com.orhon.smartcampus.material.modules.management.mm;
import com.orhon.smartcampus.material.basicComponents.ConvertHelper;
import com.orhon.smartcampus.material.modules.management.entity.Buildings;
import com.orhon.smartcampus.material.modules.management.entity.GoodsClassify;
import com.orhon.smartcampus.material.modules.management.entity.GoodsManage;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLBuildings;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLGoodsClassify;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLGoodsManage;
import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper(
uses = {
ConvertHelper.class
}
)
public interface BuildingsMapper {
BuildingsMapper MAPPER = Mappers.getMapper(BuildingsMapper.class);
// @Mapping(source = "id" , target = "id")
// @Mapping(source = "classify_name" , target = "classify_name")
// @Mapping(source = "classify_status" , target = "classify_status")
// @Mapping(source = "classify_campus_id" , target = "classify_campus_id")
// @Mapping(source = "classify_userid" , target = "classify_userid")
// @Mapping(source = "created_at" , target = "created_at")
// @Mapping(source = "updated_at" , target = "updated_at")
GQLGoodsClassify toGoodsClassify(GoodsClassify entity);
@InheritConfiguration(name = "toBuildings")
List<GQLBuildings> toBuildingsList(List<Buildings> entities);
}
package com.orhon.smartcampus.material.modules.management.mm;
import com.orhon.smartcampus.material.basicComponents.ConvertHelper;
import com.orhon.smartcampus.material.modules.management.entity.FloorEntity;
import com.orhon.smartcampus.material.modules.management.entity.RoomEntity;
import com.orhon.smartcampus.material.modules.management.gqlModel.FloorGqlModel;
import com.orhon.smartcampus.material.modules.management.gqlModel.RoomGqlModel;
import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper(
uses = {
ConvertHelper.class
}
)
public interface FloorMapper {
FloorMapper MAPPER = Mappers.getMapper(FloorMapper.class);
// @Mapping(source = "id" , target = "id")
// @Mapping(source = "unit_id" , target = "unit_id")
// @Mapping(source = "floor_number" , target = "floor_number")
// @Mapping(source = "floor_head" , target = "floor_head")
// @Mapping(source = "add_id" , target = "add_id")
// @Mapping(source = "created_at" , target = "created_at")
// @Mapping(source = "updated_at" , target = "updated_at")
FloorGqlModel toFloorModel(FloorEntity entity);
@InheritConfiguration(name = "toFloorList")
List<FloorGqlModel> toFloorList(List<FloorEntity> entities);
}
......@@ -23,8 +23,8 @@ public interface GoodsClassifyMapper {
@Mapping(source = "id" , target = "id")
@Mapping(source = "classify_name" , target = "classify_name")
@Mapping(source = "classify_status" , target = "classify_status")
@Mapping(source = "classify_campus_id" , target = "classify_campus_id")
@Mapping(source = "classify_userid" , target = "classify_userid")
@Mapping(source = "add_id" , target = "add_id")
@Mapping(source = "school_id" , target = "school_id")
@Mapping(source = "created_at" , target = "created_at")
@Mapping(source = "updated_at" , target = "updated_at")
GQLGoodsClassify toGoodsClassify(GoodsClassify entity);
......
package com.orhon.smartcampus.material.modules.management.mm;
import com.orhon.smartcampus.material.basicComponents.ConvertHelper;
import com.orhon.smartcampus.material.modules.management.entity.GoodsClassify;
import com.orhon.smartcampus.material.modules.management.entity.GoodsManage;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLGoodsClassify;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLGoodsManage;
import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper(
uses = {
ConvertHelper.class
}
)
public interface GoodsManageMapper {
GoodsManageMapper MAPPER = Mappers.getMapper(GoodsManageMapper.class);
// @Mapping(source = "id" , target = "id")
// @Mapping(source = "classify_name" , target = "classify_name")
// @Mapping(source = "classify_status" , target = "classify_status")
// @Mapping(source = "classify_campus_id" , target = "classify_campus_id")
// @Mapping(source = "classify_userid" , target = "classify_userid")
// @Mapping(source = "created_at" , target = "created_at")
// @Mapping(source = "updated_at" , target = "updated_at")
// GQLGoodsClassify toGoodsClassify(GoodsClassify entity);
@InheritConfiguration(name = "toGoodsClassify")
List<GQLGoodsManage> toGoodsManageList(List<GoodsManage> entities);
}
package com.orhon.smartcampus.material.modules.management.mm;
import com.orhon.smartcampus.material.basicComponents.ConvertHelper;
import com.orhon.smartcampus.material.modules.management.entity.RoomEntity;
import com.orhon.smartcampus.material.modules.management.entity.RootEntity;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLRootBeans;
import com.orhon.smartcampus.material.modules.management.gqlModel.RoomGqlModel;
import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper(
uses = {
ConvertHelper.class
}
)
public interface RoomMapper {
RoomMapper MAPPER = Mappers.getMapper(RoomMapper.class);
// @Mapping(source = "id" , target = "id")
// @Mapping(source = "unit_id" , target = "unit_id")
// @Mapping(source = "room_head" , target = "room_head")
// @Mapping(source = "room_number" , target = "room_number")
// @Mapping(source = "room_number_of" , target = "room_number_of")
// @Mapping(source = "room_list_name" , target = "room_list_name")
// @Mapping(source = "room_status" , target = "room_status")
// @Mapping(source = "add_id" , target = "add_id")
// @Mapping(source = "created_at" , target = "created_at")
// @Mapping(source = "updated_at" , target = "updated_at")
RoomGqlModel toRoomModel(RoomEntity entity);
@InheritConfiguration(name = "toRoomList")
List<RoomGqlModel> toRoomList(List<RoomEntity> entities);
}
package com.orhon.smartcampus.material.modules.management.mm;
import com.orhon.smartcampus.material.basicComponents.ConvertHelper;
import com.orhon.smartcampus.material.modules.management.entity.GoodsClassify;
import com.orhon.smartcampus.material.modules.management.entity.RootEntity;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLGoodsClassify;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLRootBeans;
import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper(
uses = {
ConvertHelper.class
}
)
public interface RootBeanMapper {
RootBeanMapper MAPPER = Mappers.getMapper(RootBeanMapper.class);
// @Mapping(source = "id" , target = "id")
// @Mapping(source = "site_name" , target = "site_name")
// @Mapping(source = "site_status" , target = "site_status")
// @Mapping(source = "school_id" , target = "school_id")
// @Mapping(source = "add_id" , target = "add_id")
// @Mapping(source = "created_at" , target = "created_at")
// @Mapping(source = "updated_at" , target = "updated_at")
GQLRootBeans toRootsClassify(RootEntity entity);
@InheritConfiguration(name = "toGoodsClassify")
List<GQLRootBeans> toRootList(List<RootEntity> entities);
}
package com.orhon.smartcampus.material.modules.management.mm;
import com.orhon.smartcampus.material.basicComponents.ConvertHelper;
import com.orhon.smartcampus.material.modules.management.entity.GoodsClassify;
import com.orhon.smartcampus.material.modules.management.entity.Unit;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLGoodsClassify;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLUnit;
import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper(
uses = {
ConvertHelper.class
}
)
public interface UnitMapper {
UnitMapper MAPPER = Mappers.getMapper(UnitMapper.class);
// @Mapping(source = "id" , target = "id")
// @Mapping(source = "classify_name" , target = "classify_name")
// @Mapping(source = "classify_status" , target = "classify_status")
// @Mapping(source = "classify_campus_id" , target = "classify_campus_id")
// @Mapping(source = "classify_userid" , target = "classify_userid")
// @Mapping(source = "created_at" , target = "created_at")
// @Mapping(source = "updated_at" , target = "updated_at")
GQLGoodsClassify toGoodsClassify(GoodsClassify entity);
@InheritConfiguration(name = "toUnit")
List<GQLUnit> toUnitList(List<Unit> entities);
}
package com.orhon.smartcampus.material.modules.management.mutation;
import com.orhon.smartcampus.material.basicComponents.Result;
import com.orhon.smartcampus.material.modules.management.dao.BuildingsDao;
import com.orhon.smartcampus.material.modules.management.dao.GoodsManageDao;
import com.orhon.smartcampus.material.modules.management.entity.Buildings;
import com.orhon.smartcampus.material.modules.management.entity.GoodsManage;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLBuildingsInput;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLGoodsManageInput;
import com.orhon.smartcampus.material.modules.management.inputMapper.BuildingsInputMapper;
import com.orhon.smartcampus.material.modules.management.inputMapper.GoodsManageInputMapper;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
@Component
public class AddBuildingsMutation implements DataFetcher {
@Autowired
BuildingsDao buildingsDao;
/**
* 楼层管理
* editor : ths
*/
@Override
public Object get(DataFetchingEnvironment environment) throws Exception {
//String token = (String) SecurityUtils.getSubject().getPrincipal();
GQLBuildingsInput input = BuildingsInputMapper.MAPPER.mapInput(environment.getArgument("inputData"));
Buildings buildings = null;
if (input.getId() != null) {
buildings = buildingsDao.get(Buildings.class, input.getId());
buildings.setUpdated_at(new Date());
} else {
buildings = new Buildings();
buildings.setCreated_at(new Date());
}
if(input.getBuildings_name() != null){
buildings.setBuildings_name(input.getBuildings_name());
}
if(input.getSite_id() != null){
buildings.setSite_id(input.getSite_id());
}
if(input.getBuildings_units() != null){
buildings.setBuildings_units(input.getBuildings_units());
}
if(input.getBuildings_head() != null){
buildings.setBuildings_head(input.getBuildings_head());
}
if(input.getBuildings_introduce()!= null){
buildings.setBuildings_introduce(input.getBuildings_introduce());
}
if(input.getBuildings_status() != null){
buildings.setBuildings_status(input.getBuildings_status());
}
if(input.getAdd_id() != null){
buildings.setAdd_id(input.getAdd_id());
}
try {
buildingsDao.saveOrUpdate(buildings);
} catch (Exception e) {
return Result.error(500, "" + e);
}
return Result.ok();
}
}
package com.orhon.smartcampus.material.modules.management.mutation;
import com.orhon.smartcampus.material.basicComponents.Result;
import com.orhon.smartcampus.material.modules.management.dao.FloorDao;
import com.orhon.smartcampus.material.modules.management.dao.RoomDao;
import com.orhon.smartcampus.material.modules.management.entity.FloorEntity;
import com.orhon.smartcampus.material.modules.management.entity.RoomEntity;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLFloorInput;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLRoomInput;
import com.orhon.smartcampus.material.modules.management.inputMapper.FloomInputMapper;
import com.orhon.smartcampus.material.modules.management.inputMapper.RoomInputMapper;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
@Component
public class AddFloorMutation implements DataFetcher {
@Autowired
FloorDao floorDao;
/**
* Room管理添加
* editor : ths
*/
@Override
public Object get(DataFetchingEnvironment environment) throws Exception {
//String token = (String) SecurityUtils.getSubject().getPrincipal();
GQLFloorInput input = FloomInputMapper.MAPPER.mapInput(environment.getArgument("inputData"));
FloorEntity roomEntity = null;
if (input.getId() != null) {
roomEntity = floorDao.get(FloorEntity.class, input.getId());
roomEntity.setUpdated_at(new Date());
} else {
roomEntity = new FloorEntity();
roomEntity.setCreated_at(new Date());
}
if(input.getUnit_id() != null){
roomEntity.setUnit_id(input.getUnit_id());
}
if(input.getFloor_name() != null){
roomEntity.setFloor_name(input.getFloor_name());
}
if(input.getFloor_head() != null){
roomEntity.setFloor_head(input.getFloor_head());
}
if(input.getFloor_status() != null){
roomEntity.setFloor_status(input.getFloor_status());
}
if(input.getAdd_id() != null){
roomEntity.setAdd_id(input.getAdd_id());
}
try {
floorDao.saveOrUpdate(roomEntity);
} catch (Exception e) {
return Result.error(500, "" + e);
}
return Result.ok();
}
}
......@@ -40,21 +40,23 @@ public class AddGoodsClassifyMutation implements DataFetcher {
goodsClassify = new GoodsClassify();
goodsClassify.setCreated_at(new Date());
}
if(input.getParent_id() != null){
goodsClassify.setParent_id(input.getParent_id());
}
if(input.getClassify_name() != null){
goodsClassify.setClassify_name(input.getClassify_name());
}
if(input.getClassify_campus_id() != null){
goodsClassify.setClassify_campus_id(input.getClassify_campus_id());
}
if(input.getClassify_status() != null){
goodsClassify.setClassify_status(input.getClassify_status());
}
if(input.getClassify_userid() != null){
goodsClassify.setClassify_userid(JSON.toJSONString(input.getClassify_userid()));
if(input.getSort_order() != null){
goodsClassify.setSort_order(input.getSort_order());
}
if(input.getSchool_id() != null){
goodsClassify.setSchool_id(input.getSchool_id());
}
if(input.getAdd_id() != null){
goodsClassify.setAdd_id(JSON.toJSONString(input.getAdd_id()));
}
try {
goodsClassifyDao.saveOrUpdate(goodsClassify);
......
package com.orhon.smartcampus.material.modules.management.mutation;
import com.alibaba.fastjson.JSON;
import com.orhon.smartcampus.material.basicComponents.Result;
import com.orhon.smartcampus.material.modules.management.dao.GoodsClassifyDao;
import com.orhon.smartcampus.material.modules.management.dao.GoodsManageDao;
import com.orhon.smartcampus.material.modules.management.entity.GoodsClassify;
import com.orhon.smartcampus.material.modules.management.entity.GoodsManage;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLGoodsClassifyInput;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLGoodsManageInput;
import com.orhon.smartcampus.material.modules.management.inputMapper.GoodsClassifyInputMapper;
import com.orhon.smartcampus.material.modules.management.inputMapper.GoodsManageInputMapper;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
@Component
public class AddGoodsManageMutation implements DataFetcher {
@Autowired
GoodsManageDao goodsManageDao;
/**
* 楼层管理
* editor : ths
*/
@Override
public Object get(DataFetchingEnvironment environment) throws Exception {
//String token = (String) SecurityUtils.getSubject().getPrincipal();
GQLGoodsManageInput input = GoodsManageInputMapper.MAPPER.mapInput(environment.getArgument("inputData"));
GoodsManage goodsManage = null;
if (input.getId() != null) {
goodsManage = goodsManageDao.get(GoodsManage.class, input.getId());
goodsManage.setUpdated_at(new Date());
} else {
goodsManage = new GoodsManage();
goodsManage.setCreated_at(new Date());
}
if(input.getClassify_id() != null){
goodsManage.setClassify_id(input.getClassify_id());
}
if(input.getGoods_name() != null){
goodsManage.setGoods_name(input.getGoods_name());
}
if(input.getMain_image() != null){
goodsManage.setMain_image(input.getMain_image());
}
if(input.getGoods_price() != null){
goodsManage.setGoods_price(input.getGoods_price());
}
if(input.getGoods_number() != null){
goodsManage.setGoods_number(input.getGoods_number());
}
if(input.getGoods_stock() != null){
goodsManage.setGoods_price(input.getGoods_price());
}
if(input.getGoods_note() != null){
goodsManage.setGoods_note(input.getGoods_note());
}
if(input.getGood_status() != null){
goodsManage.setGood_status(input.getGood_status());
}
if(input.getAdd_id() != null){
goodsManage.setAdd_id(input.getAdd_id());
}
if(input.getEmploy_time() != null){
goodsManage.setEmploy_time(input.getEmploy_time());
}
if(input.getEmploy_department() != null){
goodsManage.setEmploy_department(input.getEmploy_department());
}
try {
goodsManageDao.saveOrUpdate(goodsManage);
} catch (Exception e) {
return Result.error(500, "" + e);
}
return Result.ok();
}
}
package com.orhon.smartcampus.material.modules.management.mutation;
import com.alibaba.fastjson.JSON;
import com.orhon.smartcampus.material.basicComponents.Result;
import com.orhon.smartcampus.material.modules.management.dao.GoodsClassifyDao;
import com.orhon.smartcampus.material.modules.management.dao.RoomDao;
import com.orhon.smartcampus.material.modules.management.entity.GoodsClassify;
import com.orhon.smartcampus.material.modules.management.entity.RoomEntity;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLGoodsClassifyInput;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLRoomInput;
import com.orhon.smartcampus.material.modules.management.inputMapper.GoodsClassifyInputMapper;
import com.orhon.smartcampus.material.modules.management.inputMapper.RoomInputMapper;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
@Component
public class AddRoomMutation implements DataFetcher {
@Autowired
RoomDao roomDao;
/**
* Room管理添加
* editor : ths
*/
@Override
public Object get(DataFetchingEnvironment environment) throws Exception {
//String token = (String) SecurityUtils.getSubject().getPrincipal();
GQLRoomInput input = RoomInputMapper.MAPPER.mapInput(environment.getArgument("inputData"));
RoomEntity roomEntity = null;
if (input.getId() != null) {
roomEntity = roomDao.get(RoomEntity.class, input.getId());
roomEntity.setUpdated_at(new Date());
} else {
roomEntity = new RoomEntity();
roomEntity.setCreated_at(new Date());
}
if(input.getFloor_id() != null){
roomEntity.setFloor_id(input.getFloor_id());
}
if(input.getRoom_head() != null){
roomEntity.setRoom_head(input.getRoom_head());
}
if(input.getRoom_key() != null){
roomEntity.setRoom_key(input.getRoom_key());
}
if(input.getRoom_number() != null){
roomEntity.setRoom_number(input.getRoom_number());
}
if(input.getRoom_name() != null){
roomEntity.setRoom_name(input.getRoom_name());
}
if(input.getRoom_status() != null){
roomEntity.setRoom_status(input.getRoom_status());
}
if(input.getAdd_id() != null){
roomEntity.setAdd_id(input.getAdd_id());
}
try {
roomDao.saveOrUpdate(roomEntity);
} catch (Exception e) {
return Result.error(500, "" + e);
}
return Result.ok();
}
}
package com.orhon.smartcampus.material.modules.management.mutation;
import com.alibaba.fastjson.JSON;
import com.orhon.smartcampus.material.basicComponents.Result;
import com.orhon.smartcampus.material.modules.management.dao.GoodsClassifyDao;
import com.orhon.smartcampus.material.modules.management.dao.RootDao;
import com.orhon.smartcampus.material.modules.management.entity.GoodsClassify;
import com.orhon.smartcampus.material.modules.management.entity.RootEntity;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLGoodsClassifyInput;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLRootInput;
import com.orhon.smartcampus.material.modules.management.gqlModel.GQLRootBeans;
import com.orhon.smartcampus.material.modules.management.inputMapper.GoodsClassifyInputMapper;
import com.orhon.smartcampus.material.modules.management.inputMapper.RootInputMapper;
import com.orhon.smartcampus.material.utils.ObjectToMap;
import com.orhon.smartcampus.material.utils.Util;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@Component
public class AddRootSiteMutation implements DataFetcher {
@Autowired
RootDao rootDao;
/**
* 楼层管理
* editor : ths
*/
@Override
public Object get(DataFetchingEnvironment environment) throws Exception {
//String token = (String) SecurityUtils.getSubject().getPrincipal();
// try {
// GQLRootBeans input = RootInputMapper.MAPPER.mapInput(environment.getArgument("inputData"));
// String hql = "from RootEntity as site where 1=1";
// RootEntity goodsClassify = null;
// if(environment.containsArgument("inputData")){
// HashMap<String,Object> map = ObjectToMap.to(environment.getArgument("inputData"));
// if(map.get("site_name")!=null){
// hql+= "and site.site_name" + Util.decide(map.get("site_name"));
// }
// if(map.get("school_id")!=null){
// hql+= "and site.school_id" + Util.decide(map.get("school_id"));
// }
// if(map.get("add_id")!=null){
// hql+= "and site.add_id" + Util.decide(map.get("add_id"));
// }
// }
// List<RootEntity> rootEntityList = rootDao.find(hql,null);
// if(rootEntityList==null||rootEntityList.size()<=0){
// goodsClassify = rootEntityList.get(0);
// goodsClassify.setUpdated_at(new Date());
// }else{
// goodsClassify = new RootEntity();
// goodsClassify.setCreated_at(new Date());
// }
// if(!String.valueOf(input.getSchool_id()).equals("null")){
// goodsClassify.setSchool_id(input.getSchool_id());
// }
// if(!String.valueOf(input.getAdd_id()).equals("null")){
// goodsClassify.setAdd_id(input.getAdd_id());
// }
// if(!String.valueOf(input.getSite_name()).equals("null")){
// goodsClassify.setSite_name(input.getSite_name());
// }
// if(input.getSite_status() != null){
// goodsClassify.setSite_status(input.getSite_status());
// }
// rootDao.saveOrUpdate(goodsClassify);
// } catch (Exception e) {
// return Result.error(500, "" + e);
// }
GQLRootBeans input = RootInputMapper.MAPPER.mapInput(environment.getArgument("inputData"));
RootEntity rootEntity = null;
if (input.getId() != null) {
rootEntity = rootDao.get(RootEntity.class, input.getId());
rootEntity.setUpdated_at(new Date());
} else {
rootEntity = new RootEntity();
rootEntity.setCreated_at(new Date());
}
if(input.getParent_id() != null){
rootEntity.setParent_id(input.getParent_id());
}
if(input.getSite_name() != null){
rootEntity.setSite_name(input.getSite_name());
}
if(input.getSite_status() != null){
rootEntity.setSite_status(input.getSite_status());
}
if(input.getSort_order() != null){
rootEntity.setSort_order(input.getSort_order());
}
if(input.getSchool_id() != null){
rootEntity.setSchool_id(input.getSchool_id());
}
if(input.getAdd_id() != null){
rootEntity.setAdd_id(JSON.toJSONString(input.getAdd_id()));
}
try {
rootDao.saveOrUpdate(rootEntity);
} catch (Exception e) {
return Result.error(500, "" + e);
}
return Result.ok();
}
}
package com.orhon.smartcampus.material.modules.management.mutation;
import com.orhon.smartcampus.material.basicComponents.Result;
import com.orhon.smartcampus.material.modules.management.dao.BuildingsDao;
import com.orhon.smartcampus.material.modules.management.dao.UnitDao;
import com.orhon.smartcampus.material.modules.management.entity.Buildings;
import com.orhon.smartcampus.material.modules.management.entity.Unit;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLBuildingsInput;
import com.orhon.smartcampus.material.modules.management.gqlInputModel.GQLUnitInput;
import com.orhon.smartcampus.material.modules.management.inputMapper.BuildingsInputMapper;
import com.orhon.smartcampus.material.modules.management.inputMapper.UnitInputMapper;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
@Component
public class AddUnitMutation implements DataFetcher {
@Autowired
UnitDao unitDao;
/**
* 楼层管理
* editor : ths
*/
@Override
public Object get(DataFetchingEnvironment environment) throws Exception {
//String token = (String) SecurityUtils.getSubject().getPrincipal();
GQLUnitInput input = UnitInputMapper.MAPPER.mapInput(environment.getArgument("inputData"));
Unit unit = null;
if (input.getId() != null) {
unit = unitDao.get(Unit.class, input.getId());
unit.setUpdated_at(new Date());
} else {
unit = new Unit();
unit.setCreated_at(new Date());
}
if(input.getBuilding_id() != null){
unit.setBuilding_id(input.getBuilding_id());
}
if(input.getUnit_name() != null){
unit.setUnit_name(input.getUnit_name());
}
if(input.getFloor_status() != null){
unit.setFloor_status(input.getFloor_status());
}
if(input.getFloor_start()!= null){
unit.setFloor_start(input.getFloor_start());
}
if(input.getFloor_end() != null){
unit.setFloor_end(input.getFloor_end());
}
if(input.getAdd_id() != null){
unit.setAdd_id(input.getAdd_id());
}
try {
unitDao.saveOrUpdate(unit);
} catch (Exception e) {
return Result.error(500, "" + e);
}
return Result.ok();
}
}
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
#url: jdbc:mysql://39.104.181.104:3311/smartcloud?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&useSSL=true
url: jdbc:mysql://localhost:3306/material?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&useSSL=true
url: jdbc:mysql://39.104.181.104:3311/smartcloud?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&useSSL=true
#url: jdbc:mysql://192.168.2.117:3306/material?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&useSSL=true
username: root
password: weixuanhe2233
password: SmartCampusDB7893
type: com.alibaba.druid.pool.DruidDataSource
#最大活跃数
maxActive: 20
......
input MaterialFloorAdd{
id:Int
unit_id:Int
floor_name:String
floor_head:String
floor_status:Int
add_id:String
}
type MaterialFloorListResult {
code:Int
msg:String
data:[MaterialFloorResultType]
total:Int
}
type MaterialFloorBean{
id:Int
"单元ID"
unit_id:Int
"楼层名称"
floor_name:String
"楼层负责人"
floor_head:String
"楼层状态"
floor_status:Int
"添加人ID"
add_id:String
created_at:Date
updated_at:Date
}
type MaterialFloorResultType{
id:Int
unit_id:Int
floor_name:String
floor_head:String
floor_status:Int
add_id:String
created_at:Date
updated_at:Date
}
input MaterialFloorResult{
id:Int
floor_name:String
floor_status:Int
}
\ No newline at end of file
"楼层"
#物品分类
type GoodsClassify {
id:Long
"单元"
id:Int
"父类ID"
parent_id:Int
"分类名称"
classify_name:String
"楼层电话"
"分类状态"
classify_status:Int
"楼层负责人"
classify_campus_id:String
"楼层名"
classify_userid:String
"排序"
sort_order:Int
"校区ID"
school_id:String
"添加人"
add_id:String
"创建时间"
created_at:Date
"更新时间"
updated_at:Date
}
input GoodsClassifyInput {
id:Int
parent_id:Int
classify_name:String
classify_status:Int
classify_campus_id:String
classify_userid:String
sort_order:Int
school_id:String
add_id:String
}
input GoodsClassifyCondition {
id:Int
classify_name:String
classify_status:Int
code:String
classify_campus_id:String
classify_userid:String
}
type GoodsClassifyResponse {
code:Int
msg:String
data:[GoodsClassify]
total:Int
}
#物品管理
type GoodsManage {
id:Int
"分类ID"
classify_id:Int
"物品名称"
goods_name:String
"图片地址"
main_image:String
"图片地址扩展用"
sub_images:String
"价格"
goods_price:String
"物品编码"
goods_number:String
"物品库存"
goods_stock:Int
"物品备注"
goods_note:String
"物品状态"
good_status:Int
"添加人"
add_id:String
"使用期限"
employ_time:String
"使用部门扩展用"
employ_department:String
created_at:Date
updated_at:Date
}
input GoodsManageInput {
id:Int
classify_id:Int
goods_name:String
main_image:String
sub_images:String
goods_price:String
goods_number:String
goods_stock:Int
goods_note:String
good_status:Int
add_id:String
employ_time:String
employ_department:String
}
input GoodsManageCondition {
id:Int
goods_name:String
good_status:Int
}
type GoodsManageResponse {
code:Int
msg:String
data:[GoodsManage]
total:Int
}
#楼宇管理
type Buildings {
id:Int
"楼宇名称"
buildings_name:String
"场地ID"
site_id:Int
"楼宇单元数量"
buildings_units:Int
"楼宇负责人"
buildings_head:String
"楼宇介绍"
buildings_introduce:String
"楼宇状态"
buildings_status:Int
"添加人"
add_id:String
created_at:Date
updated_at:Date
}
input BuildingsInput {
id:Int
buildings_name:String
site_id:Int
buildings_units:Int
buildings_head:String
buildings_introduce:String
buildings_status:Int
add_id:String
}
input BuildingsCondition {
id:Int
buildings_name:String
buildings_status:Int
}
type BuildingsResponse {
code:Int
msg:String
data:[Buildings]
total:Int
}
#单元管理
type Unit {
id:Int
"楼宇ID"
building_id:Int
"单元名称"
unit_name:String
"单元负责人"
unit_head:String
"单元状态"
unit_status:String
"楼层区间开始"
floor_start:Int
"楼层区间结束"
floor_end:Int
"添加人"
add_id:String
created_at:Date
updated_at:Date
}
input UnitInput {
id:Int
building_id:Int
unit_name:String
unit_head:String
floor_status:String
floor_start:Int
floor_end:Int
add_id:String
}
input UnitCondition {
id:Int
unit_name:String
buildings_status:Int
}
type UnitResponse {
code:Int
msg:String
data:[Unit]
total:Int
}
\ No newline at end of file
input MaterialRoomAdd{
id:Int
floor_id:Int
room_head:String
room_key:Int
room_number:Int
room_name:String
room_status:Int
add_id:String
}
type MaterialRoomListResult {
code:Int
msg:String
data:[MaterialRoomResultType]
total:Int
}
type MaterialRoomBean{
id:Int
"楼层ID"
floor_id:Int
"房间负责人"
room_head:String
"房间钥匙数量"
room_key:Int
"房间人数"
room_number:Int
"房间人数名称"
room_name:String
"房间状态"
room_status:Int
"添加人ID"
add_id:String
created_at:Date
updated_at:Date
}
type MaterialRoomResultType{
id:Int
floor_id:Int
room_head:String
room_key:Int
room_number:Int
room_name:String
room_status:Int
add_id:String
created_at:Date
updated_at:Date
}
input MaterialRoomResult{
id:Int
room_name:String
room_status:Int
}
\ No newline at end of file
type Query {
type Query{
query:Query
hello(a:SubjectType):String
#物品分类
GoodsClassifys(page:Int,limit:Int,condition: GoodsClassifyCondition):GoodsClassifyResponse
GoodsClassify(id:Long!):GoodsClassify
}
input MessageInput{
hello:String
GoodsClassify(id:Int!):GoodsClassify
#物品管理
GoodsManages(page:Int,limit:Int,condition: GoodsManageCondition):GoodsManageResponse
GoodsManage(id:Int!):GoodsManage
#场地查询
SeleSite(id:Int!):MaterialSiteResultType
SeleSites(page:Int,limit:Int,condition: MaterialSiteResult):MaterialSiteListResult
#楼宇管理
BuildingsList(page:Int,limit:Int,condition: BuildingsCondition):BuildingsResponse
Buildings(id:Int!):Buildings
#单元管理
UnitList(page:Int,limit:Int,condition: UnitCondition):UnitResponse
Unit(id:Int!):Unit
#Floor查询
SeleFloor(id:Int!):MaterialFloorResultType
SeleFloors(page:Int,limit:Int,condition: MaterialFloorResult):MaterialFloorListResult
#Room查询
SeleRoom(id:Int!):MaterialRoomResultType
SeleRooms(page:Int,limit:Int,condition: MaterialRoomAdd):MaterialRoomListResult
}
type Mutation {
type Mutation{
#物品分类
addGoodsClassify(inputData:GoodsClassifyInput): GoodsClassifyResponse
#物品管理
addGoodsManage(inputData:GoodsManageInput): GoodsManageResponse
#场地添加
addMaterialSiteAdds(inputData:MaterialSiteAdd):NormalResponse
#楼宇管理
addBuildings(inputData:BuildingsInput): BuildingsResponse
#单元管理
addUnit(inputData:UnitInput): UnitResponse
#Floor添加
addMaterialFloorAdds(inputData:MaterialFloorAdd):NormalResponse
#Room添加
addMaterialRoomAdds(inputData:MaterialRoomAdd):NormalResponse
}
input MaterialSiteAdd{
id:Int
parent_id:Int
site_name:String
site_status:String
sort_order:Int
school_id:String
add_id:String
}
type MaterialSiteListResult {
code:Int
msg:String
data:[MaterialSiteResultType]
total:Int
}
type MaterialSiteBean{
id:Int
"分类ID"
parent_id:Int
"场地名称"
site_name:String
"场地状态"
site_status:String
"排序"
sort_order:Int
"学校ID"
school_id:String
"添加人ID"
add_id:String
created_at:Date
updated_at:Date
}
type MaterialSiteResultType{
id:Int
parent_id:Int
site_name:String
site_status:String
sort_order:Int
school_id:String
add_id:String
created_at:Date
updated_at:Date
}
input MaterialSiteResult{
id:Int
site_name:String
site_status:Int
}
\ 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