——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
用户:登录、注册、新闻增删改






技术框架
HTML CSS JavaScript jQuery Bootstrap thymeleaf SpringBoot SpringMVC MyBatis
基于javaweb的SpringBoot+MyBatis新闻管理系统(java+html+thymeleaf+springboot+javabean+mysql+tomcat+maven)
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| }
public boolean isValid() { return criteria.size() > 0; }
public List<Criterion> getAllCriteria() { return criteria; }
public List<Criterion> getCriteria() { return criteria; }
protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); }
protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); }
protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); }
public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; }
public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; }
public Criteria andIdEqualTo(Integer value) { addCriterion("id =", value, "id"); return (Criteria) this;
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| 'false' as QUERYID, <include refid="Base_Column_List" /> from news <if test="_parameter != null" > <include refid="Example_Where_Clause" /> </if> <if test="orderByClause != null" > order by ${orderByClause} </if> </select> <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" > select <include refid="Base_Column_List" /> , <include refid="Blob_Column_List" /> from news where newsid = #{newsid,jdbcType=INTEGER} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > delete from news where newsid = #{newsid,jdbcType=INTEGER} </delete> <insert id="insert" parameterType="com.demo.pojo.News" > insert into news (newsid, title, url, time, info) values (#{newsid,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{time,jdbcType=TIMESTAMP}, #{info,jdbcType=LONGVARCHAR}) </insert> <insert id="insertSelective" parameterType="com.demo.pojo.News" > insert into news <trim prefix="(" suffix=")" suffixOverrides="," > <if test="newsid != null" > newsid, </if> <if test="title != null" > title, </if> <if test="url != null" > url, </if> <if test="time != null" > time, </if>
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| </sql> <select id="selectByExampleWithBLOBs" resultMap="ResultMapWithBLOBs" parameterType="com.demo.pojo.NewsExample" > select <if test="distinct" > distinct </if> 'false' as QUERYID, <include refid="Base_Column_List" /> , <include refid="Blob_Column_List" /> from news <if test="_parameter != null" > <include refid="Example_Where_Clause" /> </if> <if test="orderByClause != null" > order by ${orderByClause} </if> </select> <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.demo.pojo.NewsExample" > select <if test="distinct" > distinct </if> 'false' as QUERYID, <include refid="Base_Column_List" /> from news <if test="_parameter != null" > <include refid="Example_Where_Clause" /> </if> <if test="orderByClause != null" > order by ${orderByClause} </if> </select> <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" > select <include refid="Base_Column_List" /> , <include refid="Blob_Column_List" /> from news where newsid = #{newsid,jdbcType=INTEGER} </select>
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| }
public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; }
public Criteria andIdEqualTo(Integer value) { addCriterion("id =", value, "id"); return (Criteria) this; }
public Criteria andIdNotEqualTo(Integer value) { addCriterion("id <>", value, "id"); return (Criteria) this; }
public Criteria andIdGreaterThan(Integer value) { addCriterion("id >", value, "id"); return (Criteria) this; }
public Criteria andIdGreaterThanOrEqualTo(Integer value) { addCriterion("id >=", value, "id"); return (Criteria) this; }
public Criteria andIdLessThan(Integer value) { addCriterion("id <", value, "id"); return (Criteria) this; }
public Criteria andIdLessThanOrEqualTo(Integer value) { addCriterion("id <=", value, "id"); return (Criteria) this; }
public Criteria andIdIn(List<Integer> values) { addCriterion("id in", values, "id"); return (Criteria) this; }
public Criteria andIdNotIn(List<Integer> values) { addCriterion("id not in", values, "id"); return (Criteria) this; }
public Criteria andIdBetween(Integer value1, Integer value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| PageHelper.startPage(pn, 4); List<News> newsList = newsService.findAll(); PageInfo<News> pageInfo = new PageInfo<>(newsList, 5); model.addAttribute("newsList", pageInfo); return "AllNews"; }
@PostMapping("/addNews") public String addNews(News news, @RequestParam("uploadfile") List<MultipartFile> uploadfile, HttpServletRequest request) { if (!uploadfile.isEmpty() && uploadfile.size() > 0) { for (MultipartFile file : uploadfile) { String originalFilename = file.getOriginalFilename(); String dirPath = System.getProperty("user.dir") + "/src/main/resources/static/upload/"; File filePath = new File(dirPath); if (!filePath.exists()) { filePath.mkdirs(); } String newFilename = UUID.randomUUID() + "_" + originalFilename; String imgurl = "/upload/" + newFilename; System.err.println("" + imgurl); news.setUrl(imgurl); try { file.transferTo(new File(dirPath + newFilename)); System.err.println(dirPath + newFilename); } catch (Exception e) { e.printStackTrace(); return "Error"; } } newsService.addNews(news); return "redirect:/allNews"; } else { return "Error"; } }
@PostMapping("/updateNews") public String updateNews(News news, @RequestParam("uploadfile") List<MultipartFile> uploadfile, HttpServletRequest request) {
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| return (Criteria) this; }
public Criteria andUrlNotIn(List<String> values) { addCriterion("url not in", values, "url"); return (Criteria) this; }
public Criteria andUrlBetween(String value1, String value2) { addCriterion("url between", value1, value2, "url"); return (Criteria) this; }
public Criteria andUrlNotBetween(String value1, String value2) { addCriterion("url not between", value1, value2, "url"); return (Criteria) this; }
public Criteria andTimeIsNull() { addCriterion("time is null"); return (Criteria) this; }
public Criteria andTimeIsNotNull() { addCriterion("time is not null"); return (Criteria) this; }
public Criteria andTimeEqualTo(Date value) { addCriterion("time =", value, "time"); return (Criteria) this; }
public Criteria andTimeNotEqualTo(Date value) { addCriterion("time <>", value, "time"); return (Criteria) this; }
public Criteria andTimeGreaterThan(Date value) { addCriterion("time >", value, "time"); return (Criteria) this; }
public Criteria andTimeGreaterThanOrEqualTo(Date value) { addCriterion("time >=", value, "time"); return (Criteria) this; }
public Criteria andTimeLessThan(Date value) { addCriterion("time <", value, "time"); return (Criteria) this; }
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=071521182802106aa
https://javayms.pages.dev?id=071521182802106aa