Service层(业务层)
package com.ruoyi.system.service;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.domain.SysSchool;
import java.util.List;
/**
* 公告 服务层
*
* @author ruoyi
*/
public interface ISysSchoolService
{
/**
* 查询公告信息
*
* @param sid 公告ID
* @return 公告信息
*/
public SysSchool selectSchoolById(Long sid);
/**
* 查询公告列表
*
* @param school 公告信息
* @return 公告集合
*/
public List<SysSchool> selectSchoolList(SysSchool school);
/**
* 新增公告
*
* @param school 公告信息
* @return 结果
*/
public int insertSchool(SysSchool school);
/**
* 修改公告
*
* @param school 公告信息
* @return 结果
*/
public int updateSchool(SysSchool school);
/**
* 删除公告信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSchoolByIds(String ids);
/**
* 导入用户数据
*
* @param schoolList 用户数据列表
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
* @param operName 操作用户
* @return 结果
*/
public String importSchool(List<SysSchool> schoolList, Boolean isUpdateSupport, String operName);
}
Mapper
package com.ruoyi.system.mapper;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.domain.SysSchool;
import java.util.List;
/**
* 公告 数据层
*
* @author ruoyi
*/
public interface SysSchoolMapper
{
public SysSchool selectSchoolById(Long sid);
public List<SysSchool> selectSchoolList(SysSchool school);
public int insertSchool(SysSchool school);//数据库添加
public int updateSchool(SysSchool school);//数据库修改
public int deleteSchoolByIds(String[] sid);//数据库删除
public SysSchool selectSchoolByLoginName(String sname);//数据库导入
}
Mapper.xml
<?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.ruoyi.system.mapper.SysSchoolMapper">
<resultMap type="SysSchool" id="SysSchoolResult">
<result property="sid" column="sid" />
<result property="sname" column="sname" />
<result property="adress" column="adress" />
<result property="phone" column="phone" />
</resultMap>
<sql id="selectSchoolVo">
select * from sys_school
</sql>
<select id="selectSchoolById" parameterType="Long" resultMap="SysSchoolResult">
<include refid="selectSchoolVo"/>
where sid = #{
sid}
</select>
<select id="selectSchoolList" parameterType="SysSchool" resultMap="SysSchoolResult">
<include refid="selectSchoolVo"/>
<where>
<if test="sname != null and sname != ''">
AND sname like concat('%', #{
sname}, '%')
</if>
</where>
</select>
<insert id="insertSchool" parameterType="SysSchool">
insert into sys_school (
<if test="sname != null and sname != '' ">sname, </if>
<if test="adress != null and adress != '' ">adress, </if>
<if test="phone != null and phone != '' ">phone </if>
)values(
<if test="sname != null and sname != ''">#{
sname},</if>
<if test="adress != null and adress != ''">#{
adress},</if>
<if test="phone != null and phone != ''">#{
phone} </if>
)
</insert>
<update id="updateSchool" parameterType="SysSchool">
update sys_school
<set>
<if test="sname != null and sname != ''">sname = #{
sname} ,</if>
<if test="adress != null and adress != ''">adress = #{
adress