Browse Source

我的消息

change 3 years ago
parent
commit
29b9a0ef41

+ 109 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/base/ProfileTpController.java

@@ -0,0 +1,109 @@
+package com.zhongzheng.controller.base;
+
+import com.zhongzheng.common.annotation.Log;
+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.enums.BusinessType;
+import com.zhongzheng.modules.base.bo.ProfileTpAddBo;
+import com.zhongzheng.modules.base.bo.ProfileTpEditBo;
+import com.zhongzheng.modules.base.bo.ProfileTpQueryBo;
+import com.zhongzheng.modules.base.service.IProfileTpService;
+import com.zhongzheng.modules.base.vo.ProfileTpVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+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;
+
+    /**
+     * 查询资料模板列表
+     */
+    @ApiOperation("查询资料模板列表")
+    @GetMapping("/list")
+    public TableDataInfo<ProfileTpVo> list(ProfileTpQueryBo bo) {
+        startPage();
+        List<ProfileTpVo> list = iProfileTpService.selectList(bo);
+        return getDataTable(list);
+    }
+
+    /**
+     * 获取所有使用商品ID
+     */
+    @ApiOperation("获取所有使用商品ID")
+    @GetMapping("/goods_list")
+    public AjaxResult<List<String>> goods_list(ProfileTpQueryBo bo) {
+        List<String> list = iProfileTpService.selectAllUseGoods(bo);
+        return AjaxResult.success(list);
+    }
+
+    /**
+     * 导出资料模板列表
+     */
+   /* @ApiOperation("导出资料模板列表")
+    @PreAuthorize("@ss.hasPermi('system:tp:export')")
+    @Log(title = "资料模板", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult<ProfileTpVo> export(ProfileTpQueryBo bo) {
+        List<ProfileTpVo> list = iProfileTpService.queryList(bo);
+        ExcelUtil<ProfileTpVo> util = new ExcelUtil<ProfileTpVo>(ProfileTpVo.class);
+        return util.exportExcel(list, "资料模板");
+    }*/
+
+    /**
+     * 获取资料模板详细信息
+     */
+    @ApiOperation("获取资料模板详细信息")
+    @GetMapping("/{goodsId}")
+    public AjaxResult<ProfileTpVo> queryByGoodsId(@PathVariable("goodsId" ) Long goodsId) {
+        return AjaxResult.success(iProfileTpService.queryByGoodsId(goodsId));
+    }
+
+    /**
+     * 新增资料模板
+     */
+    @ApiOperation("新增资料模板")
+    @Log(title = "资料模板", businessType = BusinessType.INSERT)
+    @PostMapping()
+    public AjaxResult<Void> add(@RequestBody ProfileTpAddBo bo) {
+        return toAjax(iProfileTpService.insertByAddBo(bo) ? 1 : 0);
+    }
+
+    /**
+     * 修改资料模板
+     */
+    @ApiOperation("修改资料模板")
+    @Log(title = "资料模板", businessType = BusinessType.UPDATE)
+    @PostMapping("/edit")
+    public AjaxResult<Void> edit(@RequestBody ProfileTpEditBo bo) {
+        return toAjax(iProfileTpService.updateByEditBo(bo) ? 1 : 0);
+    }
+
+    /**
+     * 删除资料模板
+     */
+   /* @ApiOperation("删除资料模板")
+    @PreAuthorize("@ss.hasPermi('system:tp:remove')")
+    @Log(title = "资料模板" , businessType = BusinessType.DELETE)
+    @DeleteMapping("/{profileTpIds}")
+    public AjaxResult<Void> remove(@PathVariable Long[] profileTpIds) {
+        return toAjax(iProfileTpService.deleteWithValidByIds(Arrays.asList(profileTpIds), true) ? 1 : 0);
+    }*/
+}

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/bo/ProfileTpQueryBo.java

@@ -43,6 +43,9 @@ public class ProfileTpQueryBo extends BaseEntity {
 	/** 编码 */
 	@ApiModelProperty("编码")
 	private String code;
+	/** 编码 */
+	@ApiModelProperty("编码")
+	private Long goodsId;
 	/** 0 禁用 1启用 */
 	@ApiModelProperty("0 禁用 1启用")
 	private List<Integer> status;

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/IProfileTpService.java

@@ -53,4 +53,6 @@ public interface IProfileTpService extends IService<ProfileTp> {
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+	ProfileTpVo queryByGoodsId(Long goodsId);
 }

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/ProfileTpServiceImpl.java

@@ -157,4 +157,11 @@ public class ProfileTpServiceImpl extends ServiceImpl<ProfileTpMapper, ProfileTp
         }
         return this.removeByIds(ids);
     }
+
+    @Override
+    public ProfileTpVo queryByGoodsId(Long goodsId) {
+        ProfileTpQueryBo profileTpQueryBo = new ProfileTpQueryBo();
+        profileTpQueryBo.setGoodsId(goodsId);
+        return profileTpMapper.selectList(profileTpQueryBo).get(0);
+    }
 }

+ 3 - 0
zhongzheng-system/src/main/resources/mapper/modules/base/ProfileTpMapper.xml

@@ -87,6 +87,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 #{item}
             </foreach>
         </if>
+        <if test="goodsId != null">
+            and FIND_IN_SET(#{goodsId},p.goods_ids)
+        </if>
         order by p.create_time desc
     </select>
 </mapper>