diff --git a/.classpath b/.classpath index 2f69697311bae2e43cbd0eaf9949056ccb0822e3..39cd5e70c89d4a58fdb0ea46a9ee8c487030c05f 100644 --- a/.classpath +++ b/.classpath @@ -1,53 +1,58 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF index d6c414c89267639fc38402ebedd79714a6c560e5..339129f068d56b34253760da9093ec2a763b2661 100644 --- a/META-INF/MANIFEST.MF +++ b/META-INF/MANIFEST.MF @@ -5,7 +5,8 @@ Bundle-SymbolicName: EducationSchedule;singleton:=true Bundle-Version: 1.0.0.qualifier Bundle-Activator: educationschedule.Activator Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime + org.eclipse.core.runtime, + org.eclipse.swt Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Bundle-ClassPath: lib/commons-codec-1.13.jar, @@ -55,4 +56,7 @@ Bundle-ClassPath: lib/commons-codec-1.13.jar, lib/swtgraphics2d.jar, lib/xmlbeans-3.1.0.jar, ., - lib/mysql-connector-java-5.1.49.jar + lib/mysql-connector-java-5.1.49.jar, + lib/shiro-all-1.3.2.jar, + lib/slf4j-api-1.6.1.jar, + lib/slf4j-log4j12-1.6.1.jar diff --git a/build.properties b/build.properties index 43b04b995354677faeb13ab38e46b3affc7d2ddb..5b17300b8cdc092db748105135b9a28f17952cc5 100644 --- a/build.properties +++ b/build.properties @@ -49,5 +49,8 @@ bin.includes = plugin.xml,\ lib/swtgraphics2d.jar,\ lib/xmlbeans-3.1.0.jar,\ plugin_customization.ini,\ - lib/mysql-connector-java-5.1.49.jar + lib/mysql-connector-java-5.1.49.jar,\ + lib/shiro-all-1.3.2.jar,\ + lib/slf4j-api-1.6.1.jar,\ + lib/slf4j-log4j12-1.6.1.jar source.. = src/ diff --git a/lib/shiro-all-1.3.2.jar b/lib/shiro-all-1.3.2.jar new file mode 100644 index 0000000000000000000000000000000000000000..522265a7b63e878913b8295e30a2867ff9170b8c Binary files /dev/null and b/lib/shiro-all-1.3.2.jar differ diff --git a/lib/slf4j-api-1.6.1.jar b/lib/slf4j-api-1.6.1.jar new file mode 100644 index 0000000000000000000000000000000000000000..42e0ad0de7773da9b94b12f503deda7f5a506015 Binary files /dev/null and b/lib/slf4j-api-1.6.1.jar differ diff --git a/lib/slf4j-log4j12-1.6.1.jar b/lib/slf4j-log4j12-1.6.1.jar new file mode 100644 index 0000000000000000000000000000000000000000..873d11983e18b71aeafbc3d805495d6842339812 Binary files /dev/null and b/lib/slf4j-log4j12-1.6.1.jar differ diff --git a/src/cn/edu/hit/education/dao/PermissionMapper.java b/src/cn/edu/hit/education/dao/PermissionMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..d98676b6c1492c965b511895e140c6a8f1801a8c --- /dev/null +++ b/src/cn/edu/hit/education/dao/PermissionMapper.java @@ -0,0 +1,30 @@ +package cn.edu.hit.education.dao; + +import cn.edu.hit.education.pojo.Permission; +import cn.edu.hit.education.pojo.PermissionExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface PermissionMapper { + int countByExample(PermissionExample example); + + int deleteByExample(PermissionExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(Permission record); + + int insertSelective(Permission record); + + List selectByExample(PermissionExample example); + + Permission selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") Permission record, @Param("example") PermissionExample example); + + int updateByExample(@Param("record") Permission record, @Param("example") PermissionExample example); + + int updateByPrimaryKeySelective(Permission record); + + int updateByPrimaryKey(Permission record); +} \ No newline at end of file diff --git a/src/cn/edu/hit/education/dao/RoleMapper.java b/src/cn/edu/hit/education/dao/RoleMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..0438526206f5c359646c988ad1fbcb7a6bf69950 --- /dev/null +++ b/src/cn/edu/hit/education/dao/RoleMapper.java @@ -0,0 +1,30 @@ +package cn.edu.hit.education.dao; + +import cn.edu.hit.education.pojo.Role; +import cn.edu.hit.education.pojo.RoleExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface RoleMapper { + int countByExample(RoleExample example); + + int deleteByExample(RoleExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(Role record); + + int insertSelective(Role record); + + List selectByExample(RoleExample example); + + Role selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") Role record, @Param("example") RoleExample example); + + int updateByExample(@Param("record") Role record, @Param("example") RoleExample example); + + int updateByPrimaryKeySelective(Role record); + + int updateByPrimaryKey(Role record); +} \ No newline at end of file diff --git a/src/cn/edu/hit/education/dao/RolePermissionMapper.java b/src/cn/edu/hit/education/dao/RolePermissionMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..0052f590475eebd689d84c20ad6425d203bd8930 --- /dev/null +++ b/src/cn/edu/hit/education/dao/RolePermissionMapper.java @@ -0,0 +1,36 @@ +package cn.edu.hit.education.dao; + +import cn.edu.hit.education.pojo.RolePermission; +import cn.edu.hit.education.pojo.RolePermissionExample; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +public interface RolePermissionMapper { + int countByExample(RolePermissionExample example); + + int deleteByExample(RolePermissionExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(RolePermission record); + + int insertSelective(RolePermission record); + + List selectByExample(RolePermissionExample example); + + RolePermission selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") RolePermission record, @Param("example") RolePermissionExample example); + + int updateByExample(@Param("record") RolePermission record, @Param("example") RolePermissionExample example); + + int updateByPrimaryKeySelective(RolePermission record); + + int updateByPrimaryKey(RolePermission record); + + @Select("select permissionId from role_permission where roleId=#{id}") + int queryPerIdByRoleId(Integer id); +} \ No newline at end of file diff --git a/src/cn/edu/hit/education/dao/SpecialtyMapper.java b/src/cn/edu/hit/education/dao/SpecialtyMapper.java index f78840a41de9e3963b7675f92393e0822be573c6..6cd0aefa688aef929fa515bed56033d69af3d059 100644 --- a/src/cn/edu/hit/education/dao/SpecialtyMapper.java +++ b/src/cn/edu/hit/education/dao/SpecialtyMapper.java @@ -2,8 +2,11 @@ package cn.edu.hit.education.dao; import cn.edu.hit.education.pojo.Specialty; import cn.edu.hit.education.pojo.SpecialtyExample; + import java.util.List; + import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; public interface SpecialtyMapper { /** @@ -93,4 +96,20 @@ public interface SpecialtyMapper { * @mbggenerated Tue Apr 27 10:55:58 CST 2021 */ int updateByPrimaryKey(Specialty record); + + + + + @Select({ + "" +}) + List queryRelativeSpecialty(@Param("ids")List ids); } \ No newline at end of file diff --git a/src/cn/edu/hit/education/dao/UserMapper.java b/src/cn/edu/hit/education/dao/UserMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..127aff35e450894ec4a6433c25de1794508ccec5 --- /dev/null +++ b/src/cn/edu/hit/education/dao/UserMapper.java @@ -0,0 +1,37 @@ +package cn.edu.hit.education.dao; + +import cn.edu.hit.education.pojo.User; +import cn.edu.hit.education.pojo.UserExample; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +public interface UserMapper { + int countByExample(UserExample example); + + int deleteByExample(UserExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(User record); + + int insertSelective(User record); + + List selectByExample(UserExample example); + + User selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example); + + int updateByExample(@Param("record") User record, @Param("example") UserExample example); + + int updateByPrimaryKeySelective(User record); + + int updateByPrimaryKey(User record); + + @Select("select * from user where username=#{username}") + User queryUserByUsername(String username); + +} \ No newline at end of file diff --git a/src/cn/edu/hit/education/dao/UserRoleMapper.java b/src/cn/edu/hit/education/dao/UserRoleMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..3a2a482279d95dd40673fce24295f25d5e287279 --- /dev/null +++ b/src/cn/edu/hit/education/dao/UserRoleMapper.java @@ -0,0 +1,36 @@ +package cn.edu.hit.education.dao; + +import cn.edu.hit.education.pojo.UserRole; +import cn.edu.hit.education.pojo.UserRoleExample; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +public interface UserRoleMapper { + int countByExample(UserRoleExample example); + + int deleteByExample(UserRoleExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(UserRole record); + + int insertSelective(UserRole record); + + List selectByExample(UserRoleExample example); + + UserRole selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") UserRole record, @Param("example") UserRoleExample example); + + int updateByExample(@Param("record") UserRole record, @Param("example") UserRoleExample example); + + int updateByPrimaryKeySelective(UserRole record); + + int updateByPrimaryKey(UserRole record); + + @Select("select roleId from user_role where userId=#{id}") + int queryRoleIdByUser(Integer id); +} \ No newline at end of file diff --git a/src/cn/edu/hit/education/dao/UserSpecialtyMapper.java b/src/cn/edu/hit/education/dao/UserSpecialtyMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..b5b46e83d431240380543fd754607fbf4c27d6ab --- /dev/null +++ b/src/cn/edu/hit/education/dao/UserSpecialtyMapper.java @@ -0,0 +1,38 @@ +package cn.edu.hit.education.dao; + +import cn.edu.hit.education.pojo.UserSpecialty; +import cn.edu.hit.education.pojo.UserSpecialtyExample; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +public interface UserSpecialtyMapper { + int countByExample(UserSpecialtyExample example); + + int deleteByExample(UserSpecialtyExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(UserSpecialty record); + + int insertSelective(UserSpecialty record); + + List selectByExample(UserSpecialtyExample example); + + UserSpecialty selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") UserSpecialty record, @Param("example") UserSpecialtyExample example); + + int updateByExample(@Param("record") UserSpecialty record, @Param("example") UserSpecialtyExample example); + + int updateByPrimaryKeySelective(UserSpecialty record); + + int updateByPrimaryKey(UserSpecialty record); + + @Select("select specialtyId from user_specialty where userId=#{id}") + List querySpeciatyIdsByUser(Integer id); + + +} \ No newline at end of file diff --git a/src/cn/edu/hit/education/dialog/LoginDialog.java b/src/cn/edu/hit/education/dialog/LoginDialog.java index d67590415d91ae1a4972d90eb05f492ddbd11d42..be1405b3ce5689eef6939d335f1e533d6fdfd470 100644 --- a/src/cn/edu/hit/education/dialog/LoginDialog.java +++ b/src/cn/edu/hit/education/dialog/LoginDialog.java @@ -8,6 +8,14 @@ */ package cn.edu.hit.education.dialog; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authc.AuthenticationException; +import org.apache.shiro.authc.IncorrectCredentialsException; +import org.apache.shiro.authc.LockedAccountException; +import org.apache.shiro.authc.UnknownAccountException; +import org.apache.shiro.authc.UsernamePasswordToken; +import org.apache.shiro.mgt.DefaultSecurityManager; +import org.apache.shiro.subject.Subject; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IMessageProvider; import org.eclipse.jface.dialogs.TitleAreaDialog; @@ -22,9 +30,15 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import cn.edu.hit.education.service.IUserService; +import cn.edu.hit.education.shiro.UserRealm; +import educationschedule.Application; /** * Copyright: Copyright (c) 2018 HIT akeil @@ -40,13 +54,17 @@ import org.eclipse.swt.widgets.Text; * ---------------------------------------------------------* 2018年6月27日 * snow v1.0.0 修改原因 */ + public class LoginDialog extends TitleAreaDialog { private Text textPassword; private Text textUsername; + private IUserService userService = Application.applicationContext + .getBean(IUserService.class); public LoginDialog(Shell parentShell) { super(parentShell); // TODO Auto-generated constructor stub + } @Override @@ -55,24 +73,25 @@ public class LoginDialog extends TitleAreaDialog { super.configureShell(newShell); newShell.setText("登录系统"); } - + @Override protected Control createDialogArea(Composite parent) { // TODO Auto-generated method stub Composite composite = (Composite) super.createDialogArea(parent); // 自定义要创建的内容 - + createContentPane(composite); return composite; } - + private void createContentPane(Composite parent) { Composite composite = new Composite(parent, SWT.NULL); - //gd_composite.widthHint = 174; - composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + // gd_composite.widthHint = 174; + composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, + 1)); // 采用三列的GridLayout Label label_remark; - + composite.setLayout(new FormLayout()); final Label label_name = new Label(composite, SWT.NONE); @@ -89,12 +108,12 @@ public class LoginDialog extends TitleAreaDialog { fd_textUsername.left = new FormAttachment(label_name, 6); fd_textUsername.right = new FormAttachment(100, -38); textUsername.setLayoutData(fd_textUsername); - + textPassword = new Text(composite, SWT.BORDER | SWT.PASSWORD); fd_textUsername.bottom = new FormAttachment(textPassword, -24); textPassword.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { - //cec110f7fd2deb32d36bb868239b0e3c + // cec110f7fd2deb32d36bb868239b0e3c checkValid(); } }); @@ -112,17 +131,16 @@ public class LoginDialog extends TitleAreaDialog { formData_3.top = new FormAttachment(0, 78); label_remark.setLayoutData(formData_3); label_remark.setText("密码"); - + Label label = new Label(composite, SWT.NONE); FormData fd_label = new FormData(); fd_label.top = new FormAttachment(label_name, 33); fd_label.left = new FormAttachment(label_name, 0, SWT.LEFT); label.setLayoutData(fd_label); label.setText("用户密码"); - - + this.setTitle("请输入系统用户名和密码"); - this.setMessage("系统用户名和密码",IMessageProvider.INFORMATION); + this.setMessage("系统用户名和密码", IMessageProvider.INFORMATION); } public Text getText_remark() { @@ -140,14 +158,61 @@ public class LoginDialog extends TitleAreaDialog { public void setText_name(Text text_name) { this.textUsername = text_name; } - - protected void checkValid(){ + + protected void checkValid() { } @Override protected Point getInitialSize() { // TODO 自动生成的方法存根 - return new Point(360,300); + return new Point(360, 300); } + + /** + * 单击OK进行密码认证 + */ + @Override + protected void okPressed() { + // TODO Auto-generated method stub + System.out.println(textUsername.getText()); + try { + userService.login(textUsername.getText(), textPassword.getText()); + super.okPressed(); + } catch (AuthenticationException e) { + // TODO Auto-generated catch block + if (e instanceof UnknownAccountException) { + System.out.println("用户不存在"); + MessageBox messageBox=new MessageBox(super.getShell(),SWT.OK|SWT.ICON_INFORMATION); + messageBox.setText("提示!"); + messageBox.setMessage("用户名不存在!"); + messageBox.open(); + + } else if (e instanceof IncorrectCredentialsException) { + System.out.println("密码不正确"); + MessageBox messageBox=new MessageBox(super.getShell(),SWT.OK|SWT.ICON_INFORMATION); + messageBox.setText("提示!"); + messageBox.setMessage("密码不正确!"); + messageBox.open(); + + } else if (e instanceof LockedAccountException) { + System.out.println("用户账号被锁定"); + MessageBox messageBox=new MessageBox(super.getShell(),SWT.OK|SWT.ICON_INFORMATION); + messageBox.setText("提示!"); + messageBox.setMessage("用户账号被锁定!"); + messageBox.open(); + + } else { + System.out.println("认证失败"); + MessageBox messageBox=new MessageBox(super.getShell(),SWT.OK|SWT.ICON_INFORMATION); + messageBox.setText("提示!"); + messageBox.setMessage("认证失败!"); + messageBox.open(); + } + } + } + + + + } diff --git a/src/cn/edu/hit/education/mapper/PermissionMapper.xml b/src/cn/edu/hit/education/mapper/PermissionMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..b37ec6a8ad5c288af0cf591171dfcda8eb026e01 --- /dev/null +++ b/src/cn/edu/hit/education/mapper/PermissionMapper.xml @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, permission, description + + + + + delete from permission + where id = #{id,jdbcType=INTEGER} + + + delete from permission + + + + + + insert into permission (id, permission, description, + roleId) + values (#{id,jdbcType=INTEGER}, #{permission,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, + #{roleid,jdbcType=VARCHAR}) + + + insert into permission + + + id, + + + permission, + + + description, + + + roleId, + + + + + #{id,jdbcType=INTEGER}, + + + #{permission,jdbcType=VARCHAR}, + + + #{description,jdbcType=VARCHAR}, + + + + + + + update permission + + + id = #{record.id,jdbcType=INTEGER}, + + + permission = #{record.permission,jdbcType=VARCHAR}, + + + description = #{record.description,jdbcType=VARCHAR}, + + + roleId = #{record.roleid,jdbcType=VARCHAR}, + + + + + + + + update permission + set id = #{record.id,jdbcType=INTEGER}, + permission = #{record.permission,jdbcType=VARCHAR}, + description = #{record.description,jdbcType=VARCHAR}, + roleId = #{record.roleid,jdbcType=VARCHAR} + + + + + + update permission + + + permission = #{permission,jdbcType=VARCHAR}, + + + description = #{description,jdbcType=VARCHAR}, + + + roleId = #{roleid,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update permission + set permission = #{permission,jdbcType=VARCHAR}, + description = #{description,jdbcType=VARCHAR}, + roleId = #{roleid,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/src/cn/edu/hit/education/mapper/RoleMapper.xml b/src/cn/edu/hit/education/mapper/RoleMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..58cde2f47c10efc08e445ffde4580459c2e34a47 --- /dev/null +++ b/src/cn/edu/hit/education/mapper/RoleMapper.xml @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, role, description, parentId + + + + + delete from role + where id = #{id,jdbcType=INTEGER} + + + delete from role + + + + + + insert into role (id, role, description, + parentId) + values (#{id,jdbcType=INTEGER}, #{role,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, + #{parentid,jdbcType=BIGINT}) + + + insert into role + + + id, + + + role, + + + description, + + + parentId, + + + + + #{id,jdbcType=INTEGER}, + + + #{role,jdbcType=VARCHAR}, + + + #{description,jdbcType=VARCHAR}, + + + #{parentid,jdbcType=BIGINT}, + + + + + + update role + + + id = #{record.id,jdbcType=INTEGER}, + + + role = #{record.role,jdbcType=VARCHAR}, + + + description = #{record.description,jdbcType=VARCHAR}, + + + parentId = #{record.parentid,jdbcType=BIGINT}, + + + + + + + + update role + set id = #{record.id,jdbcType=INTEGER}, + role = #{record.role,jdbcType=VARCHAR}, + description = #{record.description,jdbcType=VARCHAR}, + parentId = #{record.parentid,jdbcType=BIGINT} + + + + + + update role + + + role = #{role,jdbcType=VARCHAR}, + + + description = #{description,jdbcType=VARCHAR}, + + + parentId = #{parentid,jdbcType=BIGINT}, + + + where id = #{id,jdbcType=INTEGER} + + + update role + set role = #{role,jdbcType=VARCHAR}, + description = #{description,jdbcType=VARCHAR}, + parentId = #{parentid,jdbcType=BIGINT} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/src/cn/edu/hit/education/mapper/RolePermissionMapper.xml b/src/cn/edu/hit/education/mapper/RolePermissionMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..d67670fdc9da835c8cce9e5d948eecf343bdac0d --- /dev/null +++ b/src/cn/edu/hit/education/mapper/RolePermissionMapper.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, roleId, permissionId + + + + + delete from role_permission + where id = #{id,jdbcType=INTEGER} + + + delete from role_permission + + + + + + insert into role_permission (id, roleId, permissionId + ) + values (#{id,jdbcType=INTEGER}, #{roleid,jdbcType=BIGINT}, #{permissionid,jdbcType=BIGINT} + ) + + + insert into role_permission + + + id, + + + roleId, + + + permissionId, + + + + + #{id,jdbcType=INTEGER}, + + + #{roleid,jdbcType=BIGINT}, + + + #{permissionid,jdbcType=BIGINT}, + + + + + + update role_permission + + + id = #{record.id,jdbcType=INTEGER}, + + + roleId = #{record.roleid,jdbcType=BIGINT}, + + + permissionId = #{record.permissionid,jdbcType=BIGINT}, + + + + + + + + update role_permission + set id = #{record.id,jdbcType=INTEGER}, + roleId = #{record.roleid,jdbcType=BIGINT}, + permissionId = #{record.permissionid,jdbcType=BIGINT} + + + + + + update role_permission + + + roleId = #{roleid,jdbcType=BIGINT}, + + + permissionId = #{permissionid,jdbcType=BIGINT}, + + + where id = #{id,jdbcType=INTEGER} + + + update role_permission + set roleId = #{roleid,jdbcType=BIGINT}, + permissionId = #{permissionid,jdbcType=BIGINT} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/src/cn/edu/hit/education/mapper/UserMapper.xml b/src/cn/edu/hit/education/mapper/UserMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..dd0dc51df5a5e1e0627e570f34134c8ffa08c7dc --- /dev/null +++ b/src/cn/edu/hit/education/mapper/UserMapper.xml @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, username, password, salt, roleId + + + + + + delete from user + where id = #{id,jdbcType=INTEGER} + + + delete from user + + + + + + insert into user (id, username, password, + salt, roleId) + values (#{id,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, + #{salt,jdbcType=VARCHAR}, #{roleid,jdbcType=VARCHAR}) + + + insert into user + + + id, + + + username, + + + password, + + + salt, + + + roleId, + + + + + #{id,jdbcType=INTEGER}, + + + #{username,jdbcType=VARCHAR}, + + + #{password,jdbcType=VARCHAR}, + + + #{salt,jdbcType=VARCHAR}, + + + #{roleid,jdbcType=VARCHAR}, + + + + + + update user + + + id = #{record.id,jdbcType=INTEGER}, + + + username = #{record.username,jdbcType=VARCHAR}, + + + password = #{record.password,jdbcType=VARCHAR}, + + + salt = #{record.salt,jdbcType=VARCHAR}, + + + roleId = #{record.roleid,jdbcType=VARCHAR}, + + + + + + + + update user + set id = #{record.id,jdbcType=INTEGER}, + username = #{record.username,jdbcType=VARCHAR}, + password = #{record.password,jdbcType=VARCHAR}, + salt = #{record.salt,jdbcType=VARCHAR}, + roleId = #{record.roleid,jdbcType=VARCHAR} + + + + + + update user + + + username = #{username,jdbcType=VARCHAR}, + + + password = #{password,jdbcType=VARCHAR}, + + + salt = #{salt,jdbcType=VARCHAR}, + + + roleId = #{roleid,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update user + set username = #{username,jdbcType=VARCHAR}, + password = #{password,jdbcType=VARCHAR}, + salt = #{salt,jdbcType=VARCHAR}, + roleId = #{roleid,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/src/cn/edu/hit/education/mapper/UserRoleMapper.xml b/src/cn/edu/hit/education/mapper/UserRoleMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..a9264b86b738b79975cebc30c74ad1f90392ac4d --- /dev/null +++ b/src/cn/edu/hit/education/mapper/UserRoleMapper.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, userId, roleId + + + + + delete from user_role + where id = #{id,jdbcType=INTEGER} + + + delete from user_role + + + + + + insert into user_role (id, userId, roleId + ) + values (#{id,jdbcType=INTEGER}, #{userid,jdbcType=BIGINT}, #{roleid,jdbcType=BIGINT} + ) + + + insert into user_role + + + id, + + + userId, + + + roleId, + + + + + #{id,jdbcType=INTEGER}, + + + #{userid,jdbcType=BIGINT}, + + + #{roleid,jdbcType=BIGINT}, + + + + + + update user_role + + + id = #{record.id,jdbcType=INTEGER}, + + + userId = #{record.userid,jdbcType=BIGINT}, + + + roleId = #{record.roleid,jdbcType=BIGINT}, + + + + + + + + update user_role + set id = #{record.id,jdbcType=INTEGER}, + userId = #{record.userid,jdbcType=BIGINT}, + roleId = #{record.roleid,jdbcType=BIGINT} + + + + + + update user_role + + + userId = #{userid,jdbcType=BIGINT}, + + + roleId = #{roleid,jdbcType=BIGINT}, + + + where id = #{id,jdbcType=INTEGER} + + + update user_role + set userId = #{userid,jdbcType=BIGINT}, + roleId = #{roleid,jdbcType=BIGINT} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/src/cn/edu/hit/education/mapper/UserSpecialtyMapper.xml b/src/cn/edu/hit/education/mapper/UserSpecialtyMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..596fde0fb6138e715433bce310696bb6574bd8ed --- /dev/null +++ b/src/cn/edu/hit/education/mapper/UserSpecialtyMapper.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, userId, specialtyId + + + + + delete from user_specialty + where id = #{id,jdbcType=INTEGER} + + + delete from user_specialty + + + + + + insert into user_specialty (id, userId, specialtyId + ) + values (#{id,jdbcType=INTEGER}, #{userid,jdbcType=BIGINT}, #{specialtyid,jdbcType=BIGINT} + ) + + + insert into user_specialty + + + id, + + + userId, + + + specialtyId, + + + + + #{id,jdbcType=INTEGER}, + + + #{userid,jdbcType=BIGINT}, + + + #{specialtyid,jdbcType=BIGINT}, + + + + + + update user_specialty + + + id = #{record.id,jdbcType=INTEGER}, + + + userId = #{record.userid,jdbcType=BIGINT}, + + + specialtyId = #{record.specialtyid,jdbcType=BIGINT}, + + + + + + + + update user_specialty + set id = #{record.id,jdbcType=INTEGER}, + userId = #{record.userid,jdbcType=BIGINT}, + specialtyId = #{record.specialtyid,jdbcType=BIGINT} + + + + + + update user_specialty + + + userId = #{userid,jdbcType=BIGINT}, + + + specialtyId = #{specialtyid,jdbcType=BIGINT}, + + + where id = #{id,jdbcType=INTEGER} + + + update user_specialty + set userId = #{userid,jdbcType=BIGINT}, + specialtyId = #{specialtyid,jdbcType=BIGINT} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/src/cn/edu/hit/education/model/CourseRootNode.java b/src/cn/edu/hit/education/model/CourseRootNode.java index 9c392db30308400a110e67be889fb0cd959e6b0d..3516a7995dae93a66e2f8129388091bc093c627d 100644 --- a/src/cn/edu/hit/education/model/CourseRootNode.java +++ b/src/cn/edu/hit/education/model/CourseRootNode.java @@ -1,65 +1,128 @@ package cn.edu.hit.education.model; import java.util.List; +import java.util.stream.Collectors; + +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.subject.Subject; import cn.edu.hit.education.pojo.Course; import cn.edu.hit.education.pojo.Process; import cn.edu.hit.education.pojo.Property; +import cn.edu.hit.education.pojo.Specialty; import cn.edu.hit.education.pojo.University; +import cn.edu.hit.education.pojo.User; import cn.edu.hit.education.service.ICourseService; import cn.edu.hit.education.service.IProcessService; import cn.edu.hit.education.service.IPropertyService; +import cn.edu.hit.education.service.ISpecialtyService; import cn.edu.hit.education.service.IUniversityService; +import cn.edu.hit.education.service.IUserSpeciatyService; +import cn.edu.hit.education.service.SpecialtyServiceImpl; import educationschedule.Application; public class CourseRootNode extends Node { - IProcessService processService = (IProcessService)Application.applicationContext.getBean("processServiceImpl"); - IPropertyService propertyService = (IPropertyService)Application.applicationContext.getBean("propertyServiceImpl"); - IUniversityService universityService = (IUniversityService)Application.applicationContext.getBean("universityServiceImpl"); - ICourseService courseService = (ICourseService)Application.applicationContext.getBean("courseServiceImpl"); - + + IProcessService processService = (IProcessService) Application.applicationContext + .getBean("processServiceImpl"); + IPropertyService propertyService = (IPropertyService) Application.applicationContext + .getBean("propertyServiceImpl"); + IUniversityService universityService = (IUniversityService) Application.applicationContext + .getBean("universityServiceImpl"); + ICourseService courseService = (ICourseService) Application.applicationContext + .getBean("courseServiceImpl"); + + static ISpecialtyService specialtyService = (ISpecialtyService) Application.applicationContext + .getBean(SpecialtyServiceImpl.class); + static IUserSpeciatyService userSpeciatyService = (IUserSpeciatyService) Application.applicationContext + .getBean("userSpeciatyServiceImpl"); + private static CourseRootNode root = null; + private static List specialties; + private CourseRootNode() { } public static synchronized CourseRootNode getRootNode() { if (root == null) { root = new CourseRootNode(); + initSpecialties(); root.setParent(null); - root.initRootNode(1); + root.initRootNode(getSpecialtiesIds()); } return root; + + } + + private static void initSpecialties() { + Subject subject = SecurityUtils.getSubject(); + // 角色是校长,可查看表中所有专业对应的课程信息 + if (subject.hasRole("principal")) { + specialties = specialtyService.queryAllSpecialty(); + // 角色是院长,专业初始化为本学院下的所有专业! + } else if (subject.hasRole("president")) { + User user = (User) subject.getPrincipal(); + // 根据院长的用户Id查询到关联的专业Id + List ids = userSpeciatyService.querySpeciatyIdsByUser(user + .getId()); + specialties = specialtyService.queryRelativeSpecialty(ids); + } else if (subject.hasRole("director")) { + User user = (User) subject.getPrincipal(); + // 根据普通用户的用户Id查询到关联的专业Id + List ids = userSpeciatyService.querySpeciatyIdsByUser(user + .getId()); + specialties = specialtyService.queryRelativeSpecialty(ids); + } + } - private void initRootNode(int specialtyId) { + private static List getSpecialtiesIds() { + + // 获取当前可查看专业的Id + List specityIds = specialties.stream().map(item -> { + return item.getId(); + }).collect(Collectors.toList()); + return specityIds; + } + + private void initRootNode(List specialtiesIds) { List universities = universityService.queryAllUniversity(); List processes = processService.queryAllProcess(); - if(processes != null && processes.size() > 0){ + if (processes != null && processes.size() > 0) { for (Process process : processes) { - ProcessNode processNode = new ProcessNode(process.getId(),process.getName()); + ProcessNode processNode = new ProcessNode(process.getId(), + process.getName()); root.addChild(processNode); - - List properties = propertyService.queryPropertiesByProcessId(process.getId()); - if(properties != null && properties.size() > 0){ + + List properties = propertyService + .queryPropertiesByProcessId(process.getId()); + if (properties != null && properties.size() > 0) { for (Property property : properties) { - PropertyNode propertyNode = new PropertyNode(property.getId(),property.getName()); + PropertyNode propertyNode = new PropertyNode( + property.getId(), property.getName()); processNode.addChild(propertyNode); + + List courses = courseService + .queryCoursesByPropertyId(property.getId()); - List courses = courseService.queryCoursesBySpecialtyPropertyId(specialtyId, property.getId()); - - if(courses != null && courses.size() > 0){ + courses = courses.stream().filter(item->{ + return specialtiesIds.contains(item.getSpecialtyId()); + }).collect(Collectors.toList()); + + if (courses != null && courses.size() > 0) { for (Course course : courses) { - CourseNode courseNode = new CourseNode(course.getId(),course.getName()); + CourseNode courseNode = new CourseNode( + course.getId(), course.getName()); propertyNode.addChild(courseNode); } } } } - + } } - + System.out.println(universities); } } diff --git a/src/cn/edu/hit/education/pojo/Permission.java b/src/cn/edu/hit/education/pojo/Permission.java new file mode 100644 index 0000000000000000000000000000000000000000..3643ae3e9df9133393951a3af65dabce503c14e0 --- /dev/null +++ b/src/cn/edu/hit/education/pojo/Permission.java @@ -0,0 +1,36 @@ +package cn.edu.hit.education.pojo; + +public class Permission { + private Integer id; + + private String permission; + + private String description; + + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getPermission() { + return permission; + } + + public void setPermission(String permission) { + this.permission = permission == null ? null : permission.trim(); + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description == null ? null : description.trim(); + } + +} \ No newline at end of file diff --git a/src/cn/edu/hit/education/pojo/PermissionExample.java b/src/cn/edu/hit/education/pojo/PermissionExample.java new file mode 100644 index 0000000000000000000000000000000000000000..137174150c3bfe3ebc9614c2b3e8adff2177bf7e --- /dev/null +++ b/src/cn/edu/hit/education/pojo/PermissionExample.java @@ -0,0 +1,470 @@ +package cn.edu.hit.education.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class PermissionExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public PermissionExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List 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; + } + + 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 values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List 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; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andPermissionIsNull() { + addCriterion("permission is null"); + return (Criteria) this; + } + + public Criteria andPermissionIsNotNull() { + addCriterion("permission is not null"); + return (Criteria) this; + } + + public Criteria andPermissionEqualTo(String value) { + addCriterion("permission =", value, "permission"); + return (Criteria) this; + } + + public Criteria andPermissionNotEqualTo(String value) { + addCriterion("permission <>", value, "permission"); + return (Criteria) this; + } + + public Criteria andPermissionGreaterThan(String value) { + addCriterion("permission >", value, "permission"); + return (Criteria) this; + } + + public Criteria andPermissionGreaterThanOrEqualTo(String value) { + addCriterion("permission >=", value, "permission"); + return (Criteria) this; + } + + public Criteria andPermissionLessThan(String value) { + addCriterion("permission <", value, "permission"); + return (Criteria) this; + } + + public Criteria andPermissionLessThanOrEqualTo(String value) { + addCriterion("permission <=", value, "permission"); + return (Criteria) this; + } + + public Criteria andPermissionLike(String value) { + addCriterion("permission like", value, "permission"); + return (Criteria) this; + } + + public Criteria andPermissionNotLike(String value) { + addCriterion("permission not like", value, "permission"); + return (Criteria) this; + } + + public Criteria andPermissionIn(List values) { + addCriterion("permission in", values, "permission"); + return (Criteria) this; + } + + public Criteria andPermissionNotIn(List values) { + addCriterion("permission not in", values, "permission"); + return (Criteria) this; + } + + public Criteria andPermissionBetween(String value1, String value2) { + addCriterion("permission between", value1, value2, "permission"); + return (Criteria) this; + } + + public Criteria andPermissionNotBetween(String value1, String value2) { + addCriterion("permission not between", value1, value2, "permission"); + return (Criteria) this; + } + + public Criteria andDescriptionIsNull() { + addCriterion("description is null"); + return (Criteria) this; + } + + public Criteria andDescriptionIsNotNull() { + addCriterion("description is not null"); + return (Criteria) this; + } + + public Criteria andDescriptionEqualTo(String value) { + addCriterion("description =", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionNotEqualTo(String value) { + addCriterion("description <>", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionGreaterThan(String value) { + addCriterion("description >", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionGreaterThanOrEqualTo(String value) { + addCriterion("description >=", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionLessThan(String value) { + addCriterion("description <", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionLessThanOrEqualTo(String value) { + addCriterion("description <=", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionLike(String value) { + addCriterion("description like", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionNotLike(String value) { + addCriterion("description not like", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionIn(List values) { + addCriterion("description in", values, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionNotIn(List values) { + addCriterion("description not in", values, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionBetween(String value1, String value2) { + addCriterion("description between", value1, value2, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionNotBetween(String value1, String value2) { + addCriterion("description not between", value1, value2, "description"); + return (Criteria) this; + } + + public Criteria andRoleidIsNull() { + addCriterion("roleId is null"); + return (Criteria) this; + } + + public Criteria andRoleidIsNotNull() { + addCriterion("roleId is not null"); + return (Criteria) this; + } + + public Criteria andRoleidEqualTo(String value) { + addCriterion("roleId =", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidNotEqualTo(String value) { + addCriterion("roleId <>", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidGreaterThan(String value) { + addCriterion("roleId >", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidGreaterThanOrEqualTo(String value) { + addCriterion("roleId >=", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidLessThan(String value) { + addCriterion("roleId <", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidLessThanOrEqualTo(String value) { + addCriterion("roleId <=", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidLike(String value) { + addCriterion("roleId like", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidNotLike(String value) { + addCriterion("roleId not like", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidIn(List values) { + addCriterion("roleId in", values, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidNotIn(List values) { + addCriterion("roleId not in", values, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidBetween(String value1, String value2) { + addCriterion("roleId between", value1, value2, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidNotBetween(String value1, String value2) { + addCriterion("roleId not between", value1, value2, "roleid"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/cn/edu/hit/education/pojo/Role.java b/src/cn/edu/hit/education/pojo/Role.java new file mode 100644 index 0000000000000000000000000000000000000000..b20417d71f5a1d22ba33c0069934e9c107636491 --- /dev/null +++ b/src/cn/edu/hit/education/pojo/Role.java @@ -0,0 +1,43 @@ +package cn.edu.hit.education.pojo; + +public class Role { + private Integer id; + + private String role; + + private String description; + + private Long parentid; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role == null ? null : role.trim(); + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description == null ? null : description.trim(); + } + + public Long getParentid() { + return parentid; + } + + public void setParentid(Long parentid) { + this.parentid = parentid; + } +} \ No newline at end of file diff --git a/src/cn/edu/hit/education/pojo/RoleExample.java b/src/cn/edu/hit/education/pojo/RoleExample.java new file mode 100644 index 0000000000000000000000000000000000000000..f38027c5a9caec8430291d736c758a61d3ffd240 --- /dev/null +++ b/src/cn/edu/hit/education/pojo/RoleExample.java @@ -0,0 +1,460 @@ +package cn.edu.hit.education.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class RoleExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public RoleExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List 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; + } + + 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 values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List 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; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andRoleIsNull() { + addCriterion("role is null"); + return (Criteria) this; + } + + public Criteria andRoleIsNotNull() { + addCriterion("role is not null"); + return (Criteria) this; + } + + public Criteria andRoleEqualTo(String value) { + addCriterion("role =", value, "role"); + return (Criteria) this; + } + + public Criteria andRoleNotEqualTo(String value) { + addCriterion("role <>", value, "role"); + return (Criteria) this; + } + + public Criteria andRoleGreaterThan(String value) { + addCriterion("role >", value, "role"); + return (Criteria) this; + } + + public Criteria andRoleGreaterThanOrEqualTo(String value) { + addCriterion("role >=", value, "role"); + return (Criteria) this; + } + + public Criteria andRoleLessThan(String value) { + addCriterion("role <", value, "role"); + return (Criteria) this; + } + + public Criteria andRoleLessThanOrEqualTo(String value) { + addCriterion("role <=", value, "role"); + return (Criteria) this; + } + + public Criteria andRoleLike(String value) { + addCriterion("role like", value, "role"); + return (Criteria) this; + } + + public Criteria andRoleNotLike(String value) { + addCriterion("role not like", value, "role"); + return (Criteria) this; + } + + public Criteria andRoleIn(List values) { + addCriterion("role in", values, "role"); + return (Criteria) this; + } + + public Criteria andRoleNotIn(List values) { + addCriterion("role not in", values, "role"); + return (Criteria) this; + } + + public Criteria andRoleBetween(String value1, String value2) { + addCriterion("role between", value1, value2, "role"); + return (Criteria) this; + } + + public Criteria andRoleNotBetween(String value1, String value2) { + addCriterion("role not between", value1, value2, "role"); + return (Criteria) this; + } + + public Criteria andDescriptionIsNull() { + addCriterion("description is null"); + return (Criteria) this; + } + + public Criteria andDescriptionIsNotNull() { + addCriterion("description is not null"); + return (Criteria) this; + } + + public Criteria andDescriptionEqualTo(String value) { + addCriterion("description =", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionNotEqualTo(String value) { + addCriterion("description <>", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionGreaterThan(String value) { + addCriterion("description >", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionGreaterThanOrEqualTo(String value) { + addCriterion("description >=", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionLessThan(String value) { + addCriterion("description <", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionLessThanOrEqualTo(String value) { + addCriterion("description <=", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionLike(String value) { + addCriterion("description like", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionNotLike(String value) { + addCriterion("description not like", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionIn(List values) { + addCriterion("description in", values, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionNotIn(List values) { + addCriterion("description not in", values, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionBetween(String value1, String value2) { + addCriterion("description between", value1, value2, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionNotBetween(String value1, String value2) { + addCriterion("description not between", value1, value2, "description"); + return (Criteria) this; + } + + public Criteria andParentidIsNull() { + addCriterion("parentId is null"); + return (Criteria) this; + } + + public Criteria andParentidIsNotNull() { + addCriterion("parentId is not null"); + return (Criteria) this; + } + + public Criteria andParentidEqualTo(Long value) { + addCriterion("parentId =", value, "parentid"); + return (Criteria) this; + } + + public Criteria andParentidNotEqualTo(Long value) { + addCriterion("parentId <>", value, "parentid"); + return (Criteria) this; + } + + public Criteria andParentidGreaterThan(Long value) { + addCriterion("parentId >", value, "parentid"); + return (Criteria) this; + } + + public Criteria andParentidGreaterThanOrEqualTo(Long value) { + addCriterion("parentId >=", value, "parentid"); + return (Criteria) this; + } + + public Criteria andParentidLessThan(Long value) { + addCriterion("parentId <", value, "parentid"); + return (Criteria) this; + } + + public Criteria andParentidLessThanOrEqualTo(Long value) { + addCriterion("parentId <=", value, "parentid"); + return (Criteria) this; + } + + public Criteria andParentidIn(List values) { + addCriterion("parentId in", values, "parentid"); + return (Criteria) this; + } + + public Criteria andParentidNotIn(List values) { + addCriterion("parentId not in", values, "parentid"); + return (Criteria) this; + } + + public Criteria andParentidBetween(Long value1, Long value2) { + addCriterion("parentId between", value1, value2, "parentid"); + return (Criteria) this; + } + + public Criteria andParentidNotBetween(Long value1, Long value2) { + addCriterion("parentId not between", value1, value2, "parentid"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/cn/edu/hit/education/pojo/RolePermission.java b/src/cn/edu/hit/education/pojo/RolePermission.java new file mode 100644 index 0000000000000000000000000000000000000000..f67cc11c86cbf76cdefaa1625dbd31fbe6f3a162 --- /dev/null +++ b/src/cn/edu/hit/education/pojo/RolePermission.java @@ -0,0 +1,33 @@ +package cn.edu.hit.education.pojo; + +public class RolePermission { + private Integer id; + + private Long roleid; + + private Long permissionid; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Long getRoleid() { + return roleid; + } + + public void setRoleid(Long roleid) { + this.roleid = roleid; + } + + public Long getPermissionid() { + return permissionid; + } + + public void setPermissionid(Long permissionid) { + this.permissionid = permissionid; + } +} \ No newline at end of file diff --git a/src/cn/edu/hit/education/pojo/RolePermissionExample.java b/src/cn/edu/hit/education/pojo/RolePermissionExample.java new file mode 100644 index 0000000000000000000000000000000000000000..f02fe89fa6b0ebe92212a761c87835352096b017 --- /dev/null +++ b/src/cn/edu/hit/education/pojo/RolePermissionExample.java @@ -0,0 +1,380 @@ +package cn.edu.hit.education.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class RolePermissionExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public RolePermissionExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List 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; + } + + 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 values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List 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; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andRoleidIsNull() { + addCriterion("roleId is null"); + return (Criteria) this; + } + + public Criteria andRoleidIsNotNull() { + addCriterion("roleId is not null"); + return (Criteria) this; + } + + public Criteria andRoleidEqualTo(Long value) { + addCriterion("roleId =", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidNotEqualTo(Long value) { + addCriterion("roleId <>", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidGreaterThan(Long value) { + addCriterion("roleId >", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidGreaterThanOrEqualTo(Long value) { + addCriterion("roleId >=", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidLessThan(Long value) { + addCriterion("roleId <", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidLessThanOrEqualTo(Long value) { + addCriterion("roleId <=", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidIn(List values) { + addCriterion("roleId in", values, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidNotIn(List values) { + addCriterion("roleId not in", values, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidBetween(Long value1, Long value2) { + addCriterion("roleId between", value1, value2, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidNotBetween(Long value1, Long value2) { + addCriterion("roleId not between", value1, value2, "roleid"); + return (Criteria) this; + } + + public Criteria andPermissionidIsNull() { + addCriterion("permissionId is null"); + return (Criteria) this; + } + + public Criteria andPermissionidIsNotNull() { + addCriterion("permissionId is not null"); + return (Criteria) this; + } + + public Criteria andPermissionidEqualTo(Long value) { + addCriterion("permissionId =", value, "permissionid"); + return (Criteria) this; + } + + public Criteria andPermissionidNotEqualTo(Long value) { + addCriterion("permissionId <>", value, "permissionid"); + return (Criteria) this; + } + + public Criteria andPermissionidGreaterThan(Long value) { + addCriterion("permissionId >", value, "permissionid"); + return (Criteria) this; + } + + public Criteria andPermissionidGreaterThanOrEqualTo(Long value) { + addCriterion("permissionId >=", value, "permissionid"); + return (Criteria) this; + } + + public Criteria andPermissionidLessThan(Long value) { + addCriterion("permissionId <", value, "permissionid"); + return (Criteria) this; + } + + public Criteria andPermissionidLessThanOrEqualTo(Long value) { + addCriterion("permissionId <=", value, "permissionid"); + return (Criteria) this; + } + + public Criteria andPermissionidIn(List values) { + addCriterion("permissionId in", values, "permissionid"); + return (Criteria) this; + } + + public Criteria andPermissionidNotIn(List values) { + addCriterion("permissionId not in", values, "permissionid"); + return (Criteria) this; + } + + public Criteria andPermissionidBetween(Long value1, Long value2) { + addCriterion("permissionId between", value1, value2, "permissionid"); + return (Criteria) this; + } + + public Criteria andPermissionidNotBetween(Long value1, Long value2) { + addCriterion("permissionId not between", value1, value2, "permissionid"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/cn/edu/hit/education/pojo/User.java b/src/cn/edu/hit/education/pojo/User.java new file mode 100644 index 0000000000000000000000000000000000000000..c1daf867f961012fdecacbb881b417a9964307d1 --- /dev/null +++ b/src/cn/edu/hit/education/pojo/User.java @@ -0,0 +1,53 @@ +package cn.edu.hit.education.pojo; + +public class User { + private Integer id; + + private String username; + + private String password; + + private String salt; + + private String roleid; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username == null ? null : username.trim(); + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password == null ? null : password.trim(); + } + + public String getSalt() { + return salt; + } + + public void setSalt(String salt) { + this.salt = salt == null ? null : salt.trim(); + } + + public String getRoleid() { + return roleid; + } + + public void setRoleid(String roleid) { + this.roleid = roleid == null ? null : roleid.trim(); + } +} \ No newline at end of file diff --git a/src/cn/edu/hit/education/pojo/UserExample.java b/src/cn/edu/hit/education/pojo/UserExample.java new file mode 100644 index 0000000000000000000000000000000000000000..7fa28202b0e03e47b5516da6edbaf028f52a66d7 --- /dev/null +++ b/src/cn/edu/hit/education/pojo/UserExample.java @@ -0,0 +1,540 @@ +package cn.edu.hit.education.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class UserExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public UserExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List 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; + } + + 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 values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List 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; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andUsernameIsNull() { + addCriterion("username is null"); + return (Criteria) this; + } + + public Criteria andUsernameIsNotNull() { + addCriterion("username is not null"); + return (Criteria) this; + } + + public Criteria andUsernameEqualTo(String value) { + addCriterion("username =", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameNotEqualTo(String value) { + addCriterion("username <>", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameGreaterThan(String value) { + addCriterion("username >", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameGreaterThanOrEqualTo(String value) { + addCriterion("username >=", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameLessThan(String value) { + addCriterion("username <", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameLessThanOrEqualTo(String value) { + addCriterion("username <=", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameLike(String value) { + addCriterion("username like", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameNotLike(String value) { + addCriterion("username not like", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameIn(List values) { + addCriterion("username in", values, "username"); + return (Criteria) this; + } + + public Criteria andUsernameNotIn(List values) { + addCriterion("username not in", values, "username"); + return (Criteria) this; + } + + public Criteria andUsernameBetween(String value1, String value2) { + addCriterion("username between", value1, value2, "username"); + return (Criteria) this; + } + + public Criteria andUsernameNotBetween(String value1, String value2) { + addCriterion("username not between", value1, value2, "username"); + return (Criteria) this; + } + + public Criteria andPasswordIsNull() { + addCriterion("password is null"); + return (Criteria) this; + } + + public Criteria andPasswordIsNotNull() { + addCriterion("password is not null"); + return (Criteria) this; + } + + public Criteria andPasswordEqualTo(String value) { + addCriterion("password =", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordNotEqualTo(String value) { + addCriterion("password <>", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordGreaterThan(String value) { + addCriterion("password >", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordGreaterThanOrEqualTo(String value) { + addCriterion("password >=", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordLessThan(String value) { + addCriterion("password <", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordLessThanOrEqualTo(String value) { + addCriterion("password <=", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordLike(String value) { + addCriterion("password like", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordNotLike(String value) { + addCriterion("password not like", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordIn(List values) { + addCriterion("password in", values, "password"); + return (Criteria) this; + } + + public Criteria andPasswordNotIn(List values) { + addCriterion("password not in", values, "password"); + return (Criteria) this; + } + + public Criteria andPasswordBetween(String value1, String value2) { + addCriterion("password between", value1, value2, "password"); + return (Criteria) this; + } + + public Criteria andPasswordNotBetween(String value1, String value2) { + addCriterion("password not between", value1, value2, "password"); + return (Criteria) this; + } + + public Criteria andSaltIsNull() { + addCriterion("salt is null"); + return (Criteria) this; + } + + public Criteria andSaltIsNotNull() { + addCriterion("salt is not null"); + return (Criteria) this; + } + + public Criteria andSaltEqualTo(String value) { + addCriterion("salt =", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltNotEqualTo(String value) { + addCriterion("salt <>", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltGreaterThan(String value) { + addCriterion("salt >", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltGreaterThanOrEqualTo(String value) { + addCriterion("salt >=", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltLessThan(String value) { + addCriterion("salt <", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltLessThanOrEqualTo(String value) { + addCriterion("salt <=", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltLike(String value) { + addCriterion("salt like", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltNotLike(String value) { + addCriterion("salt not like", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltIn(List values) { + addCriterion("salt in", values, "salt"); + return (Criteria) this; + } + + public Criteria andSaltNotIn(List values) { + addCriterion("salt not in", values, "salt"); + return (Criteria) this; + } + + public Criteria andSaltBetween(String value1, String value2) { + addCriterion("salt between", value1, value2, "salt"); + return (Criteria) this; + } + + public Criteria andSaltNotBetween(String value1, String value2) { + addCriterion("salt not between", value1, value2, "salt"); + return (Criteria) this; + } + + public Criteria andRoleidIsNull() { + addCriterion("roleId is null"); + return (Criteria) this; + } + + public Criteria andRoleidIsNotNull() { + addCriterion("roleId is not null"); + return (Criteria) this; + } + + public Criteria andRoleidEqualTo(String value) { + addCriterion("roleId =", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidNotEqualTo(String value) { + addCriterion("roleId <>", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidGreaterThan(String value) { + addCriterion("roleId >", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidGreaterThanOrEqualTo(String value) { + addCriterion("roleId >=", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidLessThan(String value) { + addCriterion("roleId <", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidLessThanOrEqualTo(String value) { + addCriterion("roleId <=", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidLike(String value) { + addCriterion("roleId like", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidNotLike(String value) { + addCriterion("roleId not like", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidIn(List values) { + addCriterion("roleId in", values, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidNotIn(List values) { + addCriterion("roleId not in", values, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidBetween(String value1, String value2) { + addCriterion("roleId between", value1, value2, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidNotBetween(String value1, String value2) { + addCriterion("roleId not between", value1, value2, "roleid"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/cn/edu/hit/education/pojo/UserRole.java b/src/cn/edu/hit/education/pojo/UserRole.java new file mode 100644 index 0000000000000000000000000000000000000000..7e5e2cc8961ded5204ab126036a71455ea3cc3a5 --- /dev/null +++ b/src/cn/edu/hit/education/pojo/UserRole.java @@ -0,0 +1,33 @@ +package cn.edu.hit.education.pojo; + +public class UserRole { + private Integer id; + + private Long userid; + + private Long roleid; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Long getUserid() { + return userid; + } + + public void setUserid(Long userid) { + this.userid = userid; + } + + public Long getRoleid() { + return roleid; + } + + public void setRoleid(Long roleid) { + this.roleid = roleid; + } +} \ No newline at end of file diff --git a/src/cn/edu/hit/education/pojo/UserRoleExample.java b/src/cn/edu/hit/education/pojo/UserRoleExample.java new file mode 100644 index 0000000000000000000000000000000000000000..58f8c502b1b8c246bb3ba92ac09db6992747b91d --- /dev/null +++ b/src/cn/edu/hit/education/pojo/UserRoleExample.java @@ -0,0 +1,380 @@ +package cn.edu.hit.education.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class UserRoleExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public UserRoleExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List 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; + } + + 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 values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List 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; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andUseridIsNull() { + addCriterion("userId is null"); + return (Criteria) this; + } + + public Criteria andUseridIsNotNull() { + addCriterion("userId is not null"); + return (Criteria) this; + } + + public Criteria andUseridEqualTo(Long value) { + addCriterion("userId =", value, "userid"); + return (Criteria) this; + } + + public Criteria andUseridNotEqualTo(Long value) { + addCriterion("userId <>", value, "userid"); + return (Criteria) this; + } + + public Criteria andUseridGreaterThan(Long value) { + addCriterion("userId >", value, "userid"); + return (Criteria) this; + } + + public Criteria andUseridGreaterThanOrEqualTo(Long value) { + addCriterion("userId >=", value, "userid"); + return (Criteria) this; + } + + public Criteria andUseridLessThan(Long value) { + addCriterion("userId <", value, "userid"); + return (Criteria) this; + } + + public Criteria andUseridLessThanOrEqualTo(Long value) { + addCriterion("userId <=", value, "userid"); + return (Criteria) this; + } + + public Criteria andUseridIn(List values) { + addCriterion("userId in", values, "userid"); + return (Criteria) this; + } + + public Criteria andUseridNotIn(List values) { + addCriterion("userId not in", values, "userid"); + return (Criteria) this; + } + + public Criteria andUseridBetween(Long value1, Long value2) { + addCriterion("userId between", value1, value2, "userid"); + return (Criteria) this; + } + + public Criteria andUseridNotBetween(Long value1, Long value2) { + addCriterion("userId not between", value1, value2, "userid"); + return (Criteria) this; + } + + public Criteria andRoleidIsNull() { + addCriterion("roleId is null"); + return (Criteria) this; + } + + public Criteria andRoleidIsNotNull() { + addCriterion("roleId is not null"); + return (Criteria) this; + } + + public Criteria andRoleidEqualTo(Long value) { + addCriterion("roleId =", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidNotEqualTo(Long value) { + addCriterion("roleId <>", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidGreaterThan(Long value) { + addCriterion("roleId >", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidGreaterThanOrEqualTo(Long value) { + addCriterion("roleId >=", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidLessThan(Long value) { + addCriterion("roleId <", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidLessThanOrEqualTo(Long value) { + addCriterion("roleId <=", value, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidIn(List values) { + addCriterion("roleId in", values, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidNotIn(List values) { + addCriterion("roleId not in", values, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidBetween(Long value1, Long value2) { + addCriterion("roleId between", value1, value2, "roleid"); + return (Criteria) this; + } + + public Criteria andRoleidNotBetween(Long value1, Long value2) { + addCriterion("roleId not between", value1, value2, "roleid"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/cn/edu/hit/education/pojo/UserSpecialty.java b/src/cn/edu/hit/education/pojo/UserSpecialty.java new file mode 100644 index 0000000000000000000000000000000000000000..b6d8cbafc9dd1e597478ae39a0dd70956b332dd4 --- /dev/null +++ b/src/cn/edu/hit/education/pojo/UserSpecialty.java @@ -0,0 +1,33 @@ +package cn.edu.hit.education.pojo; + +public class UserSpecialty { + private Integer id; + + private Long userid; + + private Long specialtyid; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Long getUserid() { + return userid; + } + + public void setUserid(Long userid) { + this.userid = userid; + } + + public Long getSpecialtyid() { + return specialtyid; + } + + public void setSpecialtyid(Long specialtyid) { + this.specialtyid = specialtyid; + } +} \ No newline at end of file diff --git a/src/cn/edu/hit/education/pojo/UserSpecialtyExample.java b/src/cn/edu/hit/education/pojo/UserSpecialtyExample.java new file mode 100644 index 0000000000000000000000000000000000000000..eb3a97331fbffe45d0b5373f500bae6b48b8b952 --- /dev/null +++ b/src/cn/edu/hit/education/pojo/UserSpecialtyExample.java @@ -0,0 +1,380 @@ +package cn.edu.hit.education.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class UserSpecialtyExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public UserSpecialtyExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List 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; + } + + 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 values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List 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; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andUseridIsNull() { + addCriterion("userId is null"); + return (Criteria) this; + } + + public Criteria andUseridIsNotNull() { + addCriterion("userId is not null"); + return (Criteria) this; + } + + public Criteria andUseridEqualTo(Long value) { + addCriterion("userId =", value, "userid"); + return (Criteria) this; + } + + public Criteria andUseridNotEqualTo(Long value) { + addCriterion("userId <>", value, "userid"); + return (Criteria) this; + } + + public Criteria andUseridGreaterThan(Long value) { + addCriterion("userId >", value, "userid"); + return (Criteria) this; + } + + public Criteria andUseridGreaterThanOrEqualTo(Long value) { + addCriterion("userId >=", value, "userid"); + return (Criteria) this; + } + + public Criteria andUseridLessThan(Long value) { + addCriterion("userId <", value, "userid"); + return (Criteria) this; + } + + public Criteria andUseridLessThanOrEqualTo(Long value) { + addCriterion("userId <=", value, "userid"); + return (Criteria) this; + } + + public Criteria andUseridIn(List values) { + addCriterion("userId in", values, "userid"); + return (Criteria) this; + } + + public Criteria andUseridNotIn(List values) { + addCriterion("userId not in", values, "userid"); + return (Criteria) this; + } + + public Criteria andUseridBetween(Long value1, Long value2) { + addCriterion("userId between", value1, value2, "userid"); + return (Criteria) this; + } + + public Criteria andUseridNotBetween(Long value1, Long value2) { + addCriterion("userId not between", value1, value2, "userid"); + return (Criteria) this; + } + + public Criteria andSpecialtyidIsNull() { + addCriterion("specialtyId is null"); + return (Criteria) this; + } + + public Criteria andSpecialtyidIsNotNull() { + addCriterion("specialtyId is not null"); + return (Criteria) this; + } + + public Criteria andSpecialtyidEqualTo(Long value) { + addCriterion("specialtyId =", value, "specialtyid"); + return (Criteria) this; + } + + public Criteria andSpecialtyidNotEqualTo(Long value) { + addCriterion("specialtyId <>", value, "specialtyid"); + return (Criteria) this; + } + + public Criteria andSpecialtyidGreaterThan(Long value) { + addCriterion("specialtyId >", value, "specialtyid"); + return (Criteria) this; + } + + public Criteria andSpecialtyidGreaterThanOrEqualTo(Long value) { + addCriterion("specialtyId >=", value, "specialtyid"); + return (Criteria) this; + } + + public Criteria andSpecialtyidLessThan(Long value) { + addCriterion("specialtyId <", value, "specialtyid"); + return (Criteria) this; + } + + public Criteria andSpecialtyidLessThanOrEqualTo(Long value) { + addCriterion("specialtyId <=", value, "specialtyid"); + return (Criteria) this; + } + + public Criteria andSpecialtyidIn(List values) { + addCriterion("specialtyId in", values, "specialtyid"); + return (Criteria) this; + } + + public Criteria andSpecialtyidNotIn(List values) { + addCriterion("specialtyId not in", values, "specialtyid"); + return (Criteria) this; + } + + public Criteria andSpecialtyidBetween(Long value1, Long value2) { + addCriterion("specialtyId between", value1, value2, "specialtyid"); + return (Criteria) this; + } + + public Criteria andSpecialtyidNotBetween(Long value1, Long value2) { + addCriterion("specialtyId not between", value1, value2, "specialtyid"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/cn/edu/hit/education/service/CourseServiceImpl.java b/src/cn/edu/hit/education/service/CourseServiceImpl.java index 157be89f293002798a625bdb4ef68d9e8a74d6af..7dbba77d5e49b4e00cd4133c992dfb92533847a8 100644 --- a/src/cn/edu/hit/education/service/CourseServiceImpl.java +++ b/src/cn/edu/hit/education/service/CourseServiceImpl.java @@ -1,38 +1,50 @@ /** -*

title CourseServiceImpl.java

-*

package cn.edu.hit.education.service

-*

description TODO

-*

copyright ҵѧ(C) 2019

-*

company ҵѧAS&MT

-*

author ѩ jinxuesong@163.com

-*

date 2021421 4:38:16

-*

version v1.0

-* -* Modification History: -* Date Author Version Discription -* ----------------------------------------------------------------------------------- -* 2021421 ѩ 1.0 1.0 -* Why & What is modified: <޸ԭ> -*/ + *

title �� CourseServiceImpl.java

+ *

package �� cn.edu.hit.education.service

+ *

description ��TODO

+ *

copyright �� ��������ҵ��ѧ(C) 2019

+ *

company �� ��������ҵ��ѧAS&MT

+ *

author �� ��ѩ�� jinxuesong@163.com

+ *

date �� 2021��4��21�� ����4:38:16

+ *

version �� v1.0

+ * + * Modification History: + * Date Author Version Discription + * ----------------------------------------------------------------------------------- + * 2021��4��21�� ��ѩ�� 1.0 1.0 + * Why & What is modified: <�޸�ԭ������> + */ package cn.edu.hit.education.service; import java.util.ArrayList; import java.util.List; import java.util.Set; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authc.UsernamePasswordToken; +import org.apache.shiro.mgt.DefaultSecurityManager; +import org.apache.shiro.subject.Subject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import cn.edu.hit.education.dao.CourseMapper; import cn.edu.hit.education.pojo.Course; import cn.edu.hit.education.pojo.CourseExample; - +import cn.edu.hit.education.shiro.UserRealm; /** - *

classname CourseServiceImpl

- *

description TODO

- *

author ѩ jinxuesong@163.com

- *

date 2021421 4:38:16

+ *

+ * classname �� CourseServiceImpl + *

+ *

+ * description ��TODO + *

+ *

+ * author �� ��ѩ�� jinxuesong@163.com + *

+ *

+ * date �� 2021��4��21�� ����4:38:16 + *

*/ @Service public class CourseServiceImpl implements ICourseService { @@ -40,114 +52,133 @@ public class CourseServiceImpl implements ICourseService { @Autowired CourseMapper courseMapper; + @Autowired + IUserService userService; + @Override public int insert(Course course) { - // TODO Զɵķ + // TODO �Զ����ɵķ������ return courseMapper.insert(course); } - /* ( Javadoc) - *

Title: deleteByPrimaryKey

- *

Description:

- * @param id - * @return - * @see cn.edu.hit.education.service.ICourseService#deleteByPrimaryKey(int) - */ - + /* + * (�� Javadoc)

Title: deleteByPrimaryKey

Description:

+ * + * @param id + * + * @return + * + * @see cn.edu.hit.education.service.ICourseService#deleteByPrimaryKey(int) + */ + @Override public int deleteByPrimaryKey(int id) { - // TODO Զɵķ + // TODO �Զ����ɵķ������ return courseMapper.deleteByPrimaryKey(id); } - /* ( Javadoc) - *

Title: update

- *

Description:

- * @param course - * @return - * @see cn.edu.hit.education.service.ICourseService#update(cn.edu.hit.education.pojo.Course) - */ - + /* + * (�� Javadoc)

Title: update

Description:

+ * + * @param course + * + * @return + * + * @see + * cn.edu.hit.education.service.ICourseService#update(cn.edu.hit.education + * .pojo.Course) + */ + @Override public int update(Course course) { - // TODO Զɵķ + // TODO �Զ����ɵķ������ return courseMapper.updateByPrimaryKey(course); } - /* ( Javadoc) - *

Title: queryAllCourse

- *

Description:

- * @return - * @see cn.edu.hit.education.service.ICourseService#queryAllCourse() - */ - + /* + * (�� Javadoc)

Title: queryAllCourse

Description:

+ * + * @return + * + * @see cn.edu.hit.education.service.ICourseService#queryAllCourse() + */ + @Override public List queryAllCourse() { - // TODO Զɵķ + // TODO �Զ����ɵķ������ CourseExample example = new CourseExample(); CourseExample.Criteria criteria = example.createCriteria(); criteria.andIdGreaterThan(0); - + return courseMapper.selectByExample(example); } - /* ( Javadoc) - *

Title: queryCoursesByPropertyId

- *

Description:

- * @param propertyId - * @return - * @see cn.edu.hit.education.service.ICourseService#queryCoursesByPropertyId(int) - */ - + /* + * (�� Javadoc)

Title: queryCoursesByPropertyId

Description:

+ * + * @param propertyId + * + * @return + * + * @see + * cn.edu.hit.education.service.ICourseService#queryCoursesByPropertyId(int) + */ + @Override public List queryCoursesByPropertyId(int propertyId) { - // TODO Զɵķ + // TODO �Զ����ɵķ������ CourseExample example = new CourseExample(); CourseExample.Criteria criteria = example.createCriteria(); criteria.andPropertyIdEqualTo(propertyId); - + return courseMapper.selectByExample(example); + + } - /* ( Javadoc) - *

Title: queryCoursesBySpecialtyPropertyId

- *

Description:

- * @param specialtyId - * @param propertyId - * @return - * @see cn.edu.hit.education.service.ICourseService#queryCoursesBySpecialtyPropertyId(int, int) - */ - + /* + * (�� Javadoc)

Title: queryCoursesBySpecialtyPropertyId

+ *

Description:

+ * + * @param specialtyId + * + * @param propertyId + * + * @return + * + * @see + * cn.edu.hit.education.service.ICourseService#queryCoursesBySpecialtyPropertyId + * (int, int) + */ + @Override public List queryCoursesBySpecialtyPropertyId(int specialtyId, int propertyId) { - // TODO Զɵķ + // TODO �Զ����ɵķ������ CourseExample example = new CourseExample(); CourseExample.Criteria criteria = example.createCriteria(); criteria.andSpecialtyIdEqualTo(specialtyId); criteria.andPropertyIdEqualTo(propertyId); - return courseMapper.selectByExample(example); } @Override public List queryCoursesByIds(Set ids) { - // TODO Զɵķ - List list2 = new ArrayList (); - list2.addAll(ids); - + // TODO �Զ����ɵķ������ + List list2 = new ArrayList(); + list2.addAll(ids); + CourseExample example = new CourseExample(); CourseExample.Criteria criteria = example.createCriteria(); criteria.andIdIn(list2); - + return courseMapper.selectByExample(example); } @Override public Course queryCourseByPrimaryKey(int id) { - // TODO Զɵķ + // TODO �Զ����ɵķ������ return courseMapper.selectByPrimaryKey(id); } - } diff --git a/src/cn/edu/hit/education/service/IPermissonService.java b/src/cn/edu/hit/education/service/IPermissonService.java new file mode 100644 index 0000000000000000000000000000000000000000..ae503c67f3788d3827ae495b9fa4d233bf7862ee --- /dev/null +++ b/src/cn/edu/hit/education/service/IPermissonService.java @@ -0,0 +1,9 @@ +package cn.edu.hit.education.service; + +import cn.edu.hit.education.pojo.Permission; + +public interface IPermissonService { + + Permission queryPermissionById(int permissonId); + +} diff --git a/src/cn/edu/hit/education/service/IRolePermissonService.java b/src/cn/edu/hit/education/service/IRolePermissonService.java new file mode 100644 index 0000000000000000000000000000000000000000..1a6133b07e07288bde06717c93078f0420d56346 --- /dev/null +++ b/src/cn/edu/hit/education/service/IRolePermissonService.java @@ -0,0 +1,14 @@ +package cn.edu.hit.education.service; + +/** + * +*

Title: IRolePermissonService

+*

Description:

+* @author 罗成 +* @date 2021年5月4日 + */ +public interface IRolePermissonService { + + int queryPerIdByRoleId(Integer id); + +} diff --git a/src/cn/edu/hit/education/service/IRoleService.java b/src/cn/edu/hit/education/service/IRoleService.java new file mode 100644 index 0000000000000000000000000000000000000000..023fac776e9774a55bcb63989b44c3e502b4dd4a --- /dev/null +++ b/src/cn/edu/hit/education/service/IRoleService.java @@ -0,0 +1,16 @@ +package cn.edu.hit.education.service; + +import cn.edu.hit.education.pojo.Role; + +/** + * +*

Title: IRoleService

+*

Description:

+* @author 罗成 +* @date 2021年5月4日 + */ +public interface IRoleService { + + Role queryById(int roleId); + +} diff --git a/src/cn/edu/hit/education/service/IScheduleService.java b/src/cn/edu/hit/education/service/IScheduleService.java index 422e122ea71aa3100e91a1f04d6118f8b36fcb82..cd188520449bf91146dc12ae15f3c3d75010fd94 100644 --- a/src/cn/edu/hit/education/service/IScheduleService.java +++ b/src/cn/edu/hit/education/service/IScheduleService.java @@ -47,4 +47,10 @@ public interface IScheduleService { List querySchedulesBySpecialtyCourseId(int specialtyId, int courseId); void statisticsSchedule(int specialtyId,int opened); + + List querySchedulesBySemesterCourseId(Integer semesterId, Integer courseId); + + List querySchedulesBySemesterId(int semesterId); + + List querySchedulesBySCourseId(Integer courseId); } diff --git a/src/cn/edu/hit/education/service/ISpecialtyService.java b/src/cn/edu/hit/education/service/ISpecialtyService.java index 04c501756e90c0fdc445af9bb129a14a03773cbe..76c2b8e2ad1c9f0cbede8476a2299ea46471edd5 100644 --- a/src/cn/edu/hit/education/service/ISpecialtyService.java +++ b/src/cn/edu/hit/education/service/ISpecialtyService.java @@ -1,18 +1,18 @@ /** -*

title ISpecialtyService.java

-*

package cn.edu.hit.education.service

-*

description TODO

-*

copyright ҵѧ(C) 2019

-*

company ҵѧAS&MT

-*

author ѩ jinxuesong@163.com

-*

date 2021421 2:59:59

-*

version v1.0

+*

title �� ISpecialtyService.java

+*

package �� cn.edu.hit.education.service

+*

description ��TODO

+*

copyright �� ��������ҵ��ѧ(C) 2019

+*

company �� ��������ҵ��ѧAS&MT

+*

author �� ��ѩ�� jinxuesong@163.com

+*

date �� 2021��4��21�� ����2:59:59

+*

version �� v1.0

* * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- -* 2021421 ѩ 1.0 1.0 -* Why & What is modified: <޸ԭ> +* 2021��4��21�� ��ѩ�� 1.0 1.0 +* Why & What is modified: <�޸�ԭ������> */ package cn.edu.hit.education.service; @@ -21,10 +21,10 @@ import java.util.List; import cn.edu.hit.education.pojo.Specialty; /** - *

classname ISpecialtyService

- *

description TODO

- *

author ѩ jinxuesong@163.com

- *

date 2021421 2:59:59

+ *

classname �� ISpecialtyService

+ *

description ��TODO

+ *

author �� ��ѩ�� jinxuesong@163.com

+ *

date �� 2021��4��21�� ����2:59:59

*/ public interface ISpecialtyService { @@ -39,4 +39,6 @@ public interface ISpecialtyService { List queryAllSpecialty(); List querySpecialtiesByCollegeId(int collegeId); + + List queryRelativeSpecialty(List ids); } diff --git a/src/cn/edu/hit/education/service/IUserRoleService.java b/src/cn/edu/hit/education/service/IUserRoleService.java new file mode 100644 index 0000000000000000000000000000000000000000..9fb9655c4cc856ccb8ab6c1f27a13c5a1e0e8a34 --- /dev/null +++ b/src/cn/edu/hit/education/service/IUserRoleService.java @@ -0,0 +1,13 @@ +package cn.edu.hit.education.service; +/** + * +*

Title: IUserRoleService

+*

Description:

+* @author 罗成 +* @date 2021年5月4日 + */ +public interface IUserRoleService { + + int queryRoleIdByUser(Integer id); + +} diff --git a/src/cn/edu/hit/education/service/IUserService.java b/src/cn/edu/hit/education/service/IUserService.java new file mode 100644 index 0000000000000000000000000000000000000000..7b71bf51590391049f566bac458a5cf07a2cc610 --- /dev/null +++ b/src/cn/edu/hit/education/service/IUserService.java @@ -0,0 +1,17 @@ +package cn.edu.hit.education.service; + +import cn.edu.hit.education.pojo.User; + +/** + * +*

Title: IUserService

+*

Description:

+* @author 罗成 +* @date 2021年5月4日 + */ +public interface IUserService { + void login(String username,String password); + + User queryUserByUsername(String username); + +} diff --git a/src/cn/edu/hit/education/service/IUserSpeciatyService.java b/src/cn/edu/hit/education/service/IUserSpeciatyService.java new file mode 100644 index 0000000000000000000000000000000000000000..67644d561b3b7ddf507c3e9964dc37255aa69e49 --- /dev/null +++ b/src/cn/edu/hit/education/service/IUserSpeciatyService.java @@ -0,0 +1,11 @@ +package cn.edu.hit.education.service; + +import java.util.List; + +import cn.edu.hit.education.pojo.UserSpecialty; + +public interface IUserSpeciatyService { + + List querySpeciatyIdsByUser(Integer id); + +} diff --git a/src/cn/edu/hit/education/service/PermissonServiceImpl.java b/src/cn/edu/hit/education/service/PermissonServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..d4ef9463fe91e8fe5c71df02843e5625d61fa16f --- /dev/null +++ b/src/cn/edu/hit/education/service/PermissonServiceImpl.java @@ -0,0 +1,30 @@ +package cn.edu.hit.education.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.ParameterMapper; +import org.springframework.stereotype.Service; + +import cn.edu.hit.education.dao.PermissionMapper; +import cn.edu.hit.education.pojo.Permission; + +/** + * +*

Title: PermissonServiceImpl

+*

Description:

+* @author 罗成 +* @date 2021年5月4日 + */ +@Service +public class PermissonServiceImpl implements IPermissonService { + + @Autowired + PermissionMapper permissonMapper; + + @Override + public Permission queryPermissionById(int permissionId) { + // TODO Auto-generated method stub + return permissonMapper.selectByPrimaryKey(permissionId); + } + + +} diff --git a/src/cn/edu/hit/education/service/RolePermissonServiceImpl.java b/src/cn/edu/hit/education/service/RolePermissonServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..79b99493b3db5c8b23ba802a51713ba2f81684da --- /dev/null +++ b/src/cn/edu/hit/education/service/RolePermissonServiceImpl.java @@ -0,0 +1,28 @@ +package cn.edu.hit.education.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import cn.edu.hit.education.dao.RolePermissionMapper; + +/** + * +*

Title: RolePermissonServiceImpl

+*

Description:

+* @author 罗成 +* @date 2021年5月4日 + */ +@Service +public class RolePermissonServiceImpl implements IRolePermissonService { + + + @Autowired + RolePermissionMapper rolePermissionMapper; + + @Override + public int queryPerIdByRoleId(Integer id) { + + return rolePermissionMapper.queryPerIdByRoleId(id); + } + +} diff --git a/src/cn/edu/hit/education/service/RoleServiceImlp.java b/src/cn/edu/hit/education/service/RoleServiceImlp.java new file mode 100644 index 0000000000000000000000000000000000000000..d094cbddb8458bbabcba2ab8b8949ed4a1997a8e --- /dev/null +++ b/src/cn/edu/hit/education/service/RoleServiceImlp.java @@ -0,0 +1,28 @@ +package cn.edu.hit.education.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import cn.edu.hit.education.dao.RoleMapper; +import cn.edu.hit.education.pojo.Role; + + +/** + * +*

Title: RoleServiceImlp

+*

Description:

+* @author 罗成 +* @date 2021年5月4日 + */ +@Service +public class RoleServiceImlp implements IRoleService{ + @Autowired + RoleMapper roleMapper; + + @Override + public Role queryById(int roleId) { + + return roleMapper.selectByPrimaryKey(roleId); + } + +} diff --git a/src/cn/edu/hit/education/service/ScheduleServiceImpl.java b/src/cn/edu/hit/education/service/ScheduleServiceImpl.java index 9c9aca9419e2c5b7263c6041de62ebdc99d9906f..36ef1351888b053577b3e23d7fe1b209d235af10 100644 --- a/src/cn/edu/hit/education/service/ScheduleServiceImpl.java +++ b/src/cn/edu/hit/education/service/ScheduleServiceImpl.java @@ -160,5 +160,36 @@ public class ScheduleServiceImpl implements IScheduleService { return (scheduleMapper.queryCourseByCourseId(courseId)); } + @Override + public List querySchedulesBySemesterCourseId(Integer semesterId, + Integer courseId) { + // TODO Auto-generated method stub + ScheduleExample example = new ScheduleExample(); + ScheduleExample.Criteria criteria = example.createCriteria(); + criteria.andSemesterIdEqualTo(semesterId); + criteria.andCourseIdEqualTo(courseId); + + return scheduleMapper.selectByExample(example); + } + @Override + public List querySchedulesBySemesterId(int semesterId) { + // TODO Auto-generated method stub + ScheduleExample example = new ScheduleExample(); + ScheduleExample.Criteria criteria = example.createCriteria(); + criteria.andSemesterIdEqualTo(semesterId); + + return scheduleMapper.selectByExample(example); + } + @Override + public List querySchedulesBySCourseId(Integer courseId) { + // TODO Auto-generated method stub + ScheduleExample example = new ScheduleExample(); + ScheduleExample.Criteria criteria = example.createCriteria(); + + criteria.andCourseIdEqualTo(courseId); + + return scheduleMapper.selectByExample(example); + } + } diff --git a/src/cn/edu/hit/education/service/SemesterServiceImpl.java b/src/cn/edu/hit/education/service/SemesterServiceImpl.java index e0ef838a9250ab73c8af5c2aa49176fb524b1f85..0583c1e538b79d85b6d1a09c2c370bec7a134a97 100644 --- a/src/cn/edu/hit/education/service/SemesterServiceImpl.java +++ b/src/cn/edu/hit/education/service/SemesterServiceImpl.java @@ -1,23 +1,25 @@ /** -*

title SemesterServiceImpl.java

-*

package cn.edu.hit.education.service

-*

description TODO

-*

copyright ҵѧ(C) 2019

-*

company ҵѧAS&MT

-*

author ѩ jinxuesong@163.com

-*

date 2021421 4:39:38

-*

version v1.0

+*

title �� SemesterServiceImpl.java

+*

package �� cn.edu.hit.education.service

+*

description ��TODO

+*

copyright �� ��������ҵ��ѧ(C) 2019

+*

company �� ��������ҵ��ѧAS&MT

+*

author �� ��ѩ�� jinxuesong@163.com

+*

date �� 2021��4��21�� ����4:39:38

+*

version �� v1.0

* * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- -* 2021421 ѩ 1.0 1.0 -* Why & What is modified: <޸ԭ> +* 2021��4��21�� ��ѩ�� 1.0 1.0 +* Why & What is modified: <�޸�ԭ������> */ package cn.edu.hit.education.service; import java.util.List; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.subject.Subject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -26,24 +28,27 @@ import cn.edu.hit.education.pojo.Semester; import cn.edu.hit.education.pojo.SemesterExample; /** - *

classname SemesterServiceImpl

- *

description TODO

- *

author ѩ jinxuesong@163.com

- *

date 2021421 4:39:38

+ *

classname �� SemesterServiceImpl

+ *

description ��TODO

+ *

author �� ��ѩ�� jinxuesong@163.com

+ *

date �� 2021��4��21�� ����4:39:38

*/ @Service public class SemesterServiceImpl implements ISemesterService { @Autowired SemesterMapper semesterMapper; + + @Autowired + IUserService userService; @Override public int insert(Semester semester) { - // TODO Զɵķ + // TODO �Զ����ɵķ������ return semesterMapper.insert(semester); } - /* ( Javadoc) + /* (�� Javadoc) *

Title: deleteByPrimaryKey

*

Description:

* @param id @@ -53,11 +58,11 @@ public class SemesterServiceImpl implements ISemesterService { @Override public int deleteByPrimaryKey(int id) { - // TODO Զɵķ + // TODO �Զ����ɵķ������ return semesterMapper.deleteByPrimaryKey(id); } - /* ( Javadoc) + /* (�� Javadoc) *

Title: update

*

Description:

* @param semester @@ -67,11 +72,11 @@ public class SemesterServiceImpl implements ISemesterService { @Override public int update(Semester semester) { - // TODO Զɵķ + // TODO �Զ����ɵķ������ return semesterMapper.updateByPrimaryKey(semester); } - /* ( Javadoc) + /* (�� Javadoc) *

Title: queryAllSemester

*

Description:

* @return @@ -80,7 +85,7 @@ public class SemesterServiceImpl implements ISemesterService { @Override public List queryAllSemester() { - // TODO Զɵķ + // TODO �Զ����ɵķ������ SemesterExample example = new SemesterExample(); SemesterExample.Criteria criteria = example.createCriteria(); criteria.andIdGreaterThan(0); @@ -88,7 +93,7 @@ public class SemesterServiceImpl implements ISemesterService { return semesterMapper.selectByExample(example); } - /* ( Javadoc) + /* (�� Javadoc) *

Title: queryByPrimaryKey

*

Description:

* @param id @@ -98,7 +103,8 @@ public class SemesterServiceImpl implements ISemesterService { @Override public Semester queryByPrimaryKey(int id) { - // TODO Զɵķ + + // TODO �Զ����ɵķ������ return semesterMapper.selectByPrimaryKey(id); } diff --git a/src/cn/edu/hit/education/service/SpecialtyServiceImpl.java b/src/cn/edu/hit/education/service/SpecialtyServiceImpl.java index 79b29bf8d854347b6535dbc2375d99bcc6c7b613..01f10df9ed9f206838f24334528cec4c6ae2311e 100644 --- a/src/cn/edu/hit/education/service/SpecialtyServiceImpl.java +++ b/src/cn/edu/hit/education/service/SpecialtyServiceImpl.java @@ -1,18 +1,18 @@ /** -*

title SpecialtyServiceImpl.java

-*

package cn.edu.hit.education.service

-*

description TODO

-*

copyright ҵѧ(C) 2019

-*

company ҵѧAS&MT

-*

author ѩ jinxuesong@163.com

-*

date 2021421 4:37:51

-*

version v1.0

+*

title �� SpecialtyServiceImpl.java

+*

package �� cn.edu.hit.education.service

+*

description ��TODO

+*

copyright �� ��������ҵ��ѧ(C) 2019

+*

company �� ��������ҵ��ѧAS&MT

+*

author �� ��ѩ�� jinxuesong@163.com

+*

date �� 2021��4��21�� ����4:37:51

+*

version �� v1.0

* * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- -* 2021421 ѩ 1.0 1.0 -* Why & What is modified: <޸ԭ> +* 2021��4��21�� ��ѩ�� 1.0 1.0 +* Why & What is modified: <�޸�ԭ������> */ package cn.edu.hit.education.service; @@ -26,10 +26,10 @@ import cn.edu.hit.education.pojo.Specialty; import cn.edu.hit.education.pojo.SpecialtyExample; /** - *

classname SpecialtyServiceImpl

- *

description TODO

- *

author ѩ jinxuesong@163.com

- *

date 2021421 4:37:51

+ *

classname �� SpecialtyServiceImpl

+ *

description ��TODO

+ *

author �� ��ѩ�� jinxuesong@163.com

+ *

date �� 2021��4��21�� ����4:37:51

*/ @Service public class SpecialtyServiceImpl implements ISpecialtyService { @@ -39,11 +39,11 @@ public class SpecialtyServiceImpl implements ISpecialtyService { @Override public int insert(Specialty specialty) { - // TODO Զɵķ + // TODO �Զ����ɵķ������ return specialtyMapper.insert(specialty); } - /* ( Javadoc) + /* (�� Javadoc) *

Title: deleteByPrimaryKey

*

Description:

* @param id @@ -53,11 +53,11 @@ public class SpecialtyServiceImpl implements ISpecialtyService { @Override public int deleteByPrimaryKey(int id) { - // TODO Զɵķ + // TODO �Զ����ɵķ������ return specialtyMapper.deleteByPrimaryKey(id); } - /* ( Javadoc) + /* (�� Javadoc) *

Title: update

*

Description:

* @param specialty @@ -67,11 +67,11 @@ public class SpecialtyServiceImpl implements ISpecialtyService { @Override public int update(Specialty specialty) { - // TODO Զɵķ + // TODO �Զ����ɵķ������ return specialtyMapper.updateByPrimaryKey(specialty); } - /* ( Javadoc) + /* (�� Javadoc) *

Title: queryAllSpecialty

*

Description:

* @return @@ -80,7 +80,7 @@ public class SpecialtyServiceImpl implements ISpecialtyService { @Override public List queryAllSpecialty() { - // TODO Զɵķ + // TODO �Զ����ɵķ������ SpecialtyExample example = new SpecialtyExample(); SpecialtyExample.Criteria criteria = example.createCriteria(); criteria.andIdGreaterThan(0); @@ -88,7 +88,7 @@ public class SpecialtyServiceImpl implements ISpecialtyService { return specialtyMapper.selectByExample(example); } - /* ( Javadoc) + /* (�� Javadoc) *

Title: queryAllSpecialtiesByCollegeId

*

Description:

* @param collegeId @@ -98,7 +98,7 @@ public class SpecialtyServiceImpl implements ISpecialtyService { @Override public List querySpecialtiesByCollegeId(int collegeId) { - // TODO Զɵķ + // TODO �Զ����ɵķ������ SpecialtyExample example = new SpecialtyExample(); SpecialtyExample.Criteria criteria = example.createCriteria(); criteria.andCollegeIdEqualTo(collegeId); @@ -106,7 +106,7 @@ public class SpecialtyServiceImpl implements ISpecialtyService { return specialtyMapper.selectByExample(example); } - /* ( Javadoc) + /* (�� Javadoc) *

Title: queryByPrimaryKey

*

Description:

* @param id @@ -116,8 +116,14 @@ public class SpecialtyServiceImpl implements ISpecialtyService { @Override public Specialty queryByPrimaryKey(int id) { - // TODO Զɵķ + // TODO �Զ����ɵķ������ return specialtyMapper.selectByPrimaryKey(id); } + @Override + public List queryRelativeSpecialty(List ids) { + + return specialtyMapper.queryRelativeSpecialty(ids); + } + } diff --git a/src/cn/edu/hit/education/service/UserRoleServiceImpl.java b/src/cn/edu/hit/education/service/UserRoleServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..ff90622fc092bac7c9ef8aed1b6a7eab7d12cdcc --- /dev/null +++ b/src/cn/edu/hit/education/service/UserRoleServiceImpl.java @@ -0,0 +1,27 @@ +package cn.edu.hit.education.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import cn.edu.hit.education.dao.UserRoleMapper; + +/** + * +*

Title: UserRoleServiceImpl

+*

Description:

+* @author 罗成 +* @date 2021年5月4日 + */ +@Service +public class UserRoleServiceImpl implements IUserRoleService { + + @Autowired + UserRoleMapper userRoleMapper; + + @Override + public int queryRoleIdByUser(Integer id) { + // TODO Auto-generated method stub + return userRoleMapper.queryRoleIdByUser(id); + } + +} diff --git a/src/cn/edu/hit/education/service/UserServiceImpl.java b/src/cn/edu/hit/education/service/UserServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..5a295d4eddd6b926368ad3354a8a34bc708dc05f --- /dev/null +++ b/src/cn/edu/hit/education/service/UserServiceImpl.java @@ -0,0 +1,54 @@ +package cn.edu.hit.education.service; + +import java.util.Arrays; + +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authc.AuthenticationException; +import org.apache.shiro.authc.UsernamePasswordToken; +import org.apache.shiro.mgt.DefaultSecurityManager; +import org.apache.shiro.subject.Subject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import cn.edu.hit.education.dao.UserMapper; +import cn.edu.hit.education.pojo.User; +import cn.edu.hit.education.shiro.UserRealm; + +/** + * +*

Title: UserServiceImpl

+*

Description:

+* @author 罗成 +* @date 2021年5月4日 + */ +@Service +public class UserServiceImpl implements IUserService { + @Autowired + UserMapper userMapper; + + @Autowired + DefaultSecurityManager securityManager; + + @Autowired + UserRealm userRealm; + + public void login(String username, String password) { + System.out.println("进入了login方法!"); + securityManager.setRealm(userRealm); + SecurityUtils.setSecurityManager(securityManager); + Subject subject = SecurityUtils.getSubject(); + UsernamePasswordToken token = new UsernamePasswordToken(username, + password); + subject.login(token); + + } + + @Override + public User queryUserByUsername(String username) { + System.out.println("进入查询方法!"); + + User user = userMapper.queryUserByUsername(username); + return user; + } + +} diff --git a/src/cn/edu/hit/education/service/UserSpeciatyServiceImpl.java b/src/cn/edu/hit/education/service/UserSpeciatyServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..c1a40a1b01a4a37c1f59995d1d4f25724eec6c26 --- /dev/null +++ b/src/cn/edu/hit/education/service/UserSpeciatyServiceImpl.java @@ -0,0 +1,24 @@ +package cn.edu.hit.education.service; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import cn.edu.hit.education.dao.UserSpecialtyMapper; + + + +@Service +public class UserSpeciatyServiceImpl implements IUserSpeciatyService { + @Autowired + UserSpecialtyMapper mapper; + + @Override + public List querySpeciatyIdsByUser(Integer id) { + + return mapper.querySpeciatyIdsByUser(id); + + } + +} diff --git a/src/cn/edu/hit/education/shiro/UserRealm.java b/src/cn/edu/hit/education/shiro/UserRealm.java new file mode 100644 index 0000000000000000000000000000000000000000..bf7fac51ac17f89173edf6fba466788bafd67c71 --- /dev/null +++ b/src/cn/edu/hit/education/shiro/UserRealm.java @@ -0,0 +1,101 @@ +package cn.edu.hit.education.shiro; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; + +import org.apache.shiro.authc.AuthenticationException; +import org.apache.shiro.authc.AuthenticationInfo; +import org.apache.shiro.authc.AuthenticationToken; +import org.apache.shiro.authc.SimpleAuthenticationInfo; +import org.apache.shiro.authz.AuthorizationInfo; +import org.apache.shiro.authz.SimpleAuthorizationInfo; +import org.apache.shiro.realm.AuthorizingRealm; +import org.apache.shiro.subject.PrincipalCollection; +import org.apache.shiro.util.ByteSource; +import org.springframework.beans.factory.annotation.Autowired; + +import cn.edu.hit.education.pojo.Permission; +import cn.edu.hit.education.pojo.Role; +import cn.edu.hit.education.pojo.User; +import cn.edu.hit.education.service.IPermissonService; +import cn.edu.hit.education.service.IRolePermissonService; +import cn.edu.hit.education.service.IRoleService; +import cn.edu.hit.education.service.IUserRoleService; +import cn.edu.hit.education.service.IUserService; +/** + * +*

Title: UserRealm

+*

Description: 进行了登录的密码认证和授权

+* @author 罗成 +* @date 2021年5月4日 + */ +public class UserRealm extends AuthorizingRealm{ + @Autowired + IUserService userService; + + @Autowired + IUserRoleService userRoleService; + + @Autowired + IRoleService roleService; + + @Autowired + IRolePermissonService rolePermissonService; + + @Autowired + IPermissonService permissonService; + + + + @Override + protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) { + //1从主体传过来的授权信息中获取用户名 + User user1 = (User) principalCollection.getPrimaryPrincipal(); + //2.通过用户名来获取数据库或者缓存中的角色数据 + User user = userService.queryUserByUsername(user1.getUsername()); + int roleId = userRoleService.queryRoleIdByUser(user.getId()); + Role role = roleService.queryById(roleId); + //3.通过用户名来获取数据库或者缓存中的权限数据 + int permissionId = rolePermissonService.queryPerIdByRoleId(role.getId()); + Permission permission = permissonService.queryPermissionById(permissionId); + + Set pers = new HashSet(); + pers.add(permission.getPermission()); + Set roles = new HashSet(); + roles.add(role.getRole()); + + SimpleAuthorizationInfo simpleAuthorizationInfo = new SimpleAuthorizationInfo(); + simpleAuthorizationInfo.setStringPermissions(pers); + simpleAuthorizationInfo.setRoles(roles); + + return simpleAuthorizationInfo; + + } + + + /** + * 认证方法,采用MD5进行1024次加密,盐值为用户名 + */ + @Override + protected AuthenticationInfo doGetAuthenticationInfo( + AuthenticationToken token) throws AuthenticationException { + + System.out.println("进入了realm!"); + String username = (String) token.getPrincipal(); + System.out.println(username); + User user = userService.queryUserByUsername(username); + if(user == null){ + return null; + } + + //设置颜值 + ByteSource salt = ByteSource.Util.bytes(user.getSalt()); + + SimpleAuthenticationInfo authenticationInfo = new SimpleAuthenticationInfo(user,user.getPassword(),salt,"UserRealm"); + + return authenticationInfo; + + } + +} diff --git a/src/cn/edu/hit/education/view/CourseExploreView.java b/src/cn/edu/hit/education/view/CourseExploreView.java index 1192f01f91ac884ac8b7aa61a0469ca0ca0794c6..c207f706546f6fb19d8c271a8f47aff92a876a9c 100644 --- a/src/cn/edu/hit/education/view/CourseExploreView.java +++ b/src/cn/edu/hit/education/view/CourseExploreView.java @@ -1,5 +1,7 @@ package cn.edu.hit.education.view; + +import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.MenuManager; @@ -34,6 +36,9 @@ import cn.edu.hit.education.service.IScheduleService; import cn.edu.hit.education.service.ISemesterService; import cn.edu.hit.education.service.ISpecialtyService; import cn.edu.hit.education.service.IUniversityService; +import cn.edu.hit.education.service.IUserService; +import cn.edu.hit.education.service.UserServiceImpl; +import educationschedule.Application; /** *@Title: CourseExploreView *@Description:课程View @@ -57,6 +62,8 @@ public class CourseExploreView extends ViewPart { @Autowired ISpecialtyService specialtyService; + + public static final String ID = "cn.edu.hit.education.view.CourseExploreView"; final Transfer[] transfer=new Transfer[]{LocalSelectionTransfer.getTransfer()}; final Transfer[] transfer2=new Transfer[] {TextTransfer.getInstance()}; @@ -71,6 +78,7 @@ public class CourseExploreView extends ViewPart { public CourseExploreView() { + } public void createPartControl(Composite parent) { diff --git a/src/cn/edu/hit/education/view/CourseInformationView.java b/src/cn/edu/hit/education/view/CourseInformationView.java index 2b5b37d0f982ec3d22beb9bf2ea729fd35d00057..dcb26df47574eb754c596b1b4f7bf5e251255dc7 100644 --- a/src/cn/edu/hit/education/view/CourseInformationView.java +++ b/src/cn/edu/hit/education/view/CourseInformationView.java @@ -2,7 +2,10 @@ package cn.edu.hit.education.view; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.subject.Subject; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.dialogs.MessageDialog; @@ -52,12 +55,15 @@ import cn.edu.hit.education.pojo.Property; import cn.edu.hit.education.pojo.Schedule; import cn.edu.hit.education.pojo.Semester; import cn.edu.hit.education.pojo.Specialty; +import cn.edu.hit.education.pojo.User; +import cn.edu.hit.education.pojo.UserSpecialty; import cn.edu.hit.education.service.ICourseService; import cn.edu.hit.education.service.IProcessService; import cn.edu.hit.education.service.IPropertyService; import cn.edu.hit.education.service.IScheduleService; import cn.edu.hit.education.service.ISemesterService; import cn.edu.hit.education.service.ISpecialtyService; +import cn.edu.hit.education.service.IUserSpeciatyService; import cn.edu.hit.education.utils.StatisticsUtil; @Component @@ -82,9 +88,11 @@ public class CourseInformationView extends ViewPart { ISemesterService semesterService; @Autowired ISpecialtyService specialtyService; + @Autowired + IUserSpeciatyService userSpeciatyService; private Semester semester; - private Specialty specialty; + private List specialties; List courses = new ArrayList(); List exCourses = new ArrayList(); @@ -202,9 +210,19 @@ public class CourseInformationView extends ViewPart { if (selections.length > 0) { for (TableItem tableItem : selections) { Course theCourse = (Course) tableItem.getData(); - - List schedules = scheduleService.querySchedulesBySpecialtySemesterCourseId(specialty.getId(), semester.getId(),theCourse.getId()); - + + //获取当前可查看专业的Id + List specityIds = specialties.stream().map(item->{ + return item.getId(); + }).collect(Collectors.toList()); + +// List schedules = scheduleService.querySchedulesBySpecialtySemesterCourseId(specialty.getId(), semester.getId(),theCourse.getId()); + List schedules1 = scheduleService.querySchedulesBySemesterCourseId(semester.getId(),theCourse.getId()); + //过滤掉所有跟用户无关的专业 + List schedules = schedules1.stream().filter(item->{ + return specityIds.contains(item.getId()); + }).collect(Collectors.toList()); + if (schedules != null && schedules.size() > 0) { for (Schedule schedule : schedules) { scheduleService.deleteByPrimaryKey(schedule.getId()); @@ -258,7 +276,7 @@ public class CourseInformationView extends ViewPart { tableViewer.setContentProvider(new CourseInformationContentProvider()); tableViewer.setLabelProvider(new CourseInformationLabelProvider()); - initSpecialty(); + initSpecialties(); initProcessCombo(); // /////////////// //refreshData(); @@ -294,10 +312,10 @@ public class CourseInformationView extends ViewPart { public void addNewCourse(int id) { Course course = courseService.queryCourseByPrimaryKey(id); - if (!isSameCourse(course.getId(), specialty.getId(), semester.getId())) { + if (!isSameCourse(course.getId(), 0, semester.getId())) { Schedule schedule = new Schedule(); schedule.setCourseId(course.getId()); - schedule.setSpecialtyId(specialty.getId()); + schedule.setSpecialtyId(null); schedule.setSemesterId(semester.getId()); scheduleService.insert(schedule); //refreshData(); @@ -307,7 +325,8 @@ public class CourseInformationView extends ViewPart { } private boolean isSameCourse(int courseId, int specialtyId, int semesterId) { - List theSchedules = scheduleService.querySchedulesBySpecialtySemesterId(specialtyId, semesterId); +// List theSchedules = scheduleService.querySchedulesBySpecialtySemesterId(specialtyId, semesterId); + List theSchedules = scheduleService.querySchedulesBySemesterId(semesterId); if (theSchedules != null && theSchedules.size() > 0) { for (Schedule schedule : theSchedules) { if (schedule.getCourseId() == courseId) { @@ -318,8 +337,24 @@ public class CourseInformationView extends ViewPart { return false; } - private void initSpecialty() { - specialty = specialtyService.queryByPrimaryKey(1); + private void initSpecialties() { + Subject subject = SecurityUtils.getSubject(); + //角色是校长,可查看表中所有专业对应的课程信息 + if(subject.hasRole("principal")){ + specialties = specialtyService.queryAllSpecialty(); + //角色是院长,专业初始化为本学院下的所有专业! + }else if(subject.hasRole("president")){ + User user = (User) subject.getPrincipal(); + //根据院长的用户Id查询到关联的专业Id + List ids = userSpeciatyService.querySpeciatyIdsByUser(user.getId()); + specialties = specialtyService.queryRelativeSpecialty(ids); + }else if(subject.hasRole("director")){ + User user = (User) subject.getPrincipal(); + //根据普通用户的用户Id查询到关联的专业Id + List ids = userSpeciatyService.querySpeciatyIdsByUser(user.getId()); + specialties = specialtyService.queryRelativeSpecialty(ids); + } + } private void initProcessCombo() { @@ -368,7 +403,8 @@ public class CourseInformationView extends ViewPart { } if(theProperty != null){ - courses = queryCourseByProperty(specialty, theProperty); +// courses = queryCourseByProperty(specialty, theProperty); + courses = queryCourseByProperty(theProperty); exCourses = new ArrayList(); completeCourseInformation(courses,exCourses); StatisticsUtil.processCourseInformationData(exCourses); @@ -377,6 +413,21 @@ public class CourseInformationView extends ViewPart { } } + private List queryCourseByProperty(Property property) { + //获取当前可查看专业的Id + List specityIds = specialties.stream().map(item->{ + return item.getId(); + }).collect(Collectors.toList()); + //根据property找到所有课程 + List coursesByPropertyId = courseService.queryCoursesByPropertyId(property.getId()); + //过滤掉不熟属于本用户权限的专业 + List collect = coursesByPropertyId.stream().filter(item->{ + return specityIds.contains(item.getSpecialtyId()); + }).collect(Collectors.toList()); + + return collect; + } + private void completeCourseInformation(List courses,List exCourses){ for (Course course : courses) { ExCourse exCourse = new ExCourse(); @@ -398,7 +449,19 @@ public class CourseInformationView extends ViewPart { exCourse.setSelected(course.getSelected()); exCourse.setNote(course.getNote()); - List schedules = scheduleService.querySchedulesBySpecialtyCourseId(specialty.getId(), course.getId()); +// List schedules = scheduleService.querySchedulesBySpecialtyCourseId(specialty.getId(), course.getId()); + //根据课程id查询到所有的计划 + List allSchedules = scheduleService.querySchedulesBySCourseId(course.getId()); + ////获取当前可查看专业的Id + List specityIds = specialties.stream().map(item->{ + return item.getId(); + }).collect(Collectors.toList()); + + //过滤掉不属于本用户权限的课程 + List schedules = allSchedules.stream().filter(item->{ + return specityIds.contains(item.getSpecialtyId()); + }).collect(Collectors.toList()); + if(schedules != null && schedules.size() > 0){ Schedule theSchedule = schedules.get(0); Semester theSemester = semesterService.queryByPrimaryKey(theSchedule.getSemesterId()); diff --git a/src/cn/edu/hit/education/view/CourseScheduleView.java b/src/cn/edu/hit/education/view/CourseScheduleView.java index 16275fbdb1ab657e0166784deed4aecd7afb0c49..d7937a690343d1405538caccc0e92ff8e08b8cb5 100644 --- a/src/cn/edu/hit/education/view/CourseScheduleView.java +++ b/src/cn/edu/hit/education/view/CourseScheduleView.java @@ -4,7 +4,10 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.stream.Collectors; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.subject.Subject; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.util.LocalSelectionTransfer; import org.eclipse.jface.viewers.ISelection; @@ -45,10 +48,13 @@ import cn.edu.hit.education.pojo.ExCourse; import cn.edu.hit.education.pojo.Schedule; import cn.edu.hit.education.pojo.Semester; import cn.edu.hit.education.pojo.Specialty; +import cn.edu.hit.education.pojo.User; import cn.edu.hit.education.service.ICourseService; import cn.edu.hit.education.service.IScheduleService; import cn.edu.hit.education.service.ISemesterService; import cn.edu.hit.education.service.ISpecialtyService; +import cn.edu.hit.education.service.IUserService; +import cn.edu.hit.education.service.IUserSpeciatyService; import cn.edu.hit.education.utils.StatisticsUtil; @Component @@ -61,7 +67,7 @@ public class CourseScheduleView extends ViewPart implements ISelectionProvider{ private Table table; TableViewer tableViewer; Combo comboSemester; - + @Autowired IScheduleService scheduleService; @Autowired @@ -70,14 +76,15 @@ public class CourseScheduleView extends ViewPart implements ISelectionProvider{ ISemesterService semesterService; @Autowired ISpecialtyService specialtyService; + @Autowired + IUserSpeciatyService userSpeciatyService; private Semester semester; - private Specialty specialty; - + private List specialties; List courses = new ArrayList(); public CourseScheduleView() { - + } public void createPartControl(Composite parent) { @@ -90,49 +97,59 @@ public class CourseScheduleView extends ViewPart implements ISelectionProvider{ public void widgetSelected(SelectionEvent e) { String semesterStr = comboSemester.getText(); String[] rets = semesterStr.split(":"); - semester = semesterService.queryByPrimaryKey(Integer.parseInt(rets[2])); + semester = semesterService.queryByPrimaryKey(Integer + .parseInt(rets[2])); refreshData(); } }); - comboSemester.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); - - tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION); + comboSemester.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, + false, 1, 1)); + + tableViewer = new TableViewer(composite, SWT.BORDER + | SWT.FULL_SELECTION); table = tableViewer.getTable(); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); table.setSize(297, 469); table.setLinesVisible(true); table.setHeaderVisible(true); - TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); + TableViewerColumn tableViewerColumn = new TableViewerColumn( + tableViewer, SWT.NONE); TableColumn tableColumn = tableViewerColumn.getColumn(); tableColumn.setWidth(100); tableColumn.setText("\u8BFE\u7A0B\u4EE3\u7801"); - TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tableViewer, SWT.NONE); + TableViewerColumn tableViewerColumn_1 = new TableViewerColumn( + tableViewer, SWT.NONE); TableColumn tableColumn_1 = tableViewerColumn_1.getColumn(); tableColumn_1.setWidth(300); tableColumn_1.setText("\u8BFE\u7A0B\u540D\u79F0"); - TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(tableViewer, SWT.NONE); + TableViewerColumn tableViewerColumn_2 = new TableViewerColumn( + tableViewer, SWT.NONE); TableColumn tableColumn_2 = tableViewerColumn_2.getColumn(); tableColumn_2.setWidth(100); tableColumn_2.setText("\u5B66\u5206"); - TableViewerColumn tableViewerColumn_3 = new TableViewerColumn(tableViewer, SWT.NONE); + TableViewerColumn tableViewerColumn_3 = new TableViewerColumn( + tableViewer, SWT.NONE); TableColumn tableColumn_3 = tableViewerColumn_3.getColumn(); tableColumn_3.setWidth(100); tableColumn_3.setText("\u5B66\u65F6"); - TableViewerColumn tableViewerColumn_4 = new TableViewerColumn(tableViewer, SWT.NONE); + TableViewerColumn tableViewerColumn_4 = new TableViewerColumn( + tableViewer, SWT.NONE); TableColumn tableColumn_4 = tableViewerColumn_4.getColumn(); tableColumn_4.setWidth(100); tableColumn_4.setText("\u7406\u8BBA\u5B66\u65F6"); - TableViewerColumn tableViewerColumn_5 = new TableViewerColumn(tableViewer, SWT.NONE); + TableViewerColumn tableViewerColumn_5 = new TableViewerColumn( + tableViewer, SWT.NONE); TableColumn tblclmnNewColumn = tableViewerColumn_5.getColumn(); tblclmnNewColumn.setWidth(100); tblclmnNewColumn.setText("\u5B9E\u9A8C\u5B66\u65F6"); - tableViewer.addDropSupport(DND.DROP_MOVE, transfer2, new MyDropTargetListener(tableViewer, this)); + tableViewer.addDropSupport(DND.DROP_MOVE, transfer2, + new MyDropTargetListener(tableViewer, this)); Menu contextMenu = new Menu(table); table.setMenu(contextMenu); @@ -145,17 +162,29 @@ public class CourseScheduleView extends ViewPart implements ISelectionProvider{ @Override public void widgetSelected(SelectionEvent e) { TableItem[] selections = table.getSelection(); - Shell parentShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + Shell parentShell = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow().getShell(); if (selections.length > 0) { for (TableItem tableItem : selections) { Course theCourse = (Course) tableItem.getData(); - List schedules = scheduleService.querySchedulesBySpecialtySemesterCourseId( - specialty.getId(), semester.getId(),theCourse.getId()); + List schedules = scheduleService + .querySchedulesBySemesterCourseId( + semester.getId(), theCourse.getId()); + //获取当前可查看专业的Id + List specityIds = specialties.stream().map(item->{ + return item.getId(); + }).collect(Collectors.toList()); + + schedules = schedules.stream().filter(item ->{ + return specityIds.contains(item.getSpecialtyId()); + }).collect(Collectors.toList()); + if (schedules != null && schedules.size() > 0) { for (Schedule schedule : schedules) { - scheduleService.deleteByPrimaryKey(schedule.getId()); + scheduleService.deleteByPrimaryKey(schedule + .getId()); } } } @@ -199,8 +228,11 @@ public class CourseScheduleView extends ViewPart implements ISelectionProvider{ } - private List queryCourseBySememster(Specialty specialty,Semester semester) { - List schedules = scheduleService.querySchedulesBySpecialtySemesterId(specialty.getId(), semester.getId()); + private List queryCourseBySememster(Specialty specialty, + Semester semester) { + List schedules = scheduleService + .querySchedulesBySpecialtySemesterId(specialty.getId(), + semester.getId()); Set allCourseIds = new HashSet(); List courses = new ArrayList(); if (schedules != null && schedules.size() > 0) { @@ -216,10 +248,10 @@ public class CourseScheduleView extends ViewPart implements ISelectionProvider{ public void addNewCourse(int id) { Course course = courseService.queryCourseByPrimaryKey(id); - if (!isSameCourse(course.getId(), specialty.getId(), semester.getId())) { + if (!isSameCourse(course.getId(), 0, semester.getId())) { Schedule schedule = new Schedule(); schedule.setCourseId(course.getId()); - schedule.setSpecialtyId(specialty.getId()); + schedule.setSpecialtyId(0); schedule.setSemesterId(semester.getId()); schedule.setOpened(0); // @@ -237,7 +269,8 @@ public class CourseScheduleView extends ViewPart implements ISelectionProvider{ } private boolean isSameCourse(int courseId, int specialtyId, int semesterId) { - List theSchedules = scheduleService.querySchedulesBySpecialtyId(specialtyId,0); + List theSchedules = scheduleService + .querySchedulesBySpecialtyId(specialtyId, 0); if (theSchedules != null && theSchedules.size() > 0) { for (Schedule schedule : theSchedules) { if (schedule.getCourseId() == courseId) { @@ -247,24 +280,43 @@ public class CourseScheduleView extends ViewPart implements ISelectionProvider{ } return false; } - - private void initSpecialty(){ - specialty = specialtyService.queryByPrimaryKey(1); + + private void initSpecialty() { + Subject subject = SecurityUtils.getSubject(); + // 角色是校长,可查看表中所有专业对应的课程信息 + if (subject.hasRole("principal")) { + specialties = specialtyService.queryAllSpecialty(); + // 角色是院长,专业初始化为本学院下的所有专业! + } else if (subject.hasRole("president")) { + User user = (User) subject.getPrincipal(); + // 根据院长的用户Id查询到关联的专业Id + List ids = userSpeciatyService.querySpeciatyIdsByUser(user + .getId()); + specialties = specialtyService.queryRelativeSpecialty(ids); + } else if (subject.hasRole("director")) { + User user = (User) subject.getPrincipal(); + // 根据普通用户的用户Id查询到关联的专业Id + List ids = userSpeciatyService.querySpeciatyIdsByUser(user + .getId()); + specialties = specialtyService.queryRelativeSpecialty(ids); + } } - - private void initSemesterCombo(){ + + private void initSemesterCombo() { List semesters = semesterService.queryAllSemester(); - if(semesters != null && semesters.size() > 0){ + if (semesters != null && semesters.size() > 0) { semester = semesters.get(0); for (Semester semester : semesters) { - comboSemester.add(semester.getGrade() + ":" + semester.getSemester() + ":" + semester.getId()); + comboSemester.add(semester.getGrade() + ":" + + semester.getSemester() + ":" + semester.getId()); } - + comboSemester.select(0); } } - - private void cloneCourseInformation(List courses,List exCourses){ + + private void cloneCourseInformation(List courses, + List exCourses) { for (Course course : courses) { ExCourse exCourse = new ExCourse(); exCourse.setId(course.getId()); @@ -287,12 +339,13 @@ public class CourseScheduleView extends ViewPart implements ISelectionProvider{ exCourses.add(exCourse); } } - - private void refreshData(){ - List courses = queryCourseBySememster(specialty,semester); + + private void refreshData() { + // List courses = queryCourseBySememster(specialty, semester); + List courses = queryCourseBySememster(semester); List exCourses = new ArrayList(); - //cloneCourseInformation(courses,exCourses); - if(courses != null && courses.size() > 0){ + // cloneCourseInformation(courses,exCourses); + if (courses != null && courses.size() > 0) { StatisticsUtil.processCourseScheduleData(courses); } tableViewer.setInput(courses); @@ -332,4 +385,29 @@ public class CourseScheduleView extends ViewPart implements ISelectionProvider{ } + private List queryCourseBySememster(Semester semester2) { + List schedules = scheduleService + .querySchedulesBySemesterId(semester.getId()); + + // 获取当前可查看专业的Id + List specityIds = specialties.stream().map(item -> { + return item.getId(); + }).collect(Collectors.toList()); + // 过滤出当前用户可以查看的课程计划 + schedules = schedules.stream().filter(item -> { + return specityIds.contains(item.getSpecialtyId()); + }).collect(Collectors.toList()); + + Set allCourseIds = new HashSet(); + List courses = new ArrayList(); + if (schedules != null && schedules.size() > 0) { + for (Schedule schedule : schedules) { + allCourseIds.add(schedule.getCourseId()); + } + + courses = courseService.queryCoursesByIds(allCourseIds); + } + return courses; + } + } \ No newline at end of file diff --git a/src/config/applicationContext.xml b/src/config/applicationContext.xml index e5f07d1f0a34465cb50a8c00fab16cc6f83c6c8c..a96340ccd4bf67e98efac79ebc7b001a70c4ef2b 100644 --- a/src/config/applicationContext.xml +++ b/src/config/applicationContext.xml @@ -1,72 +1,72 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - \ No newline at end of file diff --git a/src/educationschedule/Application.java b/src/educationschedule/Application.java index 376cf931aca5abc7f3e4ebd600c0bfb7d61726ae..3312e6644be08f252f6b1f2d8b29cfe358a41573 100644 --- a/src/educationschedule/Application.java +++ b/src/educationschedule/Application.java @@ -21,7 +21,7 @@ public class Application implements IApplication { * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) */ public Object start(IApplicationContext context) { - //¼֤ + //��¼��֤ LoginDialog loginDialog = new LoginDialog(null); if(!(IDialogConstants.OK_ID == loginDialog.open())){ return null;