From 8af6287c3982f7298ac2fa108fb670e962993abc Mon Sep 17 00:00:00 2001 From: mactj Date: Wed, 20 Jan 2021 17:32:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=80=E4=B8=AA=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E9=83=A8=E9=97=A8id=E6=9F=A5=E8=AF=A2=E5=95=86?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AppMerchantController.java | 64 +++++++++++-------- .../com/ruoyi/winery/domain/AppMerchant.java | 5 ++ mini-app/src/apis/merchanApis.js | 6 ++ mini-app/src/pages/winery/winery-detail.wpy | 15 ++++- 4 files changed, 62 insertions(+), 28 deletions(-) diff --git a/hope-winery/src/main/java/com/ruoyi/winery/controller/AppMerchantController.java b/hope-winery/src/main/java/com/ruoyi/winery/controller/AppMerchantController.java index d97818ce5..3848d4465 100644 --- a/hope-winery/src/main/java/com/ruoyi/winery/controller/AppMerchantController.java +++ b/hope-winery/src/main/java/com/ruoyi/winery/controller/AppMerchantController.java @@ -32,13 +32,13 @@ import com.ruoyi.common.core.page.TableDataInfo; /** * 商户Controller - * + * * @author ruoyi * @date 2021-01-19 */ @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController -@RequestMapping("/winery/merchant" ) +@RequestMapping("/winery/merchant") public class AppMerchantController extends BaseController { private final IAppMerchantService iAppMerchantService; @@ -48,21 +48,20 @@ public class AppMerchantController extends BaseController { */ @PreAuthorize("@ss.hasPermi('winery:merchant:list')") @GetMapping("/list") - public TableDataInfo list(AppMerchant appMerchant) - { + public TableDataInfo list(AppMerchant appMerchant) { startPage(); LambdaQueryWrapper lqw = Wrappers.lambdaQuery(appMerchant); - if (StringUtils.isNotBlank(appMerchant.getMchName())){ - lqw.like(AppMerchant::getMchName ,appMerchant.getMchName()); + if (StringUtils.isNotBlank(appMerchant.getMchName())) { + lqw.like(AppMerchant::getMchName, appMerchant.getMchName()); } - if (StringUtils.isNotBlank(appMerchant.getSubtitle())){ - lqw.eq(AppMerchant::getSubtitle ,appMerchant.getSubtitle()); + if (StringUtils.isNotBlank(appMerchant.getSubtitle())) { + lqw.eq(AppMerchant::getSubtitle, appMerchant.getSubtitle()); } - if (StringUtils.isNotBlank(appMerchant.getAvatar())){ - lqw.eq(AppMerchant::getAvatar ,appMerchant.getAvatar()); + if (StringUtils.isNotBlank(appMerchant.getAvatar())) { + lqw.eq(AppMerchant::getAvatar, appMerchant.getAvatar()); } - if (StringUtils.isNotBlank(appMerchant.getMchDesc())){ - lqw.eq(AppMerchant::getMchDesc ,appMerchant.getMchDesc()); + if (StringUtils.isNotBlank(appMerchant.getMchDesc())) { + lqw.eq(AppMerchant::getMchDesc, appMerchant.getMchDesc()); } lqw.orderByAsc(AppMerchant::getSort); List list = iAppMerchantService.list(lqw); @@ -72,30 +71,41 @@ public class AppMerchantController extends BaseController { /** * 导出商户列表 */ - @PreAuthorize("@ss.hasPermi('winery:merchant:export')" ) - @Log(title = "商户" , businessType = BusinessType.EXPORT) - @GetMapping("/export" ) + @PreAuthorize("@ss.hasPermi('winery:merchant:export')") + @Log(title = "商户", businessType = BusinessType.EXPORT) + @GetMapping("/export") public AjaxResult export(AppMerchant appMerchant) { LambdaQueryWrapper lqw = new LambdaQueryWrapper(appMerchant); List list = iAppMerchantService.list(lqw); - ExcelUtil util = new ExcelUtil(AppMerchant. class); - return util.exportExcel(list, "merchant" ); + ExcelUtil util = new ExcelUtil(AppMerchant.class); + return util.exportExcel(list, "merchant"); } /** * 获取商户详细信息 */ - @PreAuthorize("@ss.hasPermi('winery:merchant:query')" ) - @GetMapping(value = "/{id}" ) - public AjaxResult getInfo(@PathVariable("id" ) String id) { + @PreAuthorize("@ss.hasPermi('winery:merchant:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") String id) { return AjaxResult.success(iAppMerchantService.getById(id)); } + + /** + * 获取商户详细信息 + */ + @PreAuthorize("@ss.hasPermi('winery:merchant:query')") + @GetMapping(value = "dept/{id}") + public AjaxResult getInfoByDeptId(@PathVariable("deptId") String deptId) { + + return AjaxResult.success(iAppMerchantService.getOne(new LambdaQueryWrapper().eq(AppMerchant::getDeptId, deptId))); + } + /** * 新增商户 */ - @PreAuthorize("@ss.hasPermi('winery:merchant:add')" ) - @Log(title = "商户" , businessType = BusinessType.INSERT) + @PreAuthorize("@ss.hasPermi('winery:merchant:add')") + @Log(title = "商户", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody AppMerchant appMerchant) { String richText = appMerchant.getMchDesc(); @@ -109,8 +119,8 @@ public class AppMerchantController extends BaseController { /** * 修改商户 */ - @PreAuthorize("@ss.hasPermi('winery:merchant:edit')" ) - @Log(title = "商户" , businessType = BusinessType.UPDATE) + @PreAuthorize("@ss.hasPermi('winery:merchant:edit')") + @Log(title = "商户", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody AppMerchant appMerchant) { String richText = appMerchant.getMchDesc(); @@ -124,9 +134,9 @@ public class AppMerchantController extends BaseController { /** * 删除商户 */ - @PreAuthorize("@ss.hasPermi('winery:merchant:remove')" ) - @Log(title = "商户" , businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}" ) + @PreAuthorize("@ss.hasPermi('winery:merchant:remove')") + @Log(title = "商户", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable String[] ids) { return toAjax(iAppMerchantService.removeByIds(Arrays.asList(ids)) ? 1 : 0); } diff --git a/hope-winery/src/main/java/com/ruoyi/winery/domain/AppMerchant.java b/hope-winery/src/main/java/com/ruoyi/winery/domain/AppMerchant.java index 6facb9728..16ef21b87 100644 --- a/hope-winery/src/main/java/com/ruoyi/winery/domain/AppMerchant.java +++ b/hope-winery/src/main/java/com/ruoyi/winery/domain/AppMerchant.java @@ -36,6 +36,11 @@ private static final long serialVersionUID=1L; @TableId(value = "id", type = IdType.ASSIGN_UUID) private String id; + /** + * 部门id + */ + private Long deptId; + /** 商户名称 */ @Excel(name = "商户名称") private String mchName; diff --git a/mini-app/src/apis/merchanApis.js b/mini-app/src/apis/merchanApis.js index 4852382c8..1cb0471f0 100644 --- a/mini-app/src/apis/merchanApis.js +++ b/mini-app/src/apis/merchanApis.js @@ -19,6 +19,12 @@ class MerchanApis { url: baseUrl + 'winery/merchant/' + id }) } + + getMerchantInfoByDeptId(deptId) { + return request.get({ + url: baseUrl + 'winery/merchant/dept/' + deptId + }) + } } export default new MerchanApis() diff --git a/mini-app/src/pages/winery/winery-detail.wpy b/mini-app/src/pages/winery/winery-detail.wpy index 666186b31..fef7da5d1 100644 --- a/mini-app/src/pages/winery/winery-detail.wpy +++ b/mini-app/src/pages/winery/winery-detail.wpy @@ -116,12 +116,25 @@ wepy.page({ merchanApis.getMerchantInfo(id).then(r => { this.wineryItem = r.data }) + }, + + async initByDept(deptId) { + merchanApis.getMerchantInfoByDeptId(deptId).then(r => { + this.wineryItem = r.data + }) } }, onLoad(options) { - this.init(options.id) + + if (options.id) { + this.init(options.id) + } else if (options.deptId) { + this.initByDept(options.deptId) + } + } +} })