TeacherMapper
package com.zking.ssm.mapper; import com.zking.ssm.model.Teacher; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface TeacherMapper { int deleteByPrimaryKey(Integer tid); int insert(Teacher record); int insertSelective(Teacher record); Teacher selectByPrimaryKey(Integer tid); int updateByPrimaryKeySelective(Teacher record); int updateByPrimaryKey(Teacher record); List<Teacher> queryTeacher(Teacher teacher); }
TeacherMapper.xml
<select id="queryTeacher" resultType="com.zking.ssm.model.Teacher"> select <include refid="Base_Column_List"/> from teacher where 1=1 <if test="null!=tname and '' !=tname"> and tname like concat('%',#{tname},'%') </if> </select><insert id="insert" parameterType="com.zking.ssm.model.Teacher" > insert into teacher ( tname, tjob, tsal) values ( #{tname,jdbcType=VARCHAR}, #{tjob,jdbcType=VARCHAR}, #{tsal,jdbcType=INTEGER}) </insert>
ITeacherService
package com.zking.ssm.service; import com.zking.ssm.model.Teacher; import java.util.List; public interface ITeacherService { int insert(Teacher record); List<Teacher> queryTeacher(Teacher teacher); }
TeacherServiceImpl
package com.zking.ssm.service.impl; import com.zking.ssm.mapper.TeacherMapper; import com.zking.ssm.model.Teacher; import com.zking.ssm.service.ITeacherService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class TeacherServiceImpl implements ITeacherService