|
@@ -1,5 +1,9 @@
|
|
package com.jzdsh.auto.biz;
|
|
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 com.jzdsh.auto.model.Activity;
|
|
import lombok.Setter;
|
|
import lombok.Setter;
|
|
import lombok.extern.java.Log;
|
|
import lombok.extern.java.Log;
|
|
@@ -27,4 +31,47 @@ public class ActivityServce {
|
|
}
|
|
}
|
|
return null;
|
|
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", "删除失败");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|