更新notice

This commit is contained in:
sjm 2023-12-28 00:42:19 +08:00
parent 4ee3765cf4
commit 0804aa5e0f
5 changed files with 20 additions and 5 deletions

View File

@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List;
@RestController @RestController
public class NoticeController { public class NoticeController {
@ -29,8 +30,8 @@ public class NoticeController {
} }
// //
@RequestMapping(method = RequestMethod.GET,value = "/notice/select") @RequestMapping(method = RequestMethod.GET,value = "/notice/select")
public String select(int id){ public String select(){
return noticeService.select(id); return noticeService.select();
} }
// //
@RequestMapping(method = RequestMethod.GET,value = "/notice/update") @RequestMapping(method = RequestMethod.GET,value = "/notice/update")

View File

@ -4,6 +4,8 @@ import com.lovenav.entity.Notice;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
@Repository @Repository
@Mapper @Mapper
public interface NoticeDao { public interface NoticeDao {
@ -18,4 +20,6 @@ public interface NoticeDao {
int updateByPrimaryKeySelective(Notice record); int updateByPrimaryKeySelective(Notice record);
int updateByPrimaryKey(Notice record); int updateByPrimaryKey(Notice record);
List<Notice> selectAll();
} }

View File

@ -2,10 +2,13 @@ package com.lovenav.service;
import com.lovenav.entity.Notice; import com.lovenav.entity.Notice;
import java.util.List;
public interface NoticeService { public interface NoticeService {
String add(Notice notice); String add(Notice notice);
String delete(int id); String delete(int id);
String update(Notice notice); String update(Notice notice);
String select(int id); String select();
} }

View File

@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
@Service @Service
public class NoticeServiceImpl implements NoticeService { public class NoticeServiceImpl implements NoticeService {
@ -42,9 +43,9 @@ public class NoticeServiceImpl implements NoticeService {
return JSON.toJSONString(hashMap); return JSON.toJSONString(hashMap);
} }
} }
public String select(int id){ public String select(){
HashMap<String,Object> hashMap = new HashMap<>(); HashMap<String,Object> hashMap = new HashMap<>();
Notice result = noticeDao.selectByPrimaryKey(id); List<Notice> result = noticeDao.selectAll();
if(result != null){ if(result != null){
return JSON.toJSONString(result); return JSON.toJSONString(result);
}else{ }else{

View File

@ -95,4 +95,10 @@
createtime = #{createtime,jdbcType=TIMESTAMP} createtime = #{createtime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<select id="selectAll">
select
<include refid="Base_Column_List" />
from ln_notice
</select>
</mapper> </mapper>