@@ -0,0 +1,36 @@ | |||
package com.tuoheng.api.controller; | |||
import com.tuoheng.api.entity.domain.WestreamSuggest; | |||
import com.tuoheng.api.service.IWestreamSuggestService; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
/** | |||
* 护河建议 前端控制器 | |||
* | |||
* @author WangHaoran | |||
* @since 2023-06-06 | |||
*/ | |||
@RestController | |||
@RequestMapping("/westreamSuggest") | |||
public class WestreamSuggestController { | |||
@Autowired | |||
IWestreamSuggestService westreamSuggestService; | |||
/** | |||
* 提交护河建议 | |||
* | |||
* @param entity | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
public JsonResult add(WestreamSuggest entity) { | |||
return westreamSuggestService.add(entity); | |||
} | |||
} |
@@ -0,0 +1,53 @@ | |||
package com.tuoheng.api.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.io.Serializable; | |||
/** | |||
* 全民护河保护河建议表 | |||
* | |||
* @author WangHaoran | |||
* @since 2023-06-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = false) | |||
@Accessors(chain = true) | |||
@TableName("th_westream_suggest") | |||
public class WestreamSuggest extends BaseEntity implements Serializable { | |||
/** | |||
* 租户id | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* openid | |||
*/ | |||
private String openid; | |||
/** | |||
* 用户昵称 | |||
*/ | |||
private String nickname; | |||
/** | |||
* 护河建议 | |||
*/ | |||
private String suggestName; | |||
/** | |||
* 审核状态:1待审核 2通过 3驳回 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 审核备注 | |||
*/ | |||
private String remark; | |||
} |
@@ -0,0 +1,13 @@ | |||
package com.tuoheng.api.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.api.entity.domain.WestreamSuggest; | |||
/** | |||
* 全民护河保护河建议表 Mapper 接口 | |||
* | |||
* @author WangHaoran | |||
* @since 2023-06-06 | |||
*/ | |||
public interface WestreamSuggestMapper extends BaseMapper<WestreamSuggest> { | |||
} |
@@ -0,0 +1,7 @@ | |||
package com.tuoheng.api.service; | |||
import com.tuoheng.api.entity.domain.WestreamSuggest; | |||
import com.tuoheng.common.common.IBaseService; | |||
public interface IWestreamSuggestService extends IBaseService<WestreamSuggest> { | |||
} |
@@ -0,0 +1,47 @@ | |||
package com.tuoheng.api.service.impl; | |||
import cn.hutool.core.date.DateUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.api.entity.domain.Identity; | |||
import com.tuoheng.api.entity.domain.WestreamSuggest; | |||
import com.tuoheng.api.entity.domain.WestreamUser; | |||
import com.tuoheng.api.mapper.WestreamSuggestMapper; | |||
import com.tuoheng.api.service.IWestreamSuggestService; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import com.tuoheng.common.common.BaseServiceImpl; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* 全民护河保护河建议表 服务实现类 | |||
* | |||
* @author WangHaoran | |||
* @since 2023-06-06 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class WestreamSuggestServiceImpl extends BaseServiceImpl<WestreamSuggestMapper, WestreamSuggest> implements IWestreamSuggestService { | |||
/** | |||
* 提交护河建议 | |||
* | |||
* @param entity | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult add(WestreamSuggest entity) { | |||
//校验 | |||
if (null == entity.getTenantId()) { | |||
return JsonResult.error("租户ID为空!"); | |||
} | |||
if (StringUtils.isEmpty(entity.getOpenid())) { | |||
return JsonResult.error("openid为空!"); | |||
} | |||
return super.add(entity); | |||
} | |||
} |