EDZ 4 gadi atpakaļ
vecāks
revīzija
55c03fb8c7

+ 47 - 0
code/auto/biz/src/main/java/com/jzdsh/auto/biz/ActivityServce.java

@@ -1,5 +1,9 @@
 package com.jzdsh.auto.biz;
 
+import com.jfinal.aop.Inject;
+import com.jfinal.kit.Ret;
+import com.jfinal.plugin.activerecord.Db;
+import com.jfinal.plugin.activerecord.Page;
 import com.jzdsh.auto.model.Activity;
 import lombok.Setter;
 import lombok.extern.java.Log;
@@ -27,4 +31,47 @@ public class ActivityServce {
         }
         return null;
     }
+
+
+     public Page<Activity> activityPaginate(Integer pageNum, Integer pageSize){
+
+        try {
+            return Activity.dao.paginate(pageNum, pageSize, "select a.*,b.title type,c.title tag", "from activity a inner join bs_type b ON(a.typeId = b.id and b.isTag= 0) inner join  bs_type  c on (a.tagId = c.id and c.isTag = 1) order by a.id desc");
+        }catch (Exception e){
+            log.info(e);
+        }
+        return null;
+     }
+
+     public Activity findById(int activityNewsId){
+        try {
+            Activity activity = Activity.dao.findById(activityNewsId);
+            if (activity != null) {
+                return activity;
+            }else{
+                return null;
+            }
+        }catch (Exception e){
+            log.info(e);
+        }
+        return null;
+     }
+
+
+     public Ret delete(int activityNewsId){
+        try {
+            Integer countId = Db.queryInt("select id from activity where id = ? limit 1", activityNewsId);
+            if (countId != null) {
+                Activity.dao.deleteById(activityNewsId);
+                return Ret.ok("msg", "删除成功");
+            } else {
+                return Ret.fail("msg", "删除失败");
+            }
+        }catch (Exception e){
+            log.info(e);
+        }
+         return Ret.fail("msg", "删除失败");
+     }
+
+
 }

+ 39 - 0
code/auto/biz/src/main/java/com/jzdsh/auto/biz/BsTypeService.java

@@ -0,0 +1,39 @@
+package com.jzdsh.auto.biz;
+
+import com.jfinal.kit.Ret;
+import com.jzdsh.auto.model.BsType;
+import lombok.extern.log4j.Log4j2;
+import sun.rmi.runtime.Log;
+
+import java.util.List;
+
+@Log4j2
+public class BsTypeService {
+
+    /**
+     * 查询活动资讯所有类型 isTag=0表示类型
+     * @return
+     */
+    public List<BsType> findAllType(){
+        try {
+            return BsType.dao.find("select * from bs_type where isTag = 0");
+        }catch (Exception e){
+          log.info(e);
+        }
+        return null;
+    }
+
+    /**
+     * 查询活动资讯所有标签 isTag=1表示类型
+     * @return
+     */
+    public List<BsType> findAllTag(){
+        try {
+            return BsType.dao.find("select * from bs_type where isTag = 1");
+        }catch (Exception e){
+            log.info(e);
+        }
+        return null;
+    }
+
+}

+ 8 - 0
code/auto/biz/src/main/java/com/jzdsh/auto/biz/CommonService.java

@@ -0,0 +1,8 @@
+package com.jzdsh.auto.biz;
+
+public class CommonService {
+
+    public void ueditor(){
+
+    }
+}