项目: 1->元数据 select *from t_plat_function t where t.ID = ‘8c495b995282411bb9402433fcd39864’; – 表2 select *from t_plat_function_component t where t.func_id = ‘8c495b995282411bb9402433fcd39864’;
– 表3 select *from t_plat_function_model t where t.func_id = ‘8c495b995282411bb9402433fcd39864’;
– 表4 select * from t_plat_meta_model t where t.ID=‘67a2cf99588c4339a95765c5593c2128’;
– 表5 select *from t_plat_meta_model_action t where t.model_id =‘67a2cf99588c4339a95765c5593c2128’;
– 表6 select * from t_plat_meta_model_column t where t.model_id =‘67a2cf99588c4339a95765c5593c2128’;
– 表7 select * from t_plat_service t where t.ID = ‘89e2c95e83f2466b88b68eafb3895d68’;
– 表8 select * from t_plat_service_data t where t.serv_id = ‘89e2c95e83f2466b88b68eafb3895d68’;
–>前端用react先简单写一套跑起来 –>基本的单表查询已经出来了 –>后端idea上写一个api接口 restlu风格
@Tag(name = "活动管理")
@RequestMapping("/v1/ecc/activity")
public interface EccActivityRemoteService {
@Operation(description = "活动新增", tags = "活动管理")
@PostMapping("/save")
String createActivityInfo(@RequestBody ActivityVo activityVo);
@Operation(description = "活动编辑", tags = "活动管理")
@PostMapping("/updateActivityVo/{id}")
String updateActivityVo(@RequestBody ActivityVo activityVo, @PathVariable("id") String id);
@Operation(description = "活动删除", tags = "活动管理")
@GetMapping("/deleteActivityVo/{id}")
Map<String,Object> deleteActivityVo(@PathVariable("id") String id);
@Operation(description = "状态更新", tags = "活动管理")
@GetMapping("/updateStatus")
void updateStatus();
}
–>vo包这个包里面主要是放的页面需要显示的东西
@Getter
@Setter
public class ActivityVo extends AbstractVo {
private String id;
private String name;
private String location;
private Date beginDay;
private Date[] activityTime;
private String signUp;
private String description;
private String photo;
}
—>Controller层
int ACTVITY_ID_EMPTY = 202100068;
int ACTVITY_SPID_EMPTY = 202100069;
int ACTVITY_NAME_EMPTY = 202100070;
int ACTVITY_LOCATION_EMPTY = 202100071;
int ACTVITY_BEGINDAY_EMPTY = 202100072;
int ACTVITY_ACTIVITYTIME_EMPTY = 202100073;
int ACTVITY_SIGNUP_EMPTY = 202100074;
int ACTVITYSIGNUP_ID_EMPTY = 202100075;
int ACTVITYSIGNUP_SPID_EMPTY = 202100076;
int ACTVITYSIGNUP_NAME_EMPTY = 202100077;
int ACTVITYSIGNUP_PHONE_EMPTY = 202100078;
—>Controller层
@RestController
public class EccActivityController extends BaseController implements EccActivityRemoteService {
private static final String url = PropertyHolder.getProperty("fdfs.config.url");
@Resource
private EccActivityService eccActivityService;
@Resource
private EccActivitySignUpService eccActivitySignUpService;
@Override
public String createActivityInfo(@RequestBody ActivityVo activityVo) {
Assert.notNull(activityVo.getName(), EccErrorCodeDef.ACTVITY_NAME_EMPTY);
Assert.notNull(activityVo.getLocation(), EccErrorCodeDef.ACTVITY_LOCATION_EMPTY);
Assert.notNull(activityVo.getBeginDay(), EccErrorCodeDef.ACTVITY_BEGINDAY_EMPTY);
Assert.notNull(activityVo.getActivityTime(), EccErrorCodeDef.ACTVITY_ACTIVITYTIME_EMPTY);
Assert.notNull(activityVo.getSignUp(), EccErrorCodeDef.ACTVITY_SIGNUP_EMPTY);
OmActivityInfoEntity activityInfoEntity = new OmActivityInfoEntity();
activityInfoEntity.setName(activityVo.getName());
activityInfoEntity.setLocation(activityVo.getLocation());
activityInfoEntity.setBeginDay(activityVo.getBeginDay());
activityInfoEntity.setBeginDate(activityVo.getActivityTime()[0]);
activityInfoEntity.setEndDate(activityVo.getActivityTime()[1]);
if (StringUtils.isEmpty(activityVo.getSignUp())) {
activityInfoEntity.setSignUp(GlobalConstants.NO);
} else {
activityInfoEntity.setSignUp(activityVo.getSignUp());
}
activityInfoEntity.setDescription(activityVo.getDescription());
if (!StringUtils.isEmpty(activityVo.getPhoto())){
activityInfoEntity.setPhoto(url+activityVo.getPhoto());
}
activityInfoEntity.setCreateTime(DateUtil.getCurrentDate());
activityInfoEntity.setUpdateTime(DateUtil.getCurrentDate());
activityInfoEntity.setSpId(super.getSpId());
return eccActivityService.createActivityInfo(activityInfoEntity);
}
@Override
public String updateActivityVo(ActivityVo activityVo, String id) {
return eccActivityService.updateActivityVo(activityVo,id);
}
@Override
public Map<String,Object> deleteActivityVo(String id) {
OmActivityInfoEntity activityInfoEntity = eccActivityService.getActuvityInfoById(id);
Map<String,Object> resultMap = new HashMap<>();
if(activityInfoEntity!=null){
List<OmActivitySignUpEntity> signUpEntityList = eccActivitySignUpService.getSignUpInfoByPid(id);
if(CollectionUtils.isEmpty(signUpEntityList)) {
eccActivityService.deleteVisitor(activityInfoEntity);
resultMap.put("resultCode","0");
resultMap.put("resultMsg","删除成功");
return resultMap;
}else{
resultMap.put("resultCode","1");
resultMap.put("resultMsg","删除失败,活动已有人员报名");
return resultMap;
}
}else{
resultMap.put("resultCode","1");
resultMap.put("resultMsg","删除失败,活动不存在");
return resultMap;
}
}
@Override
public void updateStatus() {
eccActivityService.updateStatus();
}
}
```service层
```java
public interface EccActivityService {
String createActivityInfo(OmActivityInfoEntity activityInfoEntity);
String updateActivityVo(ActivityVo activityVo, String id);
void deleteVisitor(@RequestBody OmActivityInfoEntity omActivityInfoEntity);
OmActivityInfoEntity getActuvityInfoById(String id);
void updateStatus();
}
– 实现类
import com.hbasesoft.spcp.ecc.dao.EccOmActivitySignUpDao;
import com.hbasesoft.spcp.ecc.entity.OmActivityInfoEntity;
import com.hbasesoft.spcp.ecc.entity.OmActivitySignUpEntity;
import com.hbasesoft.spcp.ecc.entity.UmElderlyInfoEntity;
import com.hbasesoft.spcp.ecc.entity.UmIcRelationEntity;
import com.hbasesoft.spcp.ecc.service.EccActivitySignUpService;
import com.hbasesoft.spcp.ecc.vo.AcyivitySignUpVo;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@Service
public class EccActivitySignUpServiceImpl implements EccActivitySignUpService {
@Resource
EccOmActivitySignUpDao eccOmActivitySignUpDao;
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public String createActivitySingUp(OmActivitySignUpEntity OmActivitySignUpEntity) {
return eccOmActivitySignUpDao.save(OmActivitySignUpEntity).toString();
}
@Override
@Transactional(readOnly = true)
public List<OmActivitySignUpEntity> getAcyivitySignUpVoByIdNumber(String activityId, String idNumber,String Phone) {
DetachedCriteria detachedCriteria = DetachedCriteria.forClass(OmActivitySignUpEntity.class);
detachedCriteria.add(Restrictions.eq(OmActivitySignUpEntity.ACTIVITY_ID, activityId));
detachedCriteria.add(Restrictions.eq(OmActivitySignUpEntity.ID_NUMBER, idNumber));
detachedCriteria.add(Restrictions.eq(OmActivitySignUpEntity.ACTIVITYSIGNUP_PHONE, Phone));
List<OmActivitySignUpEntity> omActivitySignUpEntity = eccOmActivitySignUpDao.queryByCriteria(detachedCriteria);
return omActivitySignUpEntity;
}
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public void delectAcyivitySignUp(OmActivitySignUpEntity omActivitySignUpEntity) {
eccOmActivitySignUpDao.delete(omActivitySignUpEntity);
}
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public void updateActivitySignUp(OmActivitySignUpEntity omActivitySignUpEntity) {
eccOmActivitySignUpDao.update(omActivitySignUpEntity);
}
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public OmActivitySignUpEntity getAcyivitySignUpVoById(String id) {
return eccOmActivitySignUpDao.get(id);
}
@Override
@Transactional(readOnly = true)
public List<OmActivitySignUpEntity> queryAcyivitySignUp() {
DetachedCriteria detachedCriteria = DetachedCriteria.forClass(OmActivitySignUpEntity.class);
return eccOmActivitySignUpDao.queryByCriteria(detachedCriteria);
}
@Override
@Transactional(readOnly = true)
public List<OmActivitySignUpEntity> getSignUpInfoByPid(String activityId) {
DetachedCriteria detachedCriteria = DetachedCriteria.forClass(OmActivitySignUpEntity.class);
detachedCriteria.add(Restrictions.eq(OmActivitySignUpEntity.ACTIVITY_ID,activityId));
return eccOmActivitySignUpDao.queryByCriteria(detachedCriteria);
}
}
– Dao层
@Dao
public interface EccOmActivityInfoDao extends IBaseDao<OmActivityInfoEntity> {
}
– entity
```java
package com.hbasesoft.spcp.ecc.entity;
import com.hbasesoft.framework.db.core.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.Date;
@Entity(name = "OM_ACTIVITY_INFO")
@Setter
@Getter
public class OmActivityInfoEntity extends BaseEntity {
public final static String BEGIN_DAY = "beginDay";
public final static String LOCATION = "location";
public static final String ID = "id";
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
@Column(name = "id")
private String id;
@Column(name = "sp_id")
private String spId;
@Column(name = "name")
private String name;
@Column(name = "location")
private String location;
@Column(name = "begin_day")
private Date beginDay;
@Column(name = "begin_date")
private Date beginDate;
@Column(name = "end_date")
private Date endDate;
@Column(name = "sign_up")
private String signUp;
@Column(name = "status")
private String status;
@Column(name = "photo")
private String photo;
@Column(name = "description")
private String description;
@Column(name = "update_time")
private Date updateTime;
@Column(name = "create_time")
private Date createTime;
}
![在这里插入图片描述](https://img-blog.csdnimg.cn/b952ab9b9ace4b28bee5d2f6f9eb236b.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl81MTYyMTg5Mw==,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/6e5982779a7144ae9aa931ed1a2e56e2.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl81MTYyMTg5Mw==,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/171a8f6f7bca4bc48bef623c00ec895a.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl81MTYyMTg5Mw==,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/bf46ba5f3d494c649a34aa10d010e155.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl81MTYyMTg5Mw==,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/68b026a867ea45849128f0bfe84751f7.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl81MTYyMTg5Mw==,size_16,color_FFFFFF,t_70)
|