Browse Source

字段调整

wangtianteng 1 year ago
parent
commit
51db07ba89

+ 1 - 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/TemplateLibraryController.java

@@ -36,10 +36,7 @@ public class TemplateLibraryController extends BaseController {
 //    @PreAuthorize("@ss.hasPermi('platform:template:list')")
     @PostMapping("/list")
     public R<IPage<TemplateLibrary>> list(@RequestBody BaseParam param) {
-        IPage<TemplateLibrary> templateIPage = templateLibraryService.page(new Page<TemplateLibrary>().setCurrent(param.getCurrent()).setSize(param.getSize()),
-                new LambdaQueryWrapper<TemplateLibrary>().like(param.getName()!=null,TemplateLibrary::getName,param.getName())
-                        .eq(TemplateLibrary::getDelFlag,0));
-        return R.ok(templateIPage);
+        return R.ok(templateLibraryService.list(param));
     }
 
 

+ 3 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/TemplateLibrary.java

@@ -71,4 +71,7 @@ public class TemplateLibrary implements Serializable {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date updateTime;
 
+    @TableField(exist = false)
+    private String businessesName;
+
 }

+ 6 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TemplateLibraryMapper.java

@@ -1,7 +1,10 @@
 package com.ruoyi.system.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.system.domain.TemplateLibrary;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 模板库Mapper接口
@@ -11,4 +14,7 @@ import com.ruoyi.system.domain.TemplateLibrary;
  */
 public interface TemplateLibraryMapper extends BaseMapper<TemplateLibrary> {
 
+    IPage<TemplateLibrary> list(Page input, @Param("name") String name);
+
+
 }

+ 3 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/TemplateLibraryService.java

@@ -1,6 +1,8 @@
 package com.ruoyi.system.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.system.domain.BaseParam;
 import com.ruoyi.system.domain.TemplateLibrary;
 
 /**
@@ -10,5 +12,5 @@ import com.ruoyi.system.domain.TemplateLibrary;
  * @date 2023-07-12
  */
 public interface TemplateLibraryService  extends IService<TemplateLibrary> {
-
+    IPage<TemplateLibrary> list(BaseParam param);
 }

+ 11 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TemplateLibraryServiceImpl.java

@@ -1,11 +1,16 @@
 package com.ruoyi.system.service.impl;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.system.domain.BaseParam;
 import com.ruoyi.system.domain.TemplateLibrary;
 import com.ruoyi.system.mapper.TemplateLibraryMapper;
 import com.ruoyi.system.service.TemplateLibraryService;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+
 /**
  * 模板库Service业务层处理
  * 
@@ -15,4 +20,10 @@ import org.springframework.stereotype.Service;
 @Service
 public class TemplateLibraryServiceImpl  extends ServiceImpl<TemplateLibraryMapper, TemplateLibrary> implements TemplateLibraryService {
 
+    @Resource
+    TemplateLibraryMapper templateLibraryMapper;
+    @Override
+    public IPage<TemplateLibrary> list(BaseParam param) {
+        return templateLibraryMapper.list(new Page<TemplateLibrary>().setCurrent(param.getCurrent()).setSize(param.getSize()),param.getName());
+    }
 }

+ 11 - 1
ruoyi-system/src/main/resources/mapper/system/platform/TemplateLibraryMapper.xml

@@ -20,7 +20,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <sql id="selectTemplateLibraryVo">
         select id, base_id, name, components_id, status, del_flag, create_by, create_time, update_by, update_time from t_template_library
     </sql>
-
+    <select id="list" resultType="com.ruoyi.system.domain.TemplateLibrary">
+        SELECT
+        tl.*, mu.`name` as businessesName
+        FROM
+        `t_template_library` tl
+        LEFT JOIN t_merchant_user  mu ON mu.id = tl.merchant_id
+        WHERE tl.del_flag = 0
+        <if test="name != null and name != ''">
+            and tl.`name` like concat('%',#{name},'%')
+        </if>
+    </select>
 
 
 </mapper>