Commit d2ec5d93 by fsn

通知列表业务编写

parent 730d16af
package com.stylefeng.guns.modular.system.controller;
import com.stylefeng.guns.common.controller.BaseController;
import com.stylefeng.guns.modular.system.dao.NoticeDao;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* 通知控制器
*
* @author fengshuonan
* @Date 2017-05-09 22:44:57
* @Date 2017-05-09 23:02:21
*/
@Controller
@RequestMapping("/notice")
......@@ -19,6 +24,9 @@ public class NoticeController extends BaseController {
private String PREFIX = "/system/notice/";
@Resource
private NoticeDao noticeDao;
/**
* 跳转到通知首页
*/
......@@ -44,6 +52,16 @@ public class NoticeController extends BaseController {
}
/**
* 获取通知列表
*/
@RequestMapping(value = "/list")
@ResponseBody
public Object list(String condition) {
List<Map<String, Object>> list = this.noticeDao.list(condition);
return list;
}
/**
* 新增通知
*/
@RequestMapping(value = "/add")
......
package com.stylefeng.guns.modular.system.dao;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 通知dao
*
* @author fengshuonan
* @date 2017-05-09 23:03
*/
public interface NoticeDao {
List<Map<String, Object>> list(@Param("condition") String condition);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.stylefeng.guns.modular.system.dao.NoticeDao">
<select id="list" resultType="map">
select * from _notice
<if test="condition != null and condition != ''">
where title like CONCAT('%',#{condition},'%') or content like CONCAT('%',#{condition},'%')
</if>
order by createtime DESC
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment