mysql数据库 map传参

mysql数据库 map传参

 Map<String, Object> map2 = new HashMap<>();
                map2.put("schoolId", appLogin.getSchoolId());
                map2.put("userType", "2");
                SysAppLogin login = loginService.selectByDeptId(map2);

//mapper层
SysAppLogin selectByDeptId(Map<String, Object> map);

//mapper实现层
  @Override
    public SysAppLogin selectByDeptId(Map<String, Object> map) {
        return SysAppLoginMapper.selectByDeptId(map);
    }

//xml层
    <select id="selectByDeptId" parameterType="Map" resultMap="SysAppLoginResult">
        SELECT
            *
        FROM
            jr_sys_app_login
        WHERE
            School_Id = #{schoolId}
        <if test="userType != null and userType != ''"> AND User_type = #{userType}</if>
        <if test="customerType != null  and customerType != ''"> AND customerType =#{customerType}</if>
    </select>
上一篇:Map2


下一篇:菜鸟之路——机器学习之Kmeans聚类个人理解及Python实现