crm最开始
见crm2项目
1.配置完成后-》逆向工程三张表,bean,mapper放进去
UserController
IUserService
public interface IUserService {
//根据用户账号密码登录
TUser login(String username, String password);
//根据用户名查询登录信息
TUser getRightByUsername(String name);
}
UserServiceImpl
TuserMapper中(新增自定义方法)
//根据用户名查询user并加载user关联属性List<TSysRight>
TUser selectRightByUsername(String name);
TUserMapper.xml中新增
<resultMap id="userMap" type="tuser">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="roleName" property="rolename" jdbcType="VARCHAR"/>
<collection property="rights" ofType="tsysright">
<id column="right_id" property="rightId" jdbcType="INTEGER"/>
<result column="right_pid" property="rightPid" jdbcType="INTEGER"/>
<result column="right_type" property="rightType" jdbcType="VARCHAR"/>
<result column="right_text" property="rightText" jdbcType="VARCHAR"/>
<result column="right_url" property="rightUrl" jdbcType="VARCHAR"/>
<result column="right_tip" property="rightTip" jdbcType="VARCHAR"/>
<result column="right_parent_name" property="rightParentName" jdbcType="VARCHAR"/>
</collection>
</resultMap>
<select id="selectRightByUsername" parameterType="string" resultMap="userMap">
select t_user.id,t_user.roleName,t_sys_right.* from t_user left join
t_role on t_user.role_id = t_role.role_id
LEFT JOIN t_role_right
on t_role.role_id = t_role_right.role_id
LEFT JOIN t_sys_right
on t_role_right.right_id = t_sys_right.right_id
where t_user.userName = #{username}
</select>
新增之后Tuser中添加关联属性
Tuser(并添加get set方法)
//关联属性
private List<TSysRight> rights;
public List<TSysRight> getRights() {
return rights;
}
public void setRights(List<TSysRight> rights) {
this.rights = rights;
}
初始配置完成
IndexController
UserController
IUserService
public interface IUserService {
//根据用户账号密码登录
TUser login(String username, String password);
//根据用户名查询登录信息
TUser getRightByUsername(String name);
//显示指派人
List<TUser> selectComBoList();
}
UserServiceImpl