package com.zhongzheng.controller.base; import com.zhongzheng.common.core.controller.BaseController; import com.zhongzheng.common.core.domain.AjaxResult; import com.zhongzheng.common.core.page.TableDataInfo; import com.zhongzheng.common.utils.ServletUtils; import com.zhongzheng.framework.web.service.WxTokenService; import com.zhongzheng.modules.base.bo.*; import com.zhongzheng.modules.base.service.IProfileTpService; import com.zhongzheng.modules.base.service.IUserProfileService; import com.zhongzheng.modules.base.vo.ProfileTpVo; import com.zhongzheng.modules.user.entity.ClientLoginUser; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * 资料模板Controller * * @author hjl * @date 2021-11-19 */ @Api(value = "资料模板控制器", tags = {"资料模板管理"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/base/profile/tp") public class ProfileTpController extends BaseController { private final IProfileTpService iProfileTpService; private final WxTokenService wxTokenService; private final IUserProfileService iUserProfileService; /** * 查询资料模板列表 */ @ApiOperation("查询资料模板列表") @GetMapping("/list") public TableDataInfo list(ProfileTpQueryBo bo) { startPage(); List list = iProfileTpService.selectList(bo); return getDataTable(list); } /** * 获取资料模板详细信息 */ @ApiOperation("获取资料模板详细信息") @GetMapping("/{goodsId}") public AjaxResult queryByGoodsId(@PathVariable("goodsId" ) Long goodsId) { return AjaxResult.success(iProfileTpService.queryByGoodsId(goodsId)); } /** * 新增填写资料审核 */ @ApiOperation("新增填写资料审核") @PostMapping() public AjaxResult add(@RequestBody UserProfileAddBo bo) { ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest()); bo.setUserId(loginUser.getUser().getUserId()); return toAjax(iUserProfileService.insertByAddBo(bo) ? 1 : 0); } @ApiOperation("新增填写资料审核") @PostMapping("/addWord") public AjaxResult addWord(@RequestBody UserProfileAddBo bo) { ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest()); bo.setUserId(loginUser.getUser().getUserId()); String s = iUserProfileService.addWord(bo); return AjaxResult.success(s); } }