导航,附件,拦截器
This commit is contained in:
parent
3bf4a8e793
commit
7adff734ea
25
src/main/java/com/lovenav/dao/NavDao.java
Normal file
25
src/main/java/com/lovenav/dao/NavDao.java
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package com.lovenav.dao;
|
||||||
|
|
||||||
|
import com.lovenav.entity.Nav;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface NavDao {
|
||||||
|
int deleteByNavName(String navName);
|
||||||
|
|
||||||
|
int insert(Nav record);
|
||||||
|
|
||||||
|
int insertSelective(Nav record);
|
||||||
|
|
||||||
|
Nav selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int updateByName(Nav record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(Nav record);
|
||||||
|
|
||||||
|
Nav selectAlreadyExist(Nav nav);
|
||||||
|
|
||||||
|
List<Nav> selectAllNav();
|
||||||
|
}
|
32
src/main/java/com/lovenav/entity/Nav.java
Normal file
32
src/main/java/com/lovenav/entity/Nav.java
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package com.lovenav.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ln_nav
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Nav implements Serializable {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导航名称
|
||||||
|
*/
|
||||||
|
private String navName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转地址
|
||||||
|
*/
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
85
src/main/resources/mybatis/NavDao.xml
Normal file
85
src/main/resources/mybatis/NavDao.xml
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<?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.lovenav.dao.NavDao">
|
||||||
|
<resultMap id="BaseResultMap" type="com.lovenav.entity.Nav">
|
||||||
|
<id column="id" jdbcType="INTEGER" property="id" />
|
||||||
|
<result column="nav_name" jdbcType="VARCHAR" property="navName" />
|
||||||
|
<result column="url" jdbcType="VARCHAR" property="url" />
|
||||||
|
<result column="status" jdbcType="INTEGER" property="status" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, nav_name, url, `status`
|
||||||
|
</sql>
|
||||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from ln_nav
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</select>
|
||||||
|
<select id="selectAlreadyExist" resultType="com.lovenav.entity.Nav" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from ln_nav
|
||||||
|
where nav_name = #{navName,jdbcType=VARCHAR}
|
||||||
|
</select>
|
||||||
|
<select id="selectAllNav" resultMap="BaseResultMap">
|
||||||
|
select * from ln_nav;
|
||||||
|
</select>
|
||||||
|
<delete id="deleteByNavName" parameterType="java.lang.String">
|
||||||
|
delete from ln_nav
|
||||||
|
where nav_name = #{navName,jdbcType=VARCHAR}
|
||||||
|
</delete>
|
||||||
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.lovenav.entity.Nav" useGeneratedKeys="true">
|
||||||
|
insert into ln_nav (nav_name, url, `status`
|
||||||
|
)
|
||||||
|
values (#{navName,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.lovenav.entity.Nav" useGeneratedKeys="true">
|
||||||
|
insert into ln_nav
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="navName != null">
|
||||||
|
nav_name,
|
||||||
|
</if>
|
||||||
|
<if test="url != null">
|
||||||
|
url,
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
`status`,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="navName != null">
|
||||||
|
#{navName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="url != null">
|
||||||
|
#{url,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
#{status,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="updateByName" parameterType="com.lovenav.entity.Nav">
|
||||||
|
update ln_nav
|
||||||
|
<set>
|
||||||
|
<if test="navName != null">
|
||||||
|
nav_name = #{navName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="url != null">
|
||||||
|
url = #{url,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
`status` = #{status,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where nav_name = #{navName,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKey" parameterType="com.lovenav.entity.Nav">
|
||||||
|
update ln_nav
|
||||||
|
set nav_name = #{navName,jdbcType=VARCHAR},
|
||||||
|
url = #{url,jdbcType=VARCHAR},
|
||||||
|
`status` = #{status,jdbcType=INTEGER}
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue
Block a user